diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /js/src/jit-test/tests/debug/Frame-identity-03.js | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'js/src/jit-test/tests/debug/Frame-identity-03.js')
-rw-r--r-- | js/src/jit-test/tests/debug/Frame-identity-03.js | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/debug/Frame-identity-03.js b/js/src/jit-test/tests/debug/Frame-identity-03.js new file mode 100644 index 000000000..19c62def8 --- /dev/null +++ b/js/src/jit-test/tests/debug/Frame-identity-03.js @@ -0,0 +1,49 @@ +// Test that we create new Debugger.Frames and reuse old ones correctly with recursion. + +var g = newGlobal(); +g.debuggeeGlobal = this; +g.eval("(" + function () { + function id(f) { + return ("id" in f) ? f.id : (f.id = nextid++); + } + + var dbg = new Debugger(debuggeeGlobal); + dbg.onDebuggerStatement = function (frame) { + var a = []; + for (; frame; frame = frame.older) + a.push(frame); + var s = ''; + while (a.length) + s += id(a.pop()); + results.push(s); + }; + } + ")();"); + +function cons(a, b) { + debugger; + return [a, b]; +} + +function tree(n) { + if (n < 2) + return n; + return cons(tree(n - 1), tree(n - 2)); +} + +g.eval("results = []; nextid = 0;"); +debugger; +assertEq(g.results.join(","), "0"); +assertEq(g.nextid, 1); + +g.eval("results = [];"); +tree(2); +assertEq(g.results.join(","), "012"); // 0=global, 1=tree, 2=cons + +g.eval("results = []; nextid = 1;"); +tree(3); +assertEq(g.results.join(","), "0123,014"); //0=global, 1=tree(3), 2=tree(2), 3=cons, 4=cons + +g.eval("results = []; nextid = 1;"); +tree(4); +// 0=global, 1=tree(4), 2=tree(3), 3=tree(2), 4=cons, tree(1), 5=cons, 6=tree(2), 7=cons, 8=cons +assertEq(g.results.join(","), "01234,0125,0167,018"); |