mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 21:27:35 +00:00
LibJS: Remove transition avoidance & start caching prototype transitions
The way that transition avoidance (foo_without_transition) was implemented led to shapes being unshareable and caused shape explosion instead, precisely what we were trying to avoid. This patch removes all the attempts to avoid transitioning shapes, and instead *adds* transitions when changing an object's prototype. This makes transitions flow naturally, and as a result we end up with way fewer shape objects in real-world situations. When we run out of big problems, we can get back to avoiding transitions as an optimization, but for now, let's avoid ballooning our processes with a unique shape for every object.
This commit is contained in:
parent
46686f7f94
commit
14c57b4b7f
7 changed files with 35 additions and 67 deletions
|
@ -128,9 +128,6 @@ public:
|
|||
void define_direct_property(PropertyName const& property_name, Value value, PropertyAttributes attributes) { storage_set(property_name, { value, attributes }); };
|
||||
void define_direct_accessor(PropertyName const&, FunctionObject* getter, FunctionObject* setter, PropertyAttributes attributes);
|
||||
|
||||
void define_direct_property_without_transition(PropertyName const&, Value, PropertyAttributes);
|
||||
void define_direct_accessor_without_transition(PropertyName const&, FunctionObject* getter, FunctionObject* setter, PropertyAttributes);
|
||||
|
||||
void define_native_function(PropertyName const&, Function<Value(VM&, GlobalObject&)>, i32 length, PropertyAttributes attributes);
|
||||
void define_native_accessor(PropertyName const&, Function<Value(VM&, GlobalObject&)> getter, Function<Value(VM&, GlobalObject&)> setter, PropertyAttributes attributes);
|
||||
|
||||
|
@ -165,12 +162,6 @@ public:
|
|||
|
||||
void ensure_shape_is_unique();
|
||||
|
||||
void enable_transitions() { m_transitions_enabled = true; }
|
||||
void disable_transitions() { m_transitions_enabled = false; }
|
||||
|
||||
void set_initialized(Badge<Heap>) { m_initialized = true; }
|
||||
void set_initialized(Badge<GlobalObject>) { m_initialized = true; }
|
||||
|
||||
template<typename T>
|
||||
bool fast_is() const = delete;
|
||||
|
||||
|
@ -192,8 +183,6 @@ private:
|
|||
Object* prototype() { return shape().prototype(); }
|
||||
Object const* prototype() const { return shape().prototype(); }
|
||||
|
||||
bool m_transitions_enabled { true };
|
||||
bool m_initialized { false };
|
||||
Shape* m_shape { nullptr };
|
||||
Vector<Value> m_storage;
|
||||
IndexedProperties m_indexed_properties;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue