js/src/jit-test/tests/debug/breakpoint-gc-03.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 // |jit-test| debug
michael@0 2 // The GC can cope with old and new breakpoints at the same position.
michael@0 3
michael@0 4 // This is a regression test for a bug Bill McCloskey found just by looking at
michael@0 5 // the source code. See bug 677386 comment 8. Here we're testing that the trap
michael@0 6 // string is correctly marked. (The silly expression for the trap string is to
michael@0 7 // ensure that it isn't constant-folded; it's harder to get a compile-time
michael@0 8 // constant to be GC'd.)
michael@0 9
michael@0 10 var g = newGlobal();
michael@0 11 g.eval("var d = 0;\n" +
michael@0 12 "function f() { return 'ok'; }\n" +
michael@0 13 "trap(f, 0, Array(17).join('\\n') + 'd++;');\n");
michael@0 14
michael@0 15 var dbg = new Debugger;
michael@0 16 var gw = dbg.addDebuggee(g);
michael@0 17 var fw = gw.getOwnPropertyDescriptor("f").value;
michael@0 18 var bp = {hits: 0, hit: function (frame) { this.hits++; }};
michael@0 19 fw.script.setBreakpoint(0, bp);
michael@0 20
michael@0 21 gc();
michael@0 22
michael@0 23 g.f();
michael@0 24 assertEq(g.d, 1);
michael@0 25 assertEq(bp.hits, 1);

mercurial