OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "src/v8.h" |
| 6 |
| 7 #include "src/assembler.h" |
| 8 #include "src/code-stubs.h" |
| 9 #include "src/compiler/linkage.h" |
| 10 #include "src/compiler/linkage-impl.h" |
| 11 #include "src/zone.h" |
| 12 |
| 13 namespace v8 { |
| 14 namespace internal { |
| 15 namespace compiler { |
| 16 |
| 17 struct LinkageHelperTraits { |
| 18 static Register ReturnValueReg() { return rax; } |
| 19 static Register ReturnValue2Reg() { return rdx; } |
| 20 static Register JSCallFunctionReg() { return rdi; } |
| 21 static Register ContextReg() { return rsi; } |
| 22 static Register RuntimeCallFunctionReg() { return rbx; } |
| 23 static Register RuntimeCallArgCountReg() { return rax; } |
| 24 #ifdef _WIN64 |
| 25 static RegList CCalleeSaveRegisters() { |
| 26 return rbx.bit() | rdi.bit() | rsi.bit() | r12.bit() | r13.bit() | |
| 27 r14.bit() | r15.bit(); |
| 28 } |
| 29 static Register CRegisterParameter(int i) { |
| 30 static Register register_parameters[] = {rcx, rdx, r8, r9}; |
| 31 return register_parameters[i]; |
| 32 } |
| 33 static int CRegisterParametersLength() { return 4; } |
| 34 #else |
| 35 static RegList CCalleeSaveRegisters() { |
| 36 return rbx.bit() | r12.bit() | r13.bit() | r14.bit() | r15.bit(); |
| 37 } |
| 38 static Register CRegisterParameter(int i) { |
| 39 static Register register_parameters[] = {rdi, rsi, rdx, rcx, r8, r9}; |
| 40 return register_parameters[i]; |
| 41 } |
| 42 static int CRegisterParametersLength() { return 6; } |
| 43 #endif |
| 44 }; |
| 45 |
| 46 |
| 47 CallDescriptor* Linkage::GetJSCallDescriptor(int parameter_count, Zone* zone) { |
| 48 return LinkageHelper::GetJSCallDescriptor<LinkageHelperTraits>( |
| 49 zone, parameter_count); |
| 50 } |
| 51 |
| 52 |
| 53 CallDescriptor* Linkage::GetRuntimeCallDescriptor( |
| 54 Runtime::FunctionId function, int parameter_count, |
| 55 Operator::Property properties, |
| 56 CallDescriptor::DeoptimizationSupport can_deoptimize, Zone* zone) { |
| 57 return LinkageHelper::GetRuntimeCallDescriptor<LinkageHelperTraits>( |
| 58 zone, function, parameter_count, properties, can_deoptimize); |
| 59 } |
| 60 |
| 61 |
| 62 CallDescriptor* Linkage::GetStubCallDescriptor( |
| 63 CodeStubInterfaceDescriptor* descriptor, int stack_parameter_count) { |
| 64 return LinkageHelper::GetStubCallDescriptor<LinkageHelperTraits>( |
| 65 this->info_->zone(), descriptor, stack_parameter_count); |
| 66 } |
| 67 |
| 68 |
| 69 CallDescriptor* Linkage::GetSimplifiedCDescriptor( |
| 70 Zone* zone, int num_params, MachineRepresentation return_type, |
| 71 const MachineRepresentation* param_types) { |
| 72 return LinkageHelper::GetSimplifiedCDescriptor<LinkageHelperTraits>( |
| 73 zone, num_params, return_type, param_types); |
| 74 } |
| 75 } |
| 76 } |
| 77 } // namespace v8::internal::compiler |
OLD | NEW |