mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 10:28:10 +00:00
LibJS: Run reusable steps of FunctionDeclarationInstantiation only once
This change moves steps that can be executed only once and then reused in subsequent function instantiations from `function_declaration_instantiation` to the ECMAScriptFunctionObject: - Determine if there are any parameters with duplicate names. - Determine if there are any parameters with expressions. - Determine if an arguments object needs to be created. - Create a list of distinct function names for which bindings need to be created. - Create a list of distinct variable names for which bindings need to be created. This change makes React-Redux-TodoMVC test in Speedometer run 10% faster :)
This commit is contained in:
parent
d27e4732b6
commit
edd2f8b37f
2 changed files with 244 additions and 169 deletions
|
@ -138,6 +138,20 @@ private:
|
|||
bool m_is_arrow_function : 1 { false };
|
||||
bool m_has_simple_parameter_list : 1 { false };
|
||||
FunctionKind m_kind : 3 { FunctionKind::Normal };
|
||||
|
||||
struct VariableNameToInitianlize {
|
||||
Identifier const& identifier;
|
||||
bool parameter_binding { false };
|
||||
bool function_name { false };
|
||||
};
|
||||
|
||||
bool m_has_parameter_expressions { false };
|
||||
bool m_has_duplicates { false };
|
||||
HashTable<DeprecatedFlyString> m_parameter_names;
|
||||
Vector<FunctionDeclaration const&> m_functions_to_initialize;
|
||||
bool m_arguments_object_needed { false };
|
||||
Vector<VariableNameToInitianlize> m_var_names_to_initialize_binding;
|
||||
Vector<StringView> m_function_names_to_initialize_binding;
|
||||
};
|
||||
|
||||
template<>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue