Reviewers: Paul Lind, kisg, kilvadyb, danno, Massi,

Message:
PTAL.

Description:
MIPS: New array bounds check elimination pass (focused on induction variables
and bitwise operations).

Port r15866 (52e8581c)

BUG=


Please review this at https://codereview.chromium.org/20393002/

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

Affected files:
  M src/mips/lithium-codegen-mips.h
  M src/mips/lithium-codegen-mips.cc


Index: src/mips/lithium-codegen-mips.cc
diff --git a/src/mips/lithium-codegen-mips.cc b/src/mips/lithium-codegen-mips.cc index 83028424fe45173e4134b386969e76f02662b117..748e4385ddf08d1773e45521387a68880a7eacce 100644
--- a/src/mips/lithium-codegen-mips.cc
+++ b/src/mips/lithium-codegen-mips.cc
@@ -4163,6 +4163,21 @@ void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) {
 }


+void LCodeGen::ApplyCheckIf(Condition cc,
+                            LBoundsCheck* check,
+                            Register src1,
+                            const Operand& src2) {
+  if (FLAG_debug_code && check->hydrogen()->skip_check()) {
+    Label done;
+    __ Branch(&done, NegateCondition(cc), src1, src2);
+    __ stop("eliminated bounds check failed");
+    __ bind(&done);
+  } else {
+    DeoptimizeIf(cc, check->environment(), src1, src2);
+  }
+}
+
+
 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) {
   if (instr->hydrogen()->skip_check()) return;

@@ -4175,13 +4190,13 @@ void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) {
     } else {
       __ li(at, Operand(constant_index));
     }
-    DeoptimizeIf(condition,
-                 instr->environment(),
+    ApplyCheckIf(condition,
+                 instr,
                  at,
                  Operand(ToRegister(instr->length())));
   } else {
-    DeoptimizeIf(condition,
-                 instr->environment(),
+    ApplyCheckIf(condition,
+                 instr,
                  ToRegister(instr->index()),
                  Operand(ToRegister(instr->length())));
   }
Index: src/mips/lithium-codegen-mips.h
diff --git a/src/mips/lithium-codegen-mips.h b/src/mips/lithium-codegen-mips.h index f330ee76ce03f34556ee8ff782a36ea56c639552..d63ba6f3596b46069594798e1ad768219148ead0 100644
--- a/src/mips/lithium-codegen-mips.h
+++ b/src/mips/lithium-codegen-mips.h
@@ -284,6 +284,10 @@ class LCodeGen BASE_EMBEDDED {
                     LEnvironment* environment,
                     Register src1 = zero_reg,
                     const Operand& src2 = Operand(zero_reg));
+  void ApplyCheckIf(Condition cc,
+                    LBoundsCheck* check,
+                    Register src1 = zero_reg,
+                    const Operand& src2 = Operand(zero_reg));

   void AddToTranslation(Translation* translation,
                         LOperand* op,


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to