diff options
author | Linus Groh <mail@linusgroh.de> | 2022-02-06 15:59:04 +0000 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-02-06 22:02:45 +0000 |
commit | 6f20f49b21092c08c2a3d910fcba6166554ffba7 (patch) | |
tree | c1cde228e893147ec4a1e5f4c7aaf8de17b89d01 /Userland/Libraries/LibJS/Runtime/Shape.cpp | |
parent | 3e6aaa3520168a93927b0df38b50653803c85810 (diff) | |
download | serenity-6f20f49b21092c08c2a3d910fcba6166554ffba7.zip |
Everywhere: Rename JS::PropertyKey variables from property_{name => key}
PropertyKey used to be called PropertyName, but got renamed. Let's
update all the variables of this type as well.
Diffstat (limited to 'Userland/Libraries/LibJS/Runtime/Shape.cpp')
-rw-r--r-- | Userland/Libraries/LibJS/Runtime/Shape.cpp | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/Shape.cpp b/Userland/Libraries/LibJS/Runtime/Shape.cpp index b7e51fc9e3..dec25b0c5e 100644 --- a/Userland/Libraries/LibJS/Runtime/Shape.cpp +++ b/Userland/Libraries/LibJS/Runtime/Shape.cpp @@ -53,24 +53,24 @@ Shape* Shape::get_or_prune_cached_prototype_transition(Object* prototype) return it->value; } -Shape* Shape::create_put_transition(const StringOrSymbol& property_name, PropertyAttributes attributes) +Shape* Shape::create_put_transition(const StringOrSymbol& property_key, PropertyAttributes attributes) { - TransitionKey key { property_name, attributes }; + TransitionKey key { property_key, attributes }; if (auto* existing_shape = get_or_prune_cached_forward_transition(key)) return existing_shape; - auto* new_shape = heap().allocate_without_global_object<Shape>(*this, property_name, attributes, TransitionType::Put); + auto* new_shape = heap().allocate_without_global_object<Shape>(*this, property_key, attributes, TransitionType::Put); if (!m_forward_transitions) m_forward_transitions = make<HashMap<TransitionKey, WeakPtr<Shape>>>(); m_forward_transitions->set(key, new_shape); return new_shape; } -Shape* Shape::create_configure_transition(const StringOrSymbol& property_name, PropertyAttributes attributes) +Shape* Shape::create_configure_transition(const StringOrSymbol& property_key, PropertyAttributes attributes) { - TransitionKey key { property_name, attributes }; + TransitionKey key { property_key, attributes }; if (auto* existing_shape = get_or_prune_cached_forward_transition(key)) return existing_shape; - auto* new_shape = heap().allocate_without_global_object<Shape>(*this, property_name, attributes, TransitionType::Configure); + auto* new_shape = heap().allocate_without_global_object<Shape>(*this, property_key, attributes, TransitionType::Configure); if (!m_forward_transitions) m_forward_transitions = make<HashMap<TransitionKey, WeakPtr<Shape>>>(); m_forward_transitions->set(key, new_shape); @@ -97,10 +97,10 @@ Shape::Shape(Object& global_object) { } -Shape::Shape(Shape& previous_shape, const StringOrSymbol& property_name, PropertyAttributes attributes, TransitionType transition_type) +Shape::Shape(Shape& previous_shape, const StringOrSymbol& property_key, PropertyAttributes attributes, TransitionType transition_type) : m_global_object(previous_shape.m_global_object) , m_previous(&previous_shape) - , m_property_name(property_name) + , m_property_key(property_key) , m_prototype(previous_shape.m_prototype) , m_property_count(transition_type == TransitionType::Put ? previous_shape.m_property_count + 1 : previous_shape.m_property_count) , m_attributes(attributes) @@ -127,18 +127,18 @@ void Shape::visit_edges(Cell::Visitor& visitor) visitor.visit(m_global_object); visitor.visit(m_prototype); visitor.visit(m_previous); - m_property_name.visit_edges(visitor); + m_property_key.visit_edges(visitor); if (m_property_table) { for (auto& it : *m_property_table) it.key.visit_edges(visitor); } } -Optional<PropertyMetadata> Shape::lookup(const StringOrSymbol& property_name) const +Optional<PropertyMetadata> Shape::lookup(const StringOrSymbol& property_key) const { if (m_property_count == 0) return {}; - auto property = property_table().get(property_name); + auto property = property_table().get(property_key); if (!property.has_value()) return {}; return property; @@ -183,46 +183,46 @@ void Shape::ensure_property_table() const for (ssize_t i = transition_chain.size() - 1; i >= 0; --i) { auto* shape = transition_chain[i]; - if (!shape->m_property_name.is_valid()) { + if (!shape->m_property_key.is_valid()) { // Ignore prototype transitions as they don't affect the key map. continue; } if (shape->m_transition_type == TransitionType::Put) { - m_property_table->set(shape->m_property_name, { next_offset++, shape->m_attributes }); + m_property_table->set(shape->m_property_key, { next_offset++, shape->m_attributes }); } else if (shape->m_transition_type == TransitionType::Configure) { - auto it = m_property_table->find(shape->m_property_name); + auto it = m_property_table->find(shape->m_property_key); VERIFY(it != m_property_table->end()); it->value.attributes = shape->m_attributes; } } } -void Shape::add_property_to_unique_shape(const StringOrSymbol& property_name, PropertyAttributes attributes) +void Shape::add_property_to_unique_shape(const StringOrSymbol& property_key, PropertyAttributes attributes) { VERIFY(is_unique()); VERIFY(m_property_table); - VERIFY(!m_property_table->contains(property_name)); - m_property_table->set(property_name, { static_cast<u32>(m_property_table->size()), attributes }); + VERIFY(!m_property_table->contains(property_key)); + m_property_table->set(property_key, { static_cast<u32>(m_property_table->size()), attributes }); VERIFY(m_property_count < NumericLimits<u32>::max()); ++m_property_count; } -void Shape::reconfigure_property_in_unique_shape(const StringOrSymbol& property_name, PropertyAttributes attributes) +void Shape::reconfigure_property_in_unique_shape(const StringOrSymbol& property_key, PropertyAttributes attributes) { VERIFY(is_unique()); VERIFY(m_property_table); - auto it = m_property_table->find(property_name); + auto it = m_property_table->find(property_key); VERIFY(it != m_property_table->end()); it->value.attributes = attributes; - m_property_table->set(property_name, it->value); + m_property_table->set(property_key, it->value); } -void Shape::remove_property_from_unique_shape(const StringOrSymbol& property_name, size_t offset) +void Shape::remove_property_from_unique_shape(const StringOrSymbol& property_key, size_t offset) { VERIFY(is_unique()); VERIFY(m_property_table); - if (m_property_table->remove(property_name)) + if (m_property_table->remove(property_key)) --m_property_count; for (auto& it : *m_property_table) { VERIFY(it.value.offset != offset); @@ -231,20 +231,20 @@ void Shape::remove_property_from_unique_shape(const StringOrSymbol& property_nam } } -void Shape::add_property_without_transition(StringOrSymbol const& property_name, PropertyAttributes attributes) +void Shape::add_property_without_transition(StringOrSymbol const& property_key, PropertyAttributes attributes) { - VERIFY(property_name.is_valid()); + VERIFY(property_key.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_key, { 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) +FLATTEN void Shape::add_property_without_transition(PropertyKey const& property_key, PropertyAttributes attributes) { - VERIFY(property_name.is_valid()); - add_property_without_transition(property_name.to_string_or_symbol(), attributes); + VERIFY(property_key.is_valid()); + add_property_without_transition(property_key.to_string_or_symbol(), attributes); } } |