Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | // |jit-test| |
michael@0 | 2 | |
michael@0 | 3 | // Only fails with Ion. |
michael@0 | 4 | function add_xors_1() { |
michael@0 | 5 | var res = 0; |
michael@0 | 6 | var step = 4; |
michael@0 | 7 | for (var i = 0x7fffffff | 0; i >= (1 << step); i -= (i >> step)) { |
michael@0 | 8 | var x = i ^ (i << 1); |
michael@0 | 9 | res += (((x + x) + res + res) | 0); |
michael@0 | 10 | } |
michael@0 | 11 | return res; |
michael@0 | 12 | } |
michael@0 | 13 | |
michael@0 | 14 | var r1 = add_xors_1(); |
michael@0 | 15 | for (var i = 0; i < 100; i++) { |
michael@0 | 16 | var r2 = add_xors_1(); |
michael@0 | 17 | assertEq(r2, r1); |
michael@0 | 18 | } |
michael@0 | 19 | |
michael@0 | 20 | // Only fails with JM |
michael@0 | 21 | function add_xors_2() { |
michael@0 | 22 | var res = 0; |
michael@0 | 23 | var step = 4; |
michael@0 | 24 | for (var i = 0x7fffffff | 0; i >= (1 << step); i -= (i >> step)) { |
michael@0 | 25 | var x = i ^ (i << 1); |
michael@0 | 26 | res += ((x + x) + res + res) | 0; |
michael@0 | 27 | } |
michael@0 | 28 | return res; |
michael@0 | 29 | } |
michael@0 | 30 | |
michael@0 | 31 | var r1 = add_xors_2(); |
michael@0 | 32 | for (var i = 0; i < 100; i++) { |
michael@0 | 33 | var r2 = add_xors_2(); |
michael@0 | 34 | assertEq(r1, r2); |
michael@0 | 35 | } |