Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1297)

Unified Diff: test/mjsunit/regress/regress-3039.js

Issue 104003004: Avoid FP exceptions when doing integer division. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/mjsunit/div-mul-minus-one.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/regress/regress-3039.js
diff --git a/test/mjsunit/regress/regress-2132.js b/test/mjsunit/regress/regress-3039.js
similarity index 84%
copy from test/mjsunit/regress/regress-2132.js
copy to test/mjsunit/regress/regress-3039.js
index 9eb2dc5b073e6e3c2ce46362903d07d727de3d27..3c7f62c16e65872c786c04e5af00cfdd5f27a8ed 100644
--- a/test/mjsunit/regress/regress-2132.js
+++ b/test/mjsunit/regress/regress-3039.js
@@ -27,22 +27,15 @@
// Flags: --allow-natives-syntax
-function mul(x, y) {
- return (x * y) | 0;
-}
-
-mul(0, 0);
-mul(0, 0);
-%OptimizeFunctionOnNextCall(mul);
-assertEquals(0, mul(0, -1));
-assertOptimized(mul);
-
-function div(x, y) {
+function do_div(x, y) {
return (x / y) | 0;
}
-div(4, 2);
-div(4, 2);
-%OptimizeFunctionOnNextCall(div);
-assertEquals(1, div(5, 3));
-assertOptimized(div);
+// Preparation.
+assertEquals(17, do_div(51, 3));
+assertEquals(13, do_div(65, 5));
+%OptimizeFunctionOnNextCall(do_div);
+assertEquals(11, do_div(77, 7));
+
+// The actual test. We should not trigger a floating point exception.
+assertEquals(-2147483648, do_div(-2147483648, -1));
« no previous file with comments | « test/mjsunit/div-mul-minus-one.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698