js/src/jit-test/tests/debug/Frame-eval-20.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-eval-20.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,46 @@
     1.4 +// Eval-in-frame with different type on non-youngest Ion frame.
     1.5 +
     1.6 +load(libdir + "jitopts.js");
     1.7 +
     1.8 +if (!jitTogglesMatch(Opts_Ion2NoParallelCompilation))
     1.9 +  quit(0);
    1.10 +
    1.11 +withJitOptions(Opts_Ion2NoParallelCompilation, function () {
    1.12 +  function test(shadow) {
    1.13 +    var g = newGlobal();
    1.14 +    var dbg = new Debugger;
    1.15 +
    1.16 +    // Note that we depend on CCW scripted functions being opaque to Ion
    1.17 +    // optimization for this test.
    1.18 +    g.h = function h(d) {
    1.19 +      if (d) {
    1.20 +        dbg.addDebuggee(g);
    1.21 +        var f = dbg.getNewestFrame().older;
    1.22 +        assertEq(f.implementation, "ion");
    1.23 +        assertEq(f.environment.getVariable("foo"), 42);
    1.24 +
    1.25 +        // EIF of a different type too.
    1.26 +        f.eval((shadow ? "var " : "") + "foo = 'string of 42'");
    1.27 +        g.expected = shadow ? 42 : "string of 42";
    1.28 +      }
    1.29 +    }
    1.30 +
    1.31 +    g.eval("" + function f(d) {
    1.32 +      var foo = 42;
    1.33 +      g(d);
    1.34 +      return foo;
    1.35 +    });
    1.36 +    g.eval("" + function g(d) {
    1.37 +      h(d);
    1.38 +    });
    1.39 +
    1.40 +    g.eval("(" + function () {
    1.41 +      for (i = 0; i < 5; i++)
    1.42 +        f(false);
    1.43 +      assertEq(f(true), "string of 42");
    1.44 +    } + ")();");
    1.45 +  }
    1.46 +
    1.47 +  test(false);
    1.48 +  test(true);
    1.49 +});

mercurial