LibJS: Use allocate_without_global_object for allocating Shapes
This commit is contained in:
parent
d8269c343c
commit
77c1957961
Notes:
sideshowbarker
2024-07-19 01:51:57 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/77c1957961d
3 changed files with 9 additions and 9 deletions
|
@ -80,14 +80,14 @@ void GlobalObject::initialize()
|
|||
ensure_shape_is_unique();
|
||||
|
||||
// These are done first since other prototypes depend on their presence.
|
||||
m_empty_object_shape = heap().allocate<Shape>(*this, *this);
|
||||
m_empty_object_shape = heap().allocate_without_global_object<Shape>(*this);
|
||||
m_object_prototype = heap().allocate_without_global_object<ObjectPrototype>(*this);
|
||||
m_function_prototype = heap().allocate_without_global_object<FunctionPrototype>(*this);
|
||||
|
||||
m_new_object_shape = vm.heap().allocate<Shape>(*this, *this);
|
||||
m_new_object_shape = vm.heap().allocate_without_global_object<Shape>(*this);
|
||||
m_new_object_shape->set_prototype_without_transition(m_object_prototype);
|
||||
|
||||
m_new_script_function_prototype_object_shape = vm.heap().allocate<Shape>(*this, *this);
|
||||
m_new_script_function_prototype_object_shape = vm.heap().allocate_without_global_object<Shape>(*this);
|
||||
m_new_script_function_prototype_object_shape->set_prototype_without_transition(m_object_prototype);
|
||||
m_new_script_function_prototype_object_shape->add_property_without_transition(vm.names.constructor, Attribute::Writable | Attribute::Configurable);
|
||||
|
||||
|
|
|
@ -90,12 +90,12 @@ Object* Object::create_empty(GlobalObject& global_object)
|
|||
Object::Object(GlobalObjectTag)
|
||||
{
|
||||
// This is the global object
|
||||
m_shape = heap().allocate<Shape>(static_cast<GlobalObject&>(*this), static_cast<GlobalObject&>(*this));
|
||||
m_shape = heap().allocate_without_global_object<Shape>(static_cast<GlobalObject&>(*this));
|
||||
}
|
||||
|
||||
Object::Object(ConstructWithoutPrototypeTag, GlobalObject& global_object)
|
||||
{
|
||||
m_shape = heap().allocate<Shape>(global_object, global_object);
|
||||
m_shape = heap().allocate_without_global_object<Shape>(global_object);
|
||||
}
|
||||
|
||||
Object::Object(Object& prototype)
|
||||
|
|
|
@ -32,7 +32,7 @@ namespace JS {
|
|||
|
||||
Shape* Shape::create_unique_clone() const
|
||||
{
|
||||
auto* new_shape = heap().allocate<Shape>(m_global_object, m_global_object);
|
||||
auto* new_shape = heap().allocate_without_global_object<Shape>(m_global_object);
|
||||
new_shape->m_unique = true;
|
||||
new_shape->m_prototype = m_prototype;
|
||||
ensure_property_table();
|
||||
|
@ -47,7 +47,7 @@ Shape* Shape::create_put_transition(const StringOrSymbol& property_name, Propert
|
|||
TransitionKey key { property_name, attributes };
|
||||
if (auto* existing_shape = m_forward_transitions.get(key).value_or(nullptr))
|
||||
return existing_shape;
|
||||
auto* new_shape = heap().allocate<Shape>(m_global_object, *this, property_name, attributes, TransitionType::Put);
|
||||
auto* new_shape = heap().allocate_without_global_object<Shape>(*this, property_name, attributes, TransitionType::Put);
|
||||
m_forward_transitions.set(key, new_shape);
|
||||
return new_shape;
|
||||
}
|
||||
|
@ -57,14 +57,14 @@ Shape* Shape::create_configure_transition(const StringOrSymbol& property_name, P
|
|||
TransitionKey key { property_name, attributes };
|
||||
if (auto* existing_shape = m_forward_transitions.get(key).value_or(nullptr))
|
||||
return existing_shape;
|
||||
auto* new_shape = heap().allocate<Shape>(m_global_object, *this, property_name, attributes, TransitionType::Configure);
|
||||
auto* new_shape = heap().allocate_without_global_object<Shape>(*this, property_name, attributes, TransitionType::Configure);
|
||||
m_forward_transitions.set(key, new_shape);
|
||||
return new_shape;
|
||||
}
|
||||
|
||||
Shape* Shape::create_prototype_transition(Object* new_prototype)
|
||||
{
|
||||
return heap().allocate<Shape>(m_global_object, *this, new_prototype);
|
||||
return heap().allocate_without_global_object<Shape>(*this, new_prototype);
|
||||
}
|
||||
|
||||
Shape::Shape(GlobalObject& global_object)
|
||||
|
|
Loading…
Add table
Reference in a new issue