LibJS/Bytecode: Avoid Value==Value in Call built-in fast path

Comparing two Values has to call the generic same_value() helper,
and we can avoid this by simply using a stronger type for built-in
native function handlers.
This commit is contained in:
Andreas Kling 2024-02-20 21:29:58 +01:00
parent 1060c63bd8
commit 01e9eee7dd
Notes: sideshowbarker 2024-07-17 11:34:34 +09:00
2 changed files with 8 additions and 5 deletions

View file

@ -1248,7 +1248,10 @@ ThrowCompletionOr<void> Call::execute_impl(Bytecode::Interpreter& interpreter) c
TRY(throw_if_needed_for_call(interpreter, callee, call_type(), expression_string()));
if (m_builtin.has_value() && m_argument_count == Bytecode::builtin_argument_count(m_builtin.value()) && interpreter.realm().get_builtin_value(m_builtin.value()) == callee) {
if (m_builtin.has_value()
&& m_argument_count == Bytecode::builtin_argument_count(m_builtin.value())
&& callee.is_object()
&& interpreter.realm().get_builtin_value(m_builtin.value()) == &callee.as_object()) {
interpreter.set(dst(), TRY(dispatch_builtin_call(interpreter, m_builtin.value(), { m_arguments, m_argument_count })));
return {};
}