mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-16 05:51:55 +00: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:
parent
0f1be720bb
commit
a2b7e04da3
Notes:
github-actions[bot]
2025-04-29 00:10:33 +00:00
Author: https://github.com/awesomekling
Commit: a2b7e04da3
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4513
1 changed files with 1 additions and 2 deletions
|
@ -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
|
// 15.8.4 Runtime Semantics: EvaluateAsyncFunctionBody, https://tc39.es/ecma262/#sec-runtime-semantics-evaluatefunctionbody
|
||||||
ThrowCompletionOr<Value> ECMAScriptFunctionObject::ordinary_call_evaluate_body(VM& vm)
|
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, {});
|
auto result_and_frame = vm.bytecode_interpreter().run_executable(*m_bytecode_executable, {});
|
||||||
|
|
||||||
if (result_and_frame.value.is_error()) [[unlikely]] {
|
if (result_and_frame.value.is_error()) [[unlikely]] {
|
||||||
|
@ -916,6 +914,7 @@ ThrowCompletionOr<Value> ECMAScriptFunctionObject::ordinary_call_evaluate_body(V
|
||||||
if (kind() == FunctionKind::Normal)
|
if (kind() == FunctionKind::Normal)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
|
auto& realm = *vm.current_realm();
|
||||||
if (kind() == FunctionKind::AsyncGenerator) {
|
if (kind() == FunctionKind::AsyncGenerator) {
|
||||||
auto async_generator_object = TRY(AsyncGenerator::create(realm, result, this, vm.running_execution_context().copy()));
|
auto async_generator_object = TRY(AsyncGenerator::create(realm, result, this, vm.running_execution_context().copy()));
|
||||||
return async_generator_object;
|
return async_generator_object;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue