1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 17:17:45 +00:00

LibJS: Make JS::Shape smaller by using OwnPtr<HashMap> for transitions

Many shapes don't have any forward transitions to cache, so we can save
a bunch of memory (and time) by only creating the cache maps when
actually needed.
This commit is contained in:
Andreas Kling 2022-01-31 12:43:30 +01:00
parent 51e5cc4e13
commit 1469057033
2 changed files with 21 additions and 11 deletions

View file

@ -106,8 +106,8 @@ private:
mutable OwnPtr<HashMap<StringOrSymbol, PropertyMetadata>> m_property_table;
HashMap<TransitionKey, WeakPtr<Shape>> m_forward_transitions;
HashMap<Object*, WeakPtr<Shape>> m_prototype_transitions;
OwnPtr<HashMap<TransitionKey, WeakPtr<Shape>>> m_forward_transitions;
OwnPtr<HashMap<Object*, WeakPtr<Shape>>> m_prototype_transitions;
Shape* m_previous { nullptr };
StringOrSymbol m_property_name;
Object* m_prototype { nullptr };