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 422545 e9c6358496ff694f7b4127c02c4dcee0fa8be96a
parent 422544 3d767ed287afdfc29a0ad9aa43561f688c731b77
child 422546 d2931773b28b393aa565dca8da2f4a765fbbdacf
push id104289
push userjandemooij@gmail.com
push dateThu, 14 Jun 2018 16:13:19 +0000
treeherdermozilla-inbound@fc2ffbc36c07 [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;