mirror of
https://github.com/RGBCube/serenity
synced 2025-05-23 19:05:08 +00:00
LibJS: Prevent object shape transitions during runtime object buildup
While initialization common runtime objects like functions, prototypes, etc, we don't really care about tracking transitions for each and every property added to them. This patch puts objects into a "disable transitions" mode while we call initialize() on them. After that, adding more properties will cause new transitions to be generated and added to the chain. This gives a ~10% speed-up on test-js. :^)
This commit is contained in:
parent
50ab87f651
commit
69bae3fd9a
5 changed files with 23 additions and 1 deletions
|
@ -486,8 +486,11 @@ bool Object::put_own_property(Object& this_object, const StringOrSymbol& propert
|
|||
if (m_shape->is_unique()) {
|
||||
m_shape->add_property_to_unique_shape(property_name, attributes);
|
||||
m_storage.resize(m_shape->property_count());
|
||||
} else {
|
||||
} else if (m_transitions_enabled) {
|
||||
set_shape(*m_shape->create_put_transition(property_name, attributes));
|
||||
} else {
|
||||
m_shape->add_property_without_transition(property_name, attributes);
|
||||
m_storage.resize(m_shape->property_count());
|
||||
}
|
||||
metadata = shape().lookup(property_name);
|
||||
ASSERT(metadata.has_value());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue