Bug 1468252 part 5 - Check for native objects in GetInitialShapeProtoKey. r=jwalden
authorJan de Mooij <jdemooij@mozilla.com>
Thu, 14 Jun 2018 09:07:31 -0700
changeset 422555 e9c6358496ff
parent 422554 3d767ed287af
child 422556 d2931773b28b
push id34138
push userdluca@mozilla.com
push date2018-06-15 02:39 +0000
treeherdermozilla-central@e51f8dbf0397 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjwalden
bugs1468252
milestone62.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1468252 part 5 - Check for native objects in GetInitialShapeProtoKey. r=jwalden
js/src/vm/Shape.cpp
--- a/js/src/vm/Shape.cpp
+++ b/js/src/vm/Shape.cpp
@@ -2016,17 +2016,17 @@ Shape::dumpSubtree(int level, js::Generi
             }
         }
     }
 }
 
 #endif
 
 static bool
-IsOriginalProto(GlobalObject* global, JSProtoKey key, JSObject& proto)
+IsOriginalProto(GlobalObject* global, JSProtoKey key, NativeObject& proto)
 {
     if (global->getPrototype(key) != ObjectValue(proto))
         return false;
 
     if (key == JSProto_Object) {
         MOZ_ASSERT(proto.staticPrototypeIsImmutable(),
                    "proto should be Object.prototype, whose prototype is "
                    "immutable");
@@ -2046,19 +2046,19 @@ IsOriginalProto(GlobalObject* global, JS
     MOZ_ASSERT(protoProto->staticPrototype() == nullptr,
                "Object.prototype must have null prototype");
     return true;
 }
 
 static JSProtoKey
 GetInitialShapeProtoKey(TaggedProto proto, JSContext* cx)
 {
-    if (proto.isObject() && proto.toObject()->hasStaticPrototype()) {
+    if (proto.isObject() && proto.toObject()->isNative()) {
         GlobalObject* global = cx->global();
-        JSObject& obj = *proto.toObject();
+        NativeObject& obj = proto.toObject()->as<NativeObject>();
         MOZ_ASSERT(global == &obj.global());
 
         if (IsOriginalProto(global, JSProto_Object, obj))
             return JSProto_Object;
         if (IsOriginalProto(global, JSProto_Function, obj))
             return JSProto_Function;
         if (IsOriginalProto(global, JSProto_Array, obj))
             return JSProto_Array;