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

@ -26,6 +26,7 @@ namespace JS::Bytecode {
O(MathSin, math_sin, Math, sin, 1) \
O(MathCos, math_cos, Math, cos, 1) \
O(MathTan, math_tan, Math, tan, 1) \
O(OrdinaryHasInstance, ordinary_has_instance, InternalBuiltin, ordinary_has_instance, 1) \
O(ArrayIteratorPrototypeNext, array_iterator_prototype_next, ArrayIteratorPrototype, next, 0) \
O(MapIteratorPrototypeNext, map_iterator_prototype_next, MapIteratorPrototype, next, 0) \
O(SetIteratorPrototypeNext, set_iterator_prototype_next, SetIteratorPrototype, next, 0) \