1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-29 20:35:13 +00:00

LibJS: Grow storage when adding a property to uniquely-shaped Object

Normally the storage would be expanded by set_shape() upon transition
to a new shape, but if the shape is already unique, there is no new
transition so we have to expand the storage manually.
This commit is contained in:
Andreas Kling 2020-04-26 19:03:23 +02:00
parent c9c1d1fae0
commit 2778d077e5
2 changed files with 11 additions and 0 deletions

View file

@ -119,6 +119,7 @@ void Object::put_own_property(Object& this_object, const FlyString& property_nam
if (!metadata.has_value()) {
if (m_shape->is_unique()) {
m_shape->add_property_to_unique_shape(property_name, attributes);
m_storage.resize(m_shape->property_count());
} else {
set_shape(*m_shape->create_put_transition(property_name, attributes));
}