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 3735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3746 EnterExitFrameEpilogue(arg_stack_space, save_doubles); | 3746 EnterExitFrameEpilogue(arg_stack_space, save_doubles); |
3747 } | 3747 } |
3748 | 3748 |
3749 | 3749 |
3750 void MacroAssembler::EnterApiExitFrame(int arg_stack_space) { | 3750 void MacroAssembler::EnterApiExitFrame(int arg_stack_space) { |
3751 EnterExitFramePrologue(false); | 3751 EnterExitFramePrologue(false); |
3752 EnterExitFrameEpilogue(arg_stack_space, false); | 3752 EnterExitFrameEpilogue(arg_stack_space, false); |
3753 } | 3753 } |
3754 | 3754 |
3755 | 3755 |
3756 void MacroAssembler::LeaveExitFrame(bool save_doubles, bool pop_arguments) { | 3756 void MacroAssembler::LeaveExitFrame(bool save_doubles) { |
3757 // Registers: | 3757 // Registers: |
3758 // r15 : argv | 3758 // r15 : argv |
3759 if (save_doubles) { | 3759 if (save_doubles) { |
3760 int offset = -2 * kPointerSize; | 3760 int offset = -2 * kPointerSize; |
3761 for (int i = 0; i < XMMRegister::NumAllocatableRegisters(); i++) { | 3761 for (int i = 0; i < XMMRegister::NumAllocatableRegisters(); i++) { |
3762 XMMRegister reg = XMMRegister::FromAllocationIndex(i); | 3762 XMMRegister reg = XMMRegister::FromAllocationIndex(i); |
3763 movsd(reg, Operand(rbp, offset - ((i + 1) * kDoubleSize))); | 3763 movsd(reg, Operand(rbp, offset - ((i + 1) * kDoubleSize))); |
3764 } | 3764 } |
3765 } | 3765 } |
| 3766 // Get the return address from the stack and restore the frame pointer. |
| 3767 movp(rcx, Operand(rbp, kFPOnStackSize)); |
| 3768 movp(rbp, Operand(rbp, 0 * kPointerSize)); |
3766 | 3769 |
3767 if (pop_arguments) { | 3770 // Drop everything up to and including the arguments and the receiver |
3768 // Get the return address from the stack and restore the frame pointer. | 3771 // from the caller stack. |
3769 movp(rcx, Operand(rbp, kFPOnStackSize)); | 3772 leap(rsp, Operand(r15, 1 * kPointerSize)); |
3770 movp(rbp, Operand(rbp, 0 * kPointerSize)); | |
3771 | 3773 |
3772 // Drop everything up to and including the arguments and the receiver | 3774 PushReturnAddressFrom(rcx); |
3773 // from the caller stack. | |
3774 leap(rsp, Operand(r15, 1 * kPointerSize)); | |
3775 | |
3776 PushReturnAddressFrom(rcx); | |
3777 } else { | |
3778 // Otherwise just leave the exit frame. | |
3779 leave(); | |
3780 } | |
3781 | 3775 |
3782 LeaveExitFrameEpilogue(true); | 3776 LeaveExitFrameEpilogue(true); |
3783 } | 3777 } |
3784 | 3778 |
3785 | 3779 |
3786 void MacroAssembler::LeaveApiExitFrame(bool restore_context) { | 3780 void MacroAssembler::LeaveApiExitFrame(bool restore_context) { |
3787 movp(rsp, rbp); | 3781 movp(rsp, rbp); |
3788 popq(rbp); | 3782 popq(rbp); |
3789 | 3783 |
3790 LeaveExitFrameEpilogue(restore_context); | 3784 LeaveExitFrameEpilogue(restore_context); |
(...skipping 1204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4995 movl(rax, dividend); | 4989 movl(rax, dividend); |
4996 shrl(rax, Immediate(31)); | 4990 shrl(rax, Immediate(31)); |
4997 addl(rdx, rax); | 4991 addl(rdx, rax); |
4998 } | 4992 } |
4999 | 4993 |
5000 | 4994 |
5001 } // namespace internal | 4995 } // namespace internal |
5002 } // namespace v8 | 4996 } // namespace v8 |
5003 | 4997 |
5004 #endif // V8_TARGET_ARCH_X64 | 4998 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |