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

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/jit-test/tests/debug/Frame-implementation-01.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,45 @@
     1.4 +// Debugger.Frames of all implementations.
     1.5 +
     1.6 +load(libdir + "jitopts.js");
     1.7 +
     1.8 +function testFrameImpl(jitopts, assertFrameImpl) {
     1.9 +  if (!jitTogglesMatch(jitopts))
    1.10 +    return;
    1.11 +
    1.12 +  withJitOptions(jitopts, function () {
    1.13 +    var g = newGlobal();
    1.14 +    var dbg = new Debugger;
    1.15 +
    1.16 +    g.toggle = function toggle(d) {
    1.17 +      if (d) {
    1.18 +        dbg.addDebuggee(g);
    1.19 +        var frame = dbg.getNewestFrame();
    1.20 +        // We only care about the f and g frames.
    1.21 +        for (var i = 0; i < 2; i++) {
    1.22 +          assertFrameImpl(frame);
    1.23 +          frame = frame.older;
    1.24 +        }
    1.25 +      }
    1.26 +    };
    1.27 +
    1.28 +    g.eval("" + function f(d) { g(d); });
    1.29 +    g.eval("" + function g(d) { toggle(d); });
    1.30 +
    1.31 +    g.eval("(" + function test() {
    1.32 +      for (var i = 0; i < 5; i++)
    1.33 +        f(false);
    1.34 +      f(true);
    1.35 +    } + ")();");
    1.36 +  });
    1.37 +}
    1.38 +
    1.39 +[[Opts_BaselineEager,
    1.40 +  function (f) { assertEq(f.implementation, "baseline"); }],
    1.41 + // Note that the Ion case *depends* on CCW scripted functions being opaque to
    1.42 + // Ion optimization and not deoptimizing the frames below the call to toggle.
    1.43 + [Opts_Ion2NoParallelCompilation,
    1.44 +  function (f) { assertEq(f.implementation, "ion"); }],
    1.45 + [Opts_NoJits,
    1.46 +  function (f) { assertEq(f.implementation, "interpreter"); }]].forEach(function ([opts, fn]) {
    1.47 +    testFrameImpl(opts, fn);
    1.48 +  });

mercurial