michael@0: // Ion can bail in-place when throwing exceptions with debug mode toggled on. 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: michael@0: g.toggle = function toggle(x, d) { michael@0: if (d) { michael@0: dbg.addDebuggee(g); michael@0: var frame = dbg.getNewestFrame().older; michael@0: assertEq(frame.callee.name, "f"); michael@0: assertEq(frame.implementation, "ion"); michael@0: throw 42; michael@0: } michael@0: }; michael@0: michael@0: g.eval("" + function f(x, d) { g(x, d); }); michael@0: g.eval("" + function g(x, d) { toggle(x, d); }); michael@0: michael@0: try { michael@0: g.eval("(" + function test() { michael@0: for (var i = 0; i < 5; i++) michael@0: f(42, false); michael@0: f(42, true); michael@0: } + ")();"); michael@0: } catch (exc) { michael@0: assertEq(exc, 42); michael@0: } michael@0: });