Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: src/x64/macro-assembler-x64.cc

Issue 1365073002: Revert of Remove register index/code indirection (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/x64/macro-assembler-x64.h ('k') | src/x87/assembler-x87.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "src/cpu-profiler.h" 11 #include "src/cpu-profiler.h"
12 #include "src/debug/debug.h" 12 #include "src/debug/debug.h"
13 #include "src/heap/heap.h" 13 #include "src/heap/heap.h"
14 #include "src/register-configuration.h"
15 #include "src/x64/assembler-x64.h" 14 #include "src/x64/assembler-x64.h"
16 #include "src/x64/macro-assembler-x64.h" 15 #include "src/x64/macro-assembler-x64.h"
17 16
18 namespace v8 { 17 namespace v8 {
19 namespace internal { 18 namespace internal {
20 19
21 MacroAssembler::MacroAssembler(Isolate* arg_isolate, void* buffer, int size) 20 MacroAssembler::MacroAssembler(Isolate* arg_isolate, void* buffer, int size)
22 : Assembler(arg_isolate, buffer, size), 21 : Assembler(arg_isolate, buffer, size),
23 generating_stub_(false), 22 generating_stub_(false),
24 has_frame_(false), 23 has_frame_(false),
(...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after
724 723
725 void MacroAssembler::GetBuiltinEntry(Register target, 724 void MacroAssembler::GetBuiltinEntry(Register target,
726 int native_context_index) { 725 int native_context_index) {
727 DCHECK(!target.is(rdi)); 726 DCHECK(!target.is(rdi));
728 // Load the JavaScript builtin function from the builtins object. 727 // Load the JavaScript builtin function from the builtins object.
729 GetBuiltinFunction(rdi, native_context_index); 728 GetBuiltinFunction(rdi, native_context_index);
730 movp(target, FieldOperand(rdi, JSFunction::kCodeEntryOffset)); 729 movp(target, FieldOperand(rdi, JSFunction::kCodeEntryOffset));
731 } 730 }
732 731
733 732
734 #define REG(Name) \ 733 #define REG(Name) { kRegister_ ## Name ## _Code }
735 { Register::kCode_##Name }
736 734
737 static const Register saved_regs[] = { 735 static const Register saved_regs[] = {
738 REG(rax), REG(rcx), REG(rdx), REG(rbx), REG(rbp), REG(rsi), REG(rdi), REG(r8), 736 REG(rax), REG(rcx), REG(rdx), REG(rbx), REG(rbp), REG(rsi), REG(rdi), REG(r8),
739 REG(r9), REG(r10), REG(r11) 737 REG(r9), REG(r10), REG(r11)
740 }; 738 };
741 739
742 #undef REG 740 #undef REG
743 741
744 static const int kNumberOfSavedRegs = sizeof(saved_regs) / sizeof(Register); 742 static const int kNumberOfSavedRegs = sizeof(saved_regs) / sizeof(Register);
745 743
(...skipping 2953 matching lines...) Expand 10 before | Expand all | Expand 10 after
3699 3697
3700 3698
3701 void MacroAssembler::EnterExitFrameEpilogue(int arg_stack_space, 3699 void MacroAssembler::EnterExitFrameEpilogue(int arg_stack_space,
3702 bool save_doubles) { 3700 bool save_doubles) {
3703 #ifdef _WIN64 3701 #ifdef _WIN64
3704 const int kShadowSpace = 4; 3702 const int kShadowSpace = 4;
3705 arg_stack_space += kShadowSpace; 3703 arg_stack_space += kShadowSpace;
3706 #endif 3704 #endif
3707 // Optionally save all XMM registers. 3705 // Optionally save all XMM registers.
3708 if (save_doubles) { 3706 if (save_doubles) {
3709 int space = XMMRegister::kMaxNumRegisters * kDoubleSize + 3707 int space = XMMRegister::kMaxNumAllocatableRegisters * kDoubleSize +
3710 arg_stack_space * kRegisterSize; 3708 arg_stack_space * kRegisterSize;
3711 subp(rsp, Immediate(space)); 3709 subp(rsp, Immediate(space));
3712 int offset = -2 * kPointerSize; 3710 int offset = -2 * kPointerSize;
3713 const RegisterConfiguration* config = RegisterConfiguration::ArchDefault(); 3711 for (int i = 0; i < XMMRegister::NumAllocatableRegisters(); i++) {
3714 for (int i = 0; i < config->num_allocatable_double_registers(); ++i) { 3712 XMMRegister reg = XMMRegister::FromAllocationIndex(i);
3715 DoubleRegister reg =
3716 DoubleRegister::from_code(config->GetAllocatableDoubleCode(i));
3717 movsd(Operand(rbp, offset - ((i + 1) * kDoubleSize)), reg); 3713 movsd(Operand(rbp, offset - ((i + 1) * kDoubleSize)), reg);
3718 } 3714 }
3719 } else if (arg_stack_space > 0) { 3715 } else if (arg_stack_space > 0) {
3720 subp(rsp, Immediate(arg_stack_space * kRegisterSize)); 3716 subp(rsp, Immediate(arg_stack_space * kRegisterSize));
3721 } 3717 }
3722 3718
3723 // Get the required frame alignment for the OS. 3719 // Get the required frame alignment for the OS.
3724 const int kFrameAlignment = base::OS::ActivationFrameAlignment(); 3720 const int kFrameAlignment = base::OS::ActivationFrameAlignment();
3725 if (kFrameAlignment > 0) { 3721 if (kFrameAlignment > 0) {
3726 DCHECK(base::bits::IsPowerOfTwo32(kFrameAlignment)); 3722 DCHECK(base::bits::IsPowerOfTwo32(kFrameAlignment));
(...skipping 22 matching lines...) Expand all
3749 EnterExitFramePrologue(false); 3745 EnterExitFramePrologue(false);
3750 EnterExitFrameEpilogue(arg_stack_space, false); 3746 EnterExitFrameEpilogue(arg_stack_space, false);
3751 } 3747 }
3752 3748
3753 3749
3754 void MacroAssembler::LeaveExitFrame(bool save_doubles) { 3750 void MacroAssembler::LeaveExitFrame(bool save_doubles) {
3755 // Registers: 3751 // Registers:
3756 // r15 : argv 3752 // r15 : argv
3757 if (save_doubles) { 3753 if (save_doubles) {
3758 int offset = -2 * kPointerSize; 3754 int offset = -2 * kPointerSize;
3759 const RegisterConfiguration* config = RegisterConfiguration::ArchDefault(); 3755 for (int i = 0; i < XMMRegister::NumAllocatableRegisters(); i++) {
3760 for (int i = 0; i < config->num_allocatable_double_registers(); ++i) { 3756 XMMRegister reg = XMMRegister::FromAllocationIndex(i);
3761 DoubleRegister reg =
3762 DoubleRegister::from_code(config->GetAllocatableDoubleCode(i));
3763 movsd(reg, Operand(rbp, offset - ((i + 1) * kDoubleSize))); 3757 movsd(reg, Operand(rbp, offset - ((i + 1) * kDoubleSize)));
3764 } 3758 }
3765 } 3759 }
3766 // Get the return address from the stack and restore the frame pointer. 3760 // Get the return address from the stack and restore the frame pointer.
3767 movp(rcx, Operand(rbp, kFPOnStackSize)); 3761 movp(rcx, Operand(rbp, kFPOnStackSize));
3768 movp(rbp, Operand(rbp, 0 * kPointerSize)); 3762 movp(rbp, Operand(rbp, 0 * kPointerSize));
3769 3763
3770 // Drop everything up to and including the arguments and the receiver 3764 // Drop everything up to and including the arguments and the receiver
3771 // from the caller stack. 3765 // from the caller stack.
3772 leap(rsp, Operand(r15, 1 * kPointerSize)); 3766 leap(rsp, Operand(r15, 1 * kPointerSize));
(...skipping 1216 matching lines...) Expand 10 before | Expand all | Expand 10 after
4989 movl(rax, dividend); 4983 movl(rax, dividend);
4990 shrl(rax, Immediate(31)); 4984 shrl(rax, Immediate(31));
4991 addl(rdx, rax); 4985 addl(rdx, rax);
4992 } 4986 }
4993 4987
4994 4988
4995 } // namespace internal 4989 } // namespace internal
4996 } // namespace v8 4990 } // namespace v8
4997 4991
4998 #endif // V8_TARGET_ARCH_X64 4992 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/macro-assembler-x64.h ('k') | src/x87/assembler-x87.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698