js/src/jit-test/tests/debug/gc-03.js

Thu, 15 Jan 2015 15:55:04 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 15:55:04 +0100
branch
TOR_BUG_9701
changeset 9
a63d609f5ebe
permissions
-rw-r--r--

Back out 97036ab72558 which inappropriately compared turds to third parties.

     1 // Storing a property on a Debugger.Object protects it from GC as long as the
     2 // referent is alive.
     4 var g = newGlobal();
     5 var N = g.N = 3;
     6 var dbg = Debugger(g);
     8 var i = 0;
     9 dbg.onDebuggerStatement = function (frame) {
    10     frame.arguments[0].id = i++;
    11 };
    12 g.eval("function f(x) { debugger; }");
    13 g.eval("var arr = [], j; for (j = 0; j < N; j++) arr[j] = {};");
    14 g.eval("for (j = 0; j < N; j++) f(arr[j]);");
    15 assertEq(i, N);
    17 gc(); gc();
    19 i = 0;
    20 dbg.onDebuggerStatement = function (frame) {
    21     assertEq(frame.arguments[0].id, i++)
    22 }
    23 g.eval("for (j = 0; j < N; j++) f(arr[j]);");
    24 assertEq(i, N);

mercurial