瀏覽代碼

LibJS: Avoid transitions in GlobalObject::initialize_constructor()

We don't need transitions for either of these:

- Adding the 'name' property to a constructor object
- Adding the 'constructor' property to its prototype object
Linus Groh 4 年之前
父節點
當前提交
45eef97906
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      Userland/Libraries/LibJS/Runtime/GlobalObject.h

+ 2 - 2
Userland/Libraries/LibJS/Runtime/GlobalObject.h

@@ -136,11 +136,11 @@ inline void GlobalObject::initialize_constructor(PropertyName const& property_na
 {
     auto& vm = this->vm();
     constructor = heap().allocate<ConstructorType>(*this, *this);
-    constructor->define_direct_property(vm.names.name, js_string(heap(), property_name.as_string()), Attribute::Configurable);
+    constructor->define_direct_property_without_transition(vm.names.name, js_string(heap(), property_name.as_string()), Attribute::Configurable);
     if (vm.exception())
         return;
     if (prototype) {
-        prototype->define_direct_property(vm.names.constructor, constructor, Attribute::Writable | Attribute::Configurable);
+        prototype->define_direct_property_without_transition(vm.names.constructor, constructor, Attribute::Writable | Attribute::Configurable);
         if (vm.exception())
             return;
     }