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

Unified Diff: test/mjsunit/div-mul-minus-one.js

Issue 24521002: Special handle for mul/div minus one when kAllUsesTruncatingToInt32 (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: remove unnecessary ASSERT statement Created 7 years, 3 months 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 | « src/hydrogen-instructions.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/div-mul-minus-one.js
diff --git a/test/mjsunit/regress/regress-2132.js b/test/mjsunit/div-mul-minus-one.js
similarity index 79%
copy from test/mjsunit/regress/regress-2132.js
copy to test/mjsunit/div-mul-minus-one.js
index 9eb2dc5b073e6e3c2ce46362903d07d727de3d27..f05bf0f54c68faf8f5e5cb5f35d7a8dcbc3fb02f 100644
--- a/test/mjsunit/regress/regress-2132.js
+++ b/test/mjsunit/div-mul-minus-one.js
@@ -27,22 +27,27 @@
// Flags: --allow-natives-syntax
-function mul(x, y) {
- return (x * y) | 0;
+function div(g) {
+ return (g/-1) ^ 1
}
-mul(0, 0);
-mul(0, 0);
-%OptimizeFunctionOnNextCall(mul);
-assertEquals(0, mul(0, -1));
-assertOptimized(mul);
+var kMinInt = 1 << 31;
+var expected_MinInt = div(kMinInt);
+var expected_minus_zero = div(0);
+%OptimizeFunctionOnNextCall(div);
+assertEquals(expected_MinInt, div(kMinInt));
+assertOptimized(div);
+assertEquals(expected_minus_zero , div(0));
+assertOptimized(div);
-function div(x, y) {
- return (x / y) | 0;
+function mul(g) {
+ return (g * -1) ^ 1
}
-div(4, 2);
-div(4, 2);
-%OptimizeFunctionOnNextCall(div);
-assertEquals(1, div(5, 3));
-assertOptimized(div);
+expected_MinInt = mul(kMinInt);
+expected_minus_zero = mul(0);
+%OptimizeFunctionOnNextCall(mul);
+assertEquals(expected_MinInt, mul(kMinInt));
+assertOptimized(mul);
+assertEquals(expected_minus_zero , mul(0));
+assertOptimized(mul);
« no previous file with comments | « src/hydrogen-instructions.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698