js/src/jit-test/tests/asm.js/bug941877.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(stdlib, n, heap) {
michael@0 2 "use asm"
michael@0 3 var Int16ArrayView = new stdlib.Int16Array(heap);
michael@0 4 function f(i0, d1) {
michael@0 5 i0 = i0 | 0
michael@0 6 d1 = +d1
michael@0 7 var d2 = 1.
michael@0 8 var i3 = 0
michael@0 9 Int16ArrayView[0] = i0
michael@0 10 d2 = (.0 / .0)
michael@0 11 switch ((i0 + i0) | 0) {
michael@0 12 case 0:
michael@0 13 d2 = .0
michael@0 14 break
michael@0 15 };
michael@0 16 (((i3 - (0 < 0)) >>> ((.0 < -0) + (.0 > .0))) / 0) >> (0 + (((0 + 0) ^
michael@0 17 (9 > 0)) | 0))
michael@0 18 }
michael@0 19 })(this, null, new ArrayBuffer(4096));
michael@0 20
michael@0 21 (function(stdlib, n, heap) {
michael@0 22 "use asm"
michael@0 23 var Float64ArrayView = new stdlib.Float64Array(heap)
michael@0 24 function f() {
michael@0 25 Float64ArrayView[0] = +(0xffffffff / 0xffffffff >> 0)
michael@0 26 }
michael@0 27 })(this, null, new ArrayBuffer(4096));
michael@0 28
michael@0 29 function test0(x)
michael@0 30 {
michael@0 31 return (x >>> 0) % 10;
michael@0 32 }
michael@0 33 assertEq(test0(25), 5);
michael@0 34 assertEq(test0(24), 4);
michael@0 35 assertEq(test0(23), 3);
michael@0 36 assertEq(test0(0), 0);
michael@0 37 assertEq(test0(4294967295), 5);
michael@0 38
michael@0 39 function test1(x)
michael@0 40 {
michael@0 41 return (x >>> 2) % 10;
michael@0 42 }
michael@0 43 assertEq(test1(25), 6);
michael@0 44 assertEq(test1(24), 6);
michael@0 45 assertEq(test1(23), 5);
michael@0 46 assertEq(test1(4294967295), 3);
michael@0 47
michael@0 48 function test2(x, y)
michael@0 49 {
michael@0 50 return (x >>> 0) % (y >>> 0);
michael@0 51 }
michael@0 52 assertEq(test2(25, 3), 1);
michael@0 53 assertEq(test2(24, 4), 0);
michael@0 54 assertEq(test2(4294967295, 10), 5);
michael@0 55 assertEq(test2(23, 0), NaN);
michael@0 56
michael@0 57 function test3()
michael@0 58 {
michael@0 59 "use asm";
michael@0 60 function f(x, y)
michael@0 61 {
michael@0 62 x = x|0;
michael@0 63 y = y|0;
michael@0 64 var t = 0;
michael@0 65 t = (x % y) > -2;
michael@0 66 return t|0;
michael@0 67 }
michael@0 68 return f;
michael@0 69 }
michael@0 70 assertEq(test3()(4294967290, 4294967295), 1);
michael@0 71 assertEq(test3()(4294967290, 4294967295), 1);
michael@0 72
michael@0 73 function test4()
michael@0 74 {
michael@0 75 "use asm";
michael@0 76 function f(x, y)
michael@0 77 {
michael@0 78 x = x|0;
michael@0 79 y = y|0;
michael@0 80 var t = 0;
michael@0 81 t = ((x>>>0) % (y>>>0)) > -2;
michael@0 82 return t|0;
michael@0 83 }
michael@0 84 return f;
michael@0 85 }
michael@0 86 assertEq(test4()(4294967290, 4294967295), 1);
michael@0 87 assertEq(test4()(4294967290, 4294967295), 1);
michael@0 88
michael@0 89 function test5()
michael@0 90 {
michael@0 91 "use asm";
michael@0 92 function f(x, y)
michael@0 93 {
michael@0 94 x = x|0;
michael@0 95 y = y|0;
michael@0 96 var t = 0;
michael@0 97 t = ((x>>>0) % (y>>>0)) * 1.01;
michael@0 98 return +t;
michael@0 99 }
michael@0 100 return f;
michael@0 101 }
michael@0 102 assertEq(test5()(4294967290, 4294967295), 4337916962.9);
michael@0 103 assertEq(test5()(4294967290, 4294967295), 4337916962.9);
michael@0 104
michael@0 105 function test6()
michael@0 106 {
michael@0 107 "use asm";
michael@0 108 function f(x, y)
michael@0 109 {
michael@0 110 x = x|0;
michael@0 111 y = y|0;
michael@0 112 return ((x>>>1) % (y>>>1))|0;
michael@0 113 }
michael@0 114 return f;
michael@0 115 }
michael@0 116 assertEq(test6()(23847, 7), 1);
michael@0 117 assertEq(test6()(23848, 7), 2);
michael@0 118
michael@0 119 function test7()
michael@0 120 {
michael@0 121 "use asm";
michael@0 122 function f(x)
michael@0 123 {
michael@0 124 x = x|0;
michael@0 125 return ((x>>>0) / 8)|0;
michael@0 126 }
michael@0 127 return f;
michael@0 128 }
michael@0 129 assertEq(test7()(23847, 7), 2980);
michael@0 130 assertEq(test7()(23848, 7), 2981);
michael@0 131
michael@0 132 function test8()
michael@0 133 {
michael@0 134 "use asm";
michael@0 135 function f(i,j)
michael@0 136 {
michael@0 137 i=i|0;j=j|0;
michael@0 138 return ((i>>>0)/(j>>>0))|0;
michael@0 139 }
michael@0 140 return f;
michael@0 141 }
michael@0 142 assertEq(test8()(2147483647, 0), 0);
michael@0 143 assertEq(test8()(2147483646, 0), 0);

mercurial