js/src/jit-test/tests/ion/bug939868-2.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 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