js/src/jit-test/tests/ion/bug939868-2.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 function f(x,y,z) {
michael@0 2 var z;
michael@0 3 if (x) {
michael@0 4 if (y) {
michael@0 5 z = 0xfffffff;
michael@0 6 } else {
michael@0 7 z = 0xfffffff;
michael@0 8 }
michael@0 9 assertFloat32(z, false);
michael@0 10 } else {
michael@0 11 z = Math.fround(z);
michael@0 12 assertFloat32(z, true);
michael@0 13 }
michael@0 14 assertFloat32(z, false);
michael@0 15 return z;
michael@0 16 }
michael@0 17
michael@0 18 function g(x,y,z) {
michael@0 19 var z;
michael@0 20 if (x) {
michael@0 21 if (y) {
michael@0 22 z = 3;
michael@0 23 } else {
michael@0 24 z = 6;
michael@0 25 }
michael@0 26 assertFloat32(z, false);
michael@0 27 } else {
michael@0 28 z = Math.fround(z);
michael@0 29 assertFloat32(z, true);
michael@0 30 }
michael@0 31 assertFloat32(z, true);
michael@0 32 return z;
michael@0 33 }
michael@0 34
michael@0 35 setJitCompilerOption("ion.usecount.trigger", 50);
michael@0 36
michael@0 37 for (var n = 100; n--; ) {
michael@0 38 assertEq(f(0,1,2), 2);
michael@0 39 assertEq(f(0,0,2), 2);
michael@0 40 assertEq(f(1,0,2), 0xfffffff);
michael@0 41 assertEq(f(1,1,2), 0xfffffff);
michael@0 42
michael@0 43 assertEq(g(0,1,2), 2);
michael@0 44 assertEq(g(0,0,2), 2);
michael@0 45 assertEq(g(1,0,2), 6);
michael@0 46 assertEq(g(1,1,2), 3);
michael@0 47 }

mercurial