diff options
Diffstat (limited to 'js/src')
-rw-r--r-- | js/src/builtin/Object.cpp | 2 | ||||
-rw-r--r-- | js/src/jsfriendapi.cpp | 2 | ||||
-rw-r--r-- | js/src/jsobj.cpp | 6 | ||||
-rw-r--r-- | js/src/jsobj.h | 3 | ||||
-rw-r--r-- | js/src/vm/ObjectGroup.cpp | 13 |
5 files changed, 13 insertions, 13 deletions
diff --git a/js/src/builtin/Object.cpp b/js/src/builtin/Object.cpp index e4bee5457b..a6dcab099d 100644 --- a/js/src/builtin/Object.cpp +++ b/js/src/builtin/Object.cpp @@ -1409,7 +1409,7 @@ FinishObjectClassInit(JSContext* cx, JS::HandleObject ctor, JS::HandleObject pro */ Rooted<TaggedProto> tagged(cx, TaggedProto(proto)); if (global->shouldSplicePrototype(cx)) { - if (!global->splicePrototype(cx, global->getClass(), tagged)) + if (!JSObject::splicePrototype(cx, global, global->getClass(), tagged)) return false; } return true; diff --git a/js/src/jsfriendapi.cpp b/js/src/jsfriendapi.cpp index 5baba0beb0..f7622cb443 100644 --- a/js/src/jsfriendapi.cpp +++ b/js/src/jsfriendapi.cpp @@ -113,7 +113,7 @@ JS_SplicePrototype(JSContext* cx, HandleObject obj, HandleObject proto) } Rooted<TaggedProto> tagged(cx, TaggedProto(proto)); - return obj->splicePrototype(cx, obj->getClass(), tagged); + return JSObject::splicePrototype(cx, obj, obj->getClass(), tagged); } JS_FRIEND_API(JSObject*) diff --git a/js/src/jsobj.cpp b/js/src/jsobj.cpp index ce2f9a6142..f4a524d44c 100644 --- a/js/src/jsobj.cpp +++ b/js/src/jsobj.cpp @@ -884,7 +884,7 @@ CreateThisForFunctionWithGroup(JSContext* cx, HandleObjectGroup group, if (newKind == SingletonObject) { Rooted<TaggedProto> proto(cx, TaggedProto(templateObject->staticPrototype())); - if (!res->splicePrototype(cx, &PlainObject::class_, proto)) + if (!JSObject::splicePrototype(cx, res, &PlainObject::class_, proto)) return nullptr; } else { res->setGroup(group); @@ -1722,7 +1722,7 @@ DefineConstructorAndPrototype(JSContext* cx, HandleObject obj, JSProtoKey key, H /* Bootstrap Function.prototype (see also JS_InitStandardClasses). */ Rooted<TaggedProto> tagged(cx, TaggedProto(proto)); - if (ctor->getClass() == clasp && !ctor->splicePrototype(cx, clasp, tagged)) + if (ctor->getClass() == clasp && !JSObject::splicePrototype(cx, ctor, clasp, tagged)) goto bad; } @@ -1862,7 +1862,7 @@ js::SetClassAndProto(JSContext* cx, HandleObject obj, * Just splice the prototype, but mark the properties as unknown for * consistent behavior. */ - if (!obj->splicePrototype(cx, clasp, proto)) + if (!JSObject::splicePrototype(cx, obj, clasp, proto)) return false; MarkObjectGroupUnknownProperties(cx, obj->group()); return true; diff --git a/js/src/jsobj.h b/js/src/jsobj.h index 49b7c5e8e6..bdfe75b925 100644 --- a/js/src/jsobj.h +++ b/js/src/jsobj.h @@ -439,7 +439,8 @@ class JSObject : public js::gc::Cell } /* Set a new prototype for an object with a singleton type. */ - bool splicePrototype(JSContext* cx, const js::Class* clasp, js::Handle<js::TaggedProto> proto); + static bool splicePrototype(JSContext* cx, js::HandleObject obj, const js::Class* clasp, + js::Handle<js::TaggedProto> proto); /* * For bootstrapping, whether to splice a prototype for Function.prototype diff --git a/js/src/vm/ObjectGroup.cpp b/js/src/vm/ObjectGroup.cpp index 6e90008940..fbad85e57a 100644 --- a/js/src/vm/ObjectGroup.cpp +++ b/js/src/vm/ObjectGroup.cpp @@ -262,19 +262,18 @@ JSObject::shouldSplicePrototype(JSContext* cx) return isSingleton(); } -bool -JSObject::splicePrototype(JSContext* cx, const Class* clasp, Handle<TaggedProto> proto) +/* static */ bool +JSObject::splicePrototype(JSContext* cx, HandleObject obj, const Class* clasp, + Handle<TaggedProto> proto) { - MOZ_ASSERT(cx->compartment() == compartment()); - - RootedObject self(cx, this); + MOZ_ASSERT(cx->compartment() == obj->compartment()); /* * For singleton groups representing only a single JSObject, the proto * can be rearranged as needed without destroying type information for * the old or new types. */ - MOZ_ASSERT(self->isSingleton()); + MOZ_ASSERT(obj->isSingleton()); // Windows may not appear on prototype chains. MOZ_ASSERT_IF(proto.isObject(), !IsWindow(proto.toObject())); @@ -283,7 +282,7 @@ JSObject::splicePrototype(JSContext* cx, const Class* clasp, Handle<TaggedProto> return false; // Force type instantiation when splicing lazy group. - RootedObjectGroup group(cx, JSObject::getGroup(cx, self)); + RootedObjectGroup group(cx, JSObject::getGroup(cx, obj)); if (!group) return false; RootedObjectGroup protoGroup(cx, nullptr); |