Frame-implementation-01.js (1335B)
1 // |jit-test| skip-if: getBuildConfiguration('pbl') 2 // Debugger.Frames of all implementations. 3 4 load(libdir + "jitopts.js"); 5 6 function testFrameImpl(jitopts, assertFrameImpl) { 7 if (!jitTogglesMatch(jitopts)) 8 return; 9 10 withJitOptions(jitopts, function () { 11 var g = newGlobal({newCompartment: true}); 12 var dbg = new Debugger; 13 14 g.toggle = function toggle(d) { 15 if (d) { 16 dbg.addDebuggee(g); 17 var frame = dbg.getNewestFrame(); 18 // We only care about the f and g frames. 19 for (var i = 0; i < 2; i++) { 20 assertFrameImpl(frame); 21 frame = frame.older; 22 } 23 } 24 }; 25 26 g.eval("" + function f(d) { g(d); }); 27 g.eval("" + function g(d) { toggle(d); }); 28 29 g.eval("(" + function test() { 30 for (var i = 0; i < 5; i++) 31 f(false); 32 f(true); 33 } + ")();"); 34 }); 35 } 36 37 [[Opts_BaselineEager, 38 function (f) { assertEq(f.implementation, "baseline"); }], 39 // Note that the Ion case *depends* on CCW scripted functions being opaque to 40 // Ion optimization and not deoptimizing the frames below the call to toggle. 41 [Opts_Ion2NoOffthreadCompilation, 42 function (f) { assertEq(f.implementation, "ion"); }], 43 [Opts_NoJits, 44 function (f) { assertEq(f.implementation, "interpreter"); }]].forEach(function ([opts, fn]) { 45 testFrameImpl(opts, fn); 46 });