LibJS+LibWeb: Use GC::Weak instead of AK::WeakPtr for GC-allocated types

This makes some common types like JS::Object smaller (by 8 bytes) and
yields a minor speed improvement on many benchmarks.
This commit is contained in:
Andreas Kling 2025-10-16 11:13:54 +02:00 committed by Andreas Kling
parent 25a5ed94d6
commit dfa796a4e4
Notes: github-actions[bot] 2025-10-17 15:25:08 +00:00
36 changed files with 111 additions and 115 deletions

View file

@ -67,11 +67,11 @@ public:
ENUMERATE_ARIA_ELEMENT_REFERENCING_ATTRIBUTES
#undef __ENUMERATE_ARIA_ATTRIBUTE
#define __ENUMERATE_ARIA_ATTRIBUTE(attribute, referencing_attribute) \
Optional<Vector<WeakPtr<DOM::Element>>> const& attribute() const; \
void set_##attribute(Optional<Vector<WeakPtr<DOM::Element>>>); \
\
GC::Ptr<JS::Array> cached_##attribute() const; \
#define __ENUMERATE_ARIA_ATTRIBUTE(attribute, referencing_attribute) \
Optional<Vector<GC::Weak<DOM::Element>>> const& attribute() const; \
void set_##attribute(Optional<Vector<GC::Weak<DOM::Element>>>); \
\
GC::Ptr<JS::Array> cached_##attribute() const; \
void set_cached_##attribute(GC::Ptr<JS::Array>);
ENUMERATE_ARIA_ELEMENT_LIST_REFERENCING_ATTRIBUTES
#undef __ENUMERATE_ARIA_ATTRIBUTE
@ -85,12 +85,12 @@ protected:
private:
#define __ENUMERATE_ARIA_ATTRIBUTE(attribute, referencing_attribute) \
WeakPtr<DOM::Element> m_##attribute;
GC::Weak<DOM::Element> m_##attribute;
ENUMERATE_ARIA_ELEMENT_REFERENCING_ATTRIBUTES
#undef __ENUMERATE_ARIA_ATTRIBUTE
#define __ENUMERATE_ARIA_ATTRIBUTE(attribute, referencing_attribute) \
Optional<Vector<WeakPtr<DOM::Element>>> m_##attribute; \
Optional<Vector<GC::Weak<DOM::Element>>> m_##attribute; \
GC::Ptr<JS::Array> m_cached_##attribute;
ENUMERATE_ARIA_ELEMENT_LIST_REFERENCING_ATTRIBUTES
#undef __ENUMERATE_ARIA_ATTRIBUTE