PageRenderTime 16ms CodeModel.GetById 13ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/js/src/jit-test/tests/debug/Frame-older-01.js

http://github.com/zpao/v8monkey
JavaScript | 20 lines | 16 code | 2 blank | 2 comment | 1 complexity | f302a8c9e823cbe0064767ee26aae7a3 MD5 | raw file
 1// |jit-test| debug
 2// Basic call chain.
 3
 4var g = newGlobal('new-compartment');
 5var result = null;
 6var dbg = new Debugger(g);
 7dbg.onDebuggerStatement = function (frame) {
 8    var a = [];
 9    assertEq(frame === frame.older, false);
10    for (; frame; frame = frame.older)
11        a.push(frame.type === 'call' ? frame.callee.name : frame.type);
12    a.reverse();
13    result = a.join(", ");
14};
15
16g.eval("function first() { return second(); }");
17g.eval("function second() { return eval('third()'); }");
18g.eval("function third() { debugger; }");
19g.evaluate("first();");
20assertEq(result, "global, first, second, eval, third");