cbb59d3a1041f45d2e1cb14205c68baf124084bb
[platform/upstream/nodejs.git] / deps / v8 / src / compiler / mips / linkage-mips.cc
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/assembler.h"
6 #include "src/code-stubs.h"
7 #include "src/compiler/linkage.h"
8 #include "src/compiler/linkage-impl.h"
9 #include "src/zone.h"
10
11 namespace v8 {
12 namespace internal {
13 namespace compiler {
14
15 struct MipsLinkageHelperTraits {
16   static Register ReturnValueReg() { return v0; }
17   static Register ReturnValue2Reg() { return v1; }
18   static Register JSCallFunctionReg() { return a1; }
19   static Register ContextReg() { return cp; }
20   static Register RuntimeCallFunctionReg() { return a1; }
21   static Register RuntimeCallArgCountReg() { return a0; }
22   static RegList CCalleeSaveRegisters() {
23     return s0.bit() | s1.bit() | s2.bit() | s3.bit() | s4.bit() | s5.bit() |
24            s6.bit() | s7.bit();
25   }
26   static Register CRegisterParameter(int i) {
27     static Register register_parameters[] = {a0, a1, a2, a3};
28     return register_parameters[i];
29   }
30   static int CRegisterParametersLength() { return 4; }
31 };
32
33
34 typedef LinkageHelper<MipsLinkageHelperTraits> LH;
35
36 CallDescriptor* Linkage::GetJSCallDescriptor(Zone* zone, bool is_osr,
37                                              int parameter_count,
38                                              CallDescriptor::Flags flags) {
39   return LH::GetJSCallDescriptor(zone, is_osr, parameter_count, flags);
40 }
41
42
43 CallDescriptor* Linkage::GetRuntimeCallDescriptor(
44     Zone* zone, Runtime::FunctionId function, int parameter_count,
45     Operator::Properties properties) {
46   return LH::GetRuntimeCallDescriptor(zone, function, parameter_count,
47                                       properties);
48 }
49
50
51 CallDescriptor* Linkage::GetStubCallDescriptor(
52     Isolate* isolate, Zone* zone, const CallInterfaceDescriptor& descriptor,
53     int stack_parameter_count, CallDescriptor::Flags flags,
54     Operator::Properties properties) {
55   return LH::GetStubCallDescriptor(isolate, zone, descriptor,
56                                    stack_parameter_count, flags, properties);
57 }
58
59
60 CallDescriptor* Linkage::GetSimplifiedCDescriptor(Zone* zone,
61                                                   const MachineSignature* sig) {
62   return LH::GetSimplifiedCDescriptor(zone, sig);
63 }
64
65 }  // namespace compiler
66 }  // namespace internal
67 }  // namespace v8