PageRenderTime 23ms CodeModel.GetById 18ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/js/src/jit-test/tests/debug/Frame-arguments-07.js

http://github.com/zpao/v8monkey
JavaScript | 23 lines | 19 code | 3 blank | 1 comment | 1 complexity | a0cfcf6e3ec2db1d1ca9c5d3e0059fc3 MD5 | raw file
 1// When argument[x] is assigned, where x > callee.length, frame.arguments reflects the change.
 2
 3var g = newGlobal('new-compartment');
 4g.eval("function f(a, b) {\n" +
 5       "    for (var i = 0; i < arguments.length; i++)\n" +
 6       "        arguments[i] = i;\n" +
 7       "    debugger;\n" +
 8       "}\n");
 9
10var dbg = Debugger(g);
11var hits = 0;
12dbg.onDebuggerStatement = function (frame) {
13    var argc = frame.eval("arguments.length").return;
14    var args = frame.arguments;
15    assertEq(args.length, argc);
16    for (var i = 0; i < argc; i++)
17        assertEq(args[i], i);
18    hits++;
19}
20
21g.f(9);
22g.f(9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9);
23assertEq(hits, 2);