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

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

Issue 1287383003: Re-reland: Remove register index/code indirection (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix MIPS tests again 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/debug/debug.h" 11 #include "src/debug/debug.h"
12 #include "src/heap/heap.h" 12 #include "src/heap/heap.h"
13 #include "src/register-configuration.h"
13 #include "src/x64/assembler-x64.h" 14 #include "src/x64/assembler-x64.h"
14 #include "src/x64/macro-assembler-x64.h" 15 #include "src/x64/macro-assembler-x64.h"
15 16
16 namespace v8 { 17 namespace v8 {
17 namespace internal { 18 namespace internal {
18 19
19 MacroAssembler::MacroAssembler(Isolate* arg_isolate, void* buffer, int size) 20 MacroAssembler::MacroAssembler(Isolate* arg_isolate, void* buffer, int size)
20 : Assembler(arg_isolate, buffer, size), 21 : Assembler(arg_isolate, buffer, size),
21 generating_stub_(false), 22 generating_stub_(false),
22 has_frame_(false), 23 has_frame_(false),
(...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after
722 723
723 void MacroAssembler::GetBuiltinEntry(Register target, 724 void MacroAssembler::GetBuiltinEntry(Register target,
724 int native_context_index) { 725 int native_context_index) {
725 DCHECK(!target.is(rdi)); 726 DCHECK(!target.is(rdi));
726 // Load the JavaScript builtin function from the builtins object. 727 // Load the JavaScript builtin function from the builtins object.
727 GetBuiltinFunction(rdi, native_context_index); 728 GetBuiltinFunction(rdi, native_context_index);
728 movp(target, FieldOperand(rdi, JSFunction::kCodeEntryOffset)); 729 movp(target, FieldOperand(rdi, JSFunction::kCodeEntryOffset));
729 } 730 }
730 731
731 732
732 #define REG(Name) { kRegister_ ## Name ## _Code } 733 #define REG(Name) \
734 { Register::kCode_##Name }
733 735
734 static const Register saved_regs[] = { 736 static const Register saved_regs[] = {
735 REG(rax), REG(rcx), REG(rdx), REG(rbx), REG(rbp), REG(rsi), REG(rdi), REG(r8), 737 REG(rax), REG(rcx), REG(rdx), REG(rbx), REG(rbp), REG(rsi), REG(rdi), REG(r8),
736 REG(r9), REG(r10), REG(r11) 738 REG(r9), REG(r10), REG(r11)
737 }; 739 };
738 740
739 #undef REG 741 #undef REG
740 742
741 static const int kNumberOfSavedRegs = sizeof(saved_regs) / sizeof(Register); 743 static const int kNumberOfSavedRegs = sizeof(saved_regs) / sizeof(Register);
742 744
(...skipping 2960 matching lines...) Expand 10 before | Expand all | Expand 10 after
3703 3705
3704 3706
3705 void MacroAssembler::EnterExitFrameEpilogue(int arg_stack_space, 3707 void MacroAssembler::EnterExitFrameEpilogue(int arg_stack_space,
3706 bool save_doubles) { 3708 bool save_doubles) {
3707 #ifdef _WIN64 3709 #ifdef _WIN64
3708 const int kShadowSpace = 4; 3710 const int kShadowSpace = 4;
3709 arg_stack_space += kShadowSpace; 3711 arg_stack_space += kShadowSpace;
3710 #endif 3712 #endif
3711 // Optionally save all XMM registers. 3713 // Optionally save all XMM registers.
3712 if (save_doubles) { 3714 if (save_doubles) {
3713 int space = XMMRegister::kMaxNumAllocatableRegisters * kDoubleSize + 3715 int space = XMMRegister::kMaxNumRegisters * kDoubleSize +
3714 arg_stack_space * kRegisterSize; 3716 arg_stack_space * kRegisterSize;
3715 subp(rsp, Immediate(space)); 3717 subp(rsp, Immediate(space));
3716 int offset = -2 * kPointerSize; 3718 int offset = -2 * kPointerSize;
3717 for (int i = 0; i < XMMRegister::NumAllocatableRegisters(); i++) { 3719 const RegisterConfiguration* config = RegisterConfiguration::ArchDefault();
3718 XMMRegister reg = XMMRegister::FromAllocationIndex(i); 3720 for (int i = 0; i < config->num_allocatable_double_registers(); ++i) {
3721 DoubleRegister reg =
3722 DoubleRegister::from_code(config->GetAllocatableDoubleCode(i));
3719 movsd(Operand(rbp, offset - ((i + 1) * kDoubleSize)), reg); 3723 movsd(Operand(rbp, offset - ((i + 1) * kDoubleSize)), reg);
3720 } 3724 }
3721 } else if (arg_stack_space > 0) { 3725 } else if (arg_stack_space > 0) {
3722 subp(rsp, Immediate(arg_stack_space * kRegisterSize)); 3726 subp(rsp, Immediate(arg_stack_space * kRegisterSize));
3723 } 3727 }
3724 3728
3725 // Get the required frame alignment for the OS. 3729 // Get the required frame alignment for the OS.
3726 const int kFrameAlignment = base::OS::ActivationFrameAlignment(); 3730 const int kFrameAlignment = base::OS::ActivationFrameAlignment();
3727 if (kFrameAlignment > 0) { 3731 if (kFrameAlignment > 0) {
3728 DCHECK(base::bits::IsPowerOfTwo32(kFrameAlignment)); 3732 DCHECK(base::bits::IsPowerOfTwo32(kFrameAlignment));
(...skipping 22 matching lines...) Expand all
3751 EnterExitFramePrologue(false); 3755 EnterExitFramePrologue(false);
3752 EnterExitFrameEpilogue(arg_stack_space, false); 3756 EnterExitFrameEpilogue(arg_stack_space, false);
3753 } 3757 }
3754 3758
3755 3759
3756 void MacroAssembler::LeaveExitFrame(bool save_doubles) { 3760 void MacroAssembler::LeaveExitFrame(bool save_doubles) {
3757 // Registers: 3761 // Registers:
3758 // r15 : argv 3762 // r15 : argv
3759 if (save_doubles) { 3763 if (save_doubles) {
3760 int offset = -2 * kPointerSize; 3764 int offset = -2 * kPointerSize;
3761 for (int i = 0; i < XMMRegister::NumAllocatableRegisters(); i++) { 3765 const RegisterConfiguration* config = RegisterConfiguration::ArchDefault();
3762 XMMRegister reg = XMMRegister::FromAllocationIndex(i); 3766 for (int i = 0; i < config->num_allocatable_double_registers(); ++i) {
3767 DoubleRegister reg =
3768 DoubleRegister::from_code(config->GetAllocatableDoubleCode(i));
3763 movsd(reg, Operand(rbp, offset - ((i + 1) * kDoubleSize))); 3769 movsd(reg, Operand(rbp, offset - ((i + 1) * kDoubleSize)));
3764 } 3770 }
3765 } 3771 }
3766 // Get the return address from the stack and restore the frame pointer. 3772 // Get the return address from the stack and restore the frame pointer.
3767 movp(rcx, Operand(rbp, kFPOnStackSize)); 3773 movp(rcx, Operand(rbp, kFPOnStackSize));
3768 movp(rbp, Operand(rbp, 0 * kPointerSize)); 3774 movp(rbp, Operand(rbp, 0 * kPointerSize));
3769 3775
3770 // Drop everything up to and including the arguments and the receiver 3776 // Drop everything up to and including the arguments and the receiver
3771 // from the caller stack. 3777 // from the caller stack.
3772 leap(rsp, Operand(r15, 1 * kPointerSize)); 3778 leap(rsp, Operand(r15, 1 * kPointerSize));
(...skipping 1216 matching lines...) Expand 10 before | Expand all | Expand 10 after
4989 movl(rax, dividend); 4995 movl(rax, dividend);
4990 shrl(rax, Immediate(31)); 4996 shrl(rax, Immediate(31));
4991 addl(rdx, rax); 4997 addl(rdx, rax);
4992 } 4998 }
4993 4999
4994 5000
4995 } // namespace internal 5001 } // namespace internal
4996 } // namespace v8 5002 } // namespace v8
4997 5003
4998 #endif // V8_TARGET_ARCH_X64 5004 #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