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.
9 #include "src/interface-descriptors.h"
14 const Register CallInterfaceDescriptor::ContextRegister() { return cp; }
17 const Register LoadDescriptor::ReceiverRegister() { return r4; }
18 const Register LoadDescriptor::NameRegister() { return r5; }
19 const Register LoadDescriptor::SlotRegister() { return r3; }
22 const Register LoadWithVectorDescriptor::VectorRegister() { return r6; }
25 const Register StoreDescriptor::ReceiverRegister() { return r4; }
26 const Register StoreDescriptor::NameRegister() { return r5; }
27 const Register StoreDescriptor::ValueRegister() { return r3; }
30 const Register VectorStoreICTrampolineDescriptor::SlotRegister() { return r7; }
33 const Register VectorStoreICDescriptor::VectorRegister() { return r6; }
36 const Register StoreTransitionDescriptor::MapRegister() { return r6; }
39 const Register LoadGlobalViaContextDescriptor::SlotRegister() { return r5; }
42 const Register StoreGlobalViaContextDescriptor::SlotRegister() { return r5; }
43 const Register StoreGlobalViaContextDescriptor::ValueRegister() { return r3; }
46 const Register InstanceofDescriptor::left() { return r3; }
47 const Register InstanceofDescriptor::right() { return r4; }
50 const Register ArgumentsAccessReadDescriptor::index() { return r4; }
51 const Register ArgumentsAccessReadDescriptor::parameter_count() { return r3; }
54 const Register ApiGetterDescriptor::function_address() { return r5; }
57 const Register MathPowTaggedDescriptor::exponent() { return r5; }
60 const Register MathPowIntegerDescriptor::exponent() {
61 return MathPowTaggedDescriptor::exponent();
65 const Register GrowArrayElementsDescriptor::ObjectRegister() { return r3; }
66 const Register GrowArrayElementsDescriptor::KeyRegister() { return r6; }
69 void StoreTransitionDescriptor::InitializePlatformSpecific(
70 CallInterfaceDescriptorData* data) {
71 Register registers[] = {ReceiverRegister(), NameRegister(), ValueRegister(),
73 data->InitializePlatformSpecific(arraysize(registers), registers);
77 void FastNewClosureDescriptor::InitializePlatformSpecific(
78 CallInterfaceDescriptorData* data) {
79 Register registers[] = {r5};
80 data->InitializePlatformSpecific(arraysize(registers), registers);
84 void FastNewContextDescriptor::InitializePlatformSpecific(
85 CallInterfaceDescriptorData* data) {
86 Register registers[] = {r4};
87 data->InitializePlatformSpecific(arraysize(registers), registers);
91 void ToNumberDescriptor::InitializePlatformSpecific(
92 CallInterfaceDescriptorData* data) {
93 Register registers[] = {r3};
94 data->InitializePlatformSpecific(arraysize(registers), registers);
98 void NumberToStringDescriptor::InitializePlatformSpecific(
99 CallInterfaceDescriptorData* data) {
100 Register registers[] = {r3};
101 data->InitializePlatformSpecific(arraysize(registers), registers);
105 void TypeofDescriptor::InitializePlatformSpecific(
106 CallInterfaceDescriptorData* data) {
107 Register registers[] = {r6};
108 data->InitializePlatformSpecific(arraysize(registers), registers);
112 void FastCloneShallowArrayDescriptor::InitializePlatformSpecific(
113 CallInterfaceDescriptorData* data) {
114 Register registers[] = {r6, r5, r4};
115 data->InitializePlatformSpecific(arraysize(registers), registers);
119 void FastCloneShallowObjectDescriptor::InitializePlatformSpecific(
120 CallInterfaceDescriptorData* data) {
121 Register registers[] = {r6, r5, r4, r3};
122 data->InitializePlatformSpecific(arraysize(registers), registers);
126 void CreateAllocationSiteDescriptor::InitializePlatformSpecific(
127 CallInterfaceDescriptorData* data) {
128 Register registers[] = {r5, r6};
129 data->InitializePlatformSpecific(arraysize(registers), registers);
133 void CreateWeakCellDescriptor::InitializePlatformSpecific(
134 CallInterfaceDescriptorData* data) {
135 Register registers[] = {r5, r6, r4};
136 data->InitializePlatformSpecific(arraysize(registers), registers);
140 void StoreArrayLiteralElementDescriptor::InitializePlatformSpecific(
141 CallInterfaceDescriptorData* data) {
142 Register registers[] = {r6, r3};
143 data->InitializePlatformSpecific(arraysize(registers), registers);
147 void CallFunctionDescriptor::InitializePlatformSpecific(
148 CallInterfaceDescriptorData* data) {
149 Register registers[] = {r4};
150 data->InitializePlatformSpecific(arraysize(registers), registers);
154 void CallFunctionWithFeedbackDescriptor::InitializePlatformSpecific(
155 CallInterfaceDescriptorData* data) {
156 Register registers[] = {r4, r6};
157 data->InitializePlatformSpecific(arraysize(registers), registers);
161 void CallFunctionWithFeedbackAndVectorDescriptor::InitializePlatformSpecific(
162 CallInterfaceDescriptorData* data) {
163 Register registers[] = {r4, r6, r5};
164 data->InitializePlatformSpecific(arraysize(registers), registers);
168 void CallConstructDescriptor::InitializePlatformSpecific(
169 CallInterfaceDescriptorData* data) {
170 // r3 : number of arguments
171 // r4 : the function to call
172 // r5 : feedback vector
173 // r6 : slot in feedback vector (Smi, for RecordCallTarget)
174 // r7 : original constructor (for IsSuperConstructorCall)
175 // TODO(turbofan): So far we don't gather type feedback and hence skip the
176 // slot parameter, but ArrayConstructStub needs the vector to be undefined.
177 Register registers[] = {r3, r4, r7, r5};
178 data->InitializePlatformSpecific(arraysize(registers), registers);
182 void RegExpConstructResultDescriptor::InitializePlatformSpecific(
183 CallInterfaceDescriptorData* data) {
184 Register registers[] = {r5, r4, r3};
185 data->InitializePlatformSpecific(arraysize(registers), registers);
189 void TransitionElementsKindDescriptor::InitializePlatformSpecific(
190 CallInterfaceDescriptorData* data) {
191 Register registers[] = {r3, r4};
192 data->InitializePlatformSpecific(arraysize(registers), registers);
196 void AllocateHeapNumberDescriptor::InitializePlatformSpecific(
197 CallInterfaceDescriptorData* data) {
198 data->InitializePlatformSpecific(0, nullptr, nullptr);
202 void ArrayConstructorConstantArgCountDescriptor::InitializePlatformSpecific(
203 CallInterfaceDescriptorData* data) {
205 // r3 -- number of arguments
207 // r5 -- allocation site with elements kind
208 Register registers[] = {r4, r5};
209 data->InitializePlatformSpecific(arraysize(registers), registers);
213 void ArrayConstructorDescriptor::InitializePlatformSpecific(
214 CallInterfaceDescriptorData* data) {
215 // stack param count needs (constructor pointer, and single argument)
216 Register registers[] = {r4, r5, r3};
217 data->InitializePlatformSpecific(arraysize(registers), registers);
221 void InternalArrayConstructorConstantArgCountDescriptor::
222 InitializePlatformSpecific(CallInterfaceDescriptorData* data) {
224 // r3 -- number of arguments
225 // r4 -- constructor function
226 Register registers[] = {r4};
227 data->InitializePlatformSpecific(arraysize(registers), registers);
231 void InternalArrayConstructorDescriptor::InitializePlatformSpecific(
232 CallInterfaceDescriptorData* data) {
233 // stack param count needs (constructor pointer, and single argument)
234 Register registers[] = {r4, r3};
235 data->InitializePlatformSpecific(arraysize(registers), registers);
239 void CompareDescriptor::InitializePlatformSpecific(
240 CallInterfaceDescriptorData* data) {
241 Register registers[] = {r4, r3};
242 data->InitializePlatformSpecific(arraysize(registers), registers);
246 void CompareNilDescriptor::InitializePlatformSpecific(
247 CallInterfaceDescriptorData* data) {
248 Register registers[] = {r3};
249 data->InitializePlatformSpecific(arraysize(registers), registers);
253 void ToBooleanDescriptor::InitializePlatformSpecific(
254 CallInterfaceDescriptorData* data) {
255 Register registers[] = {r3};
256 data->InitializePlatformSpecific(arraysize(registers), registers);
260 void BinaryOpDescriptor::InitializePlatformSpecific(
261 CallInterfaceDescriptorData* data) {
262 Register registers[] = {r4, r3};
263 data->InitializePlatformSpecific(arraysize(registers), registers);
267 void BinaryOpWithAllocationSiteDescriptor::InitializePlatformSpecific(
268 CallInterfaceDescriptorData* data) {
269 Register registers[] = {r5, r4, r3};
270 data->InitializePlatformSpecific(arraysize(registers), registers);
274 void StringAddDescriptor::InitializePlatformSpecific(
275 CallInterfaceDescriptorData* data) {
276 Register registers[] = {r4, r3};
277 data->InitializePlatformSpecific(arraysize(registers), registers);
281 void KeyedDescriptor::InitializePlatformSpecific(
282 CallInterfaceDescriptorData* data) {
283 Register registers[] = {
286 data->InitializePlatformSpecific(arraysize(registers), registers);
290 void NamedDescriptor::InitializePlatformSpecific(
291 CallInterfaceDescriptorData* data) {
292 Register registers[] = {
295 data->InitializePlatformSpecific(arraysize(registers), registers);
299 void CallHandlerDescriptor::InitializePlatformSpecific(
300 CallInterfaceDescriptorData* data) {
301 Register registers[] = {
304 data->InitializePlatformSpecific(arraysize(registers), registers);
308 void ArgumentAdaptorDescriptor::InitializePlatformSpecific(
309 CallInterfaceDescriptorData* data) {
310 Register registers[] = {
312 r3, // actual number of arguments
313 r5, // expected number of arguments
315 data->InitializePlatformSpecific(arraysize(registers), registers);
319 void ApiFunctionDescriptor::InitializePlatformSpecific(
320 CallInterfaceDescriptorData* data) {
321 Register registers[] = {
325 r4, // api_function_address
326 r6, // actual number of arguments
328 data->InitializePlatformSpecific(arraysize(registers), registers);
332 void ApiAccessorDescriptor::InitializePlatformSpecific(
333 CallInterfaceDescriptorData* data) {
334 Register registers[] = {
338 r4, // api_function_address
340 data->InitializePlatformSpecific(arraysize(registers), registers);
344 void MathRoundVariantCallFromUnoptimizedCodeDescriptor::
345 InitializePlatformSpecific(CallInterfaceDescriptorData* data) {
346 Register registers[] = {
347 r4, // math rounding function
348 r6, // vector slot id
350 data->InitializePlatformSpecific(arraysize(registers), registers);
354 void MathRoundVariantCallFromOptimizedCodeDescriptor::
355 InitializePlatformSpecific(CallInterfaceDescriptorData* data) {
356 Register registers[] = {
357 r4, // math rounding function
358 r6, // vector slot id
361 data->InitializePlatformSpecific(arraysize(registers), registers);
363 } // namespace internal
366 #endif // V8_TARGET_ARCH_PPC