js/src/jit-test/tests/debug/breakpoint-gc-03.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/breakpoint-gc-03.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,25 @@
     1.4 +// |jit-test| debug
     1.5 +// The GC can cope with old and new breakpoints at the same position.
     1.6 +
     1.7 +// This is a regression test for a bug Bill McCloskey found just by looking at
     1.8 +// the source code. See bug 677386 comment 8. Here we're testing that the trap
     1.9 +// string is correctly marked. (The silly expression for the trap string is to
    1.10 +// ensure that it isn't constant-folded; it's harder to get a compile-time
    1.11 +// constant to be GC'd.)
    1.12 +
    1.13 +var g = newGlobal();
    1.14 +g.eval("var d = 0;\n" +
    1.15 +       "function f() { return 'ok'; }\n" +
    1.16 +       "trap(f, 0, Array(17).join('\\n') + 'd++;');\n");
    1.17 +
    1.18 +var dbg = new Debugger;
    1.19 +var gw = dbg.addDebuggee(g);
    1.20 +var fw = gw.getOwnPropertyDescriptor("f").value;
    1.21 +var bp = {hits: 0, hit: function (frame) { this.hits++; }};
    1.22 +fw.script.setBreakpoint(0, bp);
    1.23 +
    1.24 +gc();
    1.25 +
    1.26 +g.f();
    1.27 +assertEq(g.d, 1);
    1.28 +assertEq(bp.hits, 1);

mercurial