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

@@ -298,7 +298,7 @@ CSSPixelRect IntersectionObserver::root_intersection_rectangle() const
} else {
document = &intersection_root.get<GC::Root<DOM::Element>>().cell()->document();
}
if (m_document.has_value() && document->origin().is_same_origin(m_document->origin())) {
if (m_document && document->origin().is_same_origin(m_document->origin())) {
if (auto layout_node = intersection_root.visit([&](auto& node) -> GC::Ptr<Layout::Node> { return node->layout_node(); })) {
rect.inflate(
m_root_margin[0].to_px(*layout_node, rect.height()),

View File

@@ -106,7 +106,7 @@ private:
Vector<GC::Ref<DOM::Element>> m_observation_targets;
// AD-HOC: This is the document where we've registered the IntersectionObserver.
WeakPtr<DOM::Document> m_document;
GC::Weak<DOM::Document> m_document;
};
}