mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 12:19:54 +00:00
LibJS: Don't create a GC::Function for every JS::NativeFunction
Instead, let JS::NativeFunction store the AK::Function directly, and take care of conservatively marking its captured data. This avoids an extra GC allocation for every JS::NativeFunction.
This commit is contained in:
parent
4283c73d02
commit
5290dcf650
Notes:
github-actions[bot]
2025-04-20 16:44:46 +00:00
Author: https://github.com/awesomekling
Commit: 5290dcf650
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4408
4 changed files with 13 additions and 15 deletions
|
@ -44,8 +44,8 @@ public:
|
|||
|
||||
protected:
|
||||
NativeFunction(FlyString name, Object& prototype);
|
||||
NativeFunction(GC::Ptr<GC::Function<ThrowCompletionOr<Value>(VM&)>>, Object* prototype, Realm& realm);
|
||||
NativeFunction(FlyString name, GC::Ptr<GC::Function<ThrowCompletionOr<Value>(VM&)>>, Object& prototype);
|
||||
NativeFunction(AK::Function<ThrowCompletionOr<Value>(VM&)>, Object* prototype, Realm& realm);
|
||||
NativeFunction(FlyString name, AK::Function<ThrowCompletionOr<Value>(VM&)>, Object& prototype);
|
||||
explicit NativeFunction(Object& prototype);
|
||||
|
||||
virtual void initialize(Realm&) override;
|
||||
|
@ -57,7 +57,7 @@ private:
|
|||
FlyString m_name;
|
||||
GC::Ptr<PrimitiveString> m_name_string;
|
||||
Optional<FlyString> m_initial_name; // [[InitialName]]
|
||||
GC::Ptr<GC::Function<ThrowCompletionOr<Value>(VM&)>> m_native_function;
|
||||
AK::Function<ThrowCompletionOr<Value>(VM&)> m_native_function;
|
||||
GC::Ptr<Realm> m_realm;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue