js/src/jit-test/tests/debug/clear-old-analyses-02.js

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

michael@0 1 // |jit-test| error:AllDone
michael@0 2 // When we leave debug mode in a compartment, we must throw away all
michael@0 3 // analyses in that compartment (debug mode affects the results of
michael@0 4 // analysis, so they become out of date). We cannot skip this step when
michael@0 5 // there are debuggee frames on the stack.
michael@0 6
michael@0 7 var g = newGlobal();
michael@0 8 var dbg = new Debugger();
michael@0 9 var gw = dbg.addDebuggee(g);
michael@0 10
michael@0 11 g.eval("" +
michael@0 12 function fib(n) {
michael@0 13 var a = 0, b = 1;
michael@0 14 while (n-- > 0)
michael@0 15 b = b+a, a = b-a;
michael@0 16 return b;
michael@0 17 });
michael@0 18
michael@0 19
michael@0 20 // Cause g.fib to be jitted. This creates an analysis with debug mode on.
michael@0 21 g.fib(20);
michael@0 22
michael@0 23 // Setting a breakpoint in g.f causes us to throw away the jit code, but
michael@0 24 // not the analysis.
michael@0 25 gw.makeDebuggeeValue(g.fib).script.setBreakpoint(0, { hit: function (f) { } });
michael@0 26
michael@0 27 // Take g out of debug mode, with debuggee code on the stack. In older
michael@0 28 // code, this would not trigger a cleansing GC, so the script will
michael@0 29 // retain its analysis.
michael@0 30 dbg.onDebuggerStatement = function (f) {
michael@0 31 dbg.removeDebuggee(g);
michael@0 32 };
michael@0 33 g.eval('debugger');
michael@0 34
michael@0 35 // Run g.fib again, causing it to be re-jitted. If the original analysis is
michael@0 36 // still present, JM will assert, because it is not in debug mode.
michael@0 37 g.fib(20);
michael@0 38
michael@0 39 throw('AllDone');

mercurial