michael@0: // Test that Ion frames are invalidated by turning on Debugger. Invalidation michael@0: // is unobservable, but we know that Ion scripts cannot handle Debugger michael@0: // handlers, so we test for the handlers being called. michael@0: michael@0: load(libdir + "jitopts.js"); michael@0: michael@0: if (!jitTogglesMatch(Opts_Ion2NoParallelCompilation)) michael@0: quit(); michael@0: michael@0: withJitOptions(Opts_Ion2NoParallelCompilation, function () { michael@0: var g = newGlobal(); michael@0: var dbg = new Debugger; michael@0: var onPopExecuted = false; michael@0: var breakpointHit = false; michael@0: michael@0: g.toggle = function toggle(d) { michael@0: if (d) { michael@0: dbg.addDebuggee(g); michael@0: michael@0: var frame1 = dbg.getNewestFrame(); michael@0: assertEq(frame1.implementation, "ion"); michael@0: frame1.onPop = function () { michael@0: onPopExecuted = true; michael@0: }; michael@0: michael@0: var frame2 = frame1.older; michael@0: assertEq(frame2.implementation, "ion"); michael@0: // Offset of |print(42 + 42)| michael@0: var offset = frame2.script.getLineOffsets(3)[0]; michael@0: frame2.script.setBreakpoint(offset, { hit: function (fr) { michael@0: assertEq(fr.implementation != "ion", true); michael@0: breakpointHit = true; michael@0: }}); michael@0: } michael@0: }; michael@0: michael@0: g.eval("" + function f(d) { michael@0: g(d); michael@0: print(42 + 42); michael@0: }); michael@0: g.eval("" + function g(d) { toggle(d); }); michael@0: michael@0: g.eval("(" + function test() { michael@0: for (var i = 0; i < 5; i++) michael@0: f(false); michael@0: f(true); michael@0: } + ")();"); michael@0: michael@0: assertEq(onPopExecuted, true); michael@0: assertEq(breakpointHit, true); michael@0: });