js/src/jit-test/tests/debug/Debugger-debuggees-26.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/Debugger-debuggees-26.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,34 @@
     1.4 +// Ion can bail in-place when throwing exceptions with debug mode toggled on.
     1.5 +
     1.6 +load(libdir + "jitopts.js");
     1.7 +
     1.8 +if (!jitTogglesMatch(Opts_Ion2NoParallelCompilation))
     1.9 +  quit();
    1.10 +
    1.11 +withJitOptions(Opts_Ion2NoParallelCompilation, function () {
    1.12 +  var g = newGlobal();
    1.13 +  var dbg = new Debugger;
    1.14 +
    1.15 +  g.toggle = function toggle(x, d) {
    1.16 +    if (d) {
    1.17 +      dbg.addDebuggee(g);
    1.18 +      var frame = dbg.getNewestFrame().older;
    1.19 +      assertEq(frame.callee.name, "f");
    1.20 +      assertEq(frame.implementation, "ion");
    1.21 +      throw 42;
    1.22 +    }
    1.23 +  };
    1.24 +
    1.25 +  g.eval("" + function f(x, d) { g(x, d); });
    1.26 +  g.eval("" + function g(x, d) { toggle(x, d); });
    1.27 +
    1.28 +  try {
    1.29 +    g.eval("(" + function test() {
    1.30 +      for (var i = 0; i < 5; i++)
    1.31 +        f(42, false);
    1.32 +      f(42, true);
    1.33 +    } + ")();");
    1.34 +  } catch (exc) {
    1.35 +    assertEq(exc, 42);
    1.36 +  }
    1.37 +});

mercurial