mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 11:27:35 +00:00
LibJS: Add property configuration transitions
Object.defineProperty() can now change the attributes of a property already on the object. Internally this becomes a shape transition with the TransitionType::Configure. Such transitions don't expand the property storage capacity, but rather simply keep attributes up to date when generating a property table.
This commit is contained in:
parent
e6d920d87d
commit
8286f8b996
5 changed files with 57 additions and 8 deletions
|
@ -52,11 +52,19 @@ class Shape final : public Cell {
|
|||
public:
|
||||
virtual ~Shape() override;
|
||||
|
||||
enum class TransitionType {
|
||||
Invalid,
|
||||
Put,
|
||||
Configure,
|
||||
Prototype,
|
||||
};
|
||||
|
||||
Shape();
|
||||
Shape(Shape* previous_shape, const FlyString& property_name, u8 attributes);
|
||||
Shape(Shape* previous_shape, const FlyString& property_name, u8 attributes, TransitionType);
|
||||
Shape(Shape* previous_shape, Object* new_prototype);
|
||||
|
||||
Shape* create_put_transition(const FlyString& name, u8 attributes);
|
||||
Shape* create_configure_transition(const FlyString& name, u8 attributes);
|
||||
Shape* create_prototype_transition(Object* new_prototype);
|
||||
|
||||
Object* prototype() { return m_prototype; }
|
||||
|
@ -81,6 +89,7 @@ private:
|
|||
FlyString m_property_name;
|
||||
u8 m_attributes { 0 };
|
||||
Object* m_prototype { nullptr };
|
||||
TransitionType m_transition_type { TransitionType::Invalid };
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue