Reviewers: Paul Lind, Toon Verwaest, danno, kisg, kilvadyb,

Message:
This CL depends on: https://codereview.chromium.org/15781006

Description:
MIPS: Tag length of FixedArrayBase and smi-array[x] as smi representation

Port r14778 (c7fdf61b)

BUG=


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

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

Affected files:
  M src/mips/lithium-codegen-mips.cc
  M src/mips/lithium-mips.h
  M src/mips/lithium-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 f7cb241211d32c3bc673ab54c3b7b1ed9133fbb7..dc7b545da97c0bc49301a58e22ab327edad304d5 100644
--- a/src/mips/lithium-codegen-mips.cc
+++ b/src/mips/lithium-codegen-mips.cc
@@ -4936,6 +4936,13 @@ void LCodeGen::DoDoubleToSmi(LDoubleToSmi* instr) {
 }


+void LCodeGen::DoCheckSmiAndReturn(LCheckSmiAndReturn* instr) {
+  LOperand* input = instr->value();
+  __ And(at, ToRegister(input), Operand(kSmiTagMask));
+  DeoptimizeIf(ne, instr->environment(), at, Operand(zero_reg));
+}
+
+
 void LCodeGen::DoCheckSmi(LCheckSmi* instr) {
   LOperand* input = instr->value();
   __ And(at, ToRegister(input), Operand(kSmiTagMask));
Index: src/mips/lithium-mips.cc
diff --git a/src/mips/lithium-mips.cc b/src/mips/lithium-mips.cc
index 758112cba6ee549ecec2df2a7526704985d38c6f..6c8bcacdb42176b9d3f56368f0cdd26cad14925e 100644
--- a/src/mips/lithium-mips.cc
+++ b/src/mips/lithium-mips.cc
@@ -1763,6 +1763,12 @@ LInstruction* LChunkBuilder::DoChange(HChange* instr) {
   if (from.IsSmi()) {
     if (to.IsTagged()) {
       LOperand* value = UseRegister(instr->value());
+      // For now, always deopt on hole.
+      if (instr->value()->IsLoadKeyed() &&
+          HLoadKeyed::cast(instr->value())->UsesMustHandleHole()) {
+        return AssignEnvironment(
+            DefineSameAsFirst(new(zone()) LCheckSmiAndReturn(value)));
+      }
       return DefineSameAsFirst(new(zone()) LDummyUse(value));
     }
     from = Representation::Tagged();
@@ -1775,9 +1781,9 @@ LInstruction* LChunkBuilder::DoChange(HChange* instr) {
       return AssignEnvironment(DefineAsRegister(res));
     } else if (to.IsSmi()) {
       HValue* val = instr->value();
-      LOperand* value = UseRegisterAtStart(val);
+      LOperand* value = UseRegister(val);
       return AssignEnvironment(
-          DefineSameAsFirst(new(zone()) LCheckSmi(value)));
+          DefineSameAsFirst(new(zone()) LCheckSmiAndReturn(value)));
     } else {
       ASSERT(to.IsInteger32());
       LOperand* value = NULL;
Index: src/mips/lithium-mips.h
diff --git a/src/mips/lithium-mips.h b/src/mips/lithium-mips.h
index 96065512b204037e77d1b49691106c7d264abdd1..d5f19869c979c337a8798e6521545dbdd0b8d6ef 100644
--- a/src/mips/lithium-mips.h
+++ b/src/mips/lithium-mips.h
@@ -76,6 +76,7 @@ class LCodeGen;
   V(CheckNonSmi)                                \
   V(CheckPrototypeMaps)                         \
   V(CheckSmi)                                   \
+  V(CheckSmiAndReturn)                          \
   V(ClampDToUint8)                              \
   V(ClampIToUint8)                              \
   V(ClampTToUint8)                              \
@@ -2328,7 +2329,7 @@ class LCheckPrototypeMaps: public LTemplateInstruction<0, 0, 2> {
 };


-class LCheckSmi: public LTemplateInstruction<1, 1, 0> {
+class LCheckSmi: public LTemplateInstruction<0, 1, 0> {
  public:
   explicit LCheckSmi(LOperand* value) {
     inputs_[0] = value;
@@ -2340,6 +2341,17 @@ class LCheckSmi: public LTemplateInstruction<1, 1, 0> {
 };


+class LCheckSmiAndReturn: public LTemplateInstruction<1, 1, 0> {
+ public:
+  explicit LCheckSmiAndReturn(LOperand* value) {
+    inputs_[0] = value;
+  }
+
+  LOperand* value() { return inputs_[0]; }
+
+  DECLARE_CONCRETE_INSTRUCTION(CheckSmiAndReturn, "check-smi-and-return")
+};
+
 class LCheckNonSmi: public LTemplateInstruction<0, 1, 0> {
  public:
   explicit LCheckNonSmi(LOperand* value) {


--
--
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