c59fc56d248ad99a672cb3dc53c691bc19080d6d
[platform/upstream/v8.git] / src / ppc / interface-descriptors-ppc.cc
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 #if V8_TARGET_ARCH_PPC
8
9 #include "src/interface-descriptors.h"
10
11 namespace v8 {
12 namespace internal {
13
14 const Register CallInterfaceDescriptor::ContextRegister() { return cp; }
15
16
17 const Register LoadDescriptor::ReceiverRegister() { return r4; }
18 const Register LoadDescriptor::NameRegister() { return r5; }
19 const Register LoadDescriptor::SlotRegister() { return r3; }
20
21
22 const Register LoadWithVectorDescriptor::VectorRegister() { return r6; }
23
24
25 const Register StoreDescriptor::ReceiverRegister() { return r4; }
26 const Register StoreDescriptor::NameRegister() { return r5; }
27 const Register StoreDescriptor::ValueRegister() { return r3; }
28
29
30 const Register VectorStoreICTrampolineDescriptor::SlotRegister() { return r7; }
31
32
33 const Register VectorStoreICDescriptor::VectorRegister() { return r6; }
34
35
36 const Register StoreTransitionDescriptor::MapRegister() { return r6; }
37
38
39 const Register LoadGlobalViaContextDescriptor::SlotRegister() { return r5; }
40
41
42 const Register StoreGlobalViaContextDescriptor::SlotRegister() { return r5; }
43 const Register StoreGlobalViaContextDescriptor::ValueRegister() { return r3; }
44
45
46 const Register InstanceofDescriptor::left() { return r3; }
47 const Register InstanceofDescriptor::right() { return r4; }
48
49
50 const Register ArgumentsAccessReadDescriptor::index() { return r4; }
51 const Register ArgumentsAccessReadDescriptor::parameter_count() { return r3; }
52
53
54 const Register ApiGetterDescriptor::function_address() { return r5; }
55
56
57 const Register MathPowTaggedDescriptor::exponent() { return r5; }
58
59
60 const Register MathPowIntegerDescriptor::exponent() {
61   return MathPowTaggedDescriptor::exponent();
62 }
63
64
65 const Register GrowArrayElementsDescriptor::ObjectRegister() { return r3; }
66 const Register GrowArrayElementsDescriptor::KeyRegister() { return r6; }
67
68
69 void StoreTransitionDescriptor::InitializePlatformSpecific(
70     CallInterfaceDescriptorData* data) {
71   Register registers[] = {ReceiverRegister(), NameRegister(), ValueRegister(),
72                           MapRegister()};
73   data->InitializePlatformSpecific(arraysize(registers), registers);
74 }
75
76
77 void FastNewClosureDescriptor::InitializePlatformSpecific(
78     CallInterfaceDescriptorData* data) {
79   Register registers[] = {r5};
80   data->InitializePlatformSpecific(arraysize(registers), registers);
81 }
82
83
84 void FastNewContextDescriptor::InitializePlatformSpecific(
85     CallInterfaceDescriptorData* data) {
86   Register registers[] = {r4};
87   data->InitializePlatformSpecific(arraysize(registers), registers);
88 }
89
90
91 void ToNumberDescriptor::InitializePlatformSpecific(
92     CallInterfaceDescriptorData* data) {
93   Register registers[] = {r3};
94   data->InitializePlatformSpecific(arraysize(registers), registers);
95 }
96
97
98 void NumberToStringDescriptor::InitializePlatformSpecific(
99     CallInterfaceDescriptorData* data) {
100   Register registers[] = {r3};
101   data->InitializePlatformSpecific(arraysize(registers), registers);
102 }
103
104
105 void TypeofDescriptor::InitializePlatformSpecific(
106     CallInterfaceDescriptorData* data) {
107   Register registers[] = {r6};
108   data->InitializePlatformSpecific(arraysize(registers), registers);
109 }
110
111
112 void FastCloneShallowArrayDescriptor::InitializePlatformSpecific(
113     CallInterfaceDescriptorData* data) {
114   Register registers[] = {r6, r5, r4};
115   data->InitializePlatformSpecific(arraysize(registers), registers);
116 }
117
118
119 void FastCloneShallowObjectDescriptor::InitializePlatformSpecific(
120     CallInterfaceDescriptorData* data) {
121   Register registers[] = {r6, r5, r4, r3};
122   data->InitializePlatformSpecific(arraysize(registers), registers);
123 }
124
125
126 void CreateAllocationSiteDescriptor::InitializePlatformSpecific(
127     CallInterfaceDescriptorData* data) {
128   Register registers[] = {r5, r6};
129   data->InitializePlatformSpecific(arraysize(registers), registers);
130 }
131
132
133 void CreateWeakCellDescriptor::InitializePlatformSpecific(
134     CallInterfaceDescriptorData* data) {
135   Register registers[] = {r5, r6, r4};
136   data->InitializePlatformSpecific(arraysize(registers), registers);
137 }
138
139
140 void StoreArrayLiteralElementDescriptor::InitializePlatformSpecific(
141     CallInterfaceDescriptorData* data) {
142   Register registers[] = {r6, r3};
143   data->InitializePlatformSpecific(arraysize(registers), registers);
144 }
145
146
147 void CallFunctionDescriptor::InitializePlatformSpecific(
148     CallInterfaceDescriptorData* data) {
149   Register registers[] = {r4};
150   data->InitializePlatformSpecific(arraysize(registers), registers);
151 }
152
153
154 void CallFunctionWithFeedbackDescriptor::InitializePlatformSpecific(
155     CallInterfaceDescriptorData* data) {
156   Register registers[] = {r4, r6};
157   data->InitializePlatformSpecific(arraysize(registers), registers);
158 }
159
160
161 void CallFunctionWithFeedbackAndVectorDescriptor::InitializePlatformSpecific(
162     CallInterfaceDescriptorData* data) {
163   Register registers[] = {r4, r6, r5};
164   data->InitializePlatformSpecific(arraysize(registers), registers);
165 }
166
167
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);
179 }
180
181
182 void RegExpConstructResultDescriptor::InitializePlatformSpecific(
183     CallInterfaceDescriptorData* data) {
184   Register registers[] = {r5, r4, r3};
185   data->InitializePlatformSpecific(arraysize(registers), registers);
186 }
187
188
189 void TransitionElementsKindDescriptor::InitializePlatformSpecific(
190     CallInterfaceDescriptorData* data) {
191   Register registers[] = {r3, r4};
192   data->InitializePlatformSpecific(arraysize(registers), registers);
193 }
194
195
196 void AllocateHeapNumberDescriptor::InitializePlatformSpecific(
197     CallInterfaceDescriptorData* data) {
198   data->InitializePlatformSpecific(0, nullptr, nullptr);
199 }
200
201
202 void ArrayConstructorConstantArgCountDescriptor::InitializePlatformSpecific(
203     CallInterfaceDescriptorData* data) {
204   // register state
205   // r3 -- number of arguments
206   // r4 -- function
207   // r5 -- allocation site with elements kind
208   Register registers[] = {r4, r5};
209   data->InitializePlatformSpecific(arraysize(registers), registers);
210 }
211
212
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);
218 }
219
220
221 void InternalArrayConstructorConstantArgCountDescriptor::
222     InitializePlatformSpecific(CallInterfaceDescriptorData* data) {
223   // register state
224   // r3 -- number of arguments
225   // r4 -- constructor function
226   Register registers[] = {r4};
227   data->InitializePlatformSpecific(arraysize(registers), registers);
228 }
229
230
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);
236 }
237
238
239 void CompareDescriptor::InitializePlatformSpecific(
240     CallInterfaceDescriptorData* data) {
241   Register registers[] = {r4, r3};
242   data->InitializePlatformSpecific(arraysize(registers), registers);
243 }
244
245
246 void CompareNilDescriptor::InitializePlatformSpecific(
247     CallInterfaceDescriptorData* data) {
248   Register registers[] = {r3};
249   data->InitializePlatformSpecific(arraysize(registers), registers);
250 }
251
252
253 void ToBooleanDescriptor::InitializePlatformSpecific(
254     CallInterfaceDescriptorData* data) {
255   Register registers[] = {r3};
256   data->InitializePlatformSpecific(arraysize(registers), registers);
257 }
258
259
260 void BinaryOpDescriptor::InitializePlatformSpecific(
261     CallInterfaceDescriptorData* data) {
262   Register registers[] = {r4, r3};
263   data->InitializePlatformSpecific(arraysize(registers), registers);
264 }
265
266
267 void BinaryOpWithAllocationSiteDescriptor::InitializePlatformSpecific(
268     CallInterfaceDescriptorData* data) {
269   Register registers[] = {r5, r4, r3};
270   data->InitializePlatformSpecific(arraysize(registers), registers);
271 }
272
273
274 void StringAddDescriptor::InitializePlatformSpecific(
275     CallInterfaceDescriptorData* data) {
276   Register registers[] = {r4, r3};
277   data->InitializePlatformSpecific(arraysize(registers), registers);
278 }
279
280
281 void KeyedDescriptor::InitializePlatformSpecific(
282     CallInterfaceDescriptorData* data) {
283   Register registers[] = {
284       r5,  // key
285   };
286   data->InitializePlatformSpecific(arraysize(registers), registers);
287 }
288
289
290 void NamedDescriptor::InitializePlatformSpecific(
291     CallInterfaceDescriptorData* data) {
292   Register registers[] = {
293       r5,  // name
294   };
295   data->InitializePlatformSpecific(arraysize(registers), registers);
296 }
297
298
299 void CallHandlerDescriptor::InitializePlatformSpecific(
300     CallInterfaceDescriptorData* data) {
301   Register registers[] = {
302       r3,  // receiver
303   };
304   data->InitializePlatformSpecific(arraysize(registers), registers);
305 }
306
307
308 void ArgumentAdaptorDescriptor::InitializePlatformSpecific(
309     CallInterfaceDescriptorData* data) {
310   Register registers[] = {
311       r4,  // JSFunction
312       r3,  // actual number of arguments
313       r5,  // expected number of arguments
314   };
315   data->InitializePlatformSpecific(arraysize(registers), registers);
316 }
317
318
319 void ApiFunctionDescriptor::InitializePlatformSpecific(
320     CallInterfaceDescriptorData* data) {
321   Register registers[] = {
322       r3,  // callee
323       r7,  // call_data
324       r5,  // holder
325       r4,  // api_function_address
326       r6,  // actual number of arguments
327   };
328   data->InitializePlatformSpecific(arraysize(registers), registers);
329 }
330
331
332 void ApiAccessorDescriptor::InitializePlatformSpecific(
333     CallInterfaceDescriptorData* data) {
334   Register registers[] = {
335       r3,  // callee
336       r7,  // call_data
337       r5,  // holder
338       r4,  // api_function_address
339   };
340   data->InitializePlatformSpecific(arraysize(registers), registers);
341 }
342
343
344 void MathRoundVariantCallFromUnoptimizedCodeDescriptor::
345     InitializePlatformSpecific(CallInterfaceDescriptorData* data) {
346   Register registers[] = {
347       r4,  // math rounding function
348       r6,  // vector slot id
349   };
350   data->InitializePlatformSpecific(arraysize(registers), registers);
351 }
352
353
354 void MathRoundVariantCallFromOptimizedCodeDescriptor::
355     InitializePlatformSpecific(CallInterfaceDescriptorData* data) {
356   Register registers[] = {
357       r4,  // math rounding function
358       r6,  // vector slot id
359       r7,  // type vector
360   };
361   data->InitializePlatformSpecific(arraysize(registers), registers);
362 }
363 }  // namespace internal
364 }  // namespace v8
365
366 #endif  // V8_TARGET_ARCH_PPC