deps: update v8 to 4.3.61.21
[platform/upstream/nodejs.git] / deps / v8 / src / arm64 / 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 #include "src/v8.h"
6
7 #if V8_TARGET_ARCH_ARM64
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 x1; }
18 const Register LoadDescriptor::NameRegister() { return x2; }
19
20
21 const Register VectorLoadICTrampolineDescriptor::SlotRegister() { return x0; }
22
23
24 const Register VectorLoadICDescriptor::VectorRegister() { return x3; }
25
26
27 const Register StoreDescriptor::ReceiverRegister() { return x1; }
28 const Register StoreDescriptor::NameRegister() { return x2; }
29 const Register StoreDescriptor::ValueRegister() { return x0; }
30
31
32 const Register StoreTransitionDescriptor::MapRegister() { return x3; }
33
34
35 const Register ElementTransitionAndStoreDescriptor::MapRegister() { return x3; }
36
37
38 const Register InstanceofDescriptor::left() {
39   // Object to check (instanceof lhs).
40   return x11;
41 }
42
43
44 const Register InstanceofDescriptor::right() {
45   // Constructor function (instanceof rhs).
46   return x10;
47 }
48
49
50 const Register ArgumentsAccessReadDescriptor::index() { return x1; }
51 const Register ArgumentsAccessReadDescriptor::parameter_count() { return x0; }
52
53
54 const Register ApiGetterDescriptor::function_address() { return x2; }
55
56
57 const Register MathPowTaggedDescriptor::exponent() { return x11; }
58
59
60 const Register MathPowIntegerDescriptor::exponent() { return x12; }
61
62
63 void FastNewClosureDescriptor::Initialize(CallInterfaceDescriptorData* data) {
64   // cp: context
65   // x2: function info
66   Register registers[] = {cp, x2};
67   data->Initialize(arraysize(registers), registers, NULL);
68 }
69
70
71 void FastNewContextDescriptor::Initialize(CallInterfaceDescriptorData* data) {
72   // cp: context
73   // x1: function
74   Register registers[] = {cp, x1};
75   data->Initialize(arraysize(registers), registers, NULL);
76 }
77
78
79 void ToNumberDescriptor::Initialize(CallInterfaceDescriptorData* data) {
80   // cp: context
81   // x0: value
82   Register registers[] = {cp, x0};
83   data->Initialize(arraysize(registers), registers, NULL);
84 }
85
86
87 void NumberToStringDescriptor::Initialize(CallInterfaceDescriptorData* data) {
88   // cp: context
89   // x0: value
90   Register registers[] = {cp, x0};
91   data->Initialize(arraysize(registers), registers, NULL);
92 }
93
94
95 void FastCloneShallowArrayDescriptor::Initialize(
96     CallInterfaceDescriptorData* data) {
97   // cp: context
98   // x3: array literals array
99   // x2: array literal index
100   // x1: constant elements
101   Register registers[] = {cp, x3, x2, x1};
102   Representation representations[] = {
103       Representation::Tagged(), Representation::Tagged(), Representation::Smi(),
104       Representation::Tagged()};
105   data->Initialize(arraysize(registers), registers, representations);
106 }
107
108
109 void FastCloneShallowObjectDescriptor::Initialize(
110     CallInterfaceDescriptorData* data) {
111   // cp: context
112   // x3: object literals array
113   // x2: object literal index
114   // x1: constant properties
115   // x0: object literal flags
116   Register registers[] = {cp, x3, x2, x1, x0};
117   data->Initialize(arraysize(registers), registers, NULL);
118 }
119
120
121 void CreateAllocationSiteDescriptor::Initialize(
122     CallInterfaceDescriptorData* data) {
123   // cp: context
124   // x2: feedback vector
125   // x3: call feedback slot
126   Register registers[] = {cp, x2, x3};
127   Representation representations[] = {Representation::Tagged(),
128                                       Representation::Tagged(),
129                                       Representation::Smi()};
130   data->Initialize(arraysize(registers), registers, representations);
131 }
132
133
134 void CreateWeakCellDescriptor::Initialize(CallInterfaceDescriptorData* data) {
135   // cp: context
136   // x2: feedback vector
137   // x3: call feedback slot
138   // x1: tagged value to put in the weak cell
139   Register registers[] = {cp, x2, x3, x1};
140   Representation representations[] = {
141       Representation::Tagged(), Representation::Tagged(), Representation::Smi(),
142       Representation::Tagged()};
143   data->Initialize(arraysize(registers), registers, representations);
144 }
145
146
147 void StoreArrayLiteralElementDescriptor::Initialize(
148     CallInterfaceDescriptorData* data) {
149   Register registers[] = {cp, x3, x0};
150   data->Initialize(arraysize(registers), registers, NULL);
151 }
152
153
154 void CallFunctionDescriptor::Initialize(CallInterfaceDescriptorData* data) {
155   // x1  function    the function to call
156   Register registers[] = {cp, x1};
157   data->Initialize(arraysize(registers), registers, NULL);
158 }
159
160
161 void CallFunctionWithFeedbackDescriptor::Initialize(
162     CallInterfaceDescriptorData* data) {
163   Register registers[] = {cp, x1, x3};
164   Representation representations[] = {Representation::Tagged(),
165                                       Representation::Tagged(),
166                                       Representation::Smi()};
167   data->Initialize(arraysize(registers), registers, representations);
168 }
169
170
171 void CallFunctionWithFeedbackAndVectorDescriptor::Initialize(
172     CallInterfaceDescriptorData* data) {
173   Register registers[] = {cp, x1, x3, x2};
174   Representation representations[] = {
175       Representation::Tagged(), Representation::Tagged(), Representation::Smi(),
176       Representation::Tagged()};
177   data->Initialize(arraysize(registers), registers, representations);
178 }
179
180
181 void CallConstructDescriptor::Initialize(CallInterfaceDescriptorData* data) {
182   // x0 : number of arguments
183   // x1 : the function to call
184   // x2 : feedback vector
185   // x3 : slot in feedback vector (smi) (if r2 is not the megamorphic symbol)
186   // TODO(turbofan): So far we don't gather type feedback and hence skip the
187   // slot parameter, but ArrayConstructStub needs the vector to be undefined.
188   Register registers[] = {cp, x0, x1, x2};
189   data->Initialize(arraysize(registers), registers, NULL);
190 }
191
192
193 void RegExpConstructResultDescriptor::Initialize(
194     CallInterfaceDescriptorData* data) {
195   // cp: context
196   // x2: length
197   // x1: index (of last match)
198   // x0: string
199   Register registers[] = {cp, x2, x1, x0};
200   data->Initialize(arraysize(registers), registers, NULL);
201 }
202
203
204 void TransitionElementsKindDescriptor::Initialize(
205     CallInterfaceDescriptorData* data) {
206   // cp: context
207   // x0: value (js_array)
208   // x1: to_map
209   Register registers[] = {cp, x0, x1};
210   data->Initialize(arraysize(registers), registers, NULL);
211 }
212
213
214 void AllocateHeapNumberDescriptor::Initialize(
215     CallInterfaceDescriptorData* data) {
216   // cp: context
217   Register registers[] = {cp};
218   data->Initialize(arraysize(registers), registers, nullptr);
219 }
220
221
222 void ArrayConstructorConstantArgCountDescriptor::Initialize(
223     CallInterfaceDescriptorData* data) {
224   // cp: context
225   // x1: function
226   // x2: allocation site with elements kind
227   // x0: number of arguments to the constructor function
228   Register registers[] = {cp, x1, x2};
229   data->Initialize(arraysize(registers), registers, NULL);
230 }
231
232
233 void ArrayConstructorDescriptor::Initialize(CallInterfaceDescriptorData* data) {
234   // stack param count needs (constructor pointer, and single argument)
235   Register registers[] = {cp, x1, x2, x0};
236   Representation representations[] = {
237       Representation::Tagged(), Representation::Tagged(),
238       Representation::Tagged(), Representation::Integer32()};
239   data->Initialize(arraysize(registers), registers, representations);
240 }
241
242
243 void InternalArrayConstructorConstantArgCountDescriptor::Initialize(
244     CallInterfaceDescriptorData* data) {
245   // cp: context
246   // x1: constructor function
247   // x0: number of arguments to the constructor function
248   Register registers[] = {cp, x1};
249   data->Initialize(arraysize(registers), registers, NULL);
250 }
251
252
253 void InternalArrayConstructorDescriptor::Initialize(
254     CallInterfaceDescriptorData* data) {
255   // stack param count needs (constructor pointer, and single argument)
256   Register registers[] = {cp, x1, x0};
257   Representation representations[] = {Representation::Tagged(),
258                                       Representation::Tagged(),
259                                       Representation::Integer32()};
260   data->Initialize(arraysize(registers), registers, representations);
261 }
262
263
264 void CompareDescriptor::Initialize(CallInterfaceDescriptorData* data) {
265   // cp: context
266   // x1: left operand
267   // x0: right operand
268   Register registers[] = {cp, x1, x0};
269   data->Initialize(arraysize(registers), registers, NULL);
270 }
271
272
273 void CompareNilDescriptor::Initialize(CallInterfaceDescriptorData* data) {
274   // cp: context
275   // x0: value to compare
276   Register registers[] = {cp, x0};
277   data->Initialize(arraysize(registers), registers, NULL);
278 }
279
280
281 void ToBooleanDescriptor::Initialize(CallInterfaceDescriptorData* data) {
282   // cp: context
283   // x0: value
284   Register registers[] = {cp, x0};
285   data->Initialize(arraysize(registers), registers, NULL);
286 }
287
288
289 void BinaryOpDescriptor::Initialize(CallInterfaceDescriptorData* data) {
290   // cp: context
291   // x1: left operand
292   // x0: right operand
293   Register registers[] = {cp, x1, x0};
294   data->Initialize(arraysize(registers), registers, NULL);
295 }
296
297
298 void BinaryOpWithAllocationSiteDescriptor::Initialize(
299     CallInterfaceDescriptorData* data) {
300   // cp: context
301   // x2: allocation site
302   // x1: left operand
303   // x0: right operand
304   Register registers[] = {cp, x2, x1, x0};
305   data->Initialize(arraysize(registers), registers, NULL);
306 }
307
308
309 void StringAddDescriptor::Initialize(CallInterfaceDescriptorData* data) {
310   // cp: context
311   // x1: left operand
312   // x0: right operand
313   Register registers[] = {cp, x1, x0};
314   data->Initialize(arraysize(registers), registers, NULL);
315 }
316
317
318 void KeyedDescriptor::Initialize(CallInterfaceDescriptorData* data) {
319   static PlatformInterfaceDescriptor noInlineDescriptor =
320       PlatformInterfaceDescriptor(NEVER_INLINE_TARGET_ADDRESS);
321
322   Register registers[] = {
323       cp,  // context
324       x2,  // key
325   };
326   Representation representations[] = {
327       Representation::Tagged(),  // context
328       Representation::Tagged(),  // key
329   };
330   data->Initialize(arraysize(registers), registers, representations,
331                    &noInlineDescriptor);
332 }
333
334
335 void NamedDescriptor::Initialize(CallInterfaceDescriptorData* data) {
336   static PlatformInterfaceDescriptor noInlineDescriptor =
337       PlatformInterfaceDescriptor(NEVER_INLINE_TARGET_ADDRESS);
338
339   Register registers[] = {
340       cp,  // context
341       x2,  // name
342   };
343   Representation representations[] = {
344       Representation::Tagged(),  // context
345       Representation::Tagged(),  // name
346   };
347   data->Initialize(arraysize(registers), registers, representations,
348                    &noInlineDescriptor);
349 }
350
351
352 void CallHandlerDescriptor::Initialize(CallInterfaceDescriptorData* data) {
353   static PlatformInterfaceDescriptor default_descriptor =
354       PlatformInterfaceDescriptor(CAN_INLINE_TARGET_ADDRESS);
355
356   Register registers[] = {
357       cp,  // context
358       x0,  // receiver
359   };
360   Representation representations[] = {
361       Representation::Tagged(),  // context
362       Representation::Tagged(),  // receiver
363   };
364   data->Initialize(arraysize(registers), registers, representations,
365                    &default_descriptor);
366 }
367
368
369 void ArgumentAdaptorDescriptor::Initialize(CallInterfaceDescriptorData* data) {
370   static PlatformInterfaceDescriptor default_descriptor =
371       PlatformInterfaceDescriptor(CAN_INLINE_TARGET_ADDRESS);
372
373   Register registers[] = {
374       cp,  // context
375       x1,  // JSFunction
376       x0,  // actual number of arguments
377       x2,  // expected number of arguments
378   };
379   Representation representations[] = {
380       Representation::Tagged(),     // context
381       Representation::Tagged(),     // JSFunction
382       Representation::Integer32(),  // actual number of arguments
383       Representation::Integer32(),  // expected number of arguments
384   };
385   data->Initialize(arraysize(registers), registers, representations,
386                    &default_descriptor);
387 }
388
389
390 void ApiFunctionDescriptor::Initialize(CallInterfaceDescriptorData* data) {
391   static PlatformInterfaceDescriptor default_descriptor =
392       PlatformInterfaceDescriptor(CAN_INLINE_TARGET_ADDRESS);
393
394   Register registers[] = {
395       cp,  // context
396       x0,  // callee
397       x4,  // call_data
398       x2,  // holder
399       x1,  // api_function_address
400       x3,  // actual number of arguments
401   };
402   Representation representations[] = {
403       Representation::Tagged(),     // context
404       Representation::Tagged(),     // callee
405       Representation::Tagged(),     // call_data
406       Representation::Tagged(),     // holder
407       Representation::External(),   // api_function_address
408       Representation::Integer32(),  // actual number of arguments
409   };
410   data->Initialize(arraysize(registers), registers, representations,
411                    &default_descriptor);
412 }
413
414
415 void ApiAccessorDescriptor::Initialize(CallInterfaceDescriptorData* data) {
416   static PlatformInterfaceDescriptor default_descriptor =
417       PlatformInterfaceDescriptor(CAN_INLINE_TARGET_ADDRESS);
418
419   Register registers[] = {
420       cp,  // context
421       x0,  // callee
422       x4,  // call_data
423       x2,  // holder
424       x1,  // api_function_address
425   };
426   Representation representations[] = {
427       Representation::Tagged(),    // context
428       Representation::Tagged(),    // callee
429       Representation::Tagged(),    // call_data
430       Representation::Tagged(),    // holder
431       Representation::External(),  // api_function_address
432   };
433   data->Initialize(arraysize(registers), registers, representations,
434                    &default_descriptor);
435 }
436 }
437 }  // namespace v8::internal
438
439 #endif  // V8_TARGET_ARCH_ARM64