Index: src/mips/lithium-mips.cc |
diff --git a/src/mips/lithium-mips.cc b/src/mips/lithium-mips.cc |
index 04125d1696d11eb40138281f9d81d3336701c572..758112cba6ee549ecec2df2a7526704985d38c6f 100644 |
--- a/src/mips/lithium-mips.cc |
+++ b/src/mips/lithium-mips.cc |
@@ -1760,12 +1760,24 @@ LInstruction* LChunkBuilder::DoForceRepresentation(HForceRepresentation* bad) { |
LInstruction* LChunkBuilder::DoChange(HChange* instr) { |
Representation from = instr->from(); |
Representation to = instr->to(); |
+ if (from.IsSmi()) { |
+ if (to.IsTagged()) { |
+ LOperand* value = UseRegister(instr->value()); |
+ return DefineSameAsFirst(new(zone()) LDummyUse(value)); |
+ } |
+ from = Representation::Tagged(); |
+ } |
if (from.IsTagged()) { |
if (to.IsDouble()) { |
info()->MarkAsDeferredCalling(); |
LOperand* value = UseRegister(instr->value()); |
LNumberUntagD* res = new(zone()) LNumberUntagD(value); |
return AssignEnvironment(DefineAsRegister(res)); |
+ } else if (to.IsSmi()) { |
+ HValue* val = instr->value(); |
+ LOperand* value = UseRegisterAtStart(val); |
+ return AssignEnvironment( |
+ DefineSameAsFirst(new(zone()) LCheckSmi(value))); |
} else { |
ASSERT(to.IsInteger32()); |
LOperand* value = NULL; |
@@ -1807,6 +1819,10 @@ LInstruction* LChunkBuilder::DoChange(HChange* instr) { |
LNumberTagD* result = new(zone()) LNumberTagD(value, temp1, temp2); |
Define(result, result_temp); |
return AssignPointerMap(result); |
+ } else if (to.IsSmi()) { |
+ LOperand* value = UseRegister(instr->value()); |
+ return AssignEnvironment(DefineAsRegister(new(zone()) LDoubleToSmi(value, |
+ TempRegister(), TempRegister()))); |
} else { |
ASSERT(to.IsInteger32()); |
LOperand* value = UseRegister(instr->value()); |
@@ -1829,6 +1845,15 @@ LInstruction* LChunkBuilder::DoChange(HChange* instr) { |
LNumberTagI* result = new(zone()) LNumberTagI(value); |
return AssignEnvironment(AssignPointerMap(DefineAsRegister(result))); |
} |
+ } else if (to.IsSmi()) { |
+ HValue* val = instr->value(); |
+ LOperand* value = UseRegister(val); |
+ LInstruction* result = |
+ DefineSameAsFirst(new(zone()) LInteger32ToSmi(value)); |
+ if (val->HasRange() && val->range()->IsInSmiRange()) { |
+ return result; |
+ } |
+ return AssignEnvironment(result); |
} else { |
ASSERT(to.IsDouble()); |
if (instr->value()->CheckFlag(HInstruction::kUint32)) { |
@@ -1923,7 +1948,7 @@ LInstruction* LChunkBuilder::DoConstant(HConstant* instr) { |
return DefineAsRegister(new(zone()) LConstantI); |
} else if (r.IsDouble()) { |
return DefineAsRegister(new(zone()) LConstantD); |
- } else if (r.IsTagged()) { |
+ } else if (r.IsTagged() || r.IsSmi()) { |
return DefineAsRegister(new(zone()) LConstantT); |
} else { |
UNREACHABLE(); |