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

LibJS: Always keep a reference to the global object in Shape

We need to move towards supporting multiple global objects, which will
be a large refactoring. To keep it manageable, let's do it in steps,
starting with giving Object a way to find the GlobalObject it lives
inside by asking its Shape for it.
This commit is contained in:
Andreas Kling 2020-06-08 12:15:58 +02:00
parent 10aebabf0b
commit ff8bb962b6
5 changed files with 26 additions and 15 deletions

View file

@ -62,9 +62,9 @@ public:
Prototype,
};
Shape();
Shape(Shape* previous_shape, const FlyString& property_name, PropertyAttributes attributes, TransitionType);
Shape(Shape* previous_shape, Object* new_prototype);
explicit Shape(GlobalObject&);
Shape(Shape& previous_shape, const FlyString& property_name, PropertyAttributes attributes, TransitionType);
Shape(Shape& previous_shape, Object* new_prototype);
Shape* create_put_transition(const FlyString& name, PropertyAttributes attributes);
Shape* create_configure_transition(const FlyString& name, PropertyAttributes attributes);
@ -73,6 +73,8 @@ public:
bool is_unique() const { return m_unique; }
Shape* create_unique_clone() const;
GlobalObject& global_object() const { return m_global_object; }
Object* prototype() { return m_prototype; }
const Object* prototype() const { return m_prototype; }
@ -99,6 +101,8 @@ private:
void ensure_property_table() const;
GlobalObject& m_global_object;
mutable OwnPtr<HashMap<FlyString, PropertyMetadata>> m_property_table;
HashMap<TransitionKey, Shape*> m_forward_transitions;