js/src/jit-test/tests/debug/breakpoint-gc-03.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 // |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