aboutsummaryrefslogtreecommitdiff
path: root/deps/v8/test/mjsunit/compiler/number-min.js
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/test/mjsunit/compiler/number-min.js')
-rw-r--r--deps/v8/test/mjsunit/compiler/number-min.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/deps/v8/test/mjsunit/compiler/number-min.js b/deps/v8/test/mjsunit/compiler/number-min.js
index 72bff78686..6c7c62d773 100644
--- a/deps/v8/test/mjsunit/compiler/number-min.js
+++ b/deps/v8/test/mjsunit/compiler/number-min.js
@@ -21,3 +21,17 @@
assertEquals(1, foo(0));
assertOptimized(foo);
})();
+
+// Test that NumberMin properly handles 64-bit comparisons.
+(function() {
+ function foo(x) {
+ x = x|0;
+ return Math.min(x - 1, x + 1);
+ }
+
+ assertEquals(-Math.pow(2, 31) - 1, foo(-Math.pow(2, 31)));
+ assertEquals(Math.pow(2, 31) - 2, foo(Math.pow(2, 31) - 1));
+ %OptimizeFunctionOnNextCall(foo);
+ assertEquals(-Math.pow(2, 31) - 1, foo(-Math.pow(2, 31)));
+ assertEquals(Math.pow(2, 31) - 2, foo(Math.pow(2, 31) - 1));
+})();