mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-27 02:05:07 +02:00
LibJS: Pre-store formal parameter runtime data
Replace the runtime uses of formal_parameters() with pre-computed data: - m_formal_parameter_count stores the parameter count - m_parameter_names_for_mapped_arguments stores ordered parameter names for simple parameter lists (used by create_mapped_arguments_object) Change create_mapped_arguments_object to take Span<Utf16FlyString> instead of NonnullRefPtr<FunctionParameters const>. Remove virtual formal_parameters() from FunctionObject as it is no longer needed.
This commit is contained in:
committed by
Andreas Kling
parent
712d3fc54f
commit
9ea5aa93f8
Notes:
github-actions[bot]
2026-02-11 23:00:44 +00:00
Author: https://github.com/awesomekling Commit: https://github.com/LadybirdBrowser/ladybird/commit/9ea5aa93f84 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/7896
@@ -41,11 +41,10 @@ public:
|
||||
GC::Ptr<PrivateEnvironment>,
|
||||
Object& prototype);
|
||||
|
||||
[[nodiscard]] static GC::Ref<ECMAScriptFunctionObject> create_from_function_node(
|
||||
FunctionNode const&,
|
||||
Utf16FlyString name,
|
||||
[[nodiscard]] static GC::Ref<ECMAScriptFunctionObject> create_from_function_data(
|
||||
GC::Ref<Realm>,
|
||||
GC::Ptr<Environment> parent_environment,
|
||||
GC::Ref<SharedFunctionInstanceData>,
|
||||
GC::Ptr<Environment>,
|
||||
GC::Ptr<PrivateEnvironment>);
|
||||
|
||||
virtual void initialize(Realm&) override;
|
||||
@@ -65,7 +64,8 @@ public:
|
||||
VERIFY(shared_data().m_ecmascript_code);
|
||||
return *shared_data().m_ecmascript_code;
|
||||
}
|
||||
[[nodiscard]] virtual FunctionParameters const& formal_parameters() const override { return *shared_data().m_formal_parameters; }
|
||||
[[nodiscard]] u32 formal_parameter_count() const { return shared_data().m_formal_parameter_count; }
|
||||
[[nodiscard]] ReadonlySpan<Utf16FlyString> parameter_names_for_mapped_arguments() const { return shared_data().m_parameter_names_for_mapped_arguments; }
|
||||
|
||||
virtual Utf16String name_for_call_stack() const override;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user