| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #if V8_TARGET_ARCH_X64 | 5 #if V8_TARGET_ARCH_X64 |
| 6 | 6 |
| 7 #include "src/crankshaft/x64/lithium-codegen-x64.h" | 7 #include "src/crankshaft/x64/lithium-codegen-x64.h" |
| 8 | 8 |
| 9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
| 10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
| (...skipping 4537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4548 // Slow case: Call the runtime system to do the number allocation. | 4548 // Slow case: Call the runtime system to do the number allocation. |
| 4549 __ bind(&slow); | 4549 __ bind(&slow); |
| 4550 { | 4550 { |
| 4551 // Put a valid pointer value in the stack slot where the result | 4551 // Put a valid pointer value in the stack slot where the result |
| 4552 // register is stored, as this register is in the pointer map, but contains | 4552 // register is stored, as this register is in the pointer map, but contains |
| 4553 // an integer value. | 4553 // an integer value. |
| 4554 __ Set(reg, 0); | 4554 __ Set(reg, 0); |
| 4555 | 4555 |
| 4556 // Preserve the value of all registers. | 4556 // Preserve the value of all registers. |
| 4557 PushSafepointRegistersScope scope(this); | 4557 PushSafepointRegistersScope scope(this); |
| 4558 | 4558 // Reset the context register. |
| 4559 // NumberTagIU uses the context from the frame, rather than | 4559 if (!reg.is(rsi)) { |
| 4560 // the environment's HContext or HInlinedContext value. | 4560 __ Set(rsi, 0); |
| 4561 // They only call Runtime::kAllocateHeapNumber. | 4561 } |
| 4562 // The corresponding HChange instructions are added in a phase that does | |
| 4563 // not have easy access to the local context. | |
| 4564 __ movp(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); | |
| 4565 __ CallRuntimeSaveDoubles(Runtime::kAllocateHeapNumber); | 4562 __ CallRuntimeSaveDoubles(Runtime::kAllocateHeapNumber); |
| 4566 RecordSafepointWithRegisters( | 4563 RecordSafepointWithRegisters( |
| 4567 instr->pointer_map(), 0, Safepoint::kNoLazyDeopt); | 4564 instr->pointer_map(), 0, Safepoint::kNoLazyDeopt); |
| 4568 __ StoreToSafepointRegisterSlot(reg, rax); | 4565 __ StoreToSafepointRegisterSlot(reg, rax); |
| 4569 } | 4566 } |
| 4570 | 4567 |
| 4571 // Done. Put the value in temp_xmm into the value of the allocated heap | 4568 // Done. Put the value in temp_xmm into the value of the allocated heap |
| 4572 // number. | 4569 // number. |
| 4573 __ bind(&done); | 4570 __ bind(&done); |
| 4574 __ Movsd(FieldOperand(reg, HeapNumber::kValueOffset), temp_xmm); | 4571 __ Movsd(FieldOperand(reg, HeapNumber::kValueOffset), temp_xmm); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 4604 | 4601 |
| 4605 void LCodeGen::DoDeferredNumberTagD(LNumberTagD* instr) { | 4602 void LCodeGen::DoDeferredNumberTagD(LNumberTagD* instr) { |
| 4606 // TODO(3095996): Get rid of this. For now, we need to make the | 4603 // TODO(3095996): Get rid of this. For now, we need to make the |
| 4607 // result register contain a valid pointer because it is already | 4604 // result register contain a valid pointer because it is already |
| 4608 // contained in the register pointer map. | 4605 // contained in the register pointer map. |
| 4609 Register reg = ToRegister(instr->result()); | 4606 Register reg = ToRegister(instr->result()); |
| 4610 __ Move(reg, Smi::FromInt(0)); | 4607 __ Move(reg, Smi::FromInt(0)); |
| 4611 | 4608 |
| 4612 { | 4609 { |
| 4613 PushSafepointRegistersScope scope(this); | 4610 PushSafepointRegistersScope scope(this); |
| 4614 // NumberTagD uses the context from the frame, rather than | 4611 // Reset the context register. |
| 4615 // the environment's HContext or HInlinedContext value. | 4612 if (!reg.is(rsi)) { |
| 4616 // They only call Runtime::kAllocateHeapNumber. | 4613 __ Move(rsi, 0); |
| 4617 // The corresponding HChange instructions are added in a phase that does | 4614 } |
| 4618 // not have easy access to the local context. | |
| 4619 __ movp(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); | |
| 4620 __ CallRuntimeSaveDoubles(Runtime::kAllocateHeapNumber); | 4615 __ CallRuntimeSaveDoubles(Runtime::kAllocateHeapNumber); |
| 4621 RecordSafepointWithRegisters( | 4616 RecordSafepointWithRegisters( |
| 4622 instr->pointer_map(), 0, Safepoint::kNoLazyDeopt); | 4617 instr->pointer_map(), 0, Safepoint::kNoLazyDeopt); |
| 4623 __ movp(kScratchRegister, rax); | 4618 __ movp(kScratchRegister, rax); |
| 4624 } | 4619 } |
| 4625 __ movp(reg, kScratchRegister); | 4620 __ movp(reg, kScratchRegister); |
| 4626 } | 4621 } |
| 4627 | 4622 |
| 4628 | 4623 |
| 4629 void LCodeGen::DoSmiTag(LSmiTag* instr) { | 4624 void LCodeGen::DoSmiTag(LSmiTag* instr) { |
| (...skipping 943 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5573 __ bind(deferred->exit()); | 5568 __ bind(deferred->exit()); |
| 5574 __ bind(&done); | 5569 __ bind(&done); |
| 5575 } | 5570 } |
| 5576 | 5571 |
| 5577 #undef __ | 5572 #undef __ |
| 5578 | 5573 |
| 5579 } // namespace internal | 5574 } // namespace internal |
| 5580 } // namespace v8 | 5575 } // namespace v8 |
| 5581 | 5576 |
| 5582 #endif // V8_TARGET_ARCH_X64 | 5577 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |