Reviewers: ulan,

Description:
Fix ARM code for DoModI.


[email protected]
BUG=166379


Please review this at https://chromiumcodereview.appspot.com/11618020/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files:
  M src/arm/lithium-codegen-arm.cc


Index: src/arm/lithium-codegen-arm.cc
diff --git a/src/arm/lithium-codegen-arm.cc b/src/arm/lithium-codegen-arm.cc
index 53d99814bb5d56cc10cb7c1aaed206f730ce1c3d..2de6ac40a8868afbb901813252e695b5aa5fef64 100644
--- a/src/arm/lithium-codegen-arm.cc
+++ b/src/arm/lithium-codegen-arm.cc
@@ -1105,6 +1105,16 @@ void LCodeGen::DoModI(LModI* instr) {
       DeoptimizeIf(eq, instr->environment());
     }

+    // Check for (kMinInt % -1).
+    if (instr->hydrogen()->CheckFlag(HValue::kCanOverflow)) {
+      Label left_not_min_int;
+      __ cmp(left, Operand(kMinInt));
+      __ b(ne, &left_not_min_int);
+      __ cmp(right, Operand(-1));
+      DeoptimizeIf(eq, instr->environment());
+      __ bind(&left_not_min_int);
+    }
+
     // For  r3 = r1 % r2; we can have the following ARM code
     // sdiv r3, r1, r2
     // mls r3, r3, r2, r1
@@ -1134,6 +1144,8 @@ void LCodeGen::DoModI(LModI* instr) {

     Label vfp_modulo, both_positive, right_negative;

+    CpuFeatures::Scope scope(VFP2);
+
     // Check for x % 0.
     if (instr->hydrogen()->CheckFlag(HValue::kCanBeDivByZero)) {
       __ cmp(right, Operand(0));
@@ -1356,7 +1368,7 @@ void LCodeGen::DoDivI(LDivI* instr) {
     __ bind(&left_not_zero);
   }

-  // Check for (-kMinInt / -1).
+  // Check for (kMinInt / -1).
   if (instr->hydrogen()->CheckFlag(HValue::kCanOverflow)) {
     Label left_not_min_int;
     __ cmp(left, Operand(kMinInt));


--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to