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

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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