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
7namespace v8 {
8namespace internal {
9
10namespace {
11// Constructors for common combined semantic and representation types.
12Type* SmiType(Zone* zone) {
13  return Type::Intersect(Type::SignedSmall(), Type::TaggedSigned(), zone);
14}
15
16
17Type* UntaggedIntegral32(Zone* zone) {
18  return Type::Intersect(Type::Signed32(), Type::UntaggedIntegral32(), zone);
19}
20
21
22Type* AnyTagged(Zone* zone) {
23  return Type::Intersect(
24      Type::Any(),
25      Type::Union(Type::TaggedPointer(), Type::TaggedSigned(), zone), zone);
26}
27
28
29Type* ExternalPointer(Zone* zone) {
30  return Type::Intersect(Type::Internal(), Type::UntaggedPointer(), zone);
31}
32}  // namespace
33
34FunctionType* CallInterfaceDescriptor::BuildDefaultFunctionType(
35    Isolate* isolate, int parameter_count) {
36  Zone* zone = isolate->interface_descriptor_zone();
37  FunctionType* function =
38      Type::Function(AnyTagged(zone), Type::Undefined(), parameter_count, zone)
39          ->AsFunction();
40  while (parameter_count-- != 0) {
41    function->InitParameter(parameter_count, AnyTagged(zone));
42  }
43  return function;
44}
45
46void CallInterfaceDescriptorData::InitializePlatformSpecific(
47    int register_parameter_count, const Register* registers,
48    PlatformInterfaceDescriptor* platform_descriptor) {
49  platform_specific_descriptor_ = platform_descriptor;
50  register_param_count_ = register_parameter_count;
51
52  // InterfaceDescriptor owns a copy of the registers array.
53  register_params_.Reset(NewArray<Register>(register_parameter_count));
54  for (int i = 0; i < register_parameter_count; i++) {
55    register_params_[i] = registers[i];
56  }
57}
58
59const char* CallInterfaceDescriptor::DebugName(Isolate* isolate) const {
60  CallInterfaceDescriptorData* start = isolate->call_descriptor_data(0);
61  size_t index = data_ - start;
62  DCHECK(index < CallDescriptors::NUMBER_OF_DESCRIPTORS);
63  CallDescriptors::Key key = static_cast<CallDescriptors::Key>(index);
64  switch (key) {
65#define DEF_CASE(NAME)        \
66  case CallDescriptors::NAME: \
67    return #NAME " Descriptor";
68    INTERFACE_DESCRIPTOR_LIST(DEF_CASE)
69#undef DEF_CASE
70    case CallDescriptors::NUMBER_OF_DESCRIPTORS:
71      break;
72  }
73  return "";
74}
75
76
77void VoidDescriptor::InitializePlatformSpecific(
78    CallInterfaceDescriptorData* data) {
79  data->InitializePlatformSpecific(0, nullptr);
80}
81
82FunctionType* LoadDescriptor::BuildCallInterfaceDescriptorFunctionType(
83    Isolate* isolate, int paramater_count) {
84  Zone* zone = isolate->interface_descriptor_zone();
85  FunctionType* function =
86      Type::Function(AnyTagged(zone), Type::Undefined(), 3, zone)->AsFunction();
87  function->InitParameter(0, AnyTagged(zone));
88  function->InitParameter(1, AnyTagged(zone));
89  function->InitParameter(2, SmiType(zone));
90  return function;
91}
92
93
94void LoadDescriptor::InitializePlatformSpecific(
95    CallInterfaceDescriptorData* data) {
96  Register registers[] = {ReceiverRegister(), NameRegister(), SlotRegister()};
97  data->InitializePlatformSpecific(arraysize(registers), registers);
98}
99
100FunctionType* LoadGlobalDescriptor::BuildCallInterfaceDescriptorFunctionType(
101    Isolate* isolate, int paramater_count) {
102  Zone* zone = isolate->interface_descriptor_zone();
103  FunctionType* function =
104      Type::Function(AnyTagged(zone), Type::Undefined(), 1, zone)->AsFunction();
105  function->InitParameter(0, SmiType(zone));
106  return function;
107}
108
109void LoadGlobalDescriptor::InitializePlatformSpecific(
110    CallInterfaceDescriptorData* data) {
111  Register registers[] = {LoadWithVectorDescriptor::SlotRegister()};
112  data->InitializePlatformSpecific(arraysize(registers), registers);
113}
114
115FunctionType*
116LoadGlobalWithVectorDescriptor::BuildCallInterfaceDescriptorFunctionType(
117    Isolate* isolate, int paramater_count) {
118  Zone* zone = isolate->interface_descriptor_zone();
119  FunctionType* function =
120      Type::Function(AnyTagged(zone), Type::Undefined(), 2, zone)->AsFunction();
121  function->InitParameter(0, SmiType(zone));
122  function->InitParameter(1, AnyTagged(zone));
123  return function;
124}
125
126void LoadGlobalWithVectorDescriptor::InitializePlatformSpecific(
127    CallInterfaceDescriptorData* data) {
128  Register registers[] = {LoadWithVectorDescriptor::SlotRegister(),
129                          LoadWithVectorDescriptor::VectorRegister()};
130  data->InitializePlatformSpecific(arraysize(registers), registers);
131}
132
133void StoreDescriptor::InitializePlatformSpecific(
134    CallInterfaceDescriptorData* data) {
135  Register registers[] = {ReceiverRegister(), NameRegister(), ValueRegister()};
136  data->InitializePlatformSpecific(arraysize(registers), registers);
137}
138
139
140void StoreTransitionDescriptor::InitializePlatformSpecific(
141    CallInterfaceDescriptorData* data) {
142  Register registers[] = {ReceiverRegister(), NameRegister(), ValueRegister(),
143                          MapRegister()};
144
145  data->InitializePlatformSpecific(arraysize(registers), registers);
146}
147
148
149void VectorStoreTransitionDescriptor::InitializePlatformSpecific(
150    CallInterfaceDescriptorData* data) {
151  if (SlotRegister().is(no_reg)) {
152    Register registers[] = {ReceiverRegister(), NameRegister(), ValueRegister(),
153                            MapRegister(), VectorRegister()};
154    data->InitializePlatformSpecific(arraysize(registers), registers);
155  } else {
156    Register registers[] = {ReceiverRegister(), NameRegister(),
157                            ValueRegister(),    MapRegister(),
158                            SlotRegister(),     VectorRegister()};
159    data->InitializePlatformSpecific(arraysize(registers), registers);
160  }
161}
162
163FunctionType*
164StoreTransitionDescriptor::BuildCallInterfaceDescriptorFunctionType(
165    Isolate* isolate, int paramater_count) {
166  Zone* zone = isolate->interface_descriptor_zone();
167  FunctionType* function =
168      Type::Function(AnyTagged(zone), Type::Undefined(), 4, zone)->AsFunction();
169  function->InitParameter(0, AnyTagged(zone));  // Receiver
170  function->InitParameter(1, AnyTagged(zone));  // Name
171  function->InitParameter(2, AnyTagged(zone));  // Value
172  function->InitParameter(3, AnyTagged(zone));  // Map
173  return function;
174}
175
176FunctionType*
177StoreGlobalViaContextDescriptor::BuildCallInterfaceDescriptorFunctionType(
178    Isolate* isolate, int paramater_count) {
179  Zone* zone = isolate->interface_descriptor_zone();
180  FunctionType* function =
181      Type::Function(AnyTagged(zone), Type::Undefined(), 2, zone)->AsFunction();
182  function->InitParameter(0, UntaggedIntegral32(zone));
183  function->InitParameter(1, AnyTagged(zone));
184  return function;
185}
186
187
188void StoreGlobalViaContextDescriptor::InitializePlatformSpecific(
189    CallInterfaceDescriptorData* data) {
190  Register registers[] = {SlotRegister(), ValueRegister()};
191  data->InitializePlatformSpecific(arraysize(registers), registers);
192}
193
194
195void StringCompareDescriptor::InitializePlatformSpecific(
196    CallInterfaceDescriptorData* data) {
197  Register registers[] = {LeftRegister(), RightRegister()};
198  data->InitializePlatformSpecific(arraysize(registers), registers);
199}
200
201void TypeConversionDescriptor::InitializePlatformSpecific(
202    CallInterfaceDescriptorData* data) {
203  Register registers[] = {ArgumentRegister()};
204  data->InitializePlatformSpecific(arraysize(registers), registers);
205}
206
207void MathPowTaggedDescriptor::InitializePlatformSpecific(
208    CallInterfaceDescriptorData* data) {
209  Register registers[] = {exponent()};
210  data->InitializePlatformSpecific(arraysize(registers), registers);
211}
212
213void MathPowIntegerDescriptor::InitializePlatformSpecific(
214    CallInterfaceDescriptorData* data) {
215  Register registers[] = {exponent()};
216  data->InitializePlatformSpecific(arraysize(registers), registers);
217}
218
219FunctionType*
220LoadWithVectorDescriptor::BuildCallInterfaceDescriptorFunctionType(
221    Isolate* isolate, int paramater_count) {
222  Zone* zone = isolate->interface_descriptor_zone();
223  FunctionType* function =
224      Type::Function(AnyTagged(zone), Type::Undefined(), 4, zone)->AsFunction();
225  function->InitParameter(0, AnyTagged(zone));
226  function->InitParameter(1, AnyTagged(zone));
227  function->InitParameter(2, SmiType(zone));
228  function->InitParameter(3, AnyTagged(zone));
229  return function;
230}
231
232
233void LoadWithVectorDescriptor::InitializePlatformSpecific(
234    CallInterfaceDescriptorData* data) {
235  Register registers[] = {ReceiverRegister(), NameRegister(), SlotRegister(),
236                          VectorRegister()};
237  data->InitializePlatformSpecific(arraysize(registers), registers);
238}
239
240FunctionType*
241VectorStoreTransitionDescriptor::BuildCallInterfaceDescriptorFunctionType(
242    Isolate* isolate, int paramater_count) {
243  Zone* zone = isolate->interface_descriptor_zone();
244  bool has_slot = !VectorStoreTransitionDescriptor::SlotRegister().is(no_reg);
245  int arg_count = has_slot ? 6 : 5;
246  FunctionType* function =
247      Type::Function(AnyTagged(zone), Type::Undefined(), arg_count, zone)
248          ->AsFunction();
249  int index = 0;
250  function->InitParameter(index++, AnyTagged(zone));  // receiver
251  function->InitParameter(index++, AnyTagged(zone));  // name
252  function->InitParameter(index++, AnyTagged(zone));  // value
253  function->InitParameter(index++, AnyTagged(zone));  // map
254  if (has_slot) {
255    function->InitParameter(index++, SmiType(zone));  // slot
256  }
257  function->InitParameter(index++, AnyTagged(zone));  // vector
258  return function;
259}
260
261FunctionType* VectorStoreICDescriptor::BuildCallInterfaceDescriptorFunctionType(
262    Isolate* isolate, int paramater_count) {
263  Zone* zone = isolate->interface_descriptor_zone();
264  FunctionType* function =
265      Type::Function(AnyTagged(zone), Type::Undefined(), 5, zone)->AsFunction();
266  function->InitParameter(0, AnyTagged(zone));
267  function->InitParameter(1, AnyTagged(zone));
268  function->InitParameter(2, AnyTagged(zone));
269  function->InitParameter(3, SmiType(zone));
270  function->InitParameter(4, AnyTagged(zone));
271  return function;
272}
273
274
275void VectorStoreICDescriptor::InitializePlatformSpecific(
276    CallInterfaceDescriptorData* data) {
277  Register registers[] = {ReceiverRegister(), NameRegister(), ValueRegister(),
278                          SlotRegister(), VectorRegister()};
279  data->InitializePlatformSpecific(arraysize(registers), registers);
280}
281
282FunctionType*
283VectorStoreICTrampolineDescriptor::BuildCallInterfaceDescriptorFunctionType(
284    Isolate* isolate, int paramater_count) {
285  Zone* zone = isolate->interface_descriptor_zone();
286  FunctionType* function =
287      Type::Function(AnyTagged(zone), Type::Undefined(), 4, zone)->AsFunction();
288  function->InitParameter(0, AnyTagged(zone));
289  function->InitParameter(1, AnyTagged(zone));
290  function->InitParameter(2, AnyTagged(zone));
291  function->InitParameter(3, SmiType(zone));
292  return function;
293}
294
295
296void VectorStoreICTrampolineDescriptor::InitializePlatformSpecific(
297    CallInterfaceDescriptorData* data) {
298  Register registers[] = {ReceiverRegister(), NameRegister(), ValueRegister(),
299                          SlotRegister()};
300  data->InitializePlatformSpecific(arraysize(registers), registers);
301}
302
303const Register ApiGetterDescriptor::ReceiverRegister() {
304  return LoadDescriptor::ReceiverRegister();
305}
306
307void ApiGetterDescriptor::InitializePlatformSpecific(
308    CallInterfaceDescriptorData* data) {
309  Register registers[] = {ReceiverRegister(), HolderRegister(),
310                          CallbackRegister()};
311  data->InitializePlatformSpecific(arraysize(registers), registers);
312}
313
314void ContextOnlyDescriptor::InitializePlatformSpecific(
315    CallInterfaceDescriptorData* data) {
316  data->InitializePlatformSpecific(0, nullptr);
317}
318
319CallInterfaceDescriptor OnStackArgsDescriptorBase::ForArgs(
320    Isolate* isolate, int parameter_count) {
321  switch (parameter_count) {
322    case 1:
323      return OnStackWith1ArgsDescriptor(isolate);
324    case 2:
325      return OnStackWith2ArgsDescriptor(isolate);
326    case 3:
327      return OnStackWith3ArgsDescriptor(isolate);
328    case 4:
329      return OnStackWith4ArgsDescriptor(isolate);
330    case 5:
331      return OnStackWith5ArgsDescriptor(isolate);
332    case 6:
333      return OnStackWith6ArgsDescriptor(isolate);
334    case 7:
335      return OnStackWith7ArgsDescriptor(isolate);
336    default:
337      UNREACHABLE();
338      return VoidDescriptor(isolate);
339  }
340}
341
342FunctionType*
343OnStackArgsDescriptorBase::BuildCallInterfaceDescriptorFunctionTypeWithArg(
344    Isolate* isolate, int register_parameter_count, int parameter_count) {
345  DCHECK_EQ(0, register_parameter_count);
346  DCHECK_GT(parameter_count, 0);
347  Zone* zone = isolate->interface_descriptor_zone();
348  FunctionType* function =
349      Type::Function(AnyTagged(zone), AnyTagged(zone), parameter_count, zone)
350          ->AsFunction();
351  for (int i = 0; i < parameter_count; i++) {
352    function->InitParameter(i, AnyTagged(zone));
353  }
354  return function;
355}
356
357void OnStackArgsDescriptorBase::InitializePlatformSpecific(
358    CallInterfaceDescriptorData* data) {
359  data->InitializePlatformSpecific(0, nullptr);
360}
361
362void GrowArrayElementsDescriptor::InitializePlatformSpecific(
363    CallInterfaceDescriptorData* data) {
364  Register registers[] = {ObjectRegister(), KeyRegister()};
365  data->InitializePlatformSpecific(arraysize(registers), registers);
366}
367
368FunctionType*
369VarArgFunctionDescriptor::BuildCallInterfaceDescriptorFunctionType(
370    Isolate* isolate, int paramater_count) {
371  Zone* zone = isolate->interface_descriptor_zone();
372  FunctionType* function =
373      Type::Function(AnyTagged(zone), AnyTagged(zone), 1, zone)->AsFunction();
374  function->InitParameter(0, UntaggedIntegral32(zone));  // actual #arguments
375  return function;
376}
377
378FunctionType*
379FastCloneRegExpDescriptor::BuildCallInterfaceDescriptorFunctionType(
380    Isolate* isolate, int paramater_count) {
381  Zone* zone = isolate->interface_descriptor_zone();
382  FunctionType* function =
383      Type::Function(AnyTagged(zone), Type::Undefined(), 4, zone)->AsFunction();
384  function->InitParameter(0, AnyTagged(zone));  // closure
385  function->InitParameter(1, SmiType(zone));    // literal_index
386  function->InitParameter(2, AnyTagged(zone));  // pattern
387  function->InitParameter(3, AnyTagged(zone));  // flags
388  return function;
389}
390
391FunctionType*
392FastCloneShallowArrayDescriptor::BuildCallInterfaceDescriptorFunctionType(
393    Isolate* isolate, int paramater_count) {
394  Zone* zone = isolate->interface_descriptor_zone();
395  FunctionType* function =
396      Type::Function(AnyTagged(zone), Type::Undefined(), 3, zone)->AsFunction();
397  function->InitParameter(0, AnyTagged(zone));
398  function->InitParameter(1, SmiType(zone));
399  function->InitParameter(2, AnyTagged(zone));
400  return function;
401}
402
403FunctionType*
404CreateAllocationSiteDescriptor::BuildCallInterfaceDescriptorFunctionType(
405    Isolate* isolate, int paramater_count) {
406  Zone* zone = isolate->interface_descriptor_zone();
407  FunctionType* function =
408      Type::Function(AnyTagged(zone), Type::Undefined(), 2, zone)->AsFunction();
409  function->InitParameter(0, AnyTagged(zone));
410  function->InitParameter(1, SmiType(zone));
411  return function;
412}
413
414FunctionType*
415CreateWeakCellDescriptor::BuildCallInterfaceDescriptorFunctionType(
416    Isolate* isolate, int paramater_count) {
417  Zone* zone = isolate->interface_descriptor_zone();
418  FunctionType* function =
419      Type::Function(AnyTagged(zone), Type::Undefined(), 3, zone)->AsFunction();
420  function->InitParameter(0, AnyTagged(zone));
421  function->InitParameter(1, SmiType(zone));
422  function->InitParameter(2, AnyTagged(zone));
423  return function;
424}
425
426FunctionType*
427CallTrampolineDescriptor::BuildCallInterfaceDescriptorFunctionType(
428    Isolate* isolate, int paramater_count) {
429  Zone* zone = isolate->interface_descriptor_zone();
430  FunctionType* function =
431      Type::Function(AnyTagged(zone), Type::Undefined(), 2, zone)->AsFunction();
432  function->InitParameter(0, AnyTagged(zone));           // target
433  function->InitParameter(1, UntaggedIntegral32(zone));  // actual #arguments
434  return function;
435}
436
437FunctionType* ConstructStubDescriptor::BuildCallInterfaceDescriptorFunctionType(
438    Isolate* isolate, int paramater_count) {
439  Zone* zone = isolate->interface_descriptor_zone();
440  FunctionType* function =
441      Type::Function(AnyTagged(zone), Type::Undefined(), 4, zone)->AsFunction();
442  function->InitParameter(0, AnyTagged(zone));           // target
443  function->InitParameter(1, AnyTagged(zone));           // new.target
444  function->InitParameter(2, UntaggedIntegral32(zone));  // actual #arguments
445  function->InitParameter(3, AnyTagged(zone));           // opt. allocation site
446  return function;
447}
448
449FunctionType*
450ConstructTrampolineDescriptor::BuildCallInterfaceDescriptorFunctionType(
451    Isolate* isolate, int paramater_count) {
452  Zone* zone = isolate->interface_descriptor_zone();
453  FunctionType* function =
454      Type::Function(AnyTagged(zone), Type::Undefined(), 3, zone)->AsFunction();
455  function->InitParameter(0, AnyTagged(zone));           // target
456  function->InitParameter(1, AnyTagged(zone));           // new.target
457  function->InitParameter(2, UntaggedIntegral32(zone));  // actual #arguments
458  return function;
459}
460
461FunctionType*
462CallFunctionWithFeedbackDescriptor::BuildCallInterfaceDescriptorFunctionType(
463    Isolate* isolate, int paramater_count) {
464  Zone* zone = isolate->interface_descriptor_zone();
465  FunctionType* function =
466      Type::Function(AnyTagged(zone), Type::Undefined(), 2, zone)->AsFunction();
467  function->InitParameter(0, Type::Receiver());  // JSFunction
468  function->InitParameter(1, SmiType(zone));
469  return function;
470}
471
472FunctionType* CallFunctionWithFeedbackAndVectorDescriptor::
473    BuildCallInterfaceDescriptorFunctionType(Isolate* isolate,
474                                             int paramater_count) {
475  Zone* zone = isolate->interface_descriptor_zone();
476  FunctionType* function =
477      Type::Function(AnyTagged(zone), Type::Undefined(), 3, zone)->AsFunction();
478  function->InitParameter(0, Type::Receiver());  // JSFunction
479  function->InitParameter(1, SmiType(zone));
480  function->InitParameter(2, AnyTagged(zone));
481  return function;
482}
483
484FunctionType*
485ArrayNoArgumentConstructorDescriptor::BuildCallInterfaceDescriptorFunctionType(
486    Isolate* isolate, int paramater_count) {
487  Zone* zone = isolate->interface_descriptor_zone();
488  FunctionType* function =
489      Type::Function(AnyTagged(zone), Type::Undefined(), 4, zone)->AsFunction();
490  function->InitParameter(0, Type::Receiver());  // JSFunction
491  function->InitParameter(1, AnyTagged(zone));
492  function->InitParameter(2, UntaggedIntegral32(zone));
493  function->InitParameter(3, AnyTagged(zone));
494  return function;
495}
496
497FunctionType* ArraySingleArgumentConstructorDescriptor::
498    BuildCallInterfaceDescriptorFunctionType(Isolate* isolate,
499                                             int paramater_count) {
500  Zone* zone = isolate->interface_descriptor_zone();
501  FunctionType* function =
502      Type::Function(AnyTagged(zone), Type::Undefined(), 5, zone)->AsFunction();
503  function->InitParameter(0, Type::Receiver());  // JSFunction
504  function->InitParameter(1, AnyTagged(zone));
505  function->InitParameter(2, UntaggedIntegral32(zone));
506  function->InitParameter(3, AnyTagged(zone));
507  function->InitParameter(4, AnyTagged(zone));
508  return function;
509}
510
511FunctionType*
512ArrayNArgumentsConstructorDescriptor::BuildCallInterfaceDescriptorFunctionType(
513    Isolate* isolate, int paramater_count) {
514  Zone* zone = isolate->interface_descriptor_zone();
515  FunctionType* function =
516      Type::Function(AnyTagged(zone), Type::Undefined(), 3, zone)->AsFunction();
517  function->InitParameter(0, Type::Receiver());  // JSFunction
518  function->InitParameter(1, AnyTagged(zone));   // Allocation site or undefined
519  function->InitParameter(2, UntaggedIntegral32(zone));  //  Arg count
520  return function;
521}
522
523FunctionType*
524ArgumentAdaptorDescriptor::BuildCallInterfaceDescriptorFunctionType(
525    Isolate* isolate, int paramater_count) {
526  Zone* zone = isolate->interface_descriptor_zone();
527  FunctionType* function =
528      Type::Function(AnyTagged(zone), Type::Undefined(), 4, zone)->AsFunction();
529  function->InitParameter(0, Type::Receiver());          // JSFunction
530  function->InitParameter(1, AnyTagged(zone));           // the new target
531  function->InitParameter(2, UntaggedIntegral32(zone));  // actual #arguments
532  function->InitParameter(3, UntaggedIntegral32(zone));  // expected #arguments
533  return function;
534}
535
536CallInterfaceDescriptor ApiCallbackDescriptorBase::ForArgs(Isolate* isolate,
537                                                           int argc) {
538  switch (argc) {
539    case 0:
540      return ApiCallbackWith0ArgsDescriptor(isolate);
541    case 1:
542      return ApiCallbackWith1ArgsDescriptor(isolate);
543    case 2:
544      return ApiCallbackWith2ArgsDescriptor(isolate);
545    case 3:
546      return ApiCallbackWith3ArgsDescriptor(isolate);
547    case 4:
548      return ApiCallbackWith4ArgsDescriptor(isolate);
549    case 5:
550      return ApiCallbackWith5ArgsDescriptor(isolate);
551    case 6:
552      return ApiCallbackWith6ArgsDescriptor(isolate);
553    case 7:
554      return ApiCallbackWith7ArgsDescriptor(isolate);
555    default:
556      UNREACHABLE();
557      return VoidDescriptor(isolate);
558  }
559}
560
561FunctionType*
562ApiCallbackDescriptorBase::BuildCallInterfaceDescriptorFunctionTypeWithArg(
563    Isolate* isolate, int parameter_count, int argc) {
564  Zone* zone = isolate->interface_descriptor_zone();
565  FunctionType* function =
566      Type::Function(AnyTagged(zone), Type::Undefined(), 4 + argc, zone)
567          ->AsFunction();
568  function->InitParameter(0, AnyTagged(zone));        // callee
569  function->InitParameter(1, AnyTagged(zone));        // call_data
570  function->InitParameter(2, AnyTagged(zone));        // holder
571  function->InitParameter(3, ExternalPointer(zone));  // api_function_address
572  for (int i = 0; i < argc; i++) {
573    function->InitParameter(i, AnyTagged(zone));
574  }
575  return function;
576}
577
578FunctionType*
579InterpreterDispatchDescriptor::BuildCallInterfaceDescriptorFunctionType(
580    Isolate* isolate, int parameter_count) {
581  Zone* zone = isolate->interface_descriptor_zone();
582  FunctionType* function =
583      Type::Function(AnyTagged(zone), Type::Undefined(), 4, zone)->AsFunction();
584  function->InitParameter(kAccumulatorParameter, AnyTagged(zone));
585  function->InitParameter(kBytecodeOffsetParameter, UntaggedIntegral32(zone));
586  function->InitParameter(kBytecodeArrayParameter, AnyTagged(zone));
587  function->InitParameter(kDispatchTableParameter, AnyTagged(zone));
588  return function;
589}
590
591}  // namespace internal
592}  // namespace v8
593