mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-22 10:11:54 +00:00
LibJS: Use a local variable for arguments object when possible
This allows us to skip allocating a function environment in cases where it was previously impossible because the arguments object needed a binding. This change does not bring visible improvement in Kraken or Octane benchmarks but seems useful to have anyway.
This commit is contained in:
parent
777e84b09b
commit
210a5d77dc
Notes:
sideshowbarker
2024-07-17 02:55:44 +09:00
Author: https://github.com/kalenikaliaksandr
Commit: 210a5d77dc
Pull-request: https://github.com/SerenityOS/serenity/pull/24399
5 changed files with 39 additions and 11 deletions
|
@ -328,7 +328,8 @@ ECMAScriptFunctionObject::ECMAScriptFunctionObject(DeprecatedFlyString name, Byt
|
|||
}));
|
||||
}
|
||||
|
||||
m_function_environment_needed = m_arguments_object_needed || m_function_environment_bindings_count > 0 || m_var_environment_bindings_count > 0 || m_lex_environment_bindings_count > 0 || uses_this == UsesThis::Yes || m_contains_direct_call_to_eval;
|
||||
auto arguments_object_needs_binding = m_arguments_object_needed && !m_local_variables_names.contains_slow(vm().names.arguments.as_string());
|
||||
m_function_environment_needed = arguments_object_needs_binding || m_function_environment_bindings_count > 0 || m_var_environment_bindings_count > 0 || m_lex_environment_bindings_count > 0 || uses_this == UsesThis::Yes || m_contains_direct_call_to_eval;
|
||||
}
|
||||
|
||||
void ECMAScriptFunctionObject::initialize(Realm& realm)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue