1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 04:57:45 +00:00

LibJS/JIT: Add fast path for cached PutById

This commit is contained in:
Andreas Kling 2023-11-09 09:28:04 +01:00
parent b1b2ca1485
commit 55e467c359
7 changed files with 189 additions and 12 deletions

View file

@ -195,6 +195,8 @@ public:
Value get_direct(size_t index) const { return m_storage[index]; }
void put_direct(size_t index, Value value) { m_storage[index] = value; }
static FlatPtr storage_offset() { return OFFSET_OF(Object, m_storage); }
IndexedProperties const& indexed_properties() const { return m_indexed_properties; }
IndexedProperties& indexed_properties() { return m_indexed_properties; }
void set_indexed_property_elements(Vector<Value>&& values) { m_indexed_properties = IndexedProperties(move(values)); }
@ -202,6 +204,8 @@ public:
Shape& shape() { return *m_shape; }
Shape const& shape() const { return *m_shape; }
static FlatPtr shape_offset() { return OFFSET_OF(Object, m_shape); }
void ensure_shape_is_unique();
template<typename T>

View file

@ -57,6 +57,8 @@ public:
void add_property_without_transition(PropertyKey const&, PropertyAttributes);
bool is_unique() const { return m_unique; }
static FlatPtr is_unique_offset() { return OFFSET_OF(Shape, m_unique); }
Shape* create_unique_clone() const;
Realm& realm() const { return m_realm; }
@ -80,6 +82,7 @@ public:
void reconfigure_property_in_unique_shape(StringOrSymbol const& property_key, PropertyAttributes attributes);
[[nodiscard]] u64 unique_shape_serial_number() const { return m_unique_shape_serial_number; }
static FlatPtr unique_shape_serial_number_offset() { return OFFSET_OF(Shape, m_unique_shape_serial_number); }
private:
explicit Shape(Realm&);
@ -106,7 +109,7 @@ private:
PropertyAttributes m_attributes { 0 };
TransitionType m_transition_type : 6 { TransitionType::Invalid };
bool m_unique : 1 { false };
bool m_unique { false };
// Since unique shapes never change identity, inline caches use this incrementing serial number
// to know whether its property table has been modified since last time we checked.