V8 API Reference, 7.2.502.16 (for Deno 0.2.4)
interface-descriptors-arm64.cc
1 // Copyright 2012 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 #if V8_TARGET_ARCH_ARM64
6 
7 #include "src/interface-descriptors.h"
8 #include "src/macro-assembler.h"
9 
10 namespace v8 {
11 namespace internal {
12 
13 const Register CallInterfaceDescriptor::ContextRegister() { return cp; }
14 
15 void CallInterfaceDescriptor::DefaultInitializePlatformSpecific(
16  CallInterfaceDescriptorData* data, int register_parameter_count) {
17  const Register default_stub_registers[] = {x0, x1, x2, x3, x4};
18  CHECK_LE(static_cast<size_t>(register_parameter_count),
19  arraysize(default_stub_registers));
20  data->InitializePlatformSpecific(register_parameter_count,
21  default_stub_registers);
22 }
23 
24 void RecordWriteDescriptor::InitializePlatformSpecific(
25  CallInterfaceDescriptorData* data) {
26  const Register default_stub_registers[] = {x0, x1, x2, x3, x4};
27 
28  data->RestrictAllocatableRegisters(default_stub_registers,
29  arraysize(default_stub_registers));
30 
31  CHECK_LE(static_cast<size_t>(kParameterCount),
32  arraysize(default_stub_registers));
33  data->InitializePlatformSpecific(kParameterCount, default_stub_registers);
34 }
35 
36 const Register FastNewFunctionContextDescriptor::ScopeInfoRegister() {
37  return x1;
38 }
39 const Register FastNewFunctionContextDescriptor::SlotsRegister() { return x0; }
40 
41 const Register LoadDescriptor::ReceiverRegister() { return x1; }
42 const Register LoadDescriptor::NameRegister() { return x2; }
43 const Register LoadDescriptor::SlotRegister() { return x0; }
44 
45 const Register LoadWithVectorDescriptor::VectorRegister() { return x3; }
46 
47 const Register StoreDescriptor::ReceiverRegister() { return x1; }
48 const Register StoreDescriptor::NameRegister() { return x2; }
49 const Register StoreDescriptor::ValueRegister() { return x0; }
50 const Register StoreDescriptor::SlotRegister() { return x4; }
51 
52 const Register StoreWithVectorDescriptor::VectorRegister() { return x3; }
53 
54 const Register StoreTransitionDescriptor::SlotRegister() { return x4; }
55 const Register StoreTransitionDescriptor::VectorRegister() { return x3; }
56 const Register StoreTransitionDescriptor::MapRegister() { return x5; }
57 
58 const Register ApiGetterDescriptor::HolderRegister() { return x0; }
59 const Register ApiGetterDescriptor::CallbackRegister() { return x3; }
60 
61 const Register GrowArrayElementsDescriptor::ObjectRegister() { return x0; }
62 const Register GrowArrayElementsDescriptor::KeyRegister() { return x3; }
63 
64 
65 // static
66 const Register TypeConversionDescriptor::ArgumentRegister() { return x0; }
67 
68 void TypeofDescriptor::InitializePlatformSpecific(
69  CallInterfaceDescriptorData* data) {
70  Register registers[] = {x3};
71  data->InitializePlatformSpecific(arraysize(registers), registers);
72 }
73 
74 void CallFunctionDescriptor::InitializePlatformSpecific(
75  CallInterfaceDescriptorData* data) {
76  // x1 function the function to call
77  Register registers[] = {x1};
78  data->InitializePlatformSpecific(arraysize(registers), registers);
79 }
80 
81 void CallTrampolineDescriptor::InitializePlatformSpecific(
82  CallInterfaceDescriptorData* data) {
83  // x1: target
84  // x0: number of arguments
85  Register registers[] = {x1, x0};
86  data->InitializePlatformSpecific(arraysize(registers), registers);
87 }
88 
89 void CallVarargsDescriptor::InitializePlatformSpecific(
90  CallInterfaceDescriptorData* data) {
91  // x0 : number of arguments (on the stack, not including receiver)
92  // x1 : the target to call
93  // x4 : arguments list length (untagged)
94  // x2 : arguments list (FixedArray)
95  Register registers[] = {x1, x0, x4, x2};
96  data->InitializePlatformSpecific(arraysize(registers), registers);
97 }
98 
99 void CallForwardVarargsDescriptor::InitializePlatformSpecific(
100  CallInterfaceDescriptorData* data) {
101  // x1: target
102  // x0: number of arguments
103  // x2: start index (to supported rest parameters)
104  Register registers[] = {x1, x0, x2};
105  data->InitializePlatformSpecific(arraysize(registers), registers);
106 }
107 
108 void CallWithSpreadDescriptor::InitializePlatformSpecific(
109  CallInterfaceDescriptorData* data) {
110  // x0 : number of arguments (on the stack, not including receiver)
111  // x1 : the target to call
112  // x2 : the object to spread
113  Register registers[] = {x1, x0, x2};
114  data->InitializePlatformSpecific(arraysize(registers), registers);
115 }
116 
117 void CallWithArrayLikeDescriptor::InitializePlatformSpecific(
118  CallInterfaceDescriptorData* data) {
119  // x1 : the target to call
120  // x2 : the arguments list
121  Register registers[] = {x1, x2};
122  data->InitializePlatformSpecific(arraysize(registers), registers);
123 }
124 
125 void ConstructVarargsDescriptor::InitializePlatformSpecific(
126  CallInterfaceDescriptorData* data) {
127  // x0 : number of arguments (on the stack, not including receiver)
128  // x1 : the target to call
129  // x3 : the new target
130  // x4 : arguments list length (untagged)
131  // x2 : arguments list (FixedArray)
132  Register registers[] = {x1, x3, x0, x4, x2};
133  data->InitializePlatformSpecific(arraysize(registers), registers);
134 }
135 
136 void ConstructForwardVarargsDescriptor::InitializePlatformSpecific(
137  CallInterfaceDescriptorData* data) {
138  // x3: new target
139  // x1: target
140  // x0: number of arguments
141  // x2: start index (to supported rest parameters)
142  Register registers[] = {x1, x3, x0, x2};
143  data->InitializePlatformSpecific(arraysize(registers), registers);
144 }
145 
146 void ConstructWithSpreadDescriptor::InitializePlatformSpecific(
147  CallInterfaceDescriptorData* data) {
148  // x0 : number of arguments (on the stack, not including receiver)
149  // x1 : the target to call
150  // x3 : the new target
151  // x2 : the object to spread
152  Register registers[] = {x1, x3, x0, x2};
153  data->InitializePlatformSpecific(arraysize(registers), registers);
154 }
155 
156 void ConstructWithArrayLikeDescriptor::InitializePlatformSpecific(
157  CallInterfaceDescriptorData* data) {
158  // x1 : the target to call
159  // x3 : the new target
160  // x2 : the arguments list
161  Register registers[] = {x1, x3, x2};
162  data->InitializePlatformSpecific(arraysize(registers), registers);
163 }
164 
165 void ConstructStubDescriptor::InitializePlatformSpecific(
166  CallInterfaceDescriptorData* data) {
167  // x3: new target
168  // x1: target
169  // x0: number of arguments
170  // x2: allocation site or undefined
171  Register registers[] = {x1, x3, x0, x2};
172  data->InitializePlatformSpecific(arraysize(registers), registers);
173 }
174 
175 void AbortDescriptor::InitializePlatformSpecific(
176  CallInterfaceDescriptorData* data) {
177  Register registers[] = {x1};
178  data->InitializePlatformSpecific(arraysize(registers), registers);
179 }
180 
181 void AllocateHeapNumberDescriptor::InitializePlatformSpecific(
182  CallInterfaceDescriptorData* data) {
183  data->InitializePlatformSpecific(0, nullptr);
184 }
185 
186 void CompareDescriptor::InitializePlatformSpecific(
187  CallInterfaceDescriptorData* data) {
188  // x1: left operand
189  // x0: right operand
190  Register registers[] = {x1, x0};
191  data->InitializePlatformSpecific(arraysize(registers), registers);
192 }
193 
194 void BinaryOpDescriptor::InitializePlatformSpecific(
195  CallInterfaceDescriptorData* data) {
196  // x1: left operand
197  // x0: right operand
198  Register registers[] = {x1, x0};
199  data->InitializePlatformSpecific(arraysize(registers), registers);
200 }
201 
202 void ArgumentsAdaptorDescriptor::InitializePlatformSpecific(
203  CallInterfaceDescriptorData* data) {
204  Register registers[] = {
205  x1, // JSFunction
206  x3, // the new target
207  x0, // actual number of arguments
208  x2, // expected number of arguments
209  };
210  data->InitializePlatformSpecific(arraysize(registers), registers);
211 }
212 
213 void ApiCallbackDescriptor::InitializePlatformSpecific(
214  CallInterfaceDescriptorData* data) {
215  Register registers[] = {
216  JavaScriptFrame::context_register(), // callee context
217  x4, // call_data
218  x2, // holder
219  x1, // api_function_address
220  };
221  data->InitializePlatformSpecific(arraysize(registers), registers);
222 }
223 
224 void InterpreterDispatchDescriptor::InitializePlatformSpecific(
225  CallInterfaceDescriptorData* data) {
226  Register registers[] = {
227  kInterpreterAccumulatorRegister, kInterpreterBytecodeOffsetRegister,
228  kInterpreterBytecodeArrayRegister, kInterpreterDispatchTableRegister};
229  data->InitializePlatformSpecific(arraysize(registers), registers);
230 }
231 
232 void InterpreterPushArgsThenCallDescriptor::InitializePlatformSpecific(
233  CallInterfaceDescriptorData* data) {
234  Register registers[] = {
235  x0, // argument count (not including receiver)
236  x2, // address of first argument
237  x1 // the target callable to be call
238  };
239  data->InitializePlatformSpecific(arraysize(registers), registers);
240 }
241 
242 void InterpreterPushArgsThenConstructDescriptor::InitializePlatformSpecific(
243  CallInterfaceDescriptorData* data) {
244  Register registers[] = {
245  x0, // argument count (not including receiver)
246  x4, // address of the first argument
247  x1, // constructor to call
248  x3, // new target
249  x2, // allocation site feedback if available, undefined otherwise
250  };
251  data->InitializePlatformSpecific(arraysize(registers), registers);
252 }
253 
254 void ResumeGeneratorDescriptor::InitializePlatformSpecific(
255  CallInterfaceDescriptorData* data) {
256  Register registers[] = {
257  x0, // the value to pass to the generator
258  x1 // the JSGeneratorObject to resume
259  };
260  data->InitializePlatformSpecific(arraysize(registers), registers);
261 }
262 
263 void FrameDropperTrampolineDescriptor::InitializePlatformSpecific(
264  CallInterfaceDescriptorData* data) {
265  Register registers[] = {
266  x1, // loaded new FP
267  };
268  data->InitializePlatformSpecific(arraysize(registers), registers);
269 }
270 
271 } // namespace internal
272 } // namespace v8
273 
274 #endif // V8_TARGET_ARCH_ARM64
Definition: libplatform.h:13