mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 01:35:08 +02:00
LibJS: Defer looking up the realm in ordinary_call_evaluate_body()
We don't actually need the realm for normal function calls, so we can avoid looking it up on the EC stack in that case.
This commit is contained in:
committed by
Andreas Kling
parent
0f1be720bb
commit
a2b7e04da3
Notes:
github-actions[bot]
2025-04-29 00:10:33 +00:00
Author: https://github.com/awesomekling Commit: https://github.com/LadybirdBrowser/ladybird/commit/a2b7e04da30 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4513
@@ -901,8 +901,6 @@ template void async_function_start(VM&, PromiseCapability const&, GC::Function<C
|
||||
// 15.8.4 Runtime Semantics: EvaluateAsyncFunctionBody, https://tc39.es/ecma262/#sec-runtime-semantics-evaluatefunctionbody
|
||||
ThrowCompletionOr<Value> ECMAScriptFunctionObject::ordinary_call_evaluate_body(VM& vm)
|
||||
{
|
||||
auto& realm = *vm.current_realm();
|
||||
|
||||
auto result_and_frame = vm.bytecode_interpreter().run_executable(*m_bytecode_executable, {});
|
||||
|
||||
if (result_and_frame.value.is_error()) [[unlikely]] {
|
||||
@@ -916,6 +914,7 @@ ThrowCompletionOr<Value> ECMAScriptFunctionObject::ordinary_call_evaluate_body(V
|
||||
if (kind() == FunctionKind::Normal)
|
||||
return result;
|
||||
|
||||
auto& realm = *vm.current_realm();
|
||||
if (kind() == FunctionKind::AsyncGenerator) {
|
||||
auto async_generator_object = TRY(AsyncGenerator::create(realm, result, this, vm.running_execution_context().copy()));
|
||||
return async_generator_object;
|
||||
|
||||
Reference in New Issue
Block a user