interface-descriptors.h 23.9 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
// Copyright 2014 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef V8_CALL_INTERFACE_DESCRIPTOR_H_
#define V8_CALL_INTERFACE_DESCRIPTOR_H_

#include "src/assembler.h"
#include "src/macro-assembler.h"

namespace v8 {
namespace internal {

class PlatformInterfaceDescriptor;

16
#define INTERFACE_DESCRIPTOR_LIST(V)          \
17
  V(Void)                                     \
18 19
  V(Load)                                     \
  V(Store)                                    \
20
  V(StoreTransition)                          \
21
  V(VectorStoreTransition)                    \
22 23
  V(VectorStoreICTrampoline)                  \
  V(VectorStoreIC)                            \
24
  V(InstanceOf)                               \
25
  V(LoadWithVector)                           \
26 27 28
  V(FastNewClosure)                           \
  V(FastNewContext)                           \
  V(ToNumber)                                 \
29
  V(ToLength)                                 \
30
  V(ToString)                                 \
31
  V(ToName)                                   \
32
  V(ToObject)                                 \
33
  V(NumberToString)                           \
34
  V(Typeof)                                   \
35
  V(FastCloneRegExp)                          \
36 37 38
  V(FastCloneShallowArray)                    \
  V(FastCloneShallowObject)                   \
  V(CreateAllocationSite)                     \
39
  V(CreateWeakCell)                           \
40
  V(CallFunction)                             \
41
  V(CallFunctionWithFeedback)                 \
42
  V(CallFunctionWithFeedbackAndVector)        \
43
  V(CallConstruct)                            \
44
  V(CallTrampoline)                           \
45
  V(ConstructStub)                            \
46
  V(ConstructTrampoline)                      \
47 48
  V(RegExpConstructResult)                    \
  V(TransitionElementsKind)                   \
49
  V(AllocateHeapNumber)                       \
50
  V(AllocateMutableHeapNumber)                \
51
  V(AllocateInNewSpace)                       \
52 53 54 55
  V(ArrayConstructorConstantArgCount)         \
  V(ArrayConstructor)                         \
  V(InternalArrayConstructorConstantArgCount) \
  V(InternalArrayConstructor)                 \
56
  V(Compare)                                  \
57 58 59 60 61
  V(CompareNil)                               \
  V(ToBoolean)                                \
  V(BinaryOp)                                 \
  V(BinaryOpWithAllocationSite)               \
  V(StringAdd)                                \
62
  V(StringCompare)                            \
63 64 65 66
  V(Keyed)                                    \
  V(Named)                                    \
  V(CallHandler)                              \
  V(ArgumentAdaptor)                          \
67
  V(ApiFunction)                              \
68 69
  V(ApiAccessor)                              \
  V(ApiGetter)                                \
70
  V(ArgumentsAccessRead)                      \
71
  V(ArgumentsAccessNew)                       \
72
  V(RestParamAccess)                          \
73 74
  V(LoadGlobalViaContext)                     \
  V(StoreGlobalViaContext)                    \
75 76
  V(MathPowTagged)                            \
  V(MathPowInteger)                           \
77
  V(ContextOnly)                              \
78
  V(GrowArrayElements)                        \
79
  V(InterpreterPushArgsAndCall)               \
80
  V(InterpreterPushArgsAndConstruct)          \
81
  V(InterpreterCEntry)
82 83 84


class CallInterfaceDescriptorData {
85
 public:
86
  CallInterfaceDescriptorData()
87
      : register_param_count_(-1), function_type_(nullptr) {}
88 89

  // A copy of the passed in registers and param_representations is made
90
  // and owned by the CallInterfaceDescriptorData.
91

92
  void InitializePlatformIndependent(Type::FunctionType* function_type) {
93 94 95
    function_type_ = function_type;
  }

96 97 98
  // TODO(mvstanton): Instead of taking parallel arrays register and
  // param_representations, how about a struct that puts the representation
  // and register side by side (eg, RegRep(r1, Representation::Tagged()).
99
  // The same should go for the CodeStubDescriptor class.
100 101 102
  void InitializePlatformSpecific(
      int register_parameter_count, Register* registers,
      PlatformInterfaceDescriptor* platform_descriptor = NULL);
103

104 105
  bool IsInitialized() const { return register_param_count_ >= 0; }

106
  int param_count() const { return function_type_->Arity(); }
107 108 109
  int register_param_count() const { return register_param_count_; }
  Register register_param(int index) const { return register_params_[index]; }
  Register* register_params() const { return register_params_.get(); }
110
  Type* param_type(int index) const { return function_type_->Parameter(index); }
111 112 113 114
  PlatformInterfaceDescriptor* platform_specific_descriptor() const {
    return platform_specific_descriptor_;
  }

115 116
  Type::FunctionType* function_type() const { return function_type_; }

117 118 119 120 121 122 123
 private:
  int register_param_count_;

  // The Register params are allocated dynamically by the
  // InterfaceDescriptor, and freed on destruction. This is because static
  // arrays of Registers cause creation of runtime static initializers
  // which we don't want.
rmcilroy's avatar
rmcilroy committed
124
  base::SmartArrayPointer<Register> register_params_;
125 126 127

  // Specifies types for parameters and return
  Type::FunctionType* function_type_;
128

129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148
  PlatformInterfaceDescriptor* platform_specific_descriptor_;

  DISALLOW_COPY_AND_ASSIGN(CallInterfaceDescriptorData);
};


class CallDescriptors {
 public:
  enum Key {
#define DEF_ENUM(name) name,
    INTERFACE_DESCRIPTOR_LIST(DEF_ENUM)
#undef DEF_ENUM
    NUMBER_OF_DESCRIPTORS
  };
};


class CallInterfaceDescriptor {
 public:
  CallInterfaceDescriptor() : data_(NULL) {}
149
  virtual ~CallInterfaceDescriptor() {}
150 151 152 153

  CallInterfaceDescriptor(Isolate* isolate, CallDescriptors::Key key)
      : data_(isolate->call_descriptor_data(key)) {}

154 155
  int GetParameterCount() const { return data()->param_count(); }

156 157 158
  int GetRegisterParameterCount() const {
    return data()->register_param_count();
  }
159

160 161 162 163 164
  int GetStackParameterCount() const {
    return data()->function_type()->Arity() - data()->register_param_count();
  }

  Register GetRegisterParameter(int index) const {
165
    return data()->register_param(index);
166 167
  }

168
  Type* GetParameterType(int index) const {
169 170
    DCHECK(index < data()->param_count());
    return data()->param_type(index);
171 172 173 174
  }

  // Some platforms have extra information to associate with the descriptor.
  PlatformInterfaceDescriptor* platform_specific_descriptor() const {
175
    return data()->platform_specific_descriptor();
176 177
  }

178 179 180 181
  Type::FunctionType* GetFunctionType() const {
    return data()->function_type();
  }

182 183
  static const Register ContextRegister();

184
  const char* DebugName(Isolate* isolate) const;
185

186 187 188
  static Type::FunctionType* BuildDefaultFunctionType(Isolate* isolate,
                                                      int paramater_count);

189 190 191
 protected:
  const CallInterfaceDescriptorData* data() const { return data_; }

192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207
  virtual Type::FunctionType* BuildCallInterfaceDescriptorFunctionType(
      Isolate* isolate, int register_param_count) {
    return BuildDefaultFunctionType(isolate, register_param_count);
  }

  virtual void InitializePlatformSpecific(CallInterfaceDescriptorData* data) {
    UNREACHABLE();
  }

  void Initialize(Isolate* isolate, CallDescriptors::Key key) {
    if (!data()->IsInitialized()) {
      CallInterfaceDescriptorData* d = isolate->call_descriptor_data(key);
      InitializePlatformSpecific(d);
      Type::FunctionType* function_type =
          BuildCallInterfaceDescriptorFunctionType(isolate,
                                                   d->register_param_count());
208
      d->InitializePlatformIndependent(function_type);
209 210 211
    }
  }

212
 private:
213 214
  const CallInterfaceDescriptorData* data_;
};
215 216


217 218 219 220 221 222 223 224 225 226
#define DECLARE_DESCRIPTOR(name, base)                                         \
  explicit name(Isolate* isolate) : base(isolate, key()) {                     \
    Initialize(isolate, key());                                                \
  }                                                                            \
                                                                               \
 protected:                                                                    \
  void InitializePlatformSpecific(CallInterfaceDescriptorData* data) override; \
  name(Isolate* isolate, CallDescriptors::Key key) : base(isolate, key) {}     \
                                                                               \
 public:                                                                       \
227
  static inline CallDescriptors::Key key();
228

229

230 231 232 233 234 235
#define DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(name, base) \
  DECLARE_DESCRIPTOR(name, base)                                 \
 protected:                                                      \
  Type::FunctionType* BuildCallInterfaceDescriptorFunctionType(  \
      Isolate* isolate, int register_param_count) override;      \
                                                                 \
236
 public:
237 238 239 240 241 242 243 244


class VoidDescriptor : public CallInterfaceDescriptor {
 public:
  DECLARE_DESCRIPTOR(VoidDescriptor, CallInterfaceDescriptor)
};


245
// LoadDescriptor is used by all stubs that implement Load/KeyedLoad ICs.
246 247
class LoadDescriptor : public CallInterfaceDescriptor {
 public:
248 249
  DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(LoadDescriptor,
                                               CallInterfaceDescriptor)
250

251
  enum ParameterIndices { kReceiverIndex, kNameIndex, kSlotIndex };
252 253
  static const Register ReceiverRegister();
  static const Register NameRegister();
254
  static const Register SlotRegister();
255 256 257
};


258
class StoreDescriptor : public CallInterfaceDescriptor {
259
 public:
260
  DECLARE_DESCRIPTOR(StoreDescriptor, CallInterfaceDescriptor)
261

262 263 264 265 266 267 268 269 270
  enum ParameterIndices {
    kReceiverIndex,
    kNameIndex,
    kValueIndex,
    kParameterCount
  };
  static const Register ReceiverRegister();
  static const Register NameRegister();
  static const Register ValueRegister();
271
};
272 273


274
class StoreTransitionDescriptor : public StoreDescriptor {
275
 public:
276 277
  DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(StoreTransitionDescriptor,
                                               StoreDescriptor)
278 279 280 281 282 283 284 285 286

  // Extends StoreDescriptor with Map parameter.
  enum ParameterIndices {
    kReceiverIndex,
    kNameIndex,
    kValueIndex,
    kMapIndex,
    kParameterCount
  };
287

288 289 290 291 292 293 294 295 296 297 298
  static const Register MapRegister();
};


class VectorStoreTransitionDescriptor : public StoreDescriptor {
 public:
  DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(VectorStoreTransitionDescriptor,
                                               StoreDescriptor)

  // Extends StoreDescriptor with Map parameter.
  enum ParameterIndices {
299 300 301 302 303 304 305 306 307 308
    kReceiverIndex = 0,
    kNameIndex = 1,
    kValueIndex = 2,

    kMapIndex = 3,

    kSlotIndex = 4,  // not present on ia32.
    kVirtualSlotVectorIndex = 4,

    kVectorIndex = 5
309 310
  };

311
  static const Register MapRegister();
312 313
  static const Register SlotRegister();
  static const Register VectorRegister();
314 315 316
};


317
class InstanceOfDescriptor final : public CallInterfaceDescriptor {
318
 public:
319
  DECLARE_DESCRIPTOR(InstanceOfDescriptor, CallInterfaceDescriptor)
320 321

  enum ParameterIndices { kLeftIndex, kRightIndex, kParameterCount };
322 323
  static const Register LeftRegister();
  static const Register RightRegister();
324 325 326
};


327 328
class VectorStoreICTrampolineDescriptor : public StoreDescriptor {
 public:
329 330
  DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(
      VectorStoreICTrampolineDescriptor, StoreDescriptor)
331 332 333 334 335 336 337 338 339

  enum ParameterIndices { kReceiverIndex, kNameIndex, kValueIndex, kSlotIndex };

  static const Register SlotRegister();
};


class VectorStoreICDescriptor : public VectorStoreICTrampolineDescriptor {
 public:
340 341
  DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(
      VectorStoreICDescriptor, VectorStoreICTrampolineDescriptor)
342 343 344 345 346 347 348 349 350 351 352 353 354

  enum ParameterIndices {
    kReceiverIndex,
    kNameIndex,
    kValueIndex,
    kSlotIndex,
    kVectorIndex
  };

  static const Register VectorRegister();
};


355
class LoadWithVectorDescriptor : public LoadDescriptor {
356
 public:
357 358
  DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(LoadWithVectorDescriptor,
                                               LoadDescriptor)
359 360 361 362 363

  enum ParameterIndices {
    kReceiverIndex,
    kNameIndex,
    kSlotIndex,
364
    kVectorIndex
365 366 367 368 369 370 371 372
  };

  static const Register VectorRegister();
};


class FastNewClosureDescriptor : public CallInterfaceDescriptor {
 public:
373
  DECLARE_DESCRIPTOR(FastNewClosureDescriptor, CallInterfaceDescriptor)
374 375 376 377 378
};


class FastNewContextDescriptor : public CallInterfaceDescriptor {
 public:
379
  DECLARE_DESCRIPTOR(FastNewContextDescriptor, CallInterfaceDescriptor)
380 381 382 383 384
};


class ToNumberDescriptor : public CallInterfaceDescriptor {
 public:
385
  DECLARE_DESCRIPTOR(ToNumberDescriptor, CallInterfaceDescriptor)
386 387 388
};


389 390 391 392 393 394 395 396 397 398
class ToLengthDescriptor : public CallInterfaceDescriptor {
 public:
  enum ParameterIndices { kReceiverIndex };

  DECLARE_DESCRIPTOR(ToLengthDescriptor, CallInterfaceDescriptor)

  static const Register ReceiverRegister();
};


399 400 401 402 403 404 405 406 407 408
class ToStringDescriptor : public CallInterfaceDescriptor {
 public:
  enum ParameterIndices { kReceiverIndex };

  DECLARE_DESCRIPTOR(ToStringDescriptor, CallInterfaceDescriptor)

  static const Register ReceiverRegister();
};


409 410 411 412 413 414 415 416 417 418
class ToNameDescriptor : public CallInterfaceDescriptor {
 public:
  enum ParameterIndices { kReceiverIndex };

  DECLARE_DESCRIPTOR(ToNameDescriptor, CallInterfaceDescriptor)

  static const Register ReceiverRegister();
};


419 420 421 422 423 424 425 426 427 428
class ToObjectDescriptor : public CallInterfaceDescriptor {
 public:
  enum ParameterIndices { kReceiverIndex };

  DECLARE_DESCRIPTOR(ToObjectDescriptor, CallInterfaceDescriptor)

  static const Register ReceiverRegister();
};


429 430
class NumberToStringDescriptor : public CallInterfaceDescriptor {
 public:
431
  DECLARE_DESCRIPTOR(NumberToStringDescriptor, CallInterfaceDescriptor)
432 433 434
};


435 436 437 438 439
class TypeofDescriptor : public CallInterfaceDescriptor {
 public:
  DECLARE_DESCRIPTOR(TypeofDescriptor, CallInterfaceDescriptor)
};

440 441 442 443 444 445 446

class FastCloneRegExpDescriptor : public CallInterfaceDescriptor {
 public:
  DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(FastCloneRegExpDescriptor,
                                               CallInterfaceDescriptor)
};

447

448 449
class FastCloneShallowArrayDescriptor : public CallInterfaceDescriptor {
 public:
450 451
  DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(FastCloneShallowArrayDescriptor,
                                               CallInterfaceDescriptor)
452 453 454 455 456
};


class FastCloneShallowObjectDescriptor : public CallInterfaceDescriptor {
 public:
457
  DECLARE_DESCRIPTOR(FastCloneShallowObjectDescriptor, CallInterfaceDescriptor)
458 459 460 461 462
};


class CreateAllocationSiteDescriptor : public CallInterfaceDescriptor {
 public:
463 464
  DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(CreateAllocationSiteDescriptor,
                                               CallInterfaceDescriptor)
465 466 467
};


468 469 470 471 472 473 474 475 476
class CreateWeakCellDescriptor : public CallInterfaceDescriptor {
 public:
  enum ParameterIndices {
    kVectorIndex,
    kSlotIndex,
    kValueIndex,
    kParameterCount
  };

477 478
  DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(CreateWeakCellDescriptor,
                                               CallInterfaceDescriptor)
479 480 481
};


482 483 484 485 486 487 488
class CallTrampolineDescriptor : public CallInterfaceDescriptor {
 public:
  DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(CallTrampolineDescriptor,
                                               CallInterfaceDescriptor)
};


489 490 491 492 493 494 495
class ConstructStubDescriptor : public CallInterfaceDescriptor {
 public:
  DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(ConstructStubDescriptor,
                                               CallInterfaceDescriptor)
};


496 497 498 499 500 501 502
class ConstructTrampolineDescriptor : public CallInterfaceDescriptor {
 public:
  DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(ConstructTrampolineDescriptor,
                                               CallInterfaceDescriptor)
};


503 504
class CallFunctionDescriptor : public CallInterfaceDescriptor {
 public:
505 506 507 508 509 510
  DECLARE_DESCRIPTOR(CallFunctionDescriptor, CallInterfaceDescriptor)
};


class CallFunctionWithFeedbackDescriptor : public CallInterfaceDescriptor {
 public:
511 512
  DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(
      CallFunctionWithFeedbackDescriptor, CallInterfaceDescriptor)
513 514 515
};


516 517 518
class CallFunctionWithFeedbackAndVectorDescriptor
    : public CallInterfaceDescriptor {
 public:
519 520
  DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(
      CallFunctionWithFeedbackAndVectorDescriptor, CallInterfaceDescriptor)
521 522 523
};


524
class CallConstructDescriptor : public CallInterfaceDescriptor {
525
 public:
526
  DECLARE_DESCRIPTOR(CallConstructDescriptor, CallInterfaceDescriptor)
527 528 529 530 531
};


class RegExpConstructResultDescriptor : public CallInterfaceDescriptor {
 public:
532
  DECLARE_DESCRIPTOR(RegExpConstructResultDescriptor, CallInterfaceDescriptor)
533 534 535
};


536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554
class LoadGlobalViaContextDescriptor : public CallInterfaceDescriptor {
 public:
  DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(LoadGlobalViaContextDescriptor,
                                               CallInterfaceDescriptor)

  static const Register SlotRegister();
};


class StoreGlobalViaContextDescriptor : public CallInterfaceDescriptor {
 public:
  DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(StoreGlobalViaContextDescriptor,
                                               CallInterfaceDescriptor)

  static const Register SlotRegister();
  static const Register ValueRegister();
};


555 556
class TransitionElementsKindDescriptor : public CallInterfaceDescriptor {
 public:
557
  DECLARE_DESCRIPTOR(TransitionElementsKindDescriptor, CallInterfaceDescriptor)
558 559 560
};


561 562 563 564 565 566
class AllocateHeapNumberDescriptor : public CallInterfaceDescriptor {
 public:
  DECLARE_DESCRIPTOR(AllocateHeapNumberDescriptor, CallInterfaceDescriptor)
};


567 568 569 570 571 572 573
class AllocateMutableHeapNumberDescriptor : public CallInterfaceDescriptor {
 public:
  DECLARE_DESCRIPTOR(AllocateMutableHeapNumberDescriptor,
                     CallInterfaceDescriptor)
};


574 575 576 577 578 579
class AllocateInNewSpaceDescriptor : public CallInterfaceDescriptor {
 public:
  DECLARE_DESCRIPTOR(AllocateInNewSpaceDescriptor, CallInterfaceDescriptor)
};


580 581 582
class ArrayConstructorConstantArgCountDescriptor
    : public CallInterfaceDescriptor {
 public:
583 584
  DECLARE_DESCRIPTOR(ArrayConstructorConstantArgCountDescriptor,
                     CallInterfaceDescriptor)
585 586 587 588 589
};


class ArrayConstructorDescriptor : public CallInterfaceDescriptor {
 public:
590 591
  DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(ArrayConstructorDescriptor,
                                               CallInterfaceDescriptor)
592 593 594 595 596 597
};


class InternalArrayConstructorConstantArgCountDescriptor
    : public CallInterfaceDescriptor {
 public:
598 599
  DECLARE_DESCRIPTOR(InternalArrayConstructorConstantArgCountDescriptor,
                     CallInterfaceDescriptor)
600 601 602 603 604
};


class InternalArrayConstructorDescriptor : public CallInterfaceDescriptor {
 public:
605 606
  DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(
      InternalArrayConstructorDescriptor, CallInterfaceDescriptor)
607 608 609
};


610 611 612 613 614 615
class CompareDescriptor : public CallInterfaceDescriptor {
 public:
  DECLARE_DESCRIPTOR(CompareDescriptor, CallInterfaceDescriptor)
};


616 617
class CompareNilDescriptor : public CallInterfaceDescriptor {
 public:
618
  DECLARE_DESCRIPTOR(CompareNilDescriptor, CallInterfaceDescriptor)
619 620 621 622 623
};


class ToBooleanDescriptor : public CallInterfaceDescriptor {
 public:
624
  DECLARE_DESCRIPTOR(ToBooleanDescriptor, CallInterfaceDescriptor)
625 626 627 628 629
};


class BinaryOpDescriptor : public CallInterfaceDescriptor {
 public:
630
  DECLARE_DESCRIPTOR(BinaryOpDescriptor, CallInterfaceDescriptor)
631 632 633 634 635
};


class BinaryOpWithAllocationSiteDescriptor : public CallInterfaceDescriptor {
 public:
636 637
  DECLARE_DESCRIPTOR(BinaryOpWithAllocationSiteDescriptor,
                     CallInterfaceDescriptor)
638 639 640 641 642
};


class StringAddDescriptor : public CallInterfaceDescriptor {
 public:
643
  DECLARE_DESCRIPTOR(StringAddDescriptor, CallInterfaceDescriptor)
644 645 646
};


647 648 649 650 651 652 653 654 655 656
class StringCompareDescriptor : public CallInterfaceDescriptor {
 public:
  DECLARE_DESCRIPTOR(StringCompareDescriptor, CallInterfaceDescriptor)

  enum ParameterIndices { kLeftIndex, kRightIndex, kParameterCount };
  static const Register LeftRegister();
  static const Register RightRegister();
};


657 658
class KeyedDescriptor : public CallInterfaceDescriptor {
 public:
659
  DECLARE_DESCRIPTOR(KeyedDescriptor, CallInterfaceDescriptor)
660 661 662 663 664
};


class NamedDescriptor : public CallInterfaceDescriptor {
 public:
665
  DECLARE_DESCRIPTOR(NamedDescriptor, CallInterfaceDescriptor)
666 667 668 669 670
};


class CallHandlerDescriptor : public CallInterfaceDescriptor {
 public:
671
  DECLARE_DESCRIPTOR(CallHandlerDescriptor, CallInterfaceDescriptor)
672 673 674 675 676
};


class ArgumentAdaptorDescriptor : public CallInterfaceDescriptor {
 public:
677 678
  DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(ArgumentAdaptorDescriptor,
                                               CallInterfaceDescriptor)
679 680 681 682 683
};


class ApiFunctionDescriptor : public CallInterfaceDescriptor {
 public:
684 685
  DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(ApiFunctionDescriptor,
                                               CallInterfaceDescriptor)
686 687 688
};


689 690
class ApiAccessorDescriptor : public CallInterfaceDescriptor {
 public:
691 692
  DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(ApiAccessorDescriptor,
                                               CallInterfaceDescriptor)
693 694 695
};


696 697
class ApiGetterDescriptor : public CallInterfaceDescriptor {
 public:
698 699
  DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(ApiGetterDescriptor,
                                               CallInterfaceDescriptor)
700 701 702 703 704 705 706 707 708 709 710 711 712 713

  static const Register function_address();
};


class ArgumentsAccessReadDescriptor : public CallInterfaceDescriptor {
 public:
  DECLARE_DESCRIPTOR(ArgumentsAccessReadDescriptor, CallInterfaceDescriptor)

  static const Register index();
  static const Register parameter_count();
};


714 715 716 717 718 719 720 721 722 723 724
class ArgumentsAccessNewDescriptor : public CallInterfaceDescriptor {
 public:
  DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(ArgumentsAccessNewDescriptor,
                                               CallInterfaceDescriptor)

  static const Register function();
  static const Register parameter_count();
  static const Register parameter_pointer();
};


725 726 727 728 729 730 731 732 733 734
class RestParamAccessDescriptor : public CallInterfaceDescriptor {
 public:
  DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(RestParamAccessDescriptor,
                                               CallInterfaceDescriptor)
  static const Register parameter_count();
  static const Register parameter_pointer();
  static const Register rest_parameter_index();
};


735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753
class MathPowTaggedDescriptor : public CallInterfaceDescriptor {
 public:
  DECLARE_DESCRIPTOR(MathPowTaggedDescriptor, CallInterfaceDescriptor)

  static const Register exponent();
};


class MathPowIntegerDescriptor : public CallInterfaceDescriptor {
 public:
  DECLARE_DESCRIPTOR(MathPowIntegerDescriptor, CallInterfaceDescriptor)

  static const Register exponent();
};


class ContextOnlyDescriptor : public CallInterfaceDescriptor {
 public:
  DECLARE_DESCRIPTOR(ContextOnlyDescriptor, CallInterfaceDescriptor)
754 755
};

756 757 758 759 760

class GrowArrayElementsDescriptor : public CallInterfaceDescriptor {
 public:
  DECLARE_DESCRIPTOR(GrowArrayElementsDescriptor, CallInterfaceDescriptor)

761
  enum RegisterInfo { kObjectIndex, kKeyIndex };
762 763 764 765
  static const Register ObjectRegister();
  static const Register KeyRegister();
};

766

767
class InterpreterPushArgsAndCallDescriptor : public CallInterfaceDescriptor {
768
 public:
769 770 771 772 773
  DECLARE_DESCRIPTOR(InterpreterPushArgsAndCallDescriptor,
                     CallInterfaceDescriptor)
};


774 775 776 777 778 779 780 781
class InterpreterPushArgsAndConstructDescriptor
    : public CallInterfaceDescriptor {
 public:
  DECLARE_DESCRIPTOR(InterpreterPushArgsAndConstructDescriptor,
                     CallInterfaceDescriptor)
};


782 783 784
class InterpreterCEntryDescriptor : public CallInterfaceDescriptor {
 public:
  DECLARE_DESCRIPTOR(InterpreterCEntryDescriptor, CallInterfaceDescriptor)
785 786
};

787

788 789 790 791 792 793 794 795 796
#undef DECLARE_DESCRIPTOR


// We define the association between CallDescriptors::Key and the specialized
// descriptor here to reduce boilerplate and mistakes.
#define DEF_KEY(name) \
  CallDescriptors::Key name##Descriptor::key() { return CallDescriptors::name; }
INTERFACE_DESCRIPTOR_LIST(DEF_KEY)
#undef DEF_KEY
797 798
}  // namespace internal
}  // namespace v8
799

800

801 802 803 804 805 806 807
#if V8_TARGET_ARCH_ARM64
#include "src/arm64/interface-descriptors-arm64.h"
#elif V8_TARGET_ARCH_ARM
#include "src/arm/interface-descriptors-arm.h"
#endif

#endif  // V8_CALL_INTERFACE_DESCRIPTOR_H_