Revision: 11789
Author:   [email protected]
Date:     Wed Jun 13 00:55:53 2012
Log:      MIPS: Eliminate redundant smi checks

Port r11774 (28c45b9b)

BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com/10536128
Patch from Akos Palfi <[email protected]>.
http://code.google.com/p/v8/source/detail?r=11789

Modified:
 /branches/bleeding_edge/src/mips/lithium-codegen-mips.cc
 /branches/bleeding_edge/src/mips/lithium-mips.cc

=======================================
--- /branches/bleeding_edge/src/mips/lithium-codegen-mips.cc Mon Jun 11 23:43:13 2012 +++ /branches/bleeding_edge/src/mips/lithium-codegen-mips.cc Wed Jun 13 00:55:53 2012
@@ -2510,8 +2510,13 @@

   // Check for the hole value.
   if (instr->hydrogen()->RequiresHoleCheck()) {
-    __ LoadRoot(scratch, Heap::kTheHoleValueRootIndex);
-    DeoptimizeIf(eq, instr->environment(), result, Operand(scratch));
+    if (IsFastSmiElementsKind(instr->hydrogen()->elements_kind())) {
+      __ And(scratch, result, Operand(kSmiTagMask));
+      DeoptimizeIf(ne, instr->environment(), scratch, Operand(zero_reg));
+    } else {
+      __ LoadRoot(scratch, Heap::kTheHoleValueRootIndex);
+      DeoptimizeIf(eq, instr->environment(), result, Operand(scratch));
+    }
   }
 }

=======================================
--- /branches/bleeding_edge/src/mips/lithium-mips.cc Mon Jun 11 23:43:13 2012 +++ /branches/bleeding_edge/src/mips/lithium-mips.cc Wed Jun 13 00:55:53 2012
@@ -1647,10 +1647,9 @@
     } else {
       ASSERT(to.IsInteger32());
       LOperand* value = UseRegisterAtStart(instr->value());
-      bool needs_check = !instr->value()->type().IsSmi();
       LInstruction* res = NULL;
-      if (!needs_check) {
-        res = DefineAsRegister(new(zone()) LSmiUntag(value, needs_check));
+      if (instr->value()->type().IsSmi()) {
+        res = DefineAsRegister(new(zone()) LSmiUntag(value, false));
       } else {
         LOperand* temp1 = TempRegister();
         LOperand* temp2 = instr->CanTruncateToInt32() ? TempRegister()

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

Reply via email to