LibJS: Avoid function call if @@hasInstance is default implementation

This makes the instanceof operator signficantly faster by avoiding a
generic function call to @@hasInstance unless it has been overridden.

1.15x speed-up on Octane/earley-boyer.js
This commit is contained in:
Andreas Kling 2025-10-13 12:21:59 +02:00 committed by Andreas Kling
parent 5a7b0a07cb
commit 0e4450f4b3
Notes: github-actions[bot] 2025-10-13 15:18:08 +00:00
5 changed files with 12 additions and 1 deletions

View file

@ -2904,6 +2904,8 @@ static ThrowCompletionOr<Value> dispatch_builtin_call(Bytecode::Interpreter& int
case Builtin::SetIteratorPrototypeNext:
case Builtin::StringIteratorPrototypeNext:
VERIFY_NOT_REACHED();
case Builtin::OrdinaryHasInstance:
VERIFY_NOT_REACHED();
case Bytecode::Builtin::__Count:
VERIFY_NOT_REACHED();
}