js/src/jit-test/tests/debug/Frame-implementation-01.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial