Bug 886266 - Fix issues with enabling/disabling non-active activations. r=jandem, a=bajaj
authorHannes Verschore <hv1989@gmail.com>
Tue, 25 Jun 2013 16:58:52 +0200
changeset 143408 29f62a025aae57abc54241fc864060103e1402dc
parent 143407 40bef1cf558f215cacc8f753f53b5d6cdb32e3a5
child 143409 d5940f917a9aa0328b909ecb0cd1fdd3a6555786
push id3919
push userryanvm@gmail.com
push dateThu, 27 Jun 2013 00:59:54 +0000
treeherdermozilla-aurora@d5940f917a9a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjandem, bajaj
bugs886266
milestone24.0a2
Bug 886266 - Fix issues with enabling/disabling non-active activations. r=jandem, a=bajaj
js/src/vm/Stack.cpp
js/src/vm/Stack.h
--- a/js/src/vm/Stack.cpp
+++ b/js/src/vm/Stack.cpp
@@ -1297,16 +1297,30 @@ js::CheckLocalUnaliased(MaybeCheckAliasi
                 JS_ASSERT(!b->isAliased(depth - b->stackDepth()));
                 break;
             }
         }
     }
 }
 #endif
 
+void
+Activation::setActive(bool active)
+{
+    // Only allowed to deactivate/activate if activation is top.
+    // (Not tested and will probably fail in other situations.)
+    JS_ASSERT(cx()->mainThread().activation_ == this);
+    JS_ASSERT(active != active_);
+    active_ = active;
+
+    // Restore ionTop
+    if (!active && isJit())
+        cx()->mainThread().ionTop = asJit()->prevIonTop();
+}
+
 ion::JitActivation::JitActivation(JSContext *cx, bool firstFrameIsConstructing, bool active)
   : Activation(cx, Jit, active),
     prevIonTop_(cx->mainThread().ionTop),
     prevIonJSContext_(cx->mainThread().ionJSContext),
     firstFrameIsConstructing_(firstFrameIsConstructing)
 {
     cx->mainThread().ionJSContext = cx;
 }
--- a/js/src/vm/Stack.h
+++ b/js/src/vm/Stack.h
@@ -1172,19 +1172,17 @@ class Activation
         return compartment_;
     }
     Activation *prev() const {
         return prev_;
     }
     bool isActive() const {
         return active_;
     }
-    void setActive(bool active = true) {
-        active_ = active;
-    }
+    void setActive(bool active = true);
 
     bool isInterpreter() const {
         return kind_ == Interpreter;
     }
     bool isJit() const {
         return kind_ == Jit;
     }