Index: src/crankshaft/arm64/lithium-codegen-arm64.cc |
diff --git a/src/crankshaft/arm64/lithium-codegen-arm64.cc b/src/crankshaft/arm64/lithium-codegen-arm64.cc |
index 9fe4f5231a2b3a9cbb4f4e576f1481c2734bf35d..ece3689a4f7b2e3bf8f9b553fbe51d7ea905d708 100644 |
--- a/src/crankshaft/arm64/lithium-codegen-arm64.cc |
+++ b/src/crankshaft/arm64/lithium-codegen-arm64.cc |
@@ -4195,12 +4195,10 @@ void LCodeGen::DoDeferredNumberTagD(LNumberTagD* instr) { |
__ Mov(result, 0); |
PushSafepointRegistersScope scope(this); |
- // NumberTagU 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. |
- __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
+ // Reset the context register. |
+ if (!result.is(cp)) { |
+ __ Mov(cp, 0); |
+ } |
__ CallRuntimeSaveDoubles(Runtime::kAllocateHeapNumber); |
RecordSafepointWithRegisters( |
instr->pointer_map(), 0, Safepoint::kNoLazyDeopt); |
@@ -4260,13 +4258,10 @@ void LCodeGen::DoDeferredNumberTagU(LInstruction* instr, |
{ |
// Preserve the value of all registers. |
PushSafepointRegistersScope scope(this); |
- |
- // NumberTagU 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. |
- __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
+ // Reset the context register. |
+ if (!dst.is(cp)) { |
+ __ Mov(cp, 0); |
+ } |
__ CallRuntimeSaveDoubles(Runtime::kAllocateHeapNumber); |
RecordSafepointWithRegisters( |
instr->pointer_map(), 0, Safepoint::kNoLazyDeopt); |