michael@0: // Debugger.Frames of all implementations. michael@0: michael@0: load(libdir + "jitopts.js"); michael@0: michael@0: function testFrameImpl(jitopts, assertFrameImpl) { michael@0: if (!jitTogglesMatch(jitopts)) michael@0: return; michael@0: michael@0: withJitOptions(jitopts, function () { michael@0: var g = newGlobal(); michael@0: var dbg = new Debugger; michael@0: michael@0: g.toggle = function toggle(d) { michael@0: if (d) { michael@0: dbg.addDebuggee(g); michael@0: var frame = dbg.getNewestFrame(); michael@0: // We only care about the f and g frames. michael@0: for (var i = 0; i < 2; i++) { michael@0: assertFrameImpl(frame); michael@0: frame = frame.older; michael@0: } michael@0: } michael@0: }; michael@0: michael@0: g.eval("" + function f(d) { g(d); }); 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: } michael@0: michael@0: [[Opts_BaselineEager, michael@0: function (f) { assertEq(f.implementation, "baseline"); }], michael@0: // Note that the Ion case *depends* on CCW scripted functions being opaque to michael@0: // Ion optimization and not deoptimizing the frames below the call to toggle. michael@0: [Opts_Ion2NoParallelCompilation, michael@0: function (f) { assertEq(f.implementation, "ion"); }], michael@0: [Opts_NoJits, michael@0: function (f) { assertEq(f.implementation, "interpreter"); }]].forEach(function ([opts, fn]) { michael@0: testFrameImpl(opts, fn); michael@0: });