From 4312f71e86a7eee7ab919bca675267b19bf7b8f1 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Fri, 11 Jan 2013 09:43:00 +0100 Subject: [PATCH] Bug 828248 - Part c: Pass MutableHandleId to Shape::getUserId; r=sfink --- js/src/ion/IonCaches.cpp | 4 ++-- js/src/jsobj.cpp | 2 +- js/src/jsscope.h | 2 +- js/src/jsscopeinlines.h | 19 +++++++------------ js/src/methodjit/PolyIC.cpp | 2 +- 5 files changed, 12 insertions(+), 17 deletions(-) diff --git a/js/src/ion/IonCaches.cpp b/js/src/ion/IonCaches.cpp index a1bacb11559..5008f129241 100644 --- a/js/src/ion/IonCaches.cpp +++ b/js/src/ion/IonCaches.cpp @@ -542,7 +542,7 @@ struct GetNativePropertyStub masm.movePtr(StackPointer, argVpReg); // push canonical jsid from shape instead of propertyname. - jsid propId; + RootedId propId(cx); if (!shape->getUserId(cx, &propId)) return false; masm.Push(propId, scratchReg); @@ -1205,7 +1205,7 @@ IonCacheSetProperty::attachSetterCall(JSContext *cx, IonScript *ion, masm.move32(Imm32(strict() ? 1 : 0), argStrictReg); // push canonical jsid from shape instead of propertyname. - jsid propId; + RootedId propId(cx); if (!shape->getUserId(cx, &propId)) return false; masm.Push(propId, argIdReg); diff --git a/js/src/jsobj.cpp b/js/src/jsobj.cpp index 9bc0db00dbf..ff5f63ad6a2 100644 --- a/js/src/jsobj.cpp +++ b/js/src/jsobj.cpp @@ -3871,7 +3871,7 @@ baseops::DeleteGeneric(JSContext *cx, HandleObject obj, HandleId id, MutableHand } RootedId userid(cx); - if (!shape->getUserId(cx, userid.address())) + if (!shape->getUserId(cx, &userid)) return false; if (!CallJSPropertyOp(cx, obj->getClass()->delProperty, obj, userid, rval)) diff --git a/js/src/jsscope.h b/js/src/jsscope.h index ae9abdcd90e..966526fcedb 100644 --- a/js/src/jsscope.h +++ b/js/src/jsscope.h @@ -755,7 +755,7 @@ class Shape : public js::gc::Cell * If SHORTID is set in shape->flags, we use shape->shortid rather * than id when calling shape's getter or setter. */ - inline bool getUserId(JSContext *cx, jsid *idp) const; + inline bool getUserId(JSContext *cx, MutableHandleId idp) const; uint8_t attributes() const { return attrs; } bool configurable() const { return (attrs & JSPROP_PERMANENT) == 0; } diff --git a/js/src/jsscopeinlines.h b/js/src/jsscopeinlines.h index a9425948e2c..82473d5a77d 100644 --- a/js/src/jsscopeinlines.h +++ b/js/src/jsscopeinlines.h @@ -265,7 +265,7 @@ Shape::matchesParamsAfterId(UnrootedBaseShape base, uint32_t aslot, } inline bool -Shape::getUserId(JSContext *cx, jsid *idp) const +Shape::getUserId(JSContext *cx, MutableHandleId idp) const { AssertCanGC(); const Shape *self = this; @@ -277,16 +277,11 @@ Shape::getUserId(JSContext *cx, jsid *idp) const #endif if (self->hasShortID()) { int16_t id = self->shortid(); - if (id < 0) { - RootedId rootedId(cx); - if (!ValueToId(cx, Int32Value(id), &rootedId)) - return false; - *idp = rootedId; - return true; - } - *idp = INT_TO_JSID(id); + if (id < 0) + return ValueToId(cx, Int32Value(id), idp); + idp.set(INT_TO_JSID(id)); } else { - *idp = self->propid(); + idp.set(self->propid()); } return true; } @@ -303,7 +298,7 @@ Shape::get(JSContext* cx, HandleObject receiver, JSObject* obj, JSObject *pobj, Rooted self(cx, this); RootedId id(cx); - if (!self->getUserId(cx, id.address())) + if (!self->getUserId(cx, &id)) return false; return CallJSPropertyOp(cx, self->getterOp(), receiver, id, vp); @@ -324,7 +319,7 @@ Shape::set(JSContext* cx, HandleObject obj, HandleObject receiver, bool strict, Rooted self(cx, this); RootedId id(cx); - if (!self->getUserId(cx, id.address())) + if (!self->getUserId(cx, &id)) return false; /* diff --git a/js/src/methodjit/PolyIC.cpp b/js/src/methodjit/PolyIC.cpp index 1b4e58d35ff..70a627ccdaa 100644 --- a/js/src/methodjit/PolyIC.cpp +++ b/js/src/methodjit/PolyIC.cpp @@ -1393,7 +1393,7 @@ class GetPropCompiler : public PICStubCompiler if (shape->hasGetterValue()) { generateNativeGetterStub(masm, shape, start, shapeMismatches); } else { - jsid userid; + RootedId userid(cx); if (!shape->getUserId(cx, &userid)) return error(); generateGetterStub(masm, shape, userid, start, shapeMismatches);