mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-27 18:40:00 +00:00
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:
parent
25a5ed94d6
commit
dfa796a4e4
Notes:
github-actions[bot]
2025-10-17 15:25:08 +00:00
Author: https://github.com/awesomekling
Commit: dfa796a4e4
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6496
36 changed files with 111 additions and 115 deletions
|
|
@ -110,8 +110,8 @@ GC::Ref<Shape> Shape::create_put_transition(PropertyKey const& property_key, Pro
|
|||
invalidate_prototype_if_needed_for_new_prototype(new_shape);
|
||||
if (!m_is_prototype_shape) {
|
||||
if (!m_forward_transitions)
|
||||
m_forward_transitions = make<HashMap<TransitionKey, WeakPtr<Shape>>>();
|
||||
m_forward_transitions->set(key, new_shape.ptr());
|
||||
m_forward_transitions = make<HashMap<TransitionKey, GC::Weak<Shape>>>();
|
||||
m_forward_transitions->set(key, new_shape);
|
||||
}
|
||||
return new_shape;
|
||||
}
|
||||
|
|
@ -125,7 +125,7 @@ GC::Ref<Shape> Shape::create_configure_transition(PropertyKey const& property_ke
|
|||
invalidate_prototype_if_needed_for_new_prototype(new_shape);
|
||||
if (!m_is_prototype_shape) {
|
||||
if (!m_forward_transitions)
|
||||
m_forward_transitions = make<HashMap<TransitionKey, WeakPtr<Shape>>>();
|
||||
m_forward_transitions = make<HashMap<TransitionKey, GC::Weak<Shape>>>();
|
||||
m_forward_transitions->set(key, new_shape.ptr());
|
||||
}
|
||||
return new_shape;
|
||||
|
|
@ -141,7 +141,7 @@ GC::Ref<Shape> Shape::create_prototype_transition(Object* new_prototype)
|
|||
invalidate_prototype_if_needed_for_new_prototype(new_shape);
|
||||
if (!m_is_prototype_shape) {
|
||||
if (!m_prototype_transitions)
|
||||
m_prototype_transitions = make<HashMap<GC::Ptr<Object>, WeakPtr<Shape>>>();
|
||||
m_prototype_transitions = make<HashMap<GC::Ptr<Object>, GC::Weak<Shape>>>();
|
||||
m_prototype_transitions->set(new_prototype, new_shape.ptr());
|
||||
}
|
||||
return new_shape;
|
||||
|
|
@ -279,7 +279,7 @@ GC::Ref<Shape> Shape::create_delete_transition(PropertyKey const& property_key)
|
|||
auto new_shape = heap().allocate<Shape>(*this, property_key, TransitionType::Delete);
|
||||
invalidate_prototype_if_needed_for_new_prototype(new_shape);
|
||||
if (!m_delete_transitions)
|
||||
m_delete_transitions = make<HashMap<PropertyKey, WeakPtr<Shape>>>();
|
||||
m_delete_transitions = make<HashMap<PropertyKey, GC::Weak<Shape>>>();
|
||||
m_delete_transitions->set(property_key, new_shape.ptr());
|
||||
return new_shape;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue