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/interface-descriptors.h"
6
7 namespace v8 {
8 namespace internal {
9
10
InitializePlatformSpecific(int register_parameter_count,const Register * registers,PlatformInterfaceDescriptor * platform_descriptor)11 void CallInterfaceDescriptorData::InitializePlatformSpecific(
12 int register_parameter_count, const Register* registers,
13 PlatformInterfaceDescriptor* platform_descriptor) {
14 platform_specific_descriptor_ = platform_descriptor;
15 register_param_count_ = register_parameter_count;
16
17 // InterfaceDescriptor owns a copy of the registers array.
18 register_params_.reset(NewArray<Register>(register_parameter_count));
19 for (int i = 0; i < register_parameter_count; i++) {
20 register_params_[i] = registers[i];
21 }
22 }
23
InitializePlatformIndependent(int parameter_count,int extra_parameter_count,const MachineType * machine_types)24 void CallInterfaceDescriptorData::InitializePlatformIndependent(
25 int parameter_count, int extra_parameter_count,
26 const MachineType* machine_types) {
27 // InterfaceDescriptor owns a copy of the MachineType array.
28 // We only care about parameters, not receiver and result.
29 param_count_ = parameter_count + extra_parameter_count;
30 machine_types_.reset(NewArray<MachineType>(param_count_));
31 for (int i = 0; i < param_count_; i++) {
32 if (machine_types == NULL || i >= parameter_count) {
33 machine_types_[i] = MachineType::AnyTagged();
34 } else {
35 machine_types_[i] = machine_types[i];
36 }
37 }
38 }
39
DebugName(Isolate * isolate) const40 const char* CallInterfaceDescriptor::DebugName(Isolate* isolate) const {
41 CallInterfaceDescriptorData* start = isolate->call_descriptor_data(0);
42 size_t index = data_ - start;
43 DCHECK(index < CallDescriptors::NUMBER_OF_DESCRIPTORS);
44 CallDescriptors::Key key = static_cast<CallDescriptors::Key>(index);
45 switch (key) {
46 #define DEF_CASE(NAME) \
47 case CallDescriptors::NAME: \
48 return #NAME " Descriptor";
49 INTERFACE_DESCRIPTOR_LIST(DEF_CASE)
50 #undef DEF_CASE
51 case CallDescriptors::NUMBER_OF_DESCRIPTORS:
52 break;
53 }
54 return "";
55 }
56
57
InitializePlatformSpecific(CallInterfaceDescriptorData * data)58 void VoidDescriptor::InitializePlatformSpecific(
59 CallInterfaceDescriptorData* data) {
60 data->InitializePlatformSpecific(0, nullptr);
61 }
62
InitializePlatformIndependent(CallInterfaceDescriptorData * data)63 void FastNewFunctionContextDescriptor::InitializePlatformIndependent(
64 CallInterfaceDescriptorData* data) {
65 MachineType machine_types[] = {MachineType::AnyTagged(),
66 MachineType::Int32()};
67 data->InitializePlatformIndependent(arraysize(machine_types), 0,
68 machine_types);
69 }
70
InitializePlatformSpecific(CallInterfaceDescriptorData * data)71 void FastNewFunctionContextDescriptor::InitializePlatformSpecific(
72 CallInterfaceDescriptorData* data) {
73 Register registers[] = {FunctionRegister(), SlotsRegister()};
74 data->InitializePlatformSpecific(arraysize(registers), registers);
75 }
76
InitializePlatformSpecific(CallInterfaceDescriptorData * data)77 void FastNewObjectDescriptor::InitializePlatformSpecific(
78 CallInterfaceDescriptorData* data) {
79 Register registers[] = {TargetRegister(), NewTargetRegister()};
80 data->InitializePlatformSpecific(arraysize(registers), registers);
81 }
82
TargetRegister()83 const Register FastNewObjectDescriptor::TargetRegister() {
84 return kJSFunctionRegister;
85 }
86
NewTargetRegister()87 const Register FastNewObjectDescriptor::NewTargetRegister() {
88 return kJavaScriptCallNewTargetRegister;
89 }
90
InitializePlatformSpecific(CallInterfaceDescriptorData * data)91 void FastNewArgumentsDescriptor::InitializePlatformSpecific(
92 CallInterfaceDescriptorData* data) {
93 Register registers[] = {TargetRegister()};
94 data->InitializePlatformSpecific(arraysize(registers), registers);
95 }
96
TargetRegister()97 const Register FastNewArgumentsDescriptor::TargetRegister() {
98 return kJSFunctionRegister;
99 }
100
InitializePlatformIndependent(CallInterfaceDescriptorData * data)101 void LoadDescriptor::InitializePlatformIndependent(
102 CallInterfaceDescriptorData* data) {
103 // kReceiver, kName, kSlot
104 MachineType machine_types[] = {MachineType::AnyTagged(),
105 MachineType::AnyTagged(),
106 MachineType::TaggedSigned()};
107 data->InitializePlatformIndependent(arraysize(machine_types), 0,
108 machine_types);
109 }
110
InitializePlatformSpecific(CallInterfaceDescriptorData * data)111 void LoadDescriptor::InitializePlatformSpecific(
112 CallInterfaceDescriptorData* data) {
113 Register registers[] = {ReceiverRegister(), NameRegister(), SlotRegister()};
114 data->InitializePlatformSpecific(arraysize(registers), registers);
115 }
116
InitializePlatformIndependent(CallInterfaceDescriptorData * data)117 void LoadFieldDescriptor::InitializePlatformIndependent(
118 CallInterfaceDescriptorData* data) {
119 // kReceiver, kSmiHandler
120 MachineType machine_types[] = {MachineType::AnyTagged(),
121 MachineType::AnyTagged()};
122 data->InitializePlatformIndependent(arraysize(machine_types), 0,
123 machine_types);
124 }
125
InitializePlatformSpecific(CallInterfaceDescriptorData * data)126 void LoadFieldDescriptor::InitializePlatformSpecific(
127 CallInterfaceDescriptorData* data) {
128 Register registers[] = {ReceiverRegister(), SmiHandlerRegister()};
129 data->InitializePlatformSpecific(arraysize(registers), registers);
130 }
131
InitializePlatformIndependent(CallInterfaceDescriptorData * data)132 void LoadGlobalDescriptor::InitializePlatformIndependent(
133 CallInterfaceDescriptorData* data) {
134 // kName, kSlot
135 MachineType machine_types[] = {MachineType::AnyTagged(),
136 MachineType::TaggedSigned()};
137 data->InitializePlatformIndependent(arraysize(machine_types), 0,
138 machine_types);
139 }
140
InitializePlatformSpecific(CallInterfaceDescriptorData * data)141 void LoadGlobalDescriptor::InitializePlatformSpecific(
142 CallInterfaceDescriptorData* data) {
143 Register registers[] = {NameRegister(), SlotRegister()};
144 data->InitializePlatformSpecific(arraysize(registers), registers);
145 }
146
InitializePlatformIndependent(CallInterfaceDescriptorData * data)147 void LoadGlobalWithVectorDescriptor::InitializePlatformIndependent(
148 CallInterfaceDescriptorData* data) {
149 // kName, kSlot, kVector
150 MachineType machine_types[] = {MachineType::AnyTagged(),
151 MachineType::TaggedSigned(),
152 MachineType::AnyTagged()};
153 data->InitializePlatformIndependent(arraysize(machine_types), 0,
154 machine_types);
155 }
156
InitializePlatformSpecific(CallInterfaceDescriptorData * data)157 void LoadGlobalWithVectorDescriptor::InitializePlatformSpecific(
158 CallInterfaceDescriptorData* data) {
159 Register registers[] = {NameRegister(), SlotRegister(), VectorRegister()};
160 data->InitializePlatformSpecific(arraysize(registers), registers);
161 }
162
InitializePlatformIndependent(CallInterfaceDescriptorData * data)163 void StoreDescriptor::InitializePlatformIndependent(
164 CallInterfaceDescriptorData* data) {
165 // kReceiver, kName, kValue, kSlot
166 MachineType machine_types[] = {
167 MachineType::AnyTagged(), MachineType::AnyTagged(),
168 MachineType::AnyTagged(), MachineType::TaggedSigned()};
169 data->InitializePlatformIndependent(arraysize(machine_types), 0,
170 machine_types);
171 }
172
InitializePlatformSpecific(CallInterfaceDescriptorData * data)173 void StoreDescriptor::InitializePlatformSpecific(
174 CallInterfaceDescriptorData* data) {
175 Register registers[] = {ReceiverRegister(), NameRegister(), ValueRegister(),
176 SlotRegister()};
177
178 int len = arraysize(registers) - kStackArgumentsCount;
179 data->InitializePlatformSpecific(len, registers);
180 }
181
InitializePlatformSpecific(CallInterfaceDescriptorData * data)182 void StoreTransitionDescriptor::InitializePlatformSpecific(
183 CallInterfaceDescriptorData* data) {
184 Register registers[] = {
185 ReceiverRegister(), NameRegister(), MapRegister(),
186 ValueRegister(), SlotRegister(), VectorRegister(),
187 };
188 int len = arraysize(registers) - kStackArgumentsCount;
189 data->InitializePlatformSpecific(len, registers);
190 }
191
InitializePlatformIndependent(CallInterfaceDescriptorData * data)192 void StoreTransitionDescriptor::InitializePlatformIndependent(
193 CallInterfaceDescriptorData* data) {
194 // kReceiver, kName, kMap, kValue, kSlot, kVector
195 MachineType machine_types[] = {
196 MachineType::AnyTagged(), MachineType::AnyTagged(),
197 MachineType::AnyTagged(), MachineType::AnyTagged(),
198 MachineType::TaggedSigned(), MachineType::AnyTagged()};
199 data->InitializePlatformIndependent(arraysize(machine_types), 0,
200 machine_types);
201 }
202
InitializePlatformIndependent(CallInterfaceDescriptorData * data)203 void StoreNamedTransitionDescriptor::InitializePlatformIndependent(
204 CallInterfaceDescriptorData* data) {
205 // kReceiver, kFieldOffset, kMap, kValue, kSlot, kVector, kName
206 MachineType machine_types[] = {
207 MachineType::AnyTagged(), MachineType::TaggedSigned(),
208 MachineType::AnyTagged(), MachineType::AnyTagged(),
209 MachineType::TaggedSigned(), MachineType::AnyTagged(),
210 MachineType::AnyTagged()};
211 data->InitializePlatformIndependent(arraysize(machine_types), 0,
212 machine_types);
213 }
214
InitializePlatformSpecific(CallInterfaceDescriptorData * data)215 void StoreNamedTransitionDescriptor::InitializePlatformSpecific(
216 CallInterfaceDescriptorData* data) {
217 Register registers[] = {
218 ReceiverRegister(), FieldOffsetRegister(), MapRegister(),
219 ValueRegister(), SlotRegister(), VectorRegister(),
220 NameRegister(),
221 };
222 int len = arraysize(registers) - kStackArgumentsCount;
223 data->InitializePlatformSpecific(len, registers);
224 }
225
InitializePlatformIndependent(CallInterfaceDescriptorData * data)226 void StringCharAtDescriptor::InitializePlatformIndependent(
227 CallInterfaceDescriptorData* data) {
228 // kReceiver, kPosition
229 MachineType machine_types[] = {MachineType::AnyTagged(),
230 MachineType::IntPtr()};
231 data->InitializePlatformIndependent(arraysize(machine_types), 0,
232 machine_types);
233 }
234
InitializePlatformSpecific(CallInterfaceDescriptorData * data)235 void StringCharAtDescriptor::InitializePlatformSpecific(
236 CallInterfaceDescriptorData* data) {
237 DefaultInitializePlatformSpecific(data, kParameterCount);
238 }
239
InitializePlatformIndependent(CallInterfaceDescriptorData * data)240 void StringCharCodeAtDescriptor::InitializePlatformIndependent(
241 CallInterfaceDescriptorData* data) {
242 // kReceiver, kPosition
243 // TODO(turbofan): Allow builtins to return untagged values.
244 MachineType machine_types[] = {MachineType::AnyTagged(),
245 MachineType::IntPtr()};
246 data->InitializePlatformIndependent(arraysize(machine_types), 0,
247 machine_types);
248 }
249
InitializePlatformSpecific(CallInterfaceDescriptorData * data)250 void StringCharCodeAtDescriptor::InitializePlatformSpecific(
251 CallInterfaceDescriptorData* data) {
252 DefaultInitializePlatformSpecific(data, kParameterCount);
253 }
254
InitializePlatformSpecific(CallInterfaceDescriptorData * data)255 void StringCompareDescriptor::InitializePlatformSpecific(
256 CallInterfaceDescriptorData* data) {
257 Register registers[] = {LeftRegister(), RightRegister()};
258 data->InitializePlatformSpecific(arraysize(registers), registers);
259 }
260
InitializePlatformSpecific(CallInterfaceDescriptorData * data)261 void TypeConversionDescriptor::InitializePlatformSpecific(
262 CallInterfaceDescriptorData* data) {
263 Register registers[] = {ArgumentRegister()};
264 data->InitializePlatformSpecific(arraysize(registers), registers);
265 }
266
InitializePlatformSpecific(CallInterfaceDescriptorData * data)267 void MathPowTaggedDescriptor::InitializePlatformSpecific(
268 CallInterfaceDescriptorData* data) {
269 Register registers[] = {exponent()};
270 data->InitializePlatformSpecific(arraysize(registers), registers);
271 }
272
InitializePlatformSpecific(CallInterfaceDescriptorData * data)273 void MathPowIntegerDescriptor::InitializePlatformSpecific(
274 CallInterfaceDescriptorData* data) {
275 Register registers[] = {exponent()};
276 data->InitializePlatformSpecific(arraysize(registers), registers);
277 }
278
ReceiverRegister()279 const Register LoadFieldDescriptor::ReceiverRegister() {
280 // Reuse the register from the LoadDescriptor, since given the
281 // LoadFieldDescriptor's usage, it doesn't matter exactly which registers are
282 // used to pass parameters in.
283 return LoadDescriptor::ReceiverRegister();
284 }
SmiHandlerRegister()285 const Register LoadFieldDescriptor::SmiHandlerRegister() {
286 // Reuse the register from the LoadDescriptor, since given the
287 // LoadFieldDescriptor's usage, it doesn't matter exactly which registers are
288 // used to pass parameters in.
289 return LoadDescriptor::NameRegister();
290 }
291
InitializePlatformIndependent(CallInterfaceDescriptorData * data)292 void LoadWithVectorDescriptor::InitializePlatformIndependent(
293 CallInterfaceDescriptorData* data) {
294 // kReceiver, kName, kSlot, kVector
295 MachineType machine_types[] = {
296 MachineType::AnyTagged(), MachineType::AnyTagged(),
297 MachineType::TaggedSigned(), MachineType::AnyTagged()};
298 data->InitializePlatformIndependent(arraysize(machine_types), 0,
299 machine_types);
300 }
301
InitializePlatformSpecific(CallInterfaceDescriptorData * data)302 void LoadWithVectorDescriptor::InitializePlatformSpecific(
303 CallInterfaceDescriptorData* data) {
304 Register registers[] = {ReceiverRegister(), NameRegister(), SlotRegister(),
305 VectorRegister()};
306 data->InitializePlatformSpecific(arraysize(registers), registers);
307 }
308
InitializePlatformIndependent(CallInterfaceDescriptorData * data)309 void LoadICProtoArrayDescriptor::InitializePlatformIndependent(
310 CallInterfaceDescriptorData* data) {
311 // kReceiver, kName, kSlot, kVector, kHandler
312 MachineType machine_types[] = {
313 MachineType::AnyTagged(), MachineType::AnyTagged(),
314 MachineType::TaggedSigned(), MachineType::AnyTagged(),
315 MachineType::AnyTagged()};
316 data->InitializePlatformIndependent(arraysize(machine_types), 0,
317 machine_types);
318 }
319
InitializePlatformSpecific(CallInterfaceDescriptorData * data)320 void LoadICProtoArrayDescriptor::InitializePlatformSpecific(
321 CallInterfaceDescriptorData* data) {
322 Register registers[] = {ReceiverRegister(), NameRegister(), SlotRegister(),
323 VectorRegister(), HandlerRegister()};
324 data->InitializePlatformSpecific(arraysize(registers), registers);
325 }
326
InitializePlatformIndependent(CallInterfaceDescriptorData * data)327 void StoreWithVectorDescriptor::InitializePlatformIndependent(
328 CallInterfaceDescriptorData* data) {
329 // kReceiver, kName, kValue, kSlot, kVector
330 MachineType machine_types[] = {
331 MachineType::AnyTagged(), MachineType::AnyTagged(),
332 MachineType::AnyTagged(), MachineType::TaggedSigned(),
333 MachineType::AnyTagged()};
334 data->InitializePlatformIndependent(arraysize(machine_types), 0,
335 machine_types);
336 }
337
InitializePlatformSpecific(CallInterfaceDescriptorData * data)338 void StoreWithVectorDescriptor::InitializePlatformSpecific(
339 CallInterfaceDescriptorData* data) {
340 Register registers[] = {ReceiverRegister(), NameRegister(), ValueRegister(),
341 SlotRegister(), VectorRegister()};
342 int len = arraysize(registers) - kStackArgumentsCount;
343 data->InitializePlatformSpecific(len, registers);
344 }
345
InitializePlatformIndependent(CallInterfaceDescriptorData * data)346 void BinaryOpWithVectorDescriptor::InitializePlatformIndependent(
347 CallInterfaceDescriptorData* data) {
348 // kLeft, kRight, kSlot, kVector
349 MachineType machine_types[] = {MachineType::AnyTagged(),
350 MachineType::AnyTagged(), MachineType::Int32(),
351 MachineType::AnyTagged()};
352 data->InitializePlatformIndependent(arraysize(machine_types), 0,
353 machine_types);
354 }
355
ReceiverRegister()356 const Register ApiGetterDescriptor::ReceiverRegister() {
357 return LoadDescriptor::ReceiverRegister();
358 }
359
InitializePlatformSpecific(CallInterfaceDescriptorData * data)360 void ApiGetterDescriptor::InitializePlatformSpecific(
361 CallInterfaceDescriptorData* data) {
362 Register registers[] = {ReceiverRegister(), HolderRegister(),
363 CallbackRegister()};
364 data->InitializePlatformSpecific(arraysize(registers), registers);
365 }
366
InitializePlatformSpecific(CallInterfaceDescriptorData * data)367 void ContextOnlyDescriptor::InitializePlatformSpecific(
368 CallInterfaceDescriptorData* data) {
369 data->InitializePlatformSpecific(0, nullptr);
370 }
371
InitializePlatformSpecific(CallInterfaceDescriptorData * data)372 void GrowArrayElementsDescriptor::InitializePlatformSpecific(
373 CallInterfaceDescriptorData* data) {
374 Register registers[] = {ObjectRegister(), KeyRegister()};
375 data->InitializePlatformSpecific(arraysize(registers), registers);
376 }
377
InitializePlatformIndependent(CallInterfaceDescriptorData * data)378 void NewArgumentsElementsDescriptor::InitializePlatformIndependent(
379 CallInterfaceDescriptorData* data) {
380 MachineType const kMachineTypes[] = {MachineType::IntPtr()};
381 data->InitializePlatformIndependent(arraysize(kMachineTypes), 0,
382 kMachineTypes);
383 }
384
InitializePlatformSpecific(CallInterfaceDescriptorData * data)385 void NewArgumentsElementsDescriptor::InitializePlatformSpecific(
386 CallInterfaceDescriptorData* data) {
387 DefaultInitializePlatformSpecific(data, 1);
388 }
389
InitializePlatformIndependent(CallInterfaceDescriptorData * data)390 void VarArgFunctionDescriptor::InitializePlatformIndependent(
391 CallInterfaceDescriptorData* data) {
392 // kActualArgumentsCount
393 MachineType machine_types[] = {MachineType::Int32()};
394 data->InitializePlatformIndependent(arraysize(machine_types), 0,
395 machine_types);
396 }
397
InitializePlatformIndependent(CallInterfaceDescriptorData * data)398 void FastCloneRegExpDescriptor::InitializePlatformIndependent(
399 CallInterfaceDescriptorData* data) {
400 // kClosure, kLiteralIndex, kPattern, kFlags
401 MachineType machine_types[] = {
402 MachineType::AnyTagged(), MachineType::TaggedSigned(),
403 MachineType::AnyTagged(), MachineType::AnyTagged()};
404 data->InitializePlatformIndependent(arraysize(machine_types), 0,
405 machine_types);
406 }
407
InitializePlatformIndependent(CallInterfaceDescriptorData * data)408 void FastCloneShallowArrayDescriptor::InitializePlatformIndependent(
409 CallInterfaceDescriptorData* data) {
410 // kClosure, kLiteralIndex, kConstantElements
411 MachineType machine_types[] = {MachineType::AnyTagged(),
412 MachineType::TaggedSigned(),
413 MachineType::AnyTagged()};
414 data->InitializePlatformIndependent(arraysize(machine_types), 0,
415 machine_types);
416 }
417
InitializePlatformIndependent(CallInterfaceDescriptorData * data)418 void CreateAllocationSiteDescriptor::InitializePlatformIndependent(
419 CallInterfaceDescriptorData* data) {
420 // kVector, kSlot
421 MachineType machine_types[] = {MachineType::AnyTagged(),
422 MachineType::TaggedSigned()};
423 data->InitializePlatformIndependent(arraysize(machine_types), 0,
424 machine_types);
425 }
426
InitializePlatformIndependent(CallInterfaceDescriptorData * data)427 void CreateWeakCellDescriptor::InitializePlatformIndependent(
428 CallInterfaceDescriptorData* data) {
429 // kVector, kSlot, kValue
430 MachineType machine_types[] = {MachineType::AnyTagged(),
431 MachineType::TaggedSigned(),
432 MachineType::AnyTagged()};
433 data->InitializePlatformIndependent(arraysize(machine_types), 0,
434 machine_types);
435 }
436
InitializePlatformIndependent(CallInterfaceDescriptorData * data)437 void CallTrampolineDescriptor::InitializePlatformIndependent(
438 CallInterfaceDescriptorData* data) {
439 // kFunction, kActualArgumentsCount
440 MachineType machine_types[] = {MachineType::AnyTagged(),
441 MachineType::Int32()};
442 data->InitializePlatformIndependent(arraysize(machine_types), 0,
443 machine_types);
444 }
445
InitializePlatformIndependent(CallInterfaceDescriptorData * data)446 void CallForwardVarargsDescriptor::InitializePlatformIndependent(
447 CallInterfaceDescriptorData* data) {
448 // kTarget, kStartIndex
449 MachineType machine_types[] = {MachineType::AnyTagged(),
450 MachineType::Int32()};
451 data->InitializePlatformIndependent(arraysize(machine_types), 0,
452 machine_types);
453 }
454
InitializePlatformIndependent(CallInterfaceDescriptorData * data)455 void ConstructStubDescriptor::InitializePlatformIndependent(
456 CallInterfaceDescriptorData* data) {
457 // kFunction, kNewTarget, kActualArgumentsCount, kAllocationSite
458 MachineType machine_types[] = {MachineType::AnyTagged(),
459 MachineType::AnyTagged(), MachineType::Int32(),
460 MachineType::AnyTagged()};
461 data->InitializePlatformIndependent(arraysize(machine_types), 0,
462 machine_types);
463 }
464
InitializePlatformIndependent(CallInterfaceDescriptorData * data)465 void ConstructTrampolineDescriptor::InitializePlatformIndependent(
466 CallInterfaceDescriptorData* data) {
467 // kFunction, kNewTarget, kActualArgumentsCount
468 MachineType machine_types[] = {
469 MachineType::AnyTagged(), MachineType::AnyTagged(), MachineType::Int32()};
470 data->InitializePlatformIndependent(arraysize(machine_types), 0,
471 machine_types);
472 }
473
InitializePlatformIndependent(CallInterfaceDescriptorData * data)474 void CallICDescriptor::InitializePlatformIndependent(
475 CallInterfaceDescriptorData* data) {
476 // kTarget, kActualArgumentsCount, kSlot, kVector
477 MachineType machine_types[] = {MachineType::AnyTagged(), MachineType::Int32(),
478 MachineType::Int32(),
479 MachineType::AnyTagged()};
480 data->InitializePlatformIndependent(arraysize(machine_types), 0,
481 machine_types);
482 }
483
InitializePlatformIndependent(CallInterfaceDescriptorData * data)484 void CallICTrampolineDescriptor::InitializePlatformIndependent(
485 CallInterfaceDescriptorData* data) {
486 // kTarget, kActualArgumentsCount, kSlot
487 MachineType machine_types[] = {MachineType::AnyTagged(), MachineType::Int32(),
488 MachineType::Int32()};
489 data->InitializePlatformIndependent(arraysize(machine_types), 0,
490 machine_types);
491 }
492
InitializePlatformIndependent(CallInterfaceDescriptorData * data)493 void BuiltinDescriptor::InitializePlatformIndependent(
494 CallInterfaceDescriptorData* data) {
495 // kTarget, kNewTarget, kArgumentsCount
496 MachineType machine_types[] = {
497 MachineType::AnyTagged(), MachineType::AnyTagged(), MachineType::Int32()};
498 data->InitializePlatformIndependent(arraysize(machine_types), 0,
499 machine_types);
500 }
501
InitializePlatformSpecific(CallInterfaceDescriptorData * data)502 void BuiltinDescriptor::InitializePlatformSpecific(
503 CallInterfaceDescriptorData* data) {
504 Register registers[] = {TargetRegister(), NewTargetRegister(),
505 ArgumentsCountRegister()};
506 data->InitializePlatformSpecific(arraysize(registers), registers);
507 }
508
ArgumentsCountRegister()509 const Register BuiltinDescriptor::ArgumentsCountRegister() {
510 return kJavaScriptCallArgCountRegister;
511 }
NewTargetRegister()512 const Register BuiltinDescriptor::NewTargetRegister() {
513 return kJavaScriptCallNewTargetRegister;
514 }
515
TargetRegister()516 const Register BuiltinDescriptor::TargetRegister() {
517 return kJSFunctionRegister;
518 }
519
InitializePlatformIndependent(CallInterfaceDescriptorData * data)520 void ArrayConstructorDescriptor::InitializePlatformIndependent(
521 CallInterfaceDescriptorData* data) {
522 // kTarget, kNewTarget, kActualArgumentsCount, kAllocationSite
523 MachineType machine_types[] = {MachineType::AnyTagged(),
524 MachineType::AnyTagged(), MachineType::Int32(),
525 MachineType::AnyTagged()};
526 data->InitializePlatformIndependent(arraysize(machine_types), 0,
527 machine_types);
528 }
529
InitializePlatformIndependent(CallInterfaceDescriptorData * data)530 void ArrayNoArgumentConstructorDescriptor::InitializePlatformIndependent(
531 CallInterfaceDescriptorData* data) {
532 // kFunction, kAllocationSite, kActualArgumentsCount, kFunctionParameter
533 MachineType machine_types[] = {MachineType::TaggedPointer(),
534 MachineType::AnyTagged(), MachineType::Int32(),
535 MachineType::AnyTagged()};
536 data->InitializePlatformIndependent(arraysize(machine_types), 0,
537 machine_types);
538 }
539
InitializePlatformIndependent(CallInterfaceDescriptorData * data)540 void ArraySingleArgumentConstructorDescriptor::InitializePlatformIndependent(
541 CallInterfaceDescriptorData* data) {
542 // kFunction, kAllocationSite, kActualArgumentsCount, kFunctionParameter,
543 // kArraySizeSmiParameter
544 MachineType machine_types[] = {
545 MachineType::TaggedPointer(), MachineType::AnyTagged(),
546 MachineType::Int32(), MachineType::AnyTagged(), MachineType::AnyTagged()};
547 data->InitializePlatformIndependent(arraysize(machine_types), 0,
548 machine_types);
549 }
550
InitializePlatformIndependent(CallInterfaceDescriptorData * data)551 void ArrayNArgumentsConstructorDescriptor::InitializePlatformIndependent(
552 CallInterfaceDescriptorData* data) {
553 // kFunction, kAllocationSite, kActualArgumentsCount
554 MachineType machine_types[] = {
555 MachineType::AnyTagged(), MachineType::AnyTagged(), MachineType::Int32()};
556 data->InitializePlatformIndependent(arraysize(machine_types), 0,
557 machine_types);
558 }
559
InitializePlatformIndependent(CallInterfaceDescriptorData * data)560 void ArgumentAdaptorDescriptor::InitializePlatformIndependent(
561 CallInterfaceDescriptorData* data) {
562 // kFunction, kNewTarget, kActualArgumentsCount, kExpectedArgumentsCount
563 MachineType machine_types[] = {MachineType::TaggedPointer(),
564 MachineType::AnyTagged(), MachineType::Int32(),
565 MachineType::Int32()};
566 data->InitializePlatformIndependent(arraysize(machine_types), 0,
567 machine_types);
568 }
569
InitializePlatformIndependent(CallInterfaceDescriptorData * data)570 void ApiCallbackDescriptor::InitializePlatformIndependent(
571 CallInterfaceDescriptorData* data) {
572 // kFunction, kCallData, kHolder, kApiFunctionAddress
573 MachineType machine_types[] = {
574 MachineType::AnyTagged(), MachineType::AnyTagged(),
575 MachineType::AnyTagged(), MachineType::Pointer()};
576 data->InitializePlatformIndependent(arraysize(machine_types), 0,
577 machine_types);
578 }
579
InitializePlatformIndependent(CallInterfaceDescriptorData * data)580 void InterpreterDispatchDescriptor::InitializePlatformIndependent(
581 CallInterfaceDescriptorData* data) {
582 // kAccumulator, kBytecodeOffset, kBytecodeArray, kDispatchTable
583 MachineType machine_types[] = {
584 MachineType::AnyTagged(), MachineType::IntPtr(), MachineType::AnyTagged(),
585 MachineType::IntPtr()};
586 data->InitializePlatformIndependent(arraysize(machine_types), 0,
587 machine_types);
588 }
589
InitializePlatformIndependent(CallInterfaceDescriptorData * data)590 void InterpreterPushArgsAndCallDescriptor::InitializePlatformIndependent(
591 CallInterfaceDescriptorData* data) {
592 // kNumberOfArguments, kFirstArgument, kFunction
593 MachineType machine_types[] = {MachineType::Int32(), MachineType::Pointer(),
594 MachineType::AnyTagged()};
595 data->InitializePlatformIndependent(arraysize(machine_types), 0,
596 machine_types);
597 }
598
InitializePlatformIndependent(CallInterfaceDescriptorData * data)599 void InterpreterPushArgsAndConstructDescriptor::InitializePlatformIndependent(
600 CallInterfaceDescriptorData* data) {
601 // kNumberOfArguments, kNewTarget, kConstructor, kFeedbackElement,
602 // kFirstArgument
603 MachineType machine_types[] = {
604 MachineType::Int32(), MachineType::AnyTagged(), MachineType::AnyTagged(),
605 MachineType::AnyTagged(), MachineType::Pointer()};
606 data->InitializePlatformIndependent(arraysize(machine_types), 0,
607 machine_types);
608 }
609
610 void InterpreterPushArgsAndConstructArrayDescriptor::
InitializePlatformIndependent(CallInterfaceDescriptorData * data)611 InitializePlatformIndependent(CallInterfaceDescriptorData* data) {
612 // kNumberOfArguments, kFunction, kFeedbackElement, kFirstArgument
613 MachineType machine_types[] = {MachineType::Int32(), MachineType::AnyTagged(),
614 MachineType::AnyTagged(),
615 MachineType::Pointer()};
616 data->InitializePlatformIndependent(arraysize(machine_types), 0,
617 machine_types);
618 }
619
InitializePlatformIndependent(CallInterfaceDescriptorData * data)620 void InterpreterCEntryDescriptor::InitializePlatformIndependent(
621 CallInterfaceDescriptorData* data) {
622 // kNumberOfArguments, kFirstArgument, kFunctionEntry
623 MachineType machine_types[] = {MachineType::Int32(), MachineType::Pointer(),
624 MachineType::Pointer()};
625 data->InitializePlatformIndependent(arraysize(machine_types), 0,
626 machine_types);
627 }
628
InitializePlatformIndependent(CallInterfaceDescriptorData * data)629 void FrameDropperTrampolineDescriptor::InitializePlatformIndependent(
630 CallInterfaceDescriptorData* data) {
631 // New FP value.
632 MachineType machine_types[] = {MachineType::Pointer()};
633 data->InitializePlatformIndependent(arraysize(machine_types), 0,
634 machine_types);
635 }
636
637 } // namespace internal
638 } // namespace v8
639