OLD | NEW |
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 struct LinkageHelperTraits { | 17 struct Arm64LinkageHelperTraits { |
18 static Register ReturnValueReg() { return x0; } | 18 static Register ReturnValueReg() { return x0; } |
19 static Register ReturnValue2Reg() { return x1; } | 19 static Register ReturnValue2Reg() { return x1; } |
20 static Register JSCallFunctionReg() { return x1; } | 20 static Register JSCallFunctionReg() { return x1; } |
21 static Register ContextReg() { return cp; } | 21 static Register ContextReg() { return cp; } |
22 static Register RuntimeCallFunctionReg() { return x1; } | 22 static Register RuntimeCallFunctionReg() { return x1; } |
23 static Register RuntimeCallArgCountReg() { return x0; } | 23 static Register RuntimeCallArgCountReg() { return x0; } |
24 static RegList CCalleeSaveRegisters() { | 24 static RegList CCalleeSaveRegisters() { |
25 // TODO(dcarney): correct callee saved registers. | 25 // TODO(dcarney): correct callee saved registers. |
26 return 0; | 26 return 0; |
27 } | 27 } |
28 static Register CRegisterParameter(int i) { | 28 static Register CRegisterParameter(int i) { |
29 static Register register_parameters[] = {x0, x1, x2, x3, x4, x5, x6, x7}; | 29 static Register register_parameters[] = {x0, x1, x2, x3, x4, x5, x6, x7}; |
30 return register_parameters[i]; | 30 return register_parameters[i]; |
31 } | 31 } |
32 static int CRegisterParametersLength() { return 8; } | 32 static int CRegisterParametersLength() { return 8; } |
33 }; | 33 }; |
34 | 34 |
35 | 35 |
| 36 typedef LinkageHelper<Arm64LinkageHelperTraits> LH; |
| 37 |
36 CallDescriptor* Linkage::GetJSCallDescriptor(int parameter_count, Zone* zone) { | 38 CallDescriptor* Linkage::GetJSCallDescriptor(int parameter_count, Zone* zone) { |
37 return LinkageHelper::GetJSCallDescriptor<LinkageHelperTraits>( | 39 return LH::GetJSCallDescriptor(zone, parameter_count); |
38 zone, parameter_count); | |
39 } | 40 } |
40 | 41 |
41 | 42 |
42 CallDescriptor* Linkage::GetRuntimeCallDescriptor( | 43 CallDescriptor* Linkage::GetRuntimeCallDescriptor( |
43 Runtime::FunctionId function, int parameter_count, | 44 Runtime::FunctionId function, int parameter_count, |
44 Operator::Properties properties, Zone* zone) { | 45 Operator::Properties properties, Zone* zone) { |
45 return LinkageHelper::GetRuntimeCallDescriptor<LinkageHelperTraits>( | 46 return LH::GetRuntimeCallDescriptor(zone, function, parameter_count, |
46 zone, function, parameter_count, properties); | 47 properties); |
47 } | 48 } |
48 | 49 |
49 | 50 |
50 CallDescriptor* Linkage::GetStubCallDescriptor( | 51 CallDescriptor* Linkage::GetStubCallDescriptor( |
51 CodeStubInterfaceDescriptor* descriptor, int stack_parameter_count, | 52 CodeStubInterfaceDescriptor* descriptor, int stack_parameter_count, |
52 CallDescriptor::Flags flags, Zone* zone) { | 53 CallDescriptor::Flags flags, Zone* zone) { |
53 return LinkageHelper::GetStubCallDescriptor<LinkageHelperTraits>( | 54 return LH::GetStubCallDescriptor(zone, descriptor, stack_parameter_count, |
54 zone, descriptor, stack_parameter_count, flags); | 55 flags); |
55 } | 56 } |
56 | 57 |
57 | 58 |
58 CallDescriptor* Linkage::GetSimplifiedCDescriptor( | 59 CallDescriptor* Linkage::GetSimplifiedCDescriptor(Zone* zone, |
59 Zone* zone, int num_params, MachineType return_type, | 60 MachineSignature* sig) { |
60 const MachineType* param_types) { | 61 return LH::GetSimplifiedCDescriptor(zone, sig); |
61 return LinkageHelper::GetSimplifiedCDescriptor<LinkageHelperTraits>( | |
62 zone, num_params, return_type, param_types); | |
63 } | 62 } |
64 | 63 |
65 } // namespace compiler | 64 } // namespace compiler |
66 } // namespace internal | 65 } // namespace internal |
67 } // namespace v8 | 66 } // namespace v8 |
OLD | NEW |