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.
9 #include "src/interface-descriptors.h"
14 const Register CallInterfaceDescriptor::ContextRegister() { return cp; }
17 const Register LoadDescriptor::ReceiverRegister() { return r1; }
18 const Register LoadDescriptor::NameRegister() { return r2; }
19 const Register LoadDescriptor::SlotRegister() { return r0; }
22 const Register LoadWithVectorDescriptor::VectorRegister() { return r3; }
25 const Register StoreDescriptor::ReceiverRegister() { return r1; }
26 const Register StoreDescriptor::NameRegister() { return r2; }
27 const Register StoreDescriptor::ValueRegister() { return r0; }
30 const Register VectorStoreICTrampolineDescriptor::SlotRegister() { return r4; }
33 const Register VectorStoreICDescriptor::VectorRegister() { return r3; }
36 const Register StoreTransitionDescriptor::MapRegister() { return r3; }
39 const Register LoadGlobalViaContextDescriptor::SlotRegister() { return r2; }
40 const Register LoadGlobalViaContextDescriptor::NameRegister() { return r3; }
43 const Register StoreGlobalViaContextDescriptor::SlotRegister() { return r2; }
44 const Register StoreGlobalViaContextDescriptor::NameRegister() { return r3; }
45 const Register StoreGlobalViaContextDescriptor::ValueRegister() { return r0; }
48 const Register InstanceofDescriptor::left() { return r0; }
49 const Register InstanceofDescriptor::right() { return r1; }
52 const Register ArgumentsAccessReadDescriptor::index() { return r1; }
53 const Register ArgumentsAccessReadDescriptor::parameter_count() { return r0; }
56 const Register ApiGetterDescriptor::function_address() { return r2; }
59 const Register MathPowTaggedDescriptor::exponent() { return r2; }
62 const Register MathPowIntegerDescriptor::exponent() {
63 return MathPowTaggedDescriptor::exponent();
67 const Register GrowArrayElementsDescriptor::ObjectRegister() { return r0; }
68 const Register GrowArrayElementsDescriptor::KeyRegister() { return r3; }
71 void StoreTransitionDescriptor::InitializePlatformSpecific(
72 CallInterfaceDescriptorData* data) {
73 Register registers[] = {ReceiverRegister(), NameRegister(), ValueRegister(),
75 data->InitializePlatformSpecific(arraysize(registers), registers);
79 void FastNewClosureDescriptor::InitializePlatformSpecific(
80 CallInterfaceDescriptorData* data) {
81 Register registers[] = {r2};
82 data->InitializePlatformSpecific(arraysize(registers), registers);
86 void FastNewContextDescriptor::InitializePlatformSpecific(
87 CallInterfaceDescriptorData* data) {
88 Register registers[] = {r1};
89 data->InitializePlatformSpecific(arraysize(registers), registers);
93 void ToNumberDescriptor::InitializePlatformSpecific(
94 CallInterfaceDescriptorData* data) {
95 Register registers[] = {r0};
96 data->InitializePlatformSpecific(arraysize(registers), registers);
100 void NumberToStringDescriptor::InitializePlatformSpecific(
101 CallInterfaceDescriptorData* data) {
102 Register registers[] = {r0};
103 data->InitializePlatformSpecific(arraysize(registers), registers);
107 void TypeofDescriptor::InitializePlatformSpecific(
108 CallInterfaceDescriptorData* data) {
109 Register registers[] = {r3};
110 data->InitializePlatformSpecific(arraysize(registers), registers);
114 void FastCloneShallowArrayDescriptor::InitializePlatformSpecific(
115 CallInterfaceDescriptorData* data) {
116 Register registers[] = {r3, r2, r1};
117 data->InitializePlatformSpecific(arraysize(registers), registers);
121 void FastCloneShallowObjectDescriptor::InitializePlatformSpecific(
122 CallInterfaceDescriptorData* data) {
123 Register registers[] = {r3, r2, r1, r0};
124 data->InitializePlatformSpecific(arraysize(registers), registers);
128 void CreateAllocationSiteDescriptor::InitializePlatformSpecific(
129 CallInterfaceDescriptorData* data) {
130 Register registers[] = {r2, r3};
131 data->InitializePlatformSpecific(arraysize(registers), registers);
135 void CreateWeakCellDescriptor::InitializePlatformSpecific(
136 CallInterfaceDescriptorData* data) {
137 Register registers[] = {r2, r3, r1};
138 data->InitializePlatformSpecific(arraysize(registers), registers);
142 void StoreArrayLiteralElementDescriptor::InitializePlatformSpecific(
143 CallInterfaceDescriptorData* data) {
144 Register registers[] = {r3, r0};
145 data->InitializePlatformSpecific(arraysize(registers), registers);
149 void CallFunctionDescriptor::InitializePlatformSpecific(
150 CallInterfaceDescriptorData* data) {
151 Register registers[] = {r1};
152 data->InitializePlatformSpecific(arraysize(registers), registers);
156 void CallFunctionWithFeedbackDescriptor::InitializePlatformSpecific(
157 CallInterfaceDescriptorData* data) {
158 Register registers[] = {r1, r3};
159 data->InitializePlatformSpecific(arraysize(registers), registers);
163 void CallFunctionWithFeedbackAndVectorDescriptor::InitializePlatformSpecific(
164 CallInterfaceDescriptorData* data) {
165 Register registers[] = {r1, r3, r2};
166 data->InitializePlatformSpecific(arraysize(registers), registers);
170 void CallConstructDescriptor::InitializePlatformSpecific(
171 CallInterfaceDescriptorData* data) {
172 // r0 : number of arguments
173 // r1 : the function to call
174 // r2 : feedback vector
175 // r3 : slot in feedback vector (Smi, for RecordCallTarget)
176 // r4 : original constructor (for IsSuperConstructorCall)
177 // TODO(turbofan): So far we don't gather type feedback and hence skip the
178 // slot parameter, but ArrayConstructStub needs the vector to be undefined.
179 Register registers[] = {r0, r1, r4, r2};
180 data->InitializePlatformSpecific(arraysize(registers), registers);
184 void RegExpConstructResultDescriptor::InitializePlatformSpecific(
185 CallInterfaceDescriptorData* data) {
186 Register registers[] = {r2, r1, r0};
187 data->InitializePlatformSpecific(arraysize(registers), registers);
191 void TransitionElementsKindDescriptor::InitializePlatformSpecific(
192 CallInterfaceDescriptorData* data) {
193 Register registers[] = {r0, r1};
194 data->InitializePlatformSpecific(arraysize(registers), registers);
198 void AllocateHeapNumberDescriptor::InitializePlatformSpecific(
199 CallInterfaceDescriptorData* data) {
200 data->InitializePlatformSpecific(0, nullptr, nullptr);
204 void ArrayConstructorConstantArgCountDescriptor::InitializePlatformSpecific(
205 CallInterfaceDescriptorData* data) {
207 // r0 -- number of arguments
209 // r2 -- allocation site with elements kind
210 Register registers[] = {r1, r2};
211 data->InitializePlatformSpecific(arraysize(registers), registers);
215 void ArrayConstructorDescriptor::InitializePlatformSpecific(
216 CallInterfaceDescriptorData* data) {
217 // stack param count needs (constructor pointer, and single argument)
218 Register registers[] = {r1, r2, r0};
219 data->InitializePlatformSpecific(arraysize(registers), registers);
223 void InternalArrayConstructorConstantArgCountDescriptor::
224 InitializePlatformSpecific(CallInterfaceDescriptorData* data) {
226 // r0 -- number of arguments
227 // r1 -- constructor function
228 Register registers[] = {r1};
229 data->InitializePlatformSpecific(arraysize(registers), registers);
233 void InternalArrayConstructorDescriptor::InitializePlatformSpecific(
234 CallInterfaceDescriptorData* data) {
235 // stack param count needs (constructor pointer, and single argument)
236 Register registers[] = {r1, r0};
237 data->InitializePlatformSpecific(arraysize(registers), registers);
241 void CompareDescriptor::InitializePlatformSpecific(
242 CallInterfaceDescriptorData* data) {
243 Register registers[] = {r1, r0};
244 data->InitializePlatformSpecific(arraysize(registers), registers);
248 void CompareNilDescriptor::InitializePlatformSpecific(
249 CallInterfaceDescriptorData* data) {
250 Register registers[] = {r0};
251 data->InitializePlatformSpecific(arraysize(registers), registers);
255 void ToBooleanDescriptor::InitializePlatformSpecific(
256 CallInterfaceDescriptorData* data) {
257 Register registers[] = {r0};
258 data->InitializePlatformSpecific(arraysize(registers), registers);
262 void BinaryOpDescriptor::InitializePlatformSpecific(
263 CallInterfaceDescriptorData* data) {
264 Register registers[] = {r1, r0};
265 data->InitializePlatformSpecific(arraysize(registers), registers);
269 void BinaryOpWithAllocationSiteDescriptor::InitializePlatformSpecific(
270 CallInterfaceDescriptorData* data) {
271 Register registers[] = {r2, r1, r0};
272 data->InitializePlatformSpecific(arraysize(registers), registers);
276 void StringAddDescriptor::InitializePlatformSpecific(
277 CallInterfaceDescriptorData* data) {
278 Register registers[] = {r1, r0};
279 data->InitializePlatformSpecific(arraysize(registers), registers);
283 void KeyedDescriptor::InitializePlatformSpecific(
284 CallInterfaceDescriptorData* data) {
285 static PlatformInterfaceDescriptor noInlineDescriptor =
286 PlatformInterfaceDescriptor(NEVER_INLINE_TARGET_ADDRESS);
288 Register registers[] = {
291 data->InitializePlatformSpecific(arraysize(registers), registers,
292 &noInlineDescriptor);
296 void NamedDescriptor::InitializePlatformSpecific(
297 CallInterfaceDescriptorData* data) {
298 static PlatformInterfaceDescriptor noInlineDescriptor =
299 PlatformInterfaceDescriptor(NEVER_INLINE_TARGET_ADDRESS);
301 Register registers[] = {
304 data->InitializePlatformSpecific(arraysize(registers), registers,
305 &noInlineDescriptor);
309 void CallHandlerDescriptor::InitializePlatformSpecific(
310 CallInterfaceDescriptorData* data) {
311 static PlatformInterfaceDescriptor default_descriptor =
312 PlatformInterfaceDescriptor(CAN_INLINE_TARGET_ADDRESS);
314 Register registers[] = {
317 data->InitializePlatformSpecific(arraysize(registers), registers,
318 &default_descriptor);
322 void ArgumentAdaptorDescriptor::InitializePlatformSpecific(
323 CallInterfaceDescriptorData* data) {
324 static PlatformInterfaceDescriptor default_descriptor =
325 PlatformInterfaceDescriptor(CAN_INLINE_TARGET_ADDRESS);
327 Register registers[] = {
329 r0, // actual number of arguments
330 r2, // expected number of arguments
332 data->InitializePlatformSpecific(arraysize(registers), registers,
333 &default_descriptor);
337 void ApiFunctionDescriptor::InitializePlatformSpecific(
338 CallInterfaceDescriptorData* data) {
339 static PlatformInterfaceDescriptor default_descriptor =
340 PlatformInterfaceDescriptor(CAN_INLINE_TARGET_ADDRESS);
342 Register registers[] = {
346 r1, // api_function_address
347 r3, // actual number of arguments
349 data->InitializePlatformSpecific(arraysize(registers), registers,
350 &default_descriptor);
354 void ApiAccessorDescriptor::InitializePlatformSpecific(
355 CallInterfaceDescriptorData* data) {
356 static PlatformInterfaceDescriptor default_descriptor =
357 PlatformInterfaceDescriptor(CAN_INLINE_TARGET_ADDRESS);
359 Register registers[] = {
363 r1, // api_function_address
365 data->InitializePlatformSpecific(arraysize(registers), registers,
366 &default_descriptor);
370 void MathRoundVariantCallFromUnoptimizedCodeDescriptor::
371 InitializePlatformSpecific(CallInterfaceDescriptorData* data) {
372 Register registers[] = {
373 r1, // math rounding function
374 r3, // vector slot id
376 data->InitializePlatformSpecific(arraysize(registers), registers);
380 void MathRoundVariantCallFromOptimizedCodeDescriptor::
381 InitializePlatformSpecific(CallInterfaceDescriptorData* data) {
382 Register registers[] = {
383 r1, // math rounding function
384 r3, // vector slot id
387 data->InitializePlatformSpecific(arraysize(registers), registers);
389 } // namespace internal
392 #endif // V8_TARGET_ARCH_ARM