Revision: 17502
Author:   [email protected]
Date:     Tue Nov  5 17:38:56 2013 UTC
Log:      Merged r17451 into 3.22 branch.

MIPS: Fix uint32-to-smi conversion in Lithium.

BUG=chromium:309623
[email protected]

Review URL: https://codereview.chromium.org/58103003
http://code.google.com/p/v8/source/detail?r=17502

Modified:
 /branches/3.22/src/mips/lithium-codegen-mips.cc
 /branches/3.22/src/mips/lithium-mips.cc
 /branches/3.22/src/mips/lithium-mips.h
 /branches/3.22/src/version.cc

=======================================
--- /branches/3.22/src/mips/lithium-codegen-mips.cc Thu Oct 24 06:31:36 2013 UTC +++ /branches/3.22/src/mips/lithium-codegen-mips.cc Tue Nov 5 17:38:56 2013 UTC
@@ -4584,9 +4584,7 @@

 void LCodeGen::DoInteger32ToSmi(LInteger32ToSmi* instr) {
   LOperand* input = instr->value();
-  ASSERT(input->IsRegister());
   LOperand* output = instr->result();
-  ASSERT(output->IsRegister());
   Register scratch = scratch0();

   __ SmiTagCheckOverflow(ToRegister(output), ToRegister(input), scratch);
@@ -4605,6 +4603,19 @@
   __ mtc1(ToRegister(input), dbl_scratch);
   __ Cvt_d_uw(ToDoubleRegister(output), dbl_scratch, f22);
 }
+
+
+void LCodeGen::DoUint32ToSmi(LUint32ToSmi* instr) {
+  LOperand* input = instr->value();
+  LOperand* output = instr->result();
+  if (!instr->hydrogen()->value()->HasRange() ||
+      !instr->hydrogen()->value()->range()->IsInSmiRange()) {
+    Register scratch = scratch0();
+    __ And(scratch, ToRegister(input), Operand(0xc0000000));
+    DeoptimizeIf(ne, instr->environment(), scratch, Operand(zero_reg));
+  }
+  __ SmiTag(ToRegister(output), ToRegister(input));
+}


 void LCodeGen::DoNumberTagI(LNumberTagI* instr) {
=======================================
--- /branches/3.22/src/mips/lithium-mips.cc     Tue Oct 22 08:00:09 2013 UTC
+++ /branches/3.22/src/mips/lithium-mips.cc     Tue Nov  5 17:38:56 2013 UTC
@@ -1934,8 +1934,9 @@
     } else if (to.IsSmi()) {
       HValue* val = instr->value();
       LOperand* value = UseRegister(val);
-      LInstruction* result =
-          DefineSameAsFirst(new(zone()) LInteger32ToSmi(value));
+      LInstruction* result = val->CheckFlag(HInstruction::kUint32)
+          ? DefineSameAsFirst(new(zone()) LUint32ToSmi(value))
+          : DefineSameAsFirst(new(zone()) LInteger32ToSmi(value));
       if (val->HasRange() && val->range()->IsInSmiRange()) {
         return result;
       }
=======================================
--- /branches/3.22/src/mips/lithium-mips.h      Tue Oct 22 08:00:09 2013 UTC
+++ /branches/3.22/src/mips/lithium-mips.h      Tue Nov  5 17:38:56 2013 UTC
@@ -182,6 +182,7 @@
   V(Typeof)                                     \
   V(TypeofIsAndBranch)                          \
   V(Uint32ToDouble)                             \
+  V(Uint32ToSmi)                                \
   V(UnknownOSRValue)                            \
   V(ValueOf)                                    \
   V(WrapReceiver)
@@ -2052,6 +2053,19 @@
 };


+class LUint32ToSmi V8_FINAL : public LTemplateInstruction<1, 1, 0> {
+ public:
+  explicit LUint32ToSmi(LOperand* value) {
+    inputs_[0] = value;
+  }
+
+  LOperand* value() { return inputs_[0]; }
+
+  DECLARE_CONCRETE_INSTRUCTION(Uint32ToSmi, "uint32-to-smi")
+  DECLARE_HYDROGEN_ACCESSOR(Change)
+};
+
+
 class LNumberTagI V8_FINAL : public LTemplateInstruction<1, 1, 0> {
  public:
   explicit LNumberTagI(LOperand* value) {
=======================================
--- /branches/3.22/src/version.cc       Thu Oct 31 13:30:00 2013 UTC
+++ /branches/3.22/src/version.cc       Tue Nov  5 17:38:56 2013 UTC
@@ -35,7 +35,7 @@
 #define MAJOR_VERSION     3
 #define MINOR_VERSION     22
 #define BUILD_NUMBER      24
-#define PATCH_LEVEL       0
+#define PATCH_LEVEL       1
 // Use 1 for candidates and 0 otherwise.
 // (Boolean macro values are not supported by all preprocessors.)
 #define IS_CANDIDATE_VERSION 0

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