js/src/jit-test/tests/debug/gc-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/gc-01.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,20 @@
     1.4 +// Debuggers with enabled hooks should not be GC'd even if they are otherwise
     1.5 +// unreachable.
     1.6 +
     1.7 +var g = newGlobal();
     1.8 +var actual = 0;
     1.9 +var expected = 0;
    1.10 +
    1.11 +function f() {
    1.12 +    for (var i = 0; i < 20; i++) {
    1.13 +        var dbg = new Debugger(g);
    1.14 +        dbg.num = i;
    1.15 +        dbg.onDebuggerStatement = function (stack) { actual += this.num; };
    1.16 +        expected += i;
    1.17 +    }
    1.18 +}
    1.19 +
    1.20 +f();
    1.21 +gc(); gc(); gc();
    1.22 +g.eval("debugger;");
    1.23 +assertEq(actual, expected);

mercurial