Index: src/ia32/lithium-codegen-ia32.cc |
diff --git a/src/ia32/lithium-codegen-ia32.cc b/src/ia32/lithium-codegen-ia32.cc |
index ed5bd47a403101735846ab11fefd8e08fa670594..4732f162872ad030e06b68f145085d31225f8bbc 100644 |
--- a/src/ia32/lithium-codegen-ia32.cc |
+++ b/src/ia32/lithium-codegen-ia32.cc |
@@ -4897,7 +4897,8 @@ void LCodeGen::DoNumberTagI(LNumberTagI* instr) { |
const X87Stack& x87_stack) |
: LDeferredCode(codegen, x87_stack), instr_(instr) { } |
virtual void Generate() V8_OVERRIDE { |
- codegen()->DoDeferredNumberTagI(instr_, instr_->value(), SIGNED_INT32); |
+ codegen()->DoDeferredNumberTagIU(instr_, instr_->value(), instr_->temp(), |
+ NULL, SIGNED_INT32); |
} |
virtual LInstruction* instr() V8_OVERRIDE { return instr_; } |
private: |
@@ -4924,7 +4925,8 @@ void LCodeGen::DoNumberTagU(LNumberTagU* instr) { |
const X87Stack& x87_stack) |
: LDeferredCode(codegen, x87_stack), instr_(instr) { } |
virtual void Generate() V8_OVERRIDE { |
- codegen()->DoDeferredNumberTagI(instr_, instr_->value(), UNSIGNED_INT32); |
+ codegen()->DoDeferredNumberTagIU(instr_, instr_->value(), instr_->temp1(), |
+ instr_->temp2(), UNSIGNED_INT32); |
} |
virtual LInstruction* instr() V8_OVERRIDE { return instr_; } |
private: |
@@ -4944,19 +4946,16 @@ void LCodeGen::DoNumberTagU(LNumberTagU* instr) { |
} |
-void LCodeGen::DoDeferredNumberTagI(LInstruction* instr, |
- LOperand* value, |
- IntegerSignedness signedness) { |
- Label slow; |
+void LCodeGen::DoDeferredNumberTagIU(LInstruction* instr, |
+ LOperand* value, |
+ LOperand* temp1, |
+ LOperand* temp2, |
+ IntegerSignedness signedness) { |
+ Label done, slow; |
Register reg = ToRegister(value); |
- Register tmp = reg.is(eax) ? ecx : eax; |
+ Register tmp = ToRegister(temp1); |
XMMRegister xmm_scratch = double_scratch0(); |
- // Preserve the value of all registers. |
- PushSafepointRegistersScope scope(this); |
- |
- Label done; |
- |
if (signedness == SIGNED_INT32) { |
// There was overflow, so bits 30 and 31 of the original integer |
// disagree. Try to allocate a heap number in new space and store |
@@ -4974,8 +4973,7 @@ void LCodeGen::DoDeferredNumberTagI(LInstruction* instr, |
} else { |
if (CpuFeatures::IsSupported(SSE2)) { |
CpuFeatureScope feature_scope(masm(), SSE2); |
- __ LoadUint32(xmm_scratch, reg, |
- ToDoubleRegister(LNumberTagU::cast(instr)->temp())); |
+ __ LoadUint32(xmm_scratch, reg, ToDoubleRegister(temp2)); |
} else { |
// There's no fild variant for unsigned values, so zero-extend to a 64-bit |
// int manually. |
@@ -4994,21 +4992,26 @@ void LCodeGen::DoDeferredNumberTagI(LInstruction* instr, |
// Slow case: Call the runtime system to do the number allocation. |
__ bind(&slow); |
+ { |
+ // TODO(3095996): Put a valid pointer value in the stack slot where the |
+ // result register is stored, as this register is in the pointer map, but |
+ // contains an integer value. |
+ __ Set(reg, Immediate(0)); |
- // TODO(3095996): Put a valid pointer value in the stack slot where the result |
- // register is stored, as this register is in the pointer map, but contains an |
- // integer value. |
- __ StoreToSafepointRegisterSlot(reg, Immediate(0)); |
- // NumberTagI and NumberTagD use the context from the frame, rather than |
- // the environment's HContext or HInlinedContext value. |
- // They only call Runtime::kAllocateHeapNumber. |
- // The corresponding HChange instructions are added in a phase that does |
- // not have easy access to the local context. |
- __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
- __ CallRuntimeSaveDoubles(Runtime::kAllocateHeapNumber); |
- RecordSafepointWithRegisters( |
- instr->pointer_map(), 0, Safepoint::kNoLazyDeopt); |
- if (!reg.is(eax)) __ mov(reg, eax); |
+ // Preserve the value of all registers. |
+ PushSafepointRegistersScope scope(this); |
+ |
+ // NumberTagI and NumberTagD use the context from the frame, rather than |
+ // the environment's HContext or HInlinedContext value. |
+ // They only call Runtime::kAllocateHeapNumber. |
+ // The corresponding HChange instructions are added in a phase that does |
+ // not have easy access to the local context. |
+ __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
+ __ CallRuntimeSaveDoubles(Runtime::kAllocateHeapNumber); |
+ RecordSafepointWithRegisters( |
+ instr->pointer_map(), 0, Safepoint::kNoLazyDeopt); |
+ __ StoreToSafepointRegisterSlot(reg, eax); |
+ } |
// Done. Put the value in xmm_scratch into the value of the allocated heap |
// number. |
@@ -5019,7 +5022,6 @@ void LCodeGen::DoDeferredNumberTagI(LInstruction* instr, |
} else { |
__ fstp_d(FieldOperand(reg, HeapNumber::kValueOffset)); |
} |
- __ StoreToSafepointRegisterSlot(reg, reg); |
} |