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 IA32LinkageHelperTraits {
ReturnValueRegv8::internal::compiler::IA32LinkageHelperTraits18 static Register ReturnValueReg() { return eax; }
ReturnValue2Regv8::internal::compiler::IA32LinkageHelperTraits19 static Register ReturnValue2Reg() { return edx; }
JSCallFunctionRegv8::internal::compiler::IA32LinkageHelperTraits20 static Register JSCallFunctionReg() { return edi; }
ContextRegv8::internal::compiler::IA32LinkageHelperTraits21 static Register ContextReg() { return esi; }
RuntimeCallFunctionRegv8::internal::compiler::IA32LinkageHelperTraits22 static Register RuntimeCallFunctionReg() { return ebx; }
RuntimeCallArgCountRegv8::internal::compiler::IA32LinkageHelperTraits23 static Register RuntimeCallArgCountReg() { return eax; }
CCalleeSaveRegistersv8::internal::compiler::IA32LinkageHelperTraits24 static RegList CCalleeSaveRegisters() {
25 return esi.bit() | edi.bit() | ebx.bit();
26 }
CRegisterParameterv8::internal::compiler::IA32LinkageHelperTraits27 static Register CRegisterParameter(int i) { return no_reg; }
CRegisterParametersLengthv8::internal::compiler::IA32LinkageHelperTraits28 static int CRegisterParametersLength() { return 0; }
29 };
30
31 typedef LinkageHelper<IA32LinkageHelperTraits> LH;
32
GetJSCallDescriptor(int parameter_count,Zone * zone)33 CallDescriptor* Linkage::GetJSCallDescriptor(int parameter_count, Zone* zone) {
34 return LH::GetJSCallDescriptor(zone, parameter_count);
35 }
36
37
GetRuntimeCallDescriptor(Runtime::FunctionId function,int parameter_count,Operator::Properties properties,Zone * zone)38 CallDescriptor* Linkage::GetRuntimeCallDescriptor(
39 Runtime::FunctionId function, int parameter_count,
40 Operator::Properties properties, Zone* zone) {
41 return LH::GetRuntimeCallDescriptor(zone, function, parameter_count,
42 properties);
43 }
44
45
GetStubCallDescriptor(CallInterfaceDescriptor descriptor,int stack_parameter_count,CallDescriptor::Flags flags,Zone * zone)46 CallDescriptor* Linkage::GetStubCallDescriptor(
47 CallInterfaceDescriptor descriptor, int stack_parameter_count,
48 CallDescriptor::Flags flags, Zone* zone) {
49 return LH::GetStubCallDescriptor(zone, descriptor, stack_parameter_count,
50 flags);
51 }
52
53
GetSimplifiedCDescriptor(Zone * zone,MachineSignature * sig)54 CallDescriptor* Linkage::GetSimplifiedCDescriptor(Zone* zone,
55 MachineSignature* sig) {
56 return LH::GetSimplifiedCDescriptor(zone, sig);
57 }
58
59 } // namespace compiler
60 } // namespace internal
61 } // namespace v8
62