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

LibJS: Devirtualize is_simple_storage()

This commit is contained in:
iliadsh 2023-11-09 07:32:48 +00:00 committed by Andreas Kling
parent 89da731aa6
commit ee4948b9e7
2 changed files with 20 additions and 5 deletions

View file

@ -14,7 +14,8 @@ constexpr const size_t SPARSE_ARRAY_HOLE_THRESHOLD = 200;
constexpr const size_t LENGTH_SETTER_GENERIC_STORAGE_THRESHOLD = 4 * MiB;
SimpleIndexedPropertyStorage::SimpleIndexedPropertyStorage(Vector<Value>&& initial_values)
: m_array_size(initial_values.size())
: IndexedPropertyStorage(IsSimpleStorage::Yes)
, m_array_size(initial_values.size())
, m_packed_elements(move(initial_values))
{
}
@ -83,6 +84,7 @@ bool SimpleIndexedPropertyStorage::set_array_like_size(size_t new_size)
}
GenericIndexedPropertyStorage::GenericIndexedPropertyStorage(SimpleIndexedPropertyStorage&& storage)
: IndexedPropertyStorage(IsSimpleStorage::No)
{
m_array_size = storage.array_like_size();
for (size_t i = 0; i < storage.m_packed_elements.size(); ++i) {