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 ArmLinkageHelperTraits {
ReturnValueRegv8::internal::compiler::ArmLinkageHelperTraits18 static Register ReturnValueReg() { return r0; }
ReturnValue2Regv8::internal::compiler::ArmLinkageHelperTraits19 static Register ReturnValue2Reg() { return r1; }
JSCallFunctionRegv8::internal::compiler::ArmLinkageHelperTraits20 static Register JSCallFunctionReg() { return r1; }
ContextRegv8::internal::compiler::ArmLinkageHelperTraits21 static Register ContextReg() { return cp; }
RuntimeCallFunctionRegv8::internal::compiler::ArmLinkageHelperTraits22 static Register RuntimeCallFunctionReg() { return r1; }
RuntimeCallArgCountRegv8::internal::compiler::ArmLinkageHelperTraits23 static Register RuntimeCallArgCountReg() { return r0; }
CCalleeSaveRegistersv8::internal::compiler::ArmLinkageHelperTraits24 static RegList CCalleeSaveRegisters() {
25 return r4.bit() | r5.bit() | r6.bit() | r7.bit() | r8.bit() | r9.bit() |
26 r10.bit();
27 }
CRegisterParameterv8::internal::compiler::ArmLinkageHelperTraits28 static Register CRegisterParameter(int i) {
29 static Register register_parameters[] = {r0, r1, r2, r3};
30 return register_parameters[i];
31 }
CRegisterParametersLengthv8::internal::compiler::ArmLinkageHelperTraits32 static int CRegisterParametersLength() { return 4; }
33 };
34
35
36 typedef LinkageHelper<ArmLinkageHelperTraits> LH;
37
GetJSCallDescriptor(int parameter_count,Zone * zone)38 CallDescriptor* Linkage::GetJSCallDescriptor(int parameter_count, Zone* zone) {
39 return LH::GetJSCallDescriptor(zone, parameter_count);
40 }
41
42
GetRuntimeCallDescriptor(Runtime::FunctionId function,int parameter_count,Operator::Properties properties,Zone * zone)43 CallDescriptor* Linkage::GetRuntimeCallDescriptor(
44 Runtime::FunctionId function, int parameter_count,
45 Operator::Properties properties, Zone* zone) {
46 return LH::GetRuntimeCallDescriptor(zone, function, parameter_count,
47 properties);
48 }
49
50
GetStubCallDescriptor(CallInterfaceDescriptor descriptor,int stack_parameter_count,CallDescriptor::Flags flags,Zone * zone)51 CallDescriptor* Linkage::GetStubCallDescriptor(
52 CallInterfaceDescriptor descriptor, int stack_parameter_count,
53 CallDescriptor::Flags flags, Zone* zone) {
54 return LH::GetStubCallDescriptor(zone, descriptor, stack_parameter_count,
55 flags);
56 }
57
58
GetSimplifiedCDescriptor(Zone * zone,MachineSignature * sig)59 CallDescriptor* Linkage::GetSimplifiedCDescriptor(Zone* zone,
60 MachineSignature* sig) {
61 return LH::GetSimplifiedCDescriptor(zone, sig);
62 }
63
64 } // namespace compiler
65 } // namespace internal
66 } // namespace v8
67