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