~ubuntu-branches/ubuntu/saucy/mozjs17/saucy

« back to all changes in this revision

Viewing changes to js/src/jit-test/tests/debug/Frame-identity-04.js

  • Committer: Package Import Robot
  • Author(s): Rico Tzschichholz
  • Date: 2013-05-25 12:24:23 UTC
  • Revision ID: package-import@ubuntu.com-20130525122423-zmxucrhtensw90xy
Tags: upstream-17.0.0
ImportĀ upstreamĀ versionĀ 17.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Test that on-stack Debugger.Frames are not GC'd even if they are only reachable
 
2
// from the js::Debugger::frames table.
 
3
 
 
4
var g = newGlobal('new-compartment');
 
5
g.eval("function f(n) { if (n) f(n - 1); debugger; }");
 
6
var dbg = new Debugger(g);
 
7
var hits = 0;
 
8
dbg.onDebuggerStatement = function (frame) {
 
9
    if (hits === 0) {
 
10
        for (; frame; frame = frame.older)
 
11
            frame.seen = true;
 
12
    } else {
 
13
        for (; frame; frame = frame.older)
 
14
            assertEq(frame.seen, true);
 
15
    }
 
16
    gc();
 
17
    hits++;
 
18
};
 
19
g.f(20);
 
20
assertEq(hits, 21);