michael@0: // |jit-test| error:AllDone michael@0: // When we leave debug mode in a compartment, we must throw away all michael@0: // analyses in that compartment (debug mode affects the results of michael@0: // analysis, so they become out of date). We cannot skip this step when michael@0: // there are debuggee frames on the stack. michael@0: michael@0: var g = newGlobal(); michael@0: var dbg = new Debugger(); michael@0: var gw = dbg.addDebuggee(g); michael@0: michael@0: g.eval("" + michael@0: function fib(n) { michael@0: var a = 0, b = 1; michael@0: while (n-- > 0) michael@0: b = b+a, a = b-a; michael@0: return b; michael@0: }); michael@0: michael@0: michael@0: // Cause g.fib to be jitted. This creates an analysis with debug mode on. michael@0: g.fib(20); michael@0: michael@0: // Setting a breakpoint in g.f causes us to throw away the jit code, but michael@0: // not the analysis. michael@0: gw.makeDebuggeeValue(g.fib).script.setBreakpoint(0, { hit: function (f) { } }); michael@0: michael@0: // Take g out of debug mode, with debuggee code on the stack. In older michael@0: // code, this would not trigger a cleansing GC, so the script will michael@0: // retain its analysis. michael@0: dbg.onDebuggerStatement = function (f) { michael@0: dbg.removeDebuggee(g); michael@0: }; michael@0: g.eval('debugger'); michael@0: michael@0: // Run g.fib again, causing it to be re-jitted. If the original analysis is michael@0: // still present, JM will assert, because it is not in debug mode. michael@0: g.fib(20); michael@0: michael@0: throw('AllDone');