Chromium Code Reviews| Index: test/mjsunit/math-abs.js |
| diff --git a/test/mjsunit/math-abs.js b/test/mjsunit/math-abs.js |
| index b90ae0917c4d513c4d880f8a79e71a895dc7986c..09e6416c8b5794ba2ad19ce229523e3ec8e64e70 100644 |
| --- a/test/mjsunit/math-abs.js |
| +++ b/test/mjsunit/math-abs.js |
| @@ -120,3 +120,19 @@ assertEquals(1, foo2()); |
| assertEquals(1, foo2()); |
| %OptimizeFunctionOnNextCall(foo2); |
| assertEquals(1, foo2()); |
| + |
| + |
| +// Regression test for Integer input of Math.abs on mips64. |
| +function absHalf(bits) { |
| + var x = 1 << (bits - 1); |
| + var half = Math.abs(x); |
| + return half; |
| + |
| +} |
| + |
| +// Create minimum integer input for abs() using bitwise operations |
| +// that sould overflow. |
|
Jakob Kummerow
2015/06/19 14:50:25
nit: s/sould/should/
|
| +bits = 32; |
| +for (i = 0; i < 1000; i++) { |
|
Jakob Kummerow
2015/06/19 14:50:25
Please keep the testcase fast:
assertEquals(21474
|
| + assertEquals(2147483648, absHalf(bits)); |
| +} |