Bug 838014 - Rooting in ionmonkey. r=terrence. Relanding.
☠☠ backed out by 258b97787c17 ☠ ☠
authorSteve Fink <sfink@mozilla.com>
Thu, 07 Feb 2013 13:32:00 -0800
changeset 121229 ced35810adb220898e535f30d74230a90b110b2c
parent 121228 a934441a70c24c8789fb8ddbb2962788a772ecd4
child 121230 b5ec7ce219b276771ed170407b378454783e4c70
push id24278
push useremorley@mozilla.com
push dateFri, 08 Feb 2013 11:01:12 +0000
treeherdermozilla-central@fcf79680a057 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersterrence
bugs838014
milestone21.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 838014 - Rooting in ionmonkey. r=terrence. Relanding.
js/public/Value.h
js/src/ion/Ion.cpp
js/src/ion/IonCaches.cpp
js/src/ion/IonCaches.h
js/src/ion/TypeOracle.cpp
js/src/ion/TypeOracle.h
js/src/jsapi.h
--- a/js/public/Value.h
+++ b/js/public/Value.h
@@ -1503,19 +1503,17 @@ class ValueOperations
     double toDouble() const { return value()->toDouble(); }
     JSString *toString() const { return value()->toString(); }
     JSObject &toObject() const { return value()->toObject(); }
     JSObject *toObjectOrNull() const { return value()->toObjectOrNull(); }
     void *toGCThing() const { return value()->toGCThing(); }
 
     JSValueType extractNonDoubleType() const { return value()->extractNonDoubleType(); }
 
-#ifdef DEBUG
     JSWhyMagic whyMagic() const { return value()->whyMagic(); }
-#endif
 };
 
 /*
  * A class designed for CRTP use in implementing the mutating parts of the
  * Value interface in Value-like classes.  Outer must be a class inheriting
  * MutableValueOperations<Outer> with visible extractMutable() and extract()
  * methods returning the const Value* and Value* abstracted by Outer.
  */
--- a/js/src/ion/Ion.cpp
+++ b/js/src/ion/Ion.cpp
@@ -1712,25 +1712,25 @@ EnterIon(JSContext *cx, StackFrame *fp, 
         calleeToken = CalleeToToken(fp->script());
         thisv = fp->thisValue();
         maxArgc = 1;
         maxArgv = thisv.address();
     }
 
     // Caller must construct |this| before invoking the Ion function.
     JS_ASSERT_IF(fp->isConstructing(), fp->functionThis().isObject());
-    Value result = Int32Value(numActualArgs);
+    RootedValue result(cx, Int32Value(numActualArgs));
     {
         AssertCompartmentUnchanged pcc(cx);
         IonContext ictx(cx, cx->compartment, NULL);
         IonActivation activation(cx, fp);
         JSAutoResolveFlags rf(cx, RESOLVE_INFER);
         AutoFlushInhibitor afi(cx->compartment->ionCompartment());
         // Single transition point from Interpreter to Ion.
-        enter(jitcode, maxArgc, maxArgv, fp, calleeToken, &result);
+        enter(jitcode, maxArgc, maxArgv, fp, calleeToken, result.address());
     }
 
     if (result.isMagic() && result.whyMagic() == JS_ION_BAILOUT) {
         if (!EnsureHasScopeObjects(cx, cx->fp()))
             return IonExec_Error;
         return IonExec_Bailout;
     }
 
@@ -1848,22 +1848,22 @@ ion::FastInvoke(JSContext *cx, HandleFun
         JS_ASSERT(!activation.entryfp());
     }
 
     activation.setPrevPc(cx->regs().pc);
 
     EnterIonCode enter = cx->compartment->ionCompartment()->enterJIT();
     void *calleeToken = CalleeToToken(fun);
 
-    Value result = Int32Value(args.length());
+    RootedValue result(cx, Int32Value(args.length()));
     JS_ASSERT(args.length() >= fun->nargs);
 
     JSAutoResolveFlags rf(cx, RESOLVE_INFER);
     args.setActive();
-    enter(jitcode, args.length() + 1, args.array() - 1, fp, calleeToken, &result);
+    enter(jitcode, args.length() + 1, args.array() - 1, fp, calleeToken, result.address());
     args.setInactive();
 
     if (clearCallingIntoIon)
         fp->clearCallingIntoIon();
 
     JS_ASSERT(fp == cx->fp());
     JS_ASSERT(!cx->runtime->hasIonReturnOverride());
 
--- a/js/src/ion/IonCaches.cpp
+++ b/js/src/ion/IonCaches.cpp
@@ -1561,17 +1561,17 @@ js::ion::SetPropertyCache(JSContext *cx,
             return false;
     }
 
     return true;
 }
 
 bool
 IonCacheGetElement::attachGetProp(JSContext *cx, IonScript *ion, HandleObject obj,
-                                  const Value &idval, PropertyName *name)
+                                  const Value &idval, HandlePropertyName name)
 {
     RootedObject holder(cx);
     RootedShape shape(cx);
     if (!JSObject::lookupProperty(cx, obj, name, &holder, &shape))
         return false;
 
     RootedScript script(cx);
     jsbytecode *pc;
@@ -1727,17 +1727,18 @@ js::ion::GetElementCache(JSContext *cx, 
 
     bool attachedStub = false;
     if (cache.stubCount() < MAX_STUBS) {
         if (obj->isNative() && cache.monitoredResult()) {
             cache.incrementStubCount();
 
             uint32_t dummy;
             if (idval.isString() && JSID_IS_ATOM(id) && !JSID_TO_ATOM(id)->isIndex(&dummy)) {
-                if (!cache.attachGetProp(cx, ion, obj, idval, JSID_TO_ATOM(id)->asPropertyName()))
+                RootedPropertyName name(cx, JSID_TO_ATOM(id)->asPropertyName());
+                if (!cache.attachGetProp(cx, ion, obj, idval, name))
                     return false;
                 attachedStub = true;
             }
         } else if (!cache.hasDenseStub() && obj->isNative() && idval.isInt32()) {
             // Generate at most one dense array stub.
             cache.incrementStubCount();
 
             if (!cache.attachDenseElement(cx, ion, obj, idval))
--- a/js/src/ion/IonCaches.h
+++ b/js/src/ion/IonCaches.h
@@ -369,17 +369,17 @@ class IonCacheGetElement : public IonCac
     bool hasDenseStub() const {
         return u.getelem.hasDenseStub;
     }
     void setHasDenseStub() {
         JS_ASSERT(!hasDenseStub());
         u.getelem.hasDenseStub = true;
     }
 
-    bool attachGetProp(JSContext *cx, IonScript *ion, HandleObject obj, const Value &idval, PropertyName *name);
+    bool attachGetProp(JSContext *cx, IonScript *ion, HandleObject obj, const Value &idval, HandlePropertyName name);
     bool attachDenseElement(JSContext *cx, IonScript *ion, JSObject *obj, const Value &idval);
 };
 
 class IonCacheBindName : public IonCache
 {
   public:
     IonCacheBindName(CodeOffsetJump initialJump,
                      CodeOffsetLabel rejoinLabel,
--- a/js/src/ion/TypeOracle.cpp
+++ b/js/src/ion/TypeOracle.cpp
@@ -290,17 +290,17 @@ TypeInferenceOracle::inArrayIsPacked(Unr
 bool
 TypeInferenceOracle::elementReadIsDenseNative(RawScript script, jsbytecode *pc)
 {
     return elementAccessIsDenseNative(script->analysis()->poppedTypes(pc, 1),
                                      script->analysis()->poppedTypes(pc, 0));
 }
 
 bool
-TypeInferenceOracle::elementReadIsTypedArray(HandleScript script, jsbytecode *pc, int *arrayType)
+TypeInferenceOracle::elementReadIsTypedArray(RawScript script, jsbytecode *pc, int *arrayType)
 {
     if (!elementAccessIsTypedArray(script->analysis()->poppedTypes(pc, 1),
                                    script->analysis()->poppedTypes(pc, 0),
                                    arrayType))
     {
         return false;
     }
 
@@ -438,28 +438,28 @@ TypeInferenceOracle::elementWriteNeedsDo
 {
     StackTypeSet *types = script->analysis()->poppedTypes(pc, 2);
     types::StackTypeSet::DoubleConversion conversion = types->convertDoubleElements(cx);
     return conversion == StackTypeSet::AlwaysConvertToDoubles ||
            conversion == StackTypeSet::MaybeConvertToDoubles;
 }
 
 bool
-TypeInferenceOracle::elementWriteHasExtraIndexedProperty(UnrootedScript script, jsbytecode *pc)
+TypeInferenceOracle::elementWriteHasExtraIndexedProperty(RawScript script, jsbytecode *pc)
 {
     StackTypeSet *obj = script->analysis()->poppedTypes(pc, 2);
 
     if (obj->hasObjectFlags(cx, types::OBJECT_FLAG_LENGTH_OVERFLOW))
         return true;
 
     return types::TypeCanHaveExtraIndexedProperties(cx, obj);
 }
 
 bool
-TypeInferenceOracle::elementWriteIsPacked(UnrootedScript script, jsbytecode *pc)
+TypeInferenceOracle::elementWriteIsPacked(RawScript script, jsbytecode *pc)
 {
     StackTypeSet *types = script->analysis()->poppedTypes(pc, 2);
     return !types->hasObjectFlags(cx, types::OBJECT_FLAG_NON_PACKED);
 }
 
 bool
 TypeInferenceOracle::setElementHasWrittenHoles(UnrootedScript script, jsbytecode *pc)
 {
@@ -576,17 +576,17 @@ TypeInferenceOracle::canInlineCall(Handl
     // Gets removed in Bug 796114
     if (caller->analysis()->typeBarriers(cx, pc))
         return false;
 
     return true;
 }
 
 bool
-TypeInferenceOracle::canEnterInlinedFunction(HandleScript caller, jsbytecode *pc, JSFunction *target)
+TypeInferenceOracle::canEnterInlinedFunction(RawScript caller, jsbytecode *pc, RawFunction target)
 {
     AssertCanGC();
     RootedScript targetScript(cx, target->nonLazyScript());
 
     // Always permit the empty script.
     if (targetScript->length == 1)
         return true;
 
--- a/js/src/ion/TypeOracle.h
+++ b/js/src/ion/TypeOracle.h
@@ -80,17 +80,17 @@ class TypeOracle
         return false;
     }
     virtual bool inArrayIsPacked(UnrootedScript script, jsbytecode *pc) {
         return false;
     }
     virtual bool elementReadIsDenseNative(RawScript script, jsbytecode *pc) {
         return false;
     }
-    virtual bool elementReadIsTypedArray(HandleScript script, jsbytecode *pc, int *arrayType) {
+    virtual bool elementReadIsTypedArray(RawScript script, jsbytecode *pc, int *arrayType) {
         return false;
     }
     virtual bool elementReadIsString(UnrootedScript script, jsbytecode *pc) {
         return false;
     }
     virtual bool elementReadShouldAlwaysLoadDoubles(UnrootedScript script, jsbytecode *pc) {
         return false;
     }
@@ -111,20 +111,20 @@ class TypeOracle
         return false;
     }
     virtual bool elementWriteIsTypedArray(RawScript script, jsbytecode *pc, int *arrayType) {
         return false;
     }
     virtual bool elementWriteNeedsDoubleConversion(UnrootedScript script, jsbytecode *pc) {
         return false;
     }
-    virtual bool elementWriteHasExtraIndexedProperty(UnrootedScript script, jsbytecode *pc) {
+    virtual bool elementWriteHasExtraIndexedProperty(RawScript script, jsbytecode *pc) {
         return false;
     }
-    virtual bool elementWriteIsPacked(UnrootedScript script, jsbytecode *pc) {
+    virtual bool elementWriteIsPacked(RawScript script, jsbytecode *pc) {
         return false;
     }
     virtual bool elementAccessIsDenseNative(types::StackTypeSet *obj, types::StackTypeSet *id) {
         return false;
     }
     virtual bool elementAccessIsTypedArray(types::StackTypeSet *obj, types::StackTypeSet *id, int *arrayType) {
         return false;
     }
@@ -157,17 +157,17 @@ class TypeOracle
         return NULL;
     }
     virtual types::StackTypeSet *getCallReturn(UnrootedScript script, jsbytecode *pc) {
         return NULL;
     }
     virtual bool canInlineCall(HandleScript caller, jsbytecode *pc) {
         return false;
     }
-    virtual bool canEnterInlinedFunction(HandleScript  caller, jsbytecode *pc, JSFunction *callee) {
+    virtual bool canEnterInlinedFunction(RawScript caller, jsbytecode *pc, RawFunction callee) {
         return false;
     }
 
     virtual LazyArgumentsType isArgumentObject(types::StackTypeSet *obj) {
         return MaybeArguments;
     }
     virtual LazyArgumentsType propertyReadMagicArguments(UnrootedScript script, jsbytecode *pc) {
         return MaybeArguments;
@@ -246,38 +246,38 @@ class TypeInferenceOracle : public TypeO
     types::HeapTypeSet *globalPropertyWrite(UnrootedScript script, jsbytecode *pc, jsid id, bool *canSpecialize);
     types::StackTypeSet *returnTypeSet(UnrootedScript script, jsbytecode *pc, types::StackTypeSet **barrier);
     types::StackTypeSet *getCallTarget(UnrootedScript caller, uint32_t argc, jsbytecode *pc);
     types::StackTypeSet *getCallArg(UnrootedScript caller, uint32_t argc, uint32_t arg, jsbytecode *pc);
     types::StackTypeSet *getCallReturn(UnrootedScript caller, jsbytecode *pc);
     bool inObjectIsDenseNativeWithoutExtraIndexedProperties(HandleScript script, jsbytecode *pc);
     bool inArrayIsPacked(UnrootedScript script, jsbytecode *pc);
     bool elementReadIsDenseNative(RawScript script, jsbytecode *pc);
-    bool elementReadIsTypedArray(HandleScript script, jsbytecode *pc, int *atype);
+    bool elementReadIsTypedArray(RawScript script, jsbytecode *pc, int *atype);
     bool elementReadIsString(UnrootedScript script, jsbytecode *pc);
     bool elementReadShouldAlwaysLoadDoubles(UnrootedScript script, jsbytecode *pc);
     bool elementReadHasExtraIndexedProperty(UnrootedScript, jsbytecode *pc);
     bool elementReadIsPacked(UnrootedScript script, jsbytecode *pc);
     void elementReadGeneric(UnrootedScript script, jsbytecode *pc, bool *cacheable, bool *monitorResult);
     bool elementWriteIsDenseNative(HandleScript script, jsbytecode *pc);
     bool elementAccessIsDenseNative(types::StackTypeSet *obj, types::StackTypeSet *id);
     bool elementWriteIsTypedArray(RawScript script, jsbytecode *pc, int *arrayType);
     bool elementAccessIsTypedArray(types::StackTypeSet *obj, types::StackTypeSet *id, int *arrayType);
     bool elementWriteNeedsDoubleConversion(UnrootedScript script, jsbytecode *pc);
-    bool elementWriteHasExtraIndexedProperty(UnrootedScript script, jsbytecode *pc);
-    bool elementWriteIsPacked(UnrootedScript script, jsbytecode *pc);
+    bool elementWriteHasExtraIndexedProperty(RawScript script, jsbytecode *pc);
+    bool elementWriteIsPacked(RawScript script, jsbytecode *pc);
     bool arrayResultShouldHaveDoubleConversion(UnrootedScript script, jsbytecode *pc);
     bool setElementHasWrittenHoles(UnrootedScript script, jsbytecode *pc);
     bool propertyWriteCanSpecialize(UnrootedScript script, jsbytecode *pc);
     bool propertyWriteNeedsBarrier(UnrootedScript script, jsbytecode *pc, RawId id);
     bool elementWriteNeedsBarrier(UnrootedScript script, jsbytecode *pc);
     MIRType elementWrite(UnrootedScript script, jsbytecode *pc);
     bool canInlineCalls();
     bool canInlineCall(HandleScript caller, jsbytecode *pc);
-    bool canEnterInlinedFunction(HandleScript caller, jsbytecode *pc, JSFunction *callee);
+    bool canEnterInlinedFunction(RawScript caller, jsbytecode *pc, RawFunction callee);
     types::StackTypeSet *aliasedVarBarrier(UnrootedScript script, jsbytecode *pc, types::StackTypeSet **barrier);
 
     LazyArgumentsType isArgumentObject(types::StackTypeSet *obj);
     LazyArgumentsType propertyReadMagicArguments(UnrootedScript script, jsbytecode *pc);
     LazyArgumentsType elementReadMagicArguments(UnrootedScript script, jsbytecode *pc);
     LazyArgumentsType elementWriteMagicArguments(UnrootedScript script, jsbytecode *pc);
 };
 
--- a/js/src/jsapi.h
+++ b/js/src/jsapi.h
@@ -107,17 +107,17 @@ class JS_PUBLIC_API(AutoGCRooter) {
      * If negative, meaning is indicated by the corresponding value in the enum
      * below.  Any other negative value indicates some deeper problem such as
      * memory corruption.
      */
     ptrdiff_t tag;
 
     enum {
         JSVAL =        -1, /* js::AutoValueRooter */
-        VALARRAY =     -2, /* js::AutoValueArrayRooter */
+        VALARRAY =     -2, /* js::AutoValueArray */
         PARSER =       -3, /* js::frontend::Parser */
         SHAPEVECTOR =  -4, /* js::AutoShapeVector */
         IDARRAY =      -6, /* js::AutoIdArray */
         DESCRIPTORS =  -7, /* js::AutoPropDescArrayRooter */
         // UNUSED      -8
         // UNUSED      -9
         OBJECT =      -10, /* js::AutoObjectRooter */
         ID =          -11, /* js::AutoIdRooter */