js/src/jit-test/tests/debug/Frame-eval-23.js

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 // Debugger.Frame preserves Ion frame mutations after removing debuggee.
michael@0 2
michael@0 3 load(libdir + "jitopts.js");
michael@0 4
michael@0 5 if (!jitTogglesMatch(Opts_Ion2NoParallelCompilation))
michael@0 6 quit();
michael@0 7
michael@0 8 withJitOptions(Opts_Ion2NoParallelCompilation, function () {
michael@0 9 var g = newGlobal();
michael@0 10 var dbg = new Debugger;
michael@0 11
michael@0 12 g.toggle = function toggle(x, d) {
michael@0 13 if (d) {
michael@0 14 dbg.addDebuggee(g);
michael@0 15 var frame = dbg.getNewestFrame().older;
michael@0 16 assertEq(frame.callee.name, "f");
michael@0 17 assertEq(frame.environment.getVariable("x"), x);
michael@0 18 assertEq(frame.implementation, "ion");
michael@0 19 frame.environment.setVariable("x", "not 42");
michael@0 20 dbg.removeDebuggee(g);
michael@0 21 }
michael@0 22 };
michael@0 23
michael@0 24 g.eval("" + function f(x, d) {
michael@0 25 g(x, d);
michael@0 26 if (d)
michael@0 27 assertEq(x, "not 42");
michael@0 28 });
michael@0 29
michael@0 30 g.eval("" + function g(x, d) { toggle(x, d); });
michael@0 31
michael@0 32 g.eval("(" + function test() {
michael@0 33 for (var i = 0; i < 5; i++)
michael@0 34 f(42, false);
michael@0 35 f(42, true);
michael@0 36 } + ")();");
michael@0 37 });

mercurial