Index: src/arm/lithium-arm.cc |
diff --git a/src/arm/lithium-arm.cc b/src/arm/lithium-arm.cc |
index e1bb69eacd73fc5ac3f672abee2436ea973dc9a3..86bb10118d6ad3d59dc0de99cb05a7da7a0242e1 100644 |
--- a/src/arm/lithium-arm.cc |
+++ b/src/arm/lithium-arm.cc |
@@ -1887,12 +1887,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; |
@@ -1927,6 +1939,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()); |
@@ -1949,6 +1965,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)) { |
@@ -2042,7 +2067,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(); |