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.
7 #if V8_TARGET_ARCH_ARM64
9 #include "src/interface-descriptors.h"
14 const Register CallInterfaceDescriptor::ContextRegister() { return cp; }
17 const Register LoadDescriptor::ReceiverRegister() { return x1; }
18 const Register LoadDescriptor::NameRegister() { return x2; }
19 const Register LoadDescriptor::SlotRegister() { return x0; }
22 const Register LoadWithVectorDescriptor::VectorRegister() { return x3; }
25 const Register StoreDescriptor::ReceiverRegister() { return x1; }
26 const Register StoreDescriptor::NameRegister() { return x2; }
27 const Register StoreDescriptor::ValueRegister() { return x0; }
30 const Register VectorStoreICTrampolineDescriptor::SlotRegister() { return x4; }
33 const Register VectorStoreICDescriptor::VectorRegister() { return x3; }
36 const Register StoreTransitionDescriptor::MapRegister() { return x3; }
39 const Register LoadGlobalViaContextDescriptor::DepthRegister() { return x1; }
40 const Register LoadGlobalViaContextDescriptor::SlotRegister() { return x2; }
41 const Register LoadGlobalViaContextDescriptor::NameRegister() { return x3; }
44 const Register StoreGlobalViaContextDescriptor::DepthRegister() { return x1; }
45 const Register StoreGlobalViaContextDescriptor::SlotRegister() { return x2; }
46 const Register StoreGlobalViaContextDescriptor::NameRegister() { return x3; }
47 const Register StoreGlobalViaContextDescriptor::ValueRegister() { return x0; }
50 const Register InstanceofDescriptor::left() {
51 // Object to check (instanceof lhs).
56 const Register InstanceofDescriptor::right() {
57 // Constructor function (instanceof rhs).
62 const Register ArgumentsAccessReadDescriptor::index() { return x1; }
63 const Register ArgumentsAccessReadDescriptor::parameter_count() { return x0; }
66 const Register ApiGetterDescriptor::function_address() { return x2; }
69 const Register MathPowTaggedDescriptor::exponent() { return x11; }
72 const Register MathPowIntegerDescriptor::exponent() { return x12; }
75 const Register GrowArrayElementsDescriptor::ObjectRegister() { return x0; }
76 const Register GrowArrayElementsDescriptor::KeyRegister() { return x3; }
79 void StoreTransitionDescriptor::InitializePlatformSpecific(
80 CallInterfaceDescriptorData* data) {
81 Register registers[] = {ReceiverRegister(), NameRegister(), ValueRegister(),
83 data->InitializePlatformSpecific(arraysize(registers), registers);
87 void FastNewClosureDescriptor::InitializePlatformSpecific(
88 CallInterfaceDescriptorData* data) {
90 Register registers[] = {x2};
91 data->InitializePlatformSpecific(arraysize(registers), registers);
95 void FastNewContextDescriptor::InitializePlatformSpecific(
96 CallInterfaceDescriptorData* data) {
98 Register registers[] = {x1};
99 data->InitializePlatformSpecific(arraysize(registers), registers);
103 void ToNumberDescriptor::InitializePlatformSpecific(
104 CallInterfaceDescriptorData* data) {
106 Register registers[] = {x0};
107 data->InitializePlatformSpecific(arraysize(registers), registers);
111 void NumberToStringDescriptor::InitializePlatformSpecific(
112 CallInterfaceDescriptorData* data) {
114 Register registers[] = {x0};
115 data->InitializePlatformSpecific(arraysize(registers), registers);
119 void TypeofDescriptor::InitializePlatformSpecific(
120 CallInterfaceDescriptorData* data) {
121 Register registers[] = {x3};
122 data->InitializePlatformSpecific(arraysize(registers), registers);
126 void FastCloneShallowArrayDescriptor::InitializePlatformSpecific(
127 CallInterfaceDescriptorData* data) {
128 // x3: array literals array
129 // x2: array literal index
130 // x1: constant elements
131 Register registers[] = {x3, x2, x1};
132 data->InitializePlatformSpecific(arraysize(registers), registers);
136 void FastCloneShallowObjectDescriptor::InitializePlatformSpecific(
137 CallInterfaceDescriptorData* data) {
138 // x3: object literals array
139 // x2: object literal index
140 // x1: constant properties
141 // x0: object literal flags
142 Register registers[] = {x3, x2, x1, x0};
143 data->InitializePlatformSpecific(arraysize(registers), registers);
147 void CreateAllocationSiteDescriptor::InitializePlatformSpecific(
148 CallInterfaceDescriptorData* data) {
149 // x2: feedback vector
150 // x3: call feedback slot
151 Register registers[] = {x2, x3};
152 data->InitializePlatformSpecific(arraysize(registers), registers);
156 void CreateWeakCellDescriptor::InitializePlatformSpecific(
157 CallInterfaceDescriptorData* data) {
158 // x2: feedback vector
159 // x3: call feedback slot
160 // x1: tagged value to put in the weak cell
161 Register registers[] = {x2, x3, x1};
162 data->InitializePlatformSpecific(arraysize(registers), registers);
166 void StoreArrayLiteralElementDescriptor::InitializePlatformSpecific(
167 CallInterfaceDescriptorData* data) {
168 Register registers[] = {x3, x0};
169 data->InitializePlatformSpecific(arraysize(registers), registers);
173 void CallFunctionDescriptor::InitializePlatformSpecific(
174 CallInterfaceDescriptorData* data) {
175 // x1 function the function to call
176 Register registers[] = {x1};
177 data->InitializePlatformSpecific(arraysize(registers), registers);
181 void CallFunctionWithFeedbackDescriptor::InitializePlatformSpecific(
182 CallInterfaceDescriptorData* data) {
183 Register registers[] = {x1, x3};
184 data->InitializePlatformSpecific(arraysize(registers), registers);
188 void CallFunctionWithFeedbackAndVectorDescriptor::InitializePlatformSpecific(
189 CallInterfaceDescriptorData* data) {
190 Register registers[] = {x1, x3, x2};
191 data->InitializePlatformSpecific(arraysize(registers), registers);
195 void CallConstructDescriptor::InitializePlatformSpecific(
196 CallInterfaceDescriptorData* data) {
197 // x0 : number of arguments
198 // x1 : the function to call
199 // x2 : feedback vector
200 // x3 : slot in feedback vector (Smi, for RecordCallTarget)
201 // x4 : original constructor (for IsSuperConstructorCall)
202 // TODO(turbofan): So far we don't gather type feedback and hence skip the
203 // slot parameter, but ArrayConstructStub needs the vector to be undefined.
204 Register registers[] = {x0, x1, x4, x2};
205 data->InitializePlatformSpecific(arraysize(registers), registers);
209 void RegExpConstructResultDescriptor::InitializePlatformSpecific(
210 CallInterfaceDescriptorData* data) {
212 // x1: index (of last match)
214 Register registers[] = {x2, x1, x0};
215 data->InitializePlatformSpecific(arraysize(registers), registers);
219 void TransitionElementsKindDescriptor::InitializePlatformSpecific(
220 CallInterfaceDescriptorData* data) {
221 // x0: value (js_array)
223 Register registers[] = {x0, x1};
224 data->InitializePlatformSpecific(arraysize(registers), registers);
228 void AllocateHeapNumberDescriptor::InitializePlatformSpecific(
229 CallInterfaceDescriptorData* data) {
230 data->InitializePlatformSpecific(0, nullptr, nullptr);
234 void ArrayConstructorConstantArgCountDescriptor::InitializePlatformSpecific(
235 CallInterfaceDescriptorData* data) {
237 // x2: allocation site with elements kind
238 // x0: number of arguments to the constructor function
239 Register registers[] = {x1, x2};
240 data->InitializePlatformSpecific(arraysize(registers), registers);
244 void ArrayConstructorDescriptor::InitializePlatformSpecific(
245 CallInterfaceDescriptorData* data) {
246 // stack param count needs (constructor pointer, and single argument)
247 Register registers[] = {x1, x2, x0};
248 data->InitializePlatformSpecific(arraysize(registers), registers);
252 void InternalArrayConstructorConstantArgCountDescriptor::
253 InitializePlatformSpecific(CallInterfaceDescriptorData* data) {
254 // x1: constructor function
255 // x0: number of arguments to the constructor function
256 Register registers[] = {x1};
257 data->InitializePlatformSpecific(arraysize(registers), registers);
261 void InternalArrayConstructorDescriptor::InitializePlatformSpecific(
262 CallInterfaceDescriptorData* data) {
263 // stack param count needs (constructor pointer, and single argument)
264 Register registers[] = {x1, x0};
265 data->InitializePlatformSpecific(arraysize(registers), registers);
269 void CompareDescriptor::InitializePlatformSpecific(
270 CallInterfaceDescriptorData* data) {
273 Register registers[] = {x1, x0};
274 data->InitializePlatformSpecific(arraysize(registers), registers);
278 void CompareNilDescriptor::InitializePlatformSpecific(
279 CallInterfaceDescriptorData* data) {
280 // x0: value to compare
281 Register registers[] = {x0};
282 data->InitializePlatformSpecific(arraysize(registers), registers);
286 void ToBooleanDescriptor::InitializePlatformSpecific(
287 CallInterfaceDescriptorData* data) {
289 Register registers[] = {x0};
290 data->InitializePlatformSpecific(arraysize(registers), registers);
294 void BinaryOpDescriptor::InitializePlatformSpecific(
295 CallInterfaceDescriptorData* data) {
298 Register registers[] = {x1, x0};
299 data->InitializePlatformSpecific(arraysize(registers), registers);
303 void BinaryOpWithAllocationSiteDescriptor::InitializePlatformSpecific(
304 CallInterfaceDescriptorData* data) {
305 // x2: allocation site
308 Register registers[] = {x2, x1, x0};
309 data->InitializePlatformSpecific(arraysize(registers), registers);
313 void StringAddDescriptor::InitializePlatformSpecific(
314 CallInterfaceDescriptorData* data) {
317 Register registers[] = {x1, x0};
318 data->InitializePlatformSpecific(arraysize(registers), registers);
322 void KeyedDescriptor::InitializePlatformSpecific(
323 CallInterfaceDescriptorData* data) {
324 static PlatformInterfaceDescriptor noInlineDescriptor =
325 PlatformInterfaceDescriptor(NEVER_INLINE_TARGET_ADDRESS);
327 Register registers[] = {
330 data->InitializePlatformSpecific(arraysize(registers), registers,
331 &noInlineDescriptor);
335 void NamedDescriptor::InitializePlatformSpecific(
336 CallInterfaceDescriptorData* data) {
337 static PlatformInterfaceDescriptor noInlineDescriptor =
338 PlatformInterfaceDescriptor(NEVER_INLINE_TARGET_ADDRESS);
340 Register registers[] = {
343 data->InitializePlatformSpecific(arraysize(registers), registers,
344 &noInlineDescriptor);
348 void CallHandlerDescriptor::InitializePlatformSpecific(
349 CallInterfaceDescriptorData* data) {
350 static PlatformInterfaceDescriptor default_descriptor =
351 PlatformInterfaceDescriptor(CAN_INLINE_TARGET_ADDRESS);
353 Register registers[] = {
356 data->InitializePlatformSpecific(arraysize(registers), registers,
357 &default_descriptor);
361 void ArgumentAdaptorDescriptor::InitializePlatformSpecific(
362 CallInterfaceDescriptorData* data) {
363 static PlatformInterfaceDescriptor default_descriptor =
364 PlatformInterfaceDescriptor(CAN_INLINE_TARGET_ADDRESS);
366 Register registers[] = {
368 x0, // actual number of arguments
369 x2, // expected number of arguments
371 data->InitializePlatformSpecific(arraysize(registers), registers,
372 &default_descriptor);
376 void ApiFunctionDescriptor::InitializePlatformSpecific(
377 CallInterfaceDescriptorData* data) {
378 static PlatformInterfaceDescriptor default_descriptor =
379 PlatformInterfaceDescriptor(CAN_INLINE_TARGET_ADDRESS);
381 Register registers[] = {
385 x1, // api_function_address
386 x3, // actual number of arguments
388 data->InitializePlatformSpecific(arraysize(registers), registers,
389 &default_descriptor);
393 void ApiAccessorDescriptor::InitializePlatformSpecific(
394 CallInterfaceDescriptorData* data) {
395 static PlatformInterfaceDescriptor default_descriptor =
396 PlatformInterfaceDescriptor(CAN_INLINE_TARGET_ADDRESS);
398 Register registers[] = {
402 x1, // api_function_address
404 data->InitializePlatformSpecific(arraysize(registers), registers,
405 &default_descriptor);
409 void MathRoundVariantCallFromUnoptimizedCodeDescriptor::
410 InitializePlatformSpecific(CallInterfaceDescriptorData* data) {
411 Register registers[] = {
412 x1, // math rounding function
413 x3, // vector slot id
415 data->InitializePlatformSpecific(arraysize(registers), registers);
419 void MathRoundVariantCallFromOptimizedCodeDescriptor::
420 InitializePlatformSpecific(CallInterfaceDescriptorData* data) {
421 Register registers[] = {
422 x1, // math rounding function
423 x3, // vector slot id
426 data->InitializePlatformSpecific(arraysize(registers), registers);
428 } // namespace internal
431 #endif // V8_TARGET_ARCH_ARM64