Bug 886266 - Fix issues with enabling/disabling non-active activations, r=jandem
authorHannes Verschore <hv1989@gmail.com>
Tue, 25 Jun 2013 16:58:52 +0200
changeset 136382 ec1974330bfc6f043955986b94007177cb84f494
parent 136381 c6e4936118ca7424fad2aa3dffc24b392f96148c
child 136383 919f0b90ecf2e9dc3928806e2878d3b96ca059b2
push id30075
push userhv1989@gmail.com
push dateTue, 25 Jun 2013 14:59:39 +0000
treeherdermozilla-inbound@ec1974330bfc [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjandem
bugs886266
milestone25.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 886266 - Fix issues with enabling/disabling non-active activations, r=jandem
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
@@ -1174,19 +1174,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;
     }