michael@0: michael@0: /* Test undoing addition in overflow paths when under heavy register pressure. */ michael@0: michael@0: function add1(x, y, a, b, res) { var nres = res + 0; var z = (x + a) + (y + b); assertEq(z, nres); } michael@0: function add2(x, y, a, b, res) { var nres = res + 0; var z = (x + a) + (y + b); assertEq(z, nres); } michael@0: function add3(x, y, a, b, res) { var nres = res + 0; var z = (x + a) + (y + b); assertEq(z, nres); } michael@0: add1(0x7ffffff0, 100, 0, 0, 2147483732); michael@0: add2(-1000, -0x80000000, 0, 0, -2147484648); michael@0: add3(-0x80000000, -1000, 0, 0, -2147484648); michael@0: michael@0: function cadd1(x, a, b, res) { michael@0: var nres = res + 0; michael@0: var nb = b + 0; michael@0: var z = (x + a) + 1000; michael@0: assertEq(z, nres + nb); michael@0: } michael@0: cadd1(0x7ffffff0, 0, 0, 2147484632); michael@0: michael@0: function cadd2(x, a, b, res) { michael@0: var nres = res + 0; michael@0: var nb = b + 0; michael@0: var z = (x + a) + (-0x80000000); michael@0: assertEq(z, nres + nb); michael@0: } michael@0: cadd2(-1000, 0, 0, -2147484648);