LibJS: Make global objects have unique shape from the start
There's no point in trying to achieve shape sharing for global objects, so we can simply make the shape unique from the start and avoid making a transition chain.
This commit is contained in:
parent
2864cb66c0
commit
ec55490198
Notes:
sideshowbarker
2024-07-19 02:03:28 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/ec554901980
2 changed files with 4 additions and 1 deletions
|
@ -75,6 +75,8 @@ GlobalObject::GlobalObject()
|
|||
|
||||
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_object_prototype = heap().allocate_without_global_object<ObjectPrototype>(*this);
|
||||
|
|
|
@ -149,6 +149,8 @@ public:
|
|||
|
||||
Value invoke(const StringOrSymbol& property_name, Optional<MarkedValueList> arguments = {});
|
||||
|
||||
void ensure_shape_is_unique();
|
||||
|
||||
protected:
|
||||
enum class GlobalObjectTag { Tag };
|
||||
enum class ConstructWithoutPrototypeTag { Tag };
|
||||
|
@ -165,7 +167,6 @@ private:
|
|||
void call_native_property_setter(Object* this_object, Value property, Value) const;
|
||||
|
||||
void set_shape(Shape&);
|
||||
void ensure_shape_is_unique();
|
||||
|
||||
bool m_is_extensible { true };
|
||||
Shape* m_shape { nullptr };
|
||||
|
|
Loading…
Add table
Reference in a new issue