Index: src/ia32/lithium-ia32.cc |
diff --git a/src/ia32/lithium-ia32.cc b/src/ia32/lithium-ia32.cc |
index dec5697f8769b861b8d72e2b44ec9647695e8cc5..90939695b78fec2268761f313916703430eb84c8 100644 |
--- a/src/ia32/lithium-ia32.cc |
+++ b/src/ia32/lithium-ia32.cc |
@@ -1908,6 +1908,13 @@ 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(); |
+ } |
// Only mark conversions that might need to allocate as calling rather than |
// all changes. This makes simple, non-allocating conversion not have to force |
// building a stack frame. |
@@ -1925,6 +1932,11 @@ LInstruction* LChunkBuilder::DoChange(HChange* instr) { |
} else { |
return AssignEnvironment(DefineX87TOS(res)); |
} |
+ } else if (to.IsSmi()) { |
+ HValue* val = instr->value(); |
+ LOperand* value = UseRegisterAtStart(val); |
+ return AssignEnvironment( |
+ DefineSameAsFirst(new(zone()) LCheckSmi(value))); |
} else { |
ASSERT(to.IsInteger32()); |
if (instr->value()->type().IsSmi()) { |
@@ -1961,6 +1973,10 @@ LInstruction* LChunkBuilder::DoChange(HChange* instr) { |
LUnallocated* result_temp = TempRegister(); |
LNumberTagD* result = new(zone()) LNumberTagD(value, temp); |
return AssignPointerMap(Define(result, result_temp)); |
+ } else if (to.IsSmi()) { |
+ LOperand* value = UseRegister(instr->value()); |
+ return AssignEnvironment( |
+ DefineAsRegister(new(zone()) LDoubleToSmi(value))); |
} else { |
ASSERT(to.IsInteger32()); |
bool truncating = instr->CanTruncateToInt32(); |
@@ -1985,6 +2001,15 @@ LInstruction* LChunkBuilder::DoChange(HChange* instr) { |
LNumberTagI* result = new(zone()) LNumberTagI(value); |
return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(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)) { |
@@ -2025,13 +2050,13 @@ LInstruction* LChunkBuilder::DoCheckPrototypeMaps(HCheckPrototypeMaps* instr) { |
LInstruction* LChunkBuilder::DoCheckSmi(HCheckSmi* instr) { |
LOperand* value = UseAtStart(instr->value()); |
- return AssignEnvironment(new(zone()) LCheckSmi(value)); |
+ return AssignEnvironment(DefineSameAsFirst(new(zone()) LCheckSmi(value))); |
Jakob Kummerow
2013/05/23 12:49:31
This change causes unnecessary register pressure,
|
} |
LInstruction* LChunkBuilder::DoCheckSmiOrInt32(HCheckSmiOrInt32* instr) { |
LOperand* value = UseAtStart(instr->value()); |
- return AssignEnvironment(new(zone()) LCheckSmi(value)); |
+ return AssignEnvironment(DefineSameAsFirst(new(zone()) LCheckSmi(value))); |
} |