Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 // Debugger.Frames of all implementations.
3 load(libdir + "jitopts.js");
5 function testFrameImpl(jitopts, assertFrameImpl) {
6 if (!jitTogglesMatch(jitopts))
7 return;
9 withJitOptions(jitopts, function () {
10 var g = newGlobal();
11 var dbg = new Debugger;
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 };
25 g.eval("" + function f(d) { g(d); });
26 g.eval("" + function g(d) { toggle(d); });
28 g.eval("(" + function test() {
29 for (var i = 0; i < 5; i++)
30 f(false);
31 f(true);
32 } + ")();");
33 });
34 }
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 });