| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/base/bits.h" | 7 #include "src/base/bits.h" |
| 8 #include "src/base/division-by-constant.h" | 8 #include "src/base/division-by-constant.h" |
| 9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
| 10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
| (...skipping 3739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3750 EnterExitFrameEpilogue(arg_stack_space, save_doubles); | 3750 EnterExitFrameEpilogue(arg_stack_space, save_doubles); |
| 3751 } | 3751 } |
| 3752 | 3752 |
| 3753 | 3753 |
| 3754 void MacroAssembler::EnterApiExitFrame(int arg_stack_space) { | 3754 void MacroAssembler::EnterApiExitFrame(int arg_stack_space) { |
| 3755 EnterExitFramePrologue(false); | 3755 EnterExitFramePrologue(false); |
| 3756 EnterExitFrameEpilogue(arg_stack_space, false); | 3756 EnterExitFrameEpilogue(arg_stack_space, false); |
| 3757 } | 3757 } |
| 3758 | 3758 |
| 3759 | 3759 |
| 3760 void MacroAssembler::LeaveExitFrame(bool save_doubles) { | 3760 void MacroAssembler::LeaveExitFrame(bool save_doubles, bool pop_arguments) { |
| 3761 // Registers: | 3761 // Registers: |
| 3762 // r15 : argv | 3762 // r15 : argv |
| 3763 if (save_doubles) { | 3763 if (save_doubles) { |
| 3764 int offset = -2 * kPointerSize; | 3764 int offset = -2 * kPointerSize; |
| 3765 const RegisterConfiguration* config = RegisterConfiguration::ArchDefault(); | 3765 const RegisterConfiguration* config = RegisterConfiguration::ArchDefault(); |
| 3766 for (int i = 0; i < config->num_allocatable_double_registers(); ++i) { | 3766 for (int i = 0; i < config->num_allocatable_double_registers(); ++i) { |
| 3767 DoubleRegister reg = | 3767 DoubleRegister reg = |
| 3768 DoubleRegister::from_code(config->GetAllocatableDoubleCode(i)); | 3768 DoubleRegister::from_code(config->GetAllocatableDoubleCode(i)); |
| 3769 movsd(reg, Operand(rbp, offset - ((i + 1) * kDoubleSize))); | 3769 movsd(reg, Operand(rbp, offset - ((i + 1) * kDoubleSize))); |
| 3770 } | 3770 } |
| 3771 } | 3771 } |
| 3772 // Get the return address from the stack and restore the frame pointer. | |
| 3773 movp(rcx, Operand(rbp, kFPOnStackSize)); | |
| 3774 movp(rbp, Operand(rbp, 0 * kPointerSize)); | |
| 3775 | 3772 |
| 3776 // Drop everything up to and including the arguments and the receiver | 3773 if (pop_arguments) { |
| 3777 // from the caller stack. | 3774 // Get the return address from the stack and restore the frame pointer. |
| 3778 leap(rsp, Operand(r15, 1 * kPointerSize)); | 3775 movp(rcx, Operand(rbp, kFPOnStackSize)); |
| 3776 movp(rbp, Operand(rbp, 0 * kPointerSize)); |
| 3779 | 3777 |
| 3780 PushReturnAddressFrom(rcx); | 3778 // Drop everything up to and including the arguments and the receiver |
| 3779 // from the caller stack. |
| 3780 leap(rsp, Operand(r15, 1 * kPointerSize)); |
| 3781 |
| 3782 PushReturnAddressFrom(rcx); |
| 3783 } else { |
| 3784 // Otherwise just leave the exit frame. |
| 3785 leave(); |
| 3786 } |
| 3781 | 3787 |
| 3782 LeaveExitFrameEpilogue(true); | 3788 LeaveExitFrameEpilogue(true); |
| 3783 } | 3789 } |
| 3784 | 3790 |
| 3785 | 3791 |
| 3786 void MacroAssembler::LeaveApiExitFrame(bool restore_context) { | 3792 void MacroAssembler::LeaveApiExitFrame(bool restore_context) { |
| 3787 movp(rsp, rbp); | 3793 movp(rsp, rbp); |
| 3788 popq(rbp); | 3794 popq(rbp); |
| 3789 | 3795 |
| 3790 LeaveExitFrameEpilogue(restore_context); | 3796 LeaveExitFrameEpilogue(restore_context); |
| (...skipping 1204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4995 movl(rax, dividend); | 5001 movl(rax, dividend); |
| 4996 shrl(rax, Immediate(31)); | 5002 shrl(rax, Immediate(31)); |
| 4997 addl(rdx, rax); | 5003 addl(rdx, rax); |
| 4998 } | 5004 } |
| 4999 | 5005 |
| 5000 | 5006 |
| 5001 } // namespace internal | 5007 } // namespace internal |
| 5002 } // namespace v8 | 5008 } // namespace v8 |
| 5003 | 5009 |
| 5004 #endif // V8_TARGET_ARCH_X64 | 5010 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |