mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-29 07:48:47 +00:00
LibJS: Keep parsed function parameters in a shared data structure
Instead of making a copy of the Vector<FunctionParameter> from the AST every time we instantiate an ECMAScriptFunctionObject, we now keep the parameters in a ref-counted FunctionParameters object. This reduces memory usage, and also allows us to cache the bytecode executables for default parameter expressions without recompiling them for every instantiation. :^)
This commit is contained in:
parent
634f0c2469
commit
7477002e46
Notes:
github-actions[bot]
2025-03-27 15:02:02 +00:00
Author: https://github.com/awesomekling
Commit: 7477002e46
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4119
Reviewed-by: https://github.com/gmta ✅
11 changed files with 68 additions and 38 deletions
|
@ -770,7 +770,7 @@ ThrowCompletionOr<void> SourceTextModule::execute_module(VM& vm, GC::Ptr<Promise
|
|||
parsing_insights.uses_this = true;
|
||||
auto module_wrapper_function = ECMAScriptFunctionObject::create(
|
||||
realm(), "module code with top-level await"_fly_string, StringView {}, this->m_ecmascript_code,
|
||||
{}, 0, {}, environment(), nullptr, FunctionKind::Async, true, parsing_insights);
|
||||
FunctionParameters::empty(), 0, {}, environment(), nullptr, FunctionKind::Async, true, parsing_insights);
|
||||
module_wrapper_function->set_is_module_wrapper(true);
|
||||
|
||||
vm.pop_execution_context();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue