LibJS: Skip ordinary_call_bind_this() when possible

If during parsing it was found that function won't use `this` then
there is no need to initialise `this_value` during call.
This commit is contained in:
Aliaksandr Kalenik 2024-05-22 18:50:45 +01:00 committed by Andreas Kling
parent e934132442
commit f29ac8517e
Notes: sideshowbarker 2024-07-16 19:17:47 +09:00
6 changed files with 25 additions and 16 deletions

View file

@ -760,6 +760,7 @@ ThrowCompletionOr<void> SourceTextModule::execute_module(VM& vm, GCPtr<PromiseCa
FunctionParsingInsights parsing_insights;
parsing_insights.uses_this_from_environment = true;
parsing_insights.uses_this = true;
auto module_wrapper_function = ECMAScriptFunctionObject::create(
realm(), "module code with top-level await", StringView {}, this->m_ecmascript_code,
{}, 0, {}, environment(), nullptr, FunctionKind::Async, true, parsing_insights);