Index: src/mips/lithium-codegen-mips.cc |
diff --git a/src/mips/lithium-codegen-mips.cc b/src/mips/lithium-codegen-mips.cc |
index 30d7efd1b0d2f89034346ada2d66a9ab13ca19be..20d27c6a038cbcfb2d8da163085ab830685048c2 100644 |
--- a/src/mips/lithium-codegen-mips.cc |
+++ b/src/mips/lithium-codegen-mips.cc |
@@ -4553,9 +4553,11 @@ void LCodeGen::DoNumberTagI(LNumberTagI* instr) { |
DeferredNumberTagI(LCodeGen* codegen, LNumberTagI* instr) |
: LDeferredCode(codegen), instr_(instr) { } |
virtual void Generate() V8_OVERRIDE { |
- codegen()->DoDeferredNumberTagI(instr_, |
- instr_->value(), |
- SIGNED_INT32); |
+ codegen()->DoDeferredNumberTagIU(instr_, |
+ instr_->value(), |
+ instr_->temp1(), |
+ instr_->temp2(), |
+ SIGNED_INT32); |
} |
virtual LInstruction* instr() V8_OVERRIDE { return instr_; } |
private: |
@@ -4579,9 +4581,11 @@ void LCodeGen::DoNumberTagU(LNumberTagU* instr) { |
DeferredNumberTagU(LCodeGen* codegen, LNumberTagU* instr) |
: LDeferredCode(codegen), 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: |
@@ -4598,18 +4602,19 @@ 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 src = ToRegister(value); |
Register dst = ToRegister(instr->result()); |
+ Register tmp1 = scratch0(); |
+ Register tmp2 = ToRegister(temp1); |
+ Register tmp3 = ToRegister(temp2); |
DoubleRegister dbl_scratch = double_scratch0(); |
- // Preserve the value of all registers. |
- PushSafepointRegistersScope scope(this, Safepoint::kWithRegisters); |
- |
- 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 |
@@ -4626,37 +4631,41 @@ void LCodeGen::DoDeferredNumberTagI(LInstruction* instr, |
} |
if (FLAG_inline_new) { |
- __ LoadRoot(scratch0(), Heap::kHeapNumberMapRootIndex); |
- __ AllocateHeapNumber(t1, a3, t0, scratch0(), &slow, DONT_TAG_RESULT); |
- __ Move(dst, t1); |
+ __ LoadRoot(tmp3, Heap::kHeapNumberMapRootIndex); |
+ __ AllocateHeapNumber(dst, tmp1, tmp2, tmp3, &slow, DONT_TAG_RESULT); |
__ Branch(&done); |
} |
// 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. |
+ __ mov(dst, zero_reg); |
+ |
+ // Preserve the value of all registers. |
+ PushSafepointRegistersScope scope(this, Safepoint::kWithRegisters); |
+ |
+ // 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. |
+ __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
+ __ CallRuntimeSaveDoubles(Runtime::kAllocateHeapNumber); |
+ RecordSafepointWithRegisters( |
+ instr->pointer_map(), 0, Safepoint::kNoLazyDeopt); |
+ __ Subu(v0, v0, kHeapObjectTag); |
+ __ StoreToSafepointRegisterSlot(v0, dst); |
+ } |
- // 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(zero_reg, dst); |
- // 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. |
- __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
- __ CallRuntimeSaveDoubles(Runtime::kAllocateHeapNumber); |
- RecordSafepointWithRegisters( |
- instr->pointer_map(), 0, Safepoint::kNoLazyDeopt); |
- __ Move(dst, v0); |
- __ Subu(dst, dst, kHeapObjectTag); |
// Done. Put the value in dbl_scratch into the value of the allocated heap |
// number. |
__ bind(&done); |
__ sdc1(dbl_scratch, MemOperand(dst, HeapNumber::kValueOffset)); |
__ Addu(dst, dst, kHeapObjectTag); |
- __ StoreToSafepointRegisterSlot(dst, dst); |
} |