mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-27 14:58:46 +00:00
LibJS: Move computation out of the ECMAScriptFunctionObject constructor
We were doing way too much computation every time an ESFO was instantiated. This was particularly sad, since the results of these computations were identical every time! This patch adds a new SharedFunctionInstanceData object that gets shared between all instances of an ESFO instantiated from some kind of AST FunctionNode. ~5% speedup on Speedometer 2.1 :^)
This commit is contained in:
parent
4209b18b88
commit
2a9b6f1d97
Notes:
github-actions[bot]
2025-04-08 16:53:53 +00:00
Author: https://github.com/awesomekling
Commit: 2a9b6f1d97
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4283
Reviewed-by: https://github.com/Hendiadyoin1
Reviewed-by: https://github.com/trflynn89
7 changed files with 367 additions and 258 deletions
|
@ -426,7 +426,7 @@ GC::Ref<FunctionEnvironment> new_function_environment(ECMAScriptFunctionObject&
|
|||
env->set_function_object(function);
|
||||
|
||||
// 3. If F.[[ThisMode]] is lexical, set env.[[ThisBindingStatus]] to lexical.
|
||||
if (function.this_mode() == ECMAScriptFunctionObject::ThisMode::Lexical)
|
||||
if (function.this_mode() == ThisMode::Lexical)
|
||||
env->set_this_binding_status(FunctionEnvironment::ThisBindingStatus::Lexical);
|
||||
// 4. Else, set env.[[ThisBindingStatus]] to uninitialized.
|
||||
else
|
||||
|
@ -555,7 +555,7 @@ ThrowCompletionOr<Value> perform_eval(VM& vm, Value x, CallerMode strict_caller,
|
|||
in_method = this_function_environment_record.has_super_binding();
|
||||
|
||||
// iv. If F.[[ConstructorKind]] is derived, set inDerivedConstructor to true.
|
||||
if (function.constructor_kind() == ECMAScriptFunctionObject::ConstructorKind::Derived)
|
||||
if (function.constructor_kind() == ConstructorKind::Derived)
|
||||
in_derived_constructor = true;
|
||||
|
||||
// v. Let classFieldInitializerName be F.[[ClassFieldInitializerName]].
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue