Bug 998490 - OdinMonkey: add operator-> to ActivationIterator (r=jandem)
authorLuke Wagner <luke@mozilla.com>
Wed, 16 Apr 2014 15:57:04 -0500
changeset 199649 08b1378388ddf0b5f177ce5bc0abf3228cc50baa
parent 199648 99b775c6d2bcd9713596677dfd152b66926fcd4b
child 199650 f95e1ddbdcbdaeca5faebe9f01d4bc0b1b2f5edd
push id486
push userasasaki@mozilla.com
push dateMon, 14 Jul 2014 18:39:42 +0000
treeherdermozilla-release@d33428174ff1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjandem
bugs998490
milestone31.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 998490 - OdinMonkey: add operator-> to ActivationIterator (r=jandem)
js/src/jit/Bailouts.cpp
js/src/jit/BaselineJIT.cpp
js/src/jit/Ion.cpp
js/src/jit/IonFrames.cpp
js/src/jscntxt.cpp
js/src/jscompartment.cpp
js/src/jsgc.cpp
js/src/jsscript.cpp
js/src/vm/OldDebugAPI.cpp
js/src/vm/Stack.cpp
js/src/vm/Stack.h
--- a/js/src/jit/Bailouts.cpp
+++ b/js/src/jit/Bailouts.cpp
@@ -72,17 +72,17 @@ jit::Bailout(BailoutStack *sp, BaselineB
 {
     JSContext *cx = GetJSContextFromJitCode();
     JS_ASSERT(bailoutInfo);
 
     // We don't have an exit frame.
     cx->mainThread().ionTop = nullptr;
     JitActivationIterator jitActivations(cx->runtime());
     IonBailoutIterator iter(jitActivations, sp);
-    JitActivation *activation = jitActivations.activation()->asJit();
+    JitActivation *activation = jitActivations->asJit();
 
     TraceLogger *logger = TraceLoggerForMainThread(cx->runtime());
     TraceLogTimestamp(logger, TraceLogger::Bailout);
 
     IonSpew(IonSpew_Bailouts, "Took bailout! Snapshot offset: %d", iter.snapshotOffset());
 
     JS_ASSERT(IsBaselineEnabled(cx));
 
@@ -106,17 +106,17 @@ jit::InvalidationBailout(InvalidationBai
     sp->checkInvariants();
 
     JSContext *cx = GetJSContextFromJitCode();
 
     // We don't have an exit frame.
     cx->mainThread().ionTop = nullptr;
     JitActivationIterator jitActivations(cx->runtime());
     IonBailoutIterator iter(jitActivations, sp);
-    JitActivation *activation = jitActivations.activation()->asJit();
+    JitActivation *activation = jitActivations->asJit();
 
     TraceLogger *logger = TraceLoggerForMainThread(cx->runtime());
     TraceLogTimestamp(logger, TraceLogger::Invalidation);
 
     IonSpew(IonSpew_Bailouts, "Took invalidation bailout! Snapshot offset: %d", iter.snapshotOffset());
 
     // Note: the frame size must be computed before we return from this function.
     *frameSizeOut = iter.topFrameSize();
@@ -174,17 +174,17 @@ jit::ExceptionHandlerBailout(JSContext *
     // We can be propagating debug mode exceptions without there being an
     // actual exception pending. For instance, when we return false from an
     // operation callback like a timeout handler.
     MOZ_ASSERT_IF(!excInfo.propagatingIonExceptionForDebugMode(), cx->isExceptionPending());
 
     cx->mainThread().ionTop = nullptr;
     JitActivationIterator jitActivations(cx->runtime());
     IonBailoutIterator iter(jitActivations, frame.frame());
-    JitActivation *activation = jitActivations.activation()->asJit();
+    JitActivation *activation = jitActivations->asJit();
 
     BaselineBailoutInfo *bailoutInfo = nullptr;
     uint32_t retval = BailoutIonToBaseline(cx, activation, iter, true, &bailoutInfo, &excInfo);
 
     if (retval == BAILOUT_RETURN_OK) {
         MOZ_ASSERT(bailoutInfo);
 
         // Overwrite the kind so HandleException after the bailout returns
--- a/js/src/jit/BaselineJIT.cpp
+++ b/js/src/jit/BaselineJIT.cpp
@@ -953,12 +953,12 @@ MarkActiveBaselineScripts(JSRuntime *rt,
     }
 }
 
 void
 jit::MarkActiveBaselineScripts(Zone *zone)
 {
     JSRuntime *rt = zone->runtimeFromMainThread();
     for (JitActivationIterator iter(rt); !iter.done(); ++iter) {
-        if (iter.activation()->compartment()->zone() == zone)
+        if (iter->compartment()->zone() == zone)
             MarkActiveBaselineScripts(rt, iter);
     }
 }
--- a/js/src/jit/Ion.cpp
+++ b/js/src/jit/Ion.cpp
@@ -2648,17 +2648,17 @@ jit::StopAllOffThreadCompilations(JSComp
 
 void
 jit::InvalidateAll(FreeOp *fop, Zone *zone)
 {
     for (CompartmentsInZoneIter comp(zone); !comp.done(); comp.next())
         StopAllOffThreadCompilations(comp);
 
     for (JitActivationIterator iter(fop->runtime()); !iter.done(); ++iter) {
-        if (iter.activation()->compartment()->zone() == zone) {
+        if (iter->compartment()->zone() == zone) {
             IonContext ictx(CompileRuntime::get(fop->runtime()));
             AutoFlushCache afc("InvalidateAll", fop->runtime()->jitRuntime());
             IonSpew(IonSpew_Invalidate, "Invalidating all frames for GC");
             InvalidateActivation(fop, iter.jitTop(), true);
         }
     }
 }
 
@@ -3069,17 +3069,17 @@ AutoDebugModeInvalidation::~AutoDebugMod
             StopAllOffThreadCompilations(comp);
     }
 
     // Don't discard active baseline scripts. They are recompiled for debug
     // mode.
     jit::MarkActiveBaselineScripts(zone);
 
     for (JitActivationIterator iter(rt); !iter.done(); ++iter) {
-        JSCompartment *comp = iter.activation()->compartment();
+        JSCompartment *comp = iter->compartment();
         if (comp_ == comp || zone_ == comp->zone()) {
             IonContext ictx(CompileRuntime::get(rt));
             AutoFlushCache afc("AutoDebugModeInvalidation", rt->jitRuntime());
             IonSpew(IonSpew_Invalidate, "Invalidating frames for debug mode toggle");
             InvalidateActivation(fop, iter.jitTop(), true);
         }
     }
 
--- a/js/src/jit/IonFrames.cpp
+++ b/js/src/jit/IonFrames.cpp
@@ -87,17 +87,17 @@ JitFrameIterator::JitFrameIterator(JSCon
 }
 
 JitFrameIterator::JitFrameIterator(const ActivationIterator &activations)
     : current_(activations.jitTop()),
       type_(JitFrame_Exit),
       returnAddressToFp_(nullptr),
       frameSize_(0),
       cachedSafepointIndex_(nullptr),
-      activation_(activations.activation()->asJit()),
+      activation_(activations->asJit()),
       mode_(SequentialExecution)
 {
 }
 
 JitFrameIterator::JitFrameIterator(IonJSFrameLayout *fp, ExecutionMode mode)
   : current_((uint8_t *)fp),
     type_(JitFrame_IonJS),
     returnAddressToFp_(fp->returnAddress()),
@@ -1169,17 +1169,17 @@ MarkRectifierFrame(JSTracer *trc, const 
     // it if we're calling a constructor that returns a primitive value.
     IonRectifierFrameLayout *layout = (IonRectifierFrameLayout *)frame.fp();
     gc::MarkValueRoot(trc, &layout->argv()[0], "ion-thisv");
 }
 
 static void
 MarkJitActivation(JSTracer *trc, const JitActivationIterator &activations)
 {
-    JitActivation *activation = activations.activation()->asJit();
+    JitActivation *activation = activations->asJit();
 
 #ifdef CHECK_OSIPOINT_REGISTERS
     if (js_JitOptions.checkOsiPointRegisters) {
         // GC can modify spilled registers, breaking our register checks.
         // To handle this, we disable these checks for the current VM call
         // when a GC happens.
         activation->setCheckRegs(false);
     }
--- a/js/src/jscntxt.cpp
+++ b/js/src/jscntxt.cpp
@@ -1201,18 +1201,18 @@ JSContext::restoreFrameChain()
     if (Activation *act = mainThread().activation())
         act->restoreFrameChain();
 }
 
 bool
 JSContext::currentlyRunning() const
 {
     for (ActivationIterator iter(runtime()); !iter.done(); ++iter) {
-        if (iter.activation()->cx() == this) {
-            if (iter.activation()->hasSavedFrameChain())
+        if (iter->cx() == this) {
+            if (iter->hasSavedFrameChain())
                 return false;
             return true;
         }
     }
 
     return false;
 }
 
--- a/js/src/jscompartment.cpp
+++ b/js/src/jscompartment.cpp
@@ -676,17 +676,17 @@ JSCompartment::setObjectMetadataCallback
 
     objectMetadataCallback = callback;
 }
 
 bool
 JSCompartment::hasScriptsOnStack()
 {
     for (ActivationIterator iter(runtimeFromMainThread()); !iter.done(); ++iter) {
-        if (iter.activation()->compartment() == this)
+        if (iter->compartment() == this)
             return true;
     }
 
     return false;
 }
 
 static bool
 AddInnerLazyFunctionsFromScript(JSScript *script, AutoObjectVector &lazyFunctions)
--- a/js/src/jsgc.cpp
+++ b/js/src/jsgc.cpp
@@ -4272,17 +4272,17 @@ AutoGCSlice::AutoGCSlice(JSRuntime *rt)
 {
     /*
      * During incremental GC, the compartment's active flag determines whether
      * there are stack frames active for any of its scripts. Normally this flag
      * is set at the beginning of the mark phase. During incremental GC, we also
      * set it at the start of every phase.
      */
     for (ActivationIterator iter(rt); !iter.done(); ++iter)
-        iter.activation()->compartment()->zone()->active = true;
+        iter->compartment()->zone()->active = true;
 
     for (GCZonesIter zone(rt); !zone.done(); zone.next()) {
         /*
          * Clear needsBarrier early so we don't do any write barriers during
          * GC. We don't need to update the Ion barriers (which is expensive)
          * because Ion code doesn't run during GC. If need be, we'll update the
          * Ion barriers in ~AutoGCSlice.
          */
--- a/js/src/jsscript.cpp
+++ b/js/src/jsscript.cpp
@@ -1177,18 +1177,18 @@ JSScript::initScriptCounts(JSContext *cx
         return false;
     }
     hasScriptCounts_ = true; // safe to set this;  we can't fail after this point
 
     JS_ASSERT(size_t(cursor - base) == bytes);
 
     /* Enable interrupts in any interpreter frames running on this script. */
     for (ActivationIterator iter(cx->runtime()); !iter.done(); ++iter) {
-        if (iter.activation()->isInterpreter())
-            iter.activation()->asInterpreter()->enableInterruptsIfRunning(this);
+        if (iter->isInterpreter())
+            iter->asInterpreter()->enableInterruptsIfRunning(this);
     }
 
     return true;
 }
 
 static inline ScriptCountsMap::Ptr GetScriptCountsMapEntry(JSScript *script)
 {
     JS_ASSERT(script->hasScriptCounts());
@@ -3145,18 +3145,18 @@ JSScript::ensureHasDebugScript(JSContext
     hasDebugScript_ = true; // safe to set this;  we can't fail after this point
 
     /*
      * Ensure that any Interpret() instances running on this script have
      * interrupts enabled. The interrupts must stay enabled until the
      * debug state is destroyed.
      */
     for (ActivationIterator iter(cx->runtime()); !iter.done(); ++iter) {
-        if (iter.activation()->isInterpreter())
-            iter.activation()->asInterpreter()->enableInterruptsIfRunning(this);
+        if (iter->isInterpreter())
+            iter->asInterpreter()->enableInterruptsIfRunning(this);
     }
 
     return true;
 }
 
 void
 JSScript::setNewStepMode(FreeOp *fop, uint32_t newValue)
 {
--- a/js/src/vm/OldDebugAPI.cpp
+++ b/js/src/vm/OldDebugAPI.cpp
@@ -265,18 +265,18 @@ JS_ClearAllTrapsForCompartment(JSContext
 
 JS_PUBLIC_API(bool)
 JS_SetInterrupt(JSRuntime *rt, JSInterruptHook hook, void *closure)
 {
     rt->debugHooks.interruptHook = hook;
     rt->debugHooks.interruptHookData = closure;
 
     for (ActivationIterator iter(rt); !iter.done(); ++iter) {
-        if (iter.activation()->isInterpreter())
-            iter.activation()->asInterpreter()->enableInterruptsUnconditionally();
+        if (iter->isInterpreter())
+            iter->asInterpreter()->enableInterruptsUnconditionally();
     }
 
     return true;
 }
 
 JS_PUBLIC_API(bool)
 JS_ClearInterrupt(JSRuntime *rt, JSInterruptHook *hoop, void **closurep)
 {
--- a/js/src/vm/Stack.cpp
+++ b/js/src/vm/Stack.cpp
@@ -762,17 +762,17 @@ FrameIter::operator++()
 #endif
                 } else {
                     popInterpreterFrame();
                 }
             }
 
             data_.contextOption_ = prevContextOption;
             data_.savedOption_ = prevSavedOption;
-            data_.cx_ = data_.activations_.activation()->cx();
+            data_.cx_ = data_.activations_->cx();
             break;
         }
         popInterpreterFrame();
         break;
       case JIT:
 #ifdef JS_ION
         popJitFrame();
         break;
@@ -815,17 +815,17 @@ JSCompartment *
 FrameIter::compartment() const
 {
     switch (data_.state_) {
       case DONE:
         break;
       case INTERP:
       case JIT:
       case ASMJS:
-        return data_.activations_.activation()->compartment();
+        return data_.activations_->compartment();
     }
     MOZ_ASSUME_UNREACHABLE("Unexpected state");
 }
 
 bool
 FrameIter::isFunctionFrame() const
 {
     switch (data_.state_) {
@@ -935,17 +935,17 @@ FrameIter::functionDisplayAtom() const
     switch (data_.state_) {
       case DONE:
         break;
       case INTERP:
       case JIT:
         return callee()->displayAtom();
       case ASMJS: {
 #ifdef JS_ION
-        AsmJSActivation &act = *data_.activations_.activation()->asAsmJS();
+        AsmJSActivation &act = *data_.activations_->asAsmJS();
         return act.module().exportedFunction(act.exportIndex()).name();
 #else
         break;
 #endif
       }
     }
 
     MOZ_ASSUME_UNREACHABLE("Unexpected state");
@@ -957,17 +957,17 @@ FrameIter::scriptSource() const
     switch (data_.state_) {
       case DONE:
         break;
       case INTERP:
       case JIT:
         return script()->scriptSource();
       case ASMJS:
 #ifdef JS_ION
-        return data_.activations_.activation()->asAsmJS()->module().scriptSource();
+        return data_.activations_->asAsmJS()->module().scriptSource();
 #else
         break;
 #endif
     }
 
     MOZ_ASSUME_UNREACHABLE("Unexpected state");
 }
 
@@ -977,17 +977,17 @@ FrameIter::scriptFilename() const
     switch (data_.state_) {
       case DONE:
         break;
       case INTERP:
       case JIT:
         return script()->filename();
       case ASMJS:
 #ifdef JS_ION
-        return data_.activations_.activation()->asAsmJS()->module().scriptSource()->filename();
+        return data_.activations_->asAsmJS()->module().scriptSource()->filename();
 #else
         break;
 #endif
     }
 
     MOZ_ASSUME_UNREACHABLE("Unexpected state");
 }
 
@@ -997,17 +997,17 @@ FrameIter::computeLine(uint32_t *column)
     switch (data_.state_) {
       case DONE:
         break;
       case INTERP:
       case JIT:
         return PCToLineNumber(script(), pc(), column);
       case ASMJS: {
 #ifdef JS_ION
-        AsmJSActivation &act = *data_.activations_.activation()->asAsmJS();
+        AsmJSActivation &act = *data_.activations_->asAsmJS();
         AsmJSModule::ExportedFunction &func = act.module().exportedFunction(act.exportIndex());
         if (column)
             *column = func.column();
         return func.line();
 #else
         break;
 #endif
       }
@@ -1022,17 +1022,17 @@ FrameIter::originPrincipals() const
     switch (data_.state_) {
       case DONE:
         break;
       case INTERP:
       case JIT:
         return script()->originPrincipals();
       case ASMJS: {
 #ifdef JS_ION
-        return data_.activations_.activation()->asAsmJS()->module().scriptSource()->originPrincipals();
+        return data_.activations_->asAsmJS()->module().scriptSource()->originPrincipals();
 #else
         break;
 #endif
       }
     }
 
     MOZ_ASSUME_UNREACHABLE("Unexpected state");
 }
@@ -1123,33 +1123,33 @@ void
 FrameIter::updatePcQuadratic()
 {
     switch (data_.state_) {
       case DONE:
       case ASMJS:
         break;
       case INTERP: {
         InterpreterFrame *frame = interpFrame();
-        InterpreterActivation *activation = data_.activations_.activation()->asInterpreter();
+        InterpreterActivation *activation = data_.activations_->asInterpreter();
 
         // Look for the current frame.
         data_.interpFrames_ = InterpreterFrameIterator(activation);
         while (data_.interpFrames_.frame() != frame)
             ++data_.interpFrames_;
 
         // Update the pc.
         JS_ASSERT(data_.interpFrames_.frame() == frame);
         data_.pc_ = data_.interpFrames_.pc();
         return;
       }
       case JIT:
 #ifdef JS_ION
         if (data_.jitFrames_.isBaselineJS()) {
             jit::BaselineFrame *frame = data_.jitFrames_.baselineFrame();
-            jit::JitActivation *activation = data_.activations_.activation()->asJit();
+            jit::JitActivation *activation = data_.activations_->asJit();
 
             // ActivationIterator::ionTop_ may be invalid, so create a new
             // activation iterator.
             data_.activations_ = ActivationIterator(data_.cx_->runtime());
             while (data_.activations_.activation() != activation)
                 ++data_.activations_;
 
             // Look for the current frame.
--- a/js/src/vm/Stack.h
+++ b/js/src/vm/Stack.h
@@ -1299,16 +1299,19 @@ class ActivationIterator
   private:
     void settle();
 
   public:
     explicit ActivationIterator(JSRuntime *rt);
 
     ActivationIterator &operator++();
 
+    Activation *operator->() const {
+        return activation_;
+    }
     Activation *activation() const {
         return activation_;
     }
     uint8_t *jitTop() const {
         JS_ASSERT(activation_->isJit());
         return jitTop_;
     }
     bool done() const {