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

Side by Side Diff: src/compiler/x64/linkage-x64.cc

Issue 530783002: Convert Linkage to use MachineSignature. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebase. Created 6 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « src/compiler/x64/instruction-selector-x64.cc ('k') | src/objects.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/assembler.h" 7 #include "src/assembler.h"
8 #include "src/code-stubs.h" 8 #include "src/code-stubs.h"
9 #include "src/compiler/linkage.h" 9 #include "src/compiler/linkage.h"
10 #include "src/compiler/linkage-impl.h" 10 #include "src/compiler/linkage-impl.h"
11 #include "src/zone.h" 11 #include "src/zone.h"
12 12
13 namespace v8 { 13 namespace v8 {
14 namespace internal { 14 namespace internal {
15 namespace compiler { 15 namespace compiler {
16 16
17 #ifdef _WIN64 17 #ifdef _WIN64
18 const bool kWin64 = true; 18 const bool kWin64 = true;
19 #else 19 #else
20 const bool kWin64 = false; 20 const bool kWin64 = false;
21 #endif 21 #endif
22 22
23 struct LinkageHelperTraits { 23 struct X64LinkageHelperTraits {
24 static Register ReturnValueReg() { return rax; } 24 static Register ReturnValueReg() { return rax; }
25 static Register ReturnValue2Reg() { return rdx; } 25 static Register ReturnValue2Reg() { return rdx; }
26 static Register JSCallFunctionReg() { return rdi; } 26 static Register JSCallFunctionReg() { return rdi; }
27 static Register ContextReg() { return rsi; } 27 static Register ContextReg() { return rsi; }
28 static Register RuntimeCallFunctionReg() { return rbx; } 28 static Register RuntimeCallFunctionReg() { return rbx; }
29 static Register RuntimeCallArgCountReg() { return rax; } 29 static Register RuntimeCallArgCountReg() { return rax; }
30 static RegList CCalleeSaveRegisters() { 30 static RegList CCalleeSaveRegisters() {
31 if (kWin64) { 31 if (kWin64) {
32 return rbx.bit() | rdi.bit() | rsi.bit() | r12.bit() | r13.bit() | 32 return rbx.bit() | rdi.bit() | rsi.bit() | r12.bit() | r13.bit() |
33 r14.bit() | r15.bit(); 33 r14.bit() | r15.bit();
34 } else { 34 } else {
35 return rbx.bit() | r12.bit() | r13.bit() | r14.bit() | r15.bit(); 35 return rbx.bit() | r12.bit() | r13.bit() | r14.bit() | r15.bit();
36 } 36 }
37 } 37 }
38 static Register CRegisterParameter(int i) { 38 static Register CRegisterParameter(int i) {
39 if (kWin64) { 39 if (kWin64) {
40 static Register register_parameters[] = {rcx, rdx, r8, r9}; 40 static Register register_parameters[] = {rcx, rdx, r8, r9};
41 return register_parameters[i]; 41 return register_parameters[i];
42 } else { 42 } else {
43 static Register register_parameters[] = {rdi, rsi, rdx, rcx, r8, r9}; 43 static Register register_parameters[] = {rdi, rsi, rdx, rcx, r8, r9};
44 return register_parameters[i]; 44 return register_parameters[i];
45 } 45 }
46 } 46 }
47 static int CRegisterParametersLength() { return kWin64 ? 4 : 6; } 47 static int CRegisterParametersLength() { return kWin64 ? 4 : 6; }
48 }; 48 };
49 49
50 typedef LinkageHelper<X64LinkageHelperTraits> LH;
50 51
51 CallDescriptor* Linkage::GetJSCallDescriptor(int parameter_count, Zone* zone) { 52 CallDescriptor* Linkage::GetJSCallDescriptor(int parameter_count, Zone* zone) {
52 return LinkageHelper::GetJSCallDescriptor<LinkageHelperTraits>( 53 return LH::GetJSCallDescriptor(zone, parameter_count);
53 zone, parameter_count);
54 } 54 }
55 55
56 56
57 CallDescriptor* Linkage::GetRuntimeCallDescriptor( 57 CallDescriptor* Linkage::GetRuntimeCallDescriptor(
58 Runtime::FunctionId function, int parameter_count, 58 Runtime::FunctionId function, int parameter_count,
59 Operator::Properties properties, Zone* zone) { 59 Operator::Properties properties, Zone* zone) {
60 return LinkageHelper::GetRuntimeCallDescriptor<LinkageHelperTraits>( 60 return LH::GetRuntimeCallDescriptor(zone, function, parameter_count,
61 zone, function, parameter_count, properties); 61 properties);
62 } 62 }
63 63
64 64
65 CallDescriptor* Linkage::GetStubCallDescriptor( 65 CallDescriptor* Linkage::GetStubCallDescriptor(
66 CodeStubInterfaceDescriptor* descriptor, int stack_parameter_count, 66 CodeStubInterfaceDescriptor* descriptor, int stack_parameter_count,
67 CallDescriptor::Flags flags, Zone* zone) { 67 CallDescriptor::Flags flags, Zone* zone) {
68 return LinkageHelper::GetStubCallDescriptor<LinkageHelperTraits>( 68 return LH::GetStubCallDescriptor(zone, descriptor, stack_parameter_count,
69 zone, descriptor, stack_parameter_count, flags); 69 flags);
70 } 70 }
71 71
72 72
73 CallDescriptor* Linkage::GetSimplifiedCDescriptor( 73 CallDescriptor* Linkage::GetSimplifiedCDescriptor(Zone* zone,
74 Zone* zone, int num_params, MachineType return_type, 74 MachineSignature* sig) {
75 const MachineType* param_types) { 75 return LH::GetSimplifiedCDescriptor(zone, sig);
76 return LinkageHelper::GetSimplifiedCDescriptor<LinkageHelperTraits>(
77 zone, num_params, return_type, param_types);
78 } 76 }
79 77
80 } // namespace compiler 78 } // namespace compiler
81 } // namespace internal 79 } // namespace internal
82 } // namespace v8 80 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/x64/instruction-selector-x64.cc ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698