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

Unified Diff: test/mjsunit/smi-mul.js

Issue 22600005: Eliminate intentional conversion from Smi to Int32 in HMul (Closed) Base URL: https://github.com/v8/v8.git@master
Patch Set: Fixed navier stokes benchmark fails Created 7 years, 4 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/x64/lithium-codegen-x64.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/smi-mul.js
diff --git a/test/mjsunit/regress/regress-2132.js b/test/mjsunit/smi-mul.js
similarity index 70%
copy from test/mjsunit/regress/regress-2132.js
copy to test/mjsunit/smi-mul.js
index 9eb2dc5b073e6e3c2ce46362903d07d727de3d27..6f23d5e3a0bba23407b9db94539fb8ed7922bc11 100644
--- a/test/mjsunit/regress/regress-2132.js
+++ b/test/mjsunit/smi-mul.js
@@ -25,24 +25,43 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-// Flags: --allow-natives-syntax
+// Flags: --allow-natives-syntax --noalways-opt
-function mul(x, y) {
- return (x * y) | 0;
+function mul(a, b) {
+ return a * b;
}
-mul(0, 0);
-mul(0, 0);
+
+mul(-1, 2);
+mul(-1, 2);
%OptimizeFunctionOnNextCall(mul);
-assertEquals(0, mul(0, -1));
+assertEquals(-2, mul(-1, 2));
assertOptimized(mul);
-function div(x, y) {
- return (x / y) | 0;
+// Deopt on minus zero.
+assertEquals(-0, mul(-1, 0));
+assertUnoptimized(mul);
+
+
+function mul2(a, b) {
+ return a * b;
}
-div(4, 2);
-div(4, 2);
-%OptimizeFunctionOnNextCall(div);
-assertEquals(1, div(5, 3));
-assertOptimized(div);
+mul2(-1, 2);
+mul2(-1, 2);
+%OptimizeFunctionOnNextCall(mul2);
+
+// 2^30 is a smi boundary on arm and ia32.
+var two_30 = 1 << 30;
+// 2^31 is a smi boundary on x64.
+var two_31 = 2 * two_30;
+
+if (%IsValidSmi(two_31)) {
+ // Deopt on two_31 on x64.
+ assertEquals(two_31, mul2(-two_31, -1));
+ assertUnoptimized(mul2);
+} else {
+ // Deopt on two_30 on ia32.
+ assertEquals(two_30, mul2(-two_30, -1));
+ assertUnoptimized(mul2);
+}
« no previous file with comments | « src/x64/lithium-codegen-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698