Bug 1114587 - Bail out in-place for debug mode in exception handler even if there's no pending exception, so that the DebugEpilogue is called. r=nbp, a=sledru
authorShu-yu Guo <shu@rfrn.org>
Sat, 27 Dec 2014 21:03:13 -0800
changeset 242739 b777575191d95185e8b822c8632edfbcfd1de034
parent 242738 46551ecd26867264fa64899738cd3012c0c62285
child 242740 1aaa04637144d5775c2b6a9fb5915aecf007c84a
push id4311
push userraliiev@mozilla.com
push dateMon, 12 Jan 2015 19:37:41 +0000
treeherdermozilla-beta@150c9fed433b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnbp, sledru
bugs1114587
milestone36.0a2
Bug 1114587 - Bail out in-place for debug mode in exception handler even if there's no pending exception, so that the DebugEpilogue is called. r=nbp, a=sledru
js/src/jit-test/tests/debug/bug1114587.js
js/src/jit/JitFrames.cpp
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/debug/bug1114587.js
@@ -0,0 +1,26 @@
+// |jit-test| error: TypeError
+var lfcode = new Array();
+lfcode.push("");
+lfcode.push("");
+lfcode.push("\
+var g = newGlobal();\
+g.debuggeeGlobal = this;\
+g.eval('(' + function () {\
+        dbg = new Debugger(debuggeeGlobal);\
+        dbg.onExceptionUnwind = function (frame, exc) {\
+            var s = '!';\
+            for (var f = frame; f; f = f.older)\
+                    s += f.callee.name;\
+        };\
+    } + ')();');\
+Debugger(17) = this;\
+");
+while (true) {
+  var file = lfcode.shift(); if (file == undefined) { break; }
+  loadFile(file)
+}
+function loadFile(lfVarx) {
+  if (lfVarx.substr(-3) != ".js" && lfVarx.length != 1) {
+    function newFunc(x) { new Function(x)(); }; newFunc(lfVarx); 
+  }
+}
--- a/js/src/jit/JitFrames.cpp
+++ b/js/src/jit/JitFrames.cpp
@@ -412,17 +412,17 @@ CloseLiveIterator(JSContext *cx, const I
 
 static void
 HandleExceptionIon(JSContext *cx, const InlineFrameIterator &frame, ResumeFromException *rfe,
                    bool *overrecursed, bool *poppedLastSPSFrameOut)
 {
     RootedScript script(cx, frame.script());
     jsbytecode *pc = frame.pc();
 
-    if (cx->compartment()->isDebuggee() && cx->isExceptionPending()) {
+    if (cx->compartment()->isDebuggee()) {
         // We need to bail when there is a catchable exception, and we are the
         // debuggee of a Debugger with a live onExceptionUnwind hook, or if a
         // Debugger has observed this frame (e.g., for onPop).
         bool shouldBail = Debugger::hasLiveHook(cx->global(), Debugger::OnExceptionUnwind);
         if (!shouldBail) {
             JitActivation *act = cx->mainThread().activation()->asJit();
             RematerializedFrame *rematFrame =
                 act->lookupRematerializedFrame(frame.frame().fp(), frame.frameNo());