1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 06:47: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:
Andreas Kling 2022-01-31 15:55:54 +01:00
parent 7a742b17da
commit 8bdf6441b1
2 changed files with 9 additions and 10 deletions

View file

@ -19,7 +19,7 @@
namespace JS {
struct PropertyMetadata {
size_t offset { 0 };
u32 offset { 0 };
PropertyAttributes attributes { 0 };
};
@ -70,7 +70,7 @@ public:
Optional<PropertyMetadata> lookup(const StringOrSymbol&) const;
const HashMap<StringOrSymbol, PropertyMetadata>& property_table() const;
size_t property_count() const;
u32 property_count() const { return m_property_count; }
struct Property {
StringOrSymbol key;
@ -107,7 +107,7 @@ private:
Shape* m_previous { nullptr };
StringOrSymbol m_property_name;
Object* m_prototype { nullptr };
size_t m_property_count { 0 };
u32 m_property_count { 0 };
PropertyAttributes m_attributes { 0 };
TransitionType m_transition_type : 6 { TransitionType::Invalid };