Chromium Code Reviews| Index: src/ia32/lithium-ia32.cc |
| diff --git a/src/ia32/lithium-ia32.cc b/src/ia32/lithium-ia32.cc |
| index 986bb98115e7f73c1864d400f25528e8863a2ec4..3c82e93e702bae943596bebe30f361df1ce8e1fa 100644 |
| --- a/src/ia32/lithium-ia32.cc |
| +++ b/src/ia32/lithium-ia32.cc |
| @@ -1684,8 +1684,9 @@ LInstruction* LChunkBuilder::DoChange(HChange* instr) { |
| LOperand* value = UseRegister(instr->value()); |
| bool needs_check = !instr->value()->type().IsSmi(); |
| if (needs_check) { |
| + bool truncating = instr->CanTruncateToInt32(); |
| LOperand* xmm_temp = |
| - (instr->CanTruncateToInt32() && CpuFeatures::IsSupported(SSE3)) |
| + (truncating && CpuFeatures::IsSupported(SSE3)) |
| ? NULL |
| : FixedTemp(xmm1); |
| LTaggedToI* res = new LTaggedToI(value, xmm_temp); |
| @@ -1705,8 +1706,8 @@ LInstruction* LChunkBuilder::DoChange(HChange* instr) { |
| return AssignPointerMap(Define(result, result_temp)); |
| } else { |
| ASSERT(to.IsInteger32()); |
| - bool needs_temp = instr->CanTruncateToInt32() && |
| - !CpuFeatures::IsSupported(SSE3); |
| + bool truncating = instr->CanTruncateToInt32(); |
| + bool needs_temp = truncating && !CpuFeatures::IsSupported(SSE3); |
| LOperand* value = needs_temp ? |
| UseTempRegister(instr->value()) : UseRegister(instr->value()); |
| LOperand* temp = needs_temp ? TempRegister() : NULL; |
| @@ -1793,6 +1794,39 @@ LInstruction* LChunkBuilder::DoClampToUint8(HClampToUint8* instr) { |
| } |
| +LInstruction* LChunkBuilder::DoToInt32(HToInt32* instr) { |
| + HValue* value = instr->value(); |
| + Representation input_rep = value->representation(); |
| + if (input_rep.IsDouble()) { |
| + LOperand* reg = UseRegister(value); |
| + // Register allocator doesn't (yet) support allocation of double |
| + // temps. Reserve xmm1 explicitly. |
| + LOperand* xmm_temp = |
|
Kevin Millikin (Chromium)
2011/05/26 07:53:37
Some of this code can be lifted out of the if (the
danno
2011/06/01 13:14:41
Done.
|
| + CpuFeatures::IsSupported(SSE3) |
| + ? NULL |
| + : FixedTemp(xmm1); |
| + return AssignEnvironment( |
| + DefineAsRegister(new LDoubleToI(reg, xmm_temp))); |
| + } else if (input_rep.IsInteger32()) { |
| + // Canonicalization should already have removed the hydrogen instruction in |
| + // this case, since it is a noop. |
| + UNREACHABLE(); |
| + return NULL; |
| + } else { |
| + ASSERT(input_rep.IsTagged()); |
| + LOperand* reg = UseRegister(value); |
| + // Register allocator doesn't (yet) support allocation of double |
| + // temps. Reserve xmm1 explicitly. |
| + LOperand* xmm_temp = |
| + CpuFeatures::IsSupported(SSE3) |
| + ? NULL |
| + : FixedTemp(xmm1); |
| + return AssignEnvironment( |
| + DefineSameAsFirst(new LTaggedToI(reg, xmm_temp))); |
| + } |
| +} |
| + |
| + |
| LInstruction* LChunkBuilder::DoReturn(HReturn* instr) { |
| return new LReturn(UseFixed(instr->value(), eax)); |
| } |