mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:27:35 +00:00
LibJS: Use u32 for the JS::Shape property count
We don't need to support more than 2^32 object properties anyway, so there's no point in using 64-bit property counts. This small reduction in memory usage makes test-js run ~10% faster on x86_64 locally.
This commit is contained in:
parent
7a742b17da
commit
8bdf6441b1
2 changed files with 9 additions and 10 deletions
|
@ -150,11 +150,6 @@ FLATTEN HashMap<StringOrSymbol, PropertyMetadata> const& Shape::property_table()
|
|||
return *m_property_table;
|
||||
}
|
||||
|
||||
size_t Shape::property_count() const
|
||||
{
|
||||
return m_property_count;
|
||||
}
|
||||
|
||||
Vector<Shape::Property> Shape::property_table_ordered() const
|
||||
{
|
||||
auto vec = Vector<Shape::Property>();
|
||||
|
@ -207,7 +202,9 @@ void Shape::add_property_to_unique_shape(const StringOrSymbol& property_name, Pr
|
|||
VERIFY(is_unique());
|
||||
VERIFY(m_property_table);
|
||||
VERIFY(!m_property_table->contains(property_name));
|
||||
m_property_table->set(property_name, { m_property_table->size(), attributes });
|
||||
m_property_table->set(property_name, { static_cast<u32>(m_property_table->size()), attributes });
|
||||
|
||||
VERIFY(m_property_count < NumericLimits<u32>::max());
|
||||
++m_property_count;
|
||||
}
|
||||
|
||||
|
@ -238,8 +235,10 @@ void Shape::add_property_without_transition(StringOrSymbol const& property_name,
|
|||
{
|
||||
VERIFY(property_name.is_valid());
|
||||
ensure_property_table();
|
||||
if (m_property_table->set(property_name, { m_property_count, attributes }) == AK::HashSetResult::InsertedNewEntry)
|
||||
if (m_property_table->set(property_name, { m_property_count, attributes }) == AK::HashSetResult::InsertedNewEntry) {
|
||||
VERIFY(m_property_count < NumericLimits<u32>::max());
|
||||
++m_property_count;
|
||||
}
|
||||
}
|
||||
|
||||
FLATTEN void Shape::add_property_without_transition(PropertyKey const& property_name, PropertyAttributes attributes)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue