mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 18:18:12 +00:00
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.
This commit is contained in:
parent
3e6aaa3520
commit
6f20f49b21
25 changed files with 435 additions and 435 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue