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