js/src/jit-test/tests/jaeger/recompile/arith.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
michael@0 2 /* Handle recompilation of arithmetic operations, and on-stack int -> double conversion. */
michael@0 3
michael@0 4 function add(x, y)
michael@0 5 {
michael@0 6 var z = x + y;
michael@0 7 assertEq(z, 2147483732);
michael@0 8 assertEq(z - 10, 2147483722);
michael@0 9 }
michael@0 10 add(0x7ffffff0, 100);
michael@0 11
michael@0 12 function mul(x, y)
michael@0 13 {
michael@0 14 var z = x * y;
michael@0 15 assertEq(z, 4294967264);
michael@0 16 }
michael@0 17 mul(0x7ffffff0, 2);
michael@0 18
michael@0 19 function div1(x, y)
michael@0 20 {
michael@0 21 var z = x / y;
michael@0 22 assertEq(z + 10, 20);
michael@0 23 }
michael@0 24 div1(100, 10);
michael@0 25
michael@0 26 function div2(x, y)
michael@0 27 {
michael@0 28 var z = x / y;
michael@0 29 assertEq(z + 10, 20.5);
michael@0 30 }
michael@0 31 div2(105, 10);
michael@0 32
michael@0 33 function uncopy(x, y)
michael@0 34 {
michael@0 35 var q = x;
michael@0 36 x += y;
michael@0 37 q++;
michael@0 38 assertEq(q, 2147483633);
michael@0 39 assertEq(x, 2147483732);
michael@0 40 }
michael@0 41 uncopy(0x7ffffff0, 100);
michael@0 42
michael@0 43 function addmore(x, y)
michael@0 44 {
michael@0 45 var q = (x + 10) + (x + y);
michael@0 46 assertEq(q, 4294967374);
michael@0 47 x = q;
michael@0 48 }
michael@0 49 addmore(0x7ffffff0, 100);

mercurial