LibJS: Don't force property table reification on Shape::property_count()

Previously whenever you would ask a Shape how many properties it had,
it would reify the property table into a HashMap and use HashMap::size()
to answer the question.

This can be a huge waste of time if we don't need the property table for
anything else, so this patch implements property count tracking in a
separate integer member of Shape. :^)
This commit is contained in:
Andreas Kling 2020-10-04 18:02:28 +02:00
commit b7975abef8
Notes: sideshowbarker 2024-07-19 02:03:38 +09:00
2 changed files with 9 additions and 3 deletions

View file

@ -112,6 +112,7 @@ private:
bool m_unique { false };
Object* m_prototype { nullptr };
TransitionType m_transition_type { TransitionType::Invalid };
size_t m_property_count { 0 };
};
}