diff options
author | Linus Groh <mail@linusgroh.de> | 2021-08-28 17:12:14 +0100 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2021-08-28 23:17:01 +0100 |
commit | 222e518a5360d72337961f26dcee07a8fe24e7ea (patch) | |
tree | 9b145355753c9007d22f21e5a4634cf3ba963be0 /Tests/UserspaceEmulator | |
parent | d6de0613f59d64610f38eea8c9acf4643dcea2ab (diff) | |
download | serenity-222e518a5360d72337961f26dcee07a8fe24e7ea.zip |
LibJS: Avoid pointless transitions and metadata lookups in storage_set()
- Replace the misleading abuse of the m_transitions_enabled flag for the
fast path without lookup with a new m_initialized boolean that's set
either by Heap::allocate() after calling the Object's initialize(), or
by the GlobalObject in its special initialize_global_object(). This
makes it work regardless of the shape's uniqueness.
- When we're adding a new property past the initialization phase,
there's no need to do a second metadata lookup to retrieve the storage
value offset - it's known to always be the shape's property count
minus one. Also, instead of doing manual storage resizing and
assignment via indexing, just use Vector::append().
- When we didn't add a new property but are overwriting an existing one,
the property count and therefore storage value offset doesn't change,
so we don't have to retrieve it either.
As a result, Object::set_shape() is now solely responsible for updating
the m_shape pointer and is not resizing storage anymore, so I moved it
into the header.
Diffstat (limited to 'Tests/UserspaceEmulator')
0 files changed, 0 insertions, 0 deletions