1 // Copyright 2014 the V8 project authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef V8_CALL_INTERFACE_DESCRIPTOR_H_ 6 #define V8_CALL_INTERFACE_DESCRIPTOR_H_ 7 8 #include "src/assembler.h" 9 #include "src/macro-assembler.h" 10 11 namespace v8 { 12 namespace internal { 13 14 class PlatformInterfaceDescriptor; 15 16 #define INTERFACE_DESCRIPTOR_LIST(V) \ 17 V(Void) \ 18 V(Load) \ 19 V(Store) \ 20 V(StoreTransition) \ 21 V(VectorStoreTransition) \ 22 V(VectorStoreICTrampoline) \ 23 V(VectorStoreIC) \ 24 V(InstanceOf) \ 25 V(LoadWithVector) \ 26 V(FastNewClosure) \ 27 V(FastNewContext) \ 28 V(ToNumber) \ 29 V(ToLength) \ 30 V(ToString) \ 31 V(ToObject) \ 32 V(NumberToString) \ 33 V(Typeof) \ 34 V(FastCloneRegExp) \ 35 V(FastCloneShallowArray) \ 36 V(FastCloneShallowObject) \ 37 V(CreateAllocationSite) \ 38 V(CreateWeakCell) \ 39 V(CallFunction) \ 40 V(CallFunctionWithFeedback) \ 41 V(CallFunctionWithFeedbackAndVector) \ 42 V(CallConstruct) \ 43 V(CallTrampoline) \ 44 V(ConstructStub) \ 45 V(ConstructTrampoline) \ 46 V(RegExpConstructResult) \ 47 V(TransitionElementsKind) \ 48 V(AllocateHeapNumber) \ 49 V(AllocateMutableHeapNumber) \ 50 V(AllocateInNewSpace) \ 51 V(ArrayConstructorConstantArgCount) \ 52 V(ArrayConstructor) \ 53 V(InternalArrayConstructorConstantArgCount) \ 54 V(InternalArrayConstructor) \ 55 V(Compare) \ 56 V(CompareNil) \ 57 V(ToBoolean) \ 58 V(BinaryOp) \ 59 V(BinaryOpWithAllocationSite) \ 60 V(StringAdd) \ 61 V(StringCompare) \ 62 V(Keyed) \ 63 V(Named) \ 64 V(CallHandler) \ 65 V(ArgumentAdaptor) \ 66 V(ApiFunction) \ 67 V(ApiAccessor) \ 68 V(ApiGetter) \ 69 V(ArgumentsAccessRead) \ 70 V(ArgumentsAccessNew) \ 71 V(RestParamAccess) \ 72 V(StoreArrayLiteralElement) \ 73 V(LoadGlobalViaContext) \ 74 V(StoreGlobalViaContext) \ 75 V(MathPowTagged) \ 76 V(MathPowInteger) \ 77 V(ContextOnly) \ 78 V(GrowArrayElements) \ 79 V(InterpreterPushArgsAndCall) \ 80 V(InterpreterPushArgsAndConstruct) \ 81 V(InterpreterCEntry) 82 83 84 class CallInterfaceDescriptorData { 85 public: CallInterfaceDescriptorData()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 InitializePlatformIndependent(Type::FunctionType * function_type)92 void InitializePlatformIndependent(Type::FunctionType* function_type) { 93 function_type_ = function_type; 94 } 95 96 // TODO(mvstanton): Instead of taking parallel arrays register and 97 // param_representations, how about a struct that puts the representation 98 // and register side by side (eg, RegRep(r1, Representation::Tagged()). 99 // The same should go for the CodeStubDescriptor class. 100 void InitializePlatformSpecific( 101 int register_parameter_count, Register* registers, 102 PlatformInterfaceDescriptor* platform_descriptor = NULL); 103 IsInitialized()104 bool IsInitialized() const { return register_param_count_ >= 0; } 105 param_count()106 int param_count() const { return function_type_->Arity(); } register_param_count()107 int register_param_count() const { return register_param_count_; } register_param(int index)108 Register register_param(int index) const { return register_params_[index]; } register_params()109 Register* register_params() const { return register_params_.get(); } param_type(int index)110 Type* param_type(int index) const { return function_type_->Parameter(index); } platform_specific_descriptor()111 PlatformInterfaceDescriptor* platform_specific_descriptor() const { 112 return platform_specific_descriptor_; 113 } 114 function_type()115 Type::FunctionType* function_type() const { return function_type_; } 116 117 private: 118 int register_param_count_; 119 120 // The Register params are allocated dynamically by the 121 // InterfaceDescriptor, and freed on destruction. This is because static 122 // arrays of Registers cause creation of runtime static initializers 123 // which we don't want. 124 base::SmartArrayPointer<Register> register_params_; 125 126 // Specifies types for parameters and return 127 Type::FunctionType* function_type_; 128 129 PlatformInterfaceDescriptor* platform_specific_descriptor_; 130 131 DISALLOW_COPY_AND_ASSIGN(CallInterfaceDescriptorData); 132 }; 133 134 135 class CallDescriptors { 136 public: 137 enum Key { 138 #define DEF_ENUM(name) name, 139 INTERFACE_DESCRIPTOR_LIST(DEF_ENUM) 140 #undef DEF_ENUM 141 NUMBER_OF_DESCRIPTORS 142 }; 143 }; 144 145 146 class CallInterfaceDescriptor { 147 public: CallInterfaceDescriptor()148 CallInterfaceDescriptor() : data_(NULL) {} ~CallInterfaceDescriptor()149 virtual ~CallInterfaceDescriptor() {} 150 CallInterfaceDescriptor(Isolate * isolate,CallDescriptors::Key key)151 CallInterfaceDescriptor(Isolate* isolate, CallDescriptors::Key key) 152 : data_(isolate->call_descriptor_data(key)) {} 153 GetParameterCount()154 int GetParameterCount() const { return data()->param_count(); } 155 GetRegisterParameterCount()156 int GetRegisterParameterCount() const { 157 return data()->register_param_count(); 158 } 159 GetStackParameterCount()160 int GetStackParameterCount() const { 161 return data()->function_type()->Arity() - data()->register_param_count(); 162 } 163 GetRegisterParameter(int index)164 Register GetRegisterParameter(int index) const { 165 return data()->register_param(index); 166 } 167 GetParameterType(int index)168 Type* GetParameterType(int index) const { 169 DCHECK(index < data()->param_count()); 170 return data()->param_type(index); 171 } 172 173 // Some platforms have extra information to associate with the descriptor. platform_specific_descriptor()174 PlatformInterfaceDescriptor* platform_specific_descriptor() const { 175 return data()->platform_specific_descriptor(); 176 } 177 GetFunctionType()178 Type::FunctionType* GetFunctionType() const { 179 return data()->function_type(); 180 } 181 182 static const Register ContextRegister(); 183 184 const char* DebugName(Isolate* isolate) const; 185 186 static Type::FunctionType* BuildDefaultFunctionType(Isolate* isolate, 187 int paramater_count); 188 189 protected: data()190 const CallInterfaceDescriptorData* data() const { return data_; } 191 BuildCallInterfaceDescriptorFunctionType(Isolate * isolate,int register_param_count)192 virtual Type::FunctionType* BuildCallInterfaceDescriptorFunctionType( 193 Isolate* isolate, int register_param_count) { 194 return BuildDefaultFunctionType(isolate, register_param_count); 195 } 196 InitializePlatformSpecific(CallInterfaceDescriptorData * data)197 virtual void InitializePlatformSpecific(CallInterfaceDescriptorData* data) { 198 UNREACHABLE(); 199 } 200 Initialize(Isolate * isolate,CallDescriptors::Key key)201 void Initialize(Isolate* isolate, CallDescriptors::Key key) { 202 if (!data()->IsInitialized()) { 203 CallInterfaceDescriptorData* d = isolate->call_descriptor_data(key); 204 InitializePlatformSpecific(d); 205 Type::FunctionType* function_type = 206 BuildCallInterfaceDescriptorFunctionType(isolate, 207 d->register_param_count()); 208 d->InitializePlatformIndependent(function_type); 209 } 210 } 211 212 private: 213 const CallInterfaceDescriptorData* data_; 214 }; 215 216 217 #define DECLARE_DESCRIPTOR(name, base) \ 218 explicit name(Isolate* isolate) : base(isolate, key()) { \ 219 Initialize(isolate, key()); \ 220 } \ 221 \ 222 protected: \ 223 void InitializePlatformSpecific(CallInterfaceDescriptorData* data) override; \ 224 name(Isolate* isolate, CallDescriptors::Key key) : base(isolate, key) {} \ 225 \ 226 public: \ 227 static inline CallDescriptors::Key key(); 228 229 230 #define DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(name, base) \ 231 DECLARE_DESCRIPTOR(name, base) \ 232 protected: \ 233 Type::FunctionType* BuildCallInterfaceDescriptorFunctionType( \ 234 Isolate* isolate, int register_param_count) override; \ 235 \ 236 public: 237 238 239 class VoidDescriptor : public CallInterfaceDescriptor { 240 public: 241 DECLARE_DESCRIPTOR(VoidDescriptor, CallInterfaceDescriptor) 242 }; 243 244 245 // LoadDescriptor is used by all stubs that implement Load/KeyedLoad ICs. 246 class LoadDescriptor : public CallInterfaceDescriptor { 247 public: 248 DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(LoadDescriptor, 249 CallInterfaceDescriptor) 250 251 enum ParameterIndices { kReceiverIndex, kNameIndex, kSlotIndex }; 252 static const Register ReceiverRegister(); 253 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 enum ParameterIndices { 263 kReceiverIndex, 264 kNameIndex, 265 kValueIndex, 266 kParameterCount 267 }; 268 static const Register ReceiverRegister(); 269 static const Register NameRegister(); 270 static const Register ValueRegister(); 271 }; 272 273 274 class StoreTransitionDescriptor : public StoreDescriptor { 275 public: 276 DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(StoreTransitionDescriptor, 277 StoreDescriptor) 278 279 // Extends StoreDescriptor with Map parameter. 280 enum ParameterIndices { 281 kReceiverIndex, 282 kNameIndex, 283 kValueIndex, 284 kMapIndex, 285 kParameterCount 286 }; 287 288 static const Register MapRegister(); 289 }; 290 291 292 class VectorStoreTransitionDescriptor : public StoreDescriptor { 293 public: 294 DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(VectorStoreTransitionDescriptor, 295 StoreDescriptor) 296 297 // Extends StoreDescriptor with Map parameter. 298 enum ParameterIndices { 299 kReceiverIndex = 0, 300 kNameIndex = 1, 301 kValueIndex = 2, 302 303 kMapIndex = 3, 304 305 kSlotIndex = 4, // not present on ia32. 306 kVirtualSlotVectorIndex = 4, 307 308 kVectorIndex = 5 309 }; 310 311 static const Register MapRegister(); 312 static const Register SlotRegister(); 313 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 static const Register LeftRegister(); 323 static const Register RightRegister(); 324 }; 325 326 327 class VectorStoreICTrampolineDescriptor : public StoreDescriptor { 328 public: 329 DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE( 330 VectorStoreICTrampolineDescriptor, StoreDescriptor) 331 332 enum ParameterIndices { kReceiverIndex, kNameIndex, kValueIndex, kSlotIndex }; 333 334 static const Register SlotRegister(); 335 }; 336 337 338 class VectorStoreICDescriptor : public VectorStoreICTrampolineDescriptor { 339 public: 340 DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE( 341 VectorStoreICDescriptor, VectorStoreICTrampolineDescriptor) 342 343 enum ParameterIndices { 344 kReceiverIndex, 345 kNameIndex, 346 kValueIndex, 347 kSlotIndex, 348 kVectorIndex 349 }; 350 351 static const Register VectorRegister(); 352 }; 353 354 355 class LoadWithVectorDescriptor : public LoadDescriptor { 356 public: 357 DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(LoadWithVectorDescriptor, 358 LoadDescriptor) 359 360 enum ParameterIndices { 361 kReceiverIndex, 362 kNameIndex, 363 kSlotIndex, 364 kVectorIndex 365 }; 366 367 static const Register VectorRegister(); 368 }; 369 370 371 class FastNewClosureDescriptor : public CallInterfaceDescriptor { 372 public: 373 DECLARE_DESCRIPTOR(FastNewClosureDescriptor, CallInterfaceDescriptor) 374 }; 375 376 377 class FastNewContextDescriptor : public CallInterfaceDescriptor { 378 public: 379 DECLARE_DESCRIPTOR(FastNewContextDescriptor, CallInterfaceDescriptor) 380 }; 381 382 383 class ToNumberDescriptor : public CallInterfaceDescriptor { 384 public: 385 DECLARE_DESCRIPTOR(ToNumberDescriptor, CallInterfaceDescriptor) 386 }; 387 388 389 class ToLengthDescriptor : public CallInterfaceDescriptor { 390 public: 391 enum ParameterIndices { kReceiverIndex }; 392 393 DECLARE_DESCRIPTOR(ToLengthDescriptor, CallInterfaceDescriptor) 394 395 static const Register ReceiverRegister(); 396 }; 397 398 399 class ToStringDescriptor : public CallInterfaceDescriptor { 400 public: 401 enum ParameterIndices { kReceiverIndex }; 402 403 DECLARE_DESCRIPTOR(ToStringDescriptor, CallInterfaceDescriptor) 404 405 static const Register ReceiverRegister(); 406 }; 407 408 409 class ToObjectDescriptor : public CallInterfaceDescriptor { 410 public: 411 enum ParameterIndices { kReceiverIndex }; 412 413 DECLARE_DESCRIPTOR(ToObjectDescriptor, CallInterfaceDescriptor) 414 415 static const Register ReceiverRegister(); 416 }; 417 418 419 class NumberToStringDescriptor : public CallInterfaceDescriptor { 420 public: 421 DECLARE_DESCRIPTOR(NumberToStringDescriptor, CallInterfaceDescriptor) 422 }; 423 424 425 class TypeofDescriptor : public CallInterfaceDescriptor { 426 public: 427 DECLARE_DESCRIPTOR(TypeofDescriptor, CallInterfaceDescriptor) 428 }; 429 430 431 class FastCloneRegExpDescriptor : public CallInterfaceDescriptor { 432 public: 433 DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(FastCloneRegExpDescriptor, 434 CallInterfaceDescriptor) 435 }; 436 437 438 class FastCloneShallowArrayDescriptor : public CallInterfaceDescriptor { 439 public: 440 DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(FastCloneShallowArrayDescriptor, 441 CallInterfaceDescriptor) 442 }; 443 444 445 class FastCloneShallowObjectDescriptor : public CallInterfaceDescriptor { 446 public: 447 DECLARE_DESCRIPTOR(FastCloneShallowObjectDescriptor, CallInterfaceDescriptor) 448 }; 449 450 451 class CreateAllocationSiteDescriptor : public CallInterfaceDescriptor { 452 public: 453 DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(CreateAllocationSiteDescriptor, 454 CallInterfaceDescriptor) 455 }; 456 457 458 class CreateWeakCellDescriptor : public CallInterfaceDescriptor { 459 public: 460 enum ParameterIndices { 461 kVectorIndex, 462 kSlotIndex, 463 kValueIndex, 464 kParameterCount 465 }; 466 467 DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(CreateWeakCellDescriptor, 468 CallInterfaceDescriptor) 469 }; 470 471 472 class CallTrampolineDescriptor : public CallInterfaceDescriptor { 473 public: 474 DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(CallTrampolineDescriptor, 475 CallInterfaceDescriptor) 476 }; 477 478 479 class ConstructStubDescriptor : public CallInterfaceDescriptor { 480 public: 481 DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(ConstructStubDescriptor, 482 CallInterfaceDescriptor) 483 }; 484 485 486 class ConstructTrampolineDescriptor : public CallInterfaceDescriptor { 487 public: 488 DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(ConstructTrampolineDescriptor, 489 CallInterfaceDescriptor) 490 }; 491 492 493 class CallFunctionDescriptor : public CallInterfaceDescriptor { 494 public: 495 DECLARE_DESCRIPTOR(CallFunctionDescriptor, CallInterfaceDescriptor) 496 }; 497 498 499 class CallFunctionWithFeedbackDescriptor : public CallInterfaceDescriptor { 500 public: 501 DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE( 502 CallFunctionWithFeedbackDescriptor, CallInterfaceDescriptor) 503 }; 504 505 506 class CallFunctionWithFeedbackAndVectorDescriptor 507 : public CallInterfaceDescriptor { 508 public: 509 DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE( 510 CallFunctionWithFeedbackAndVectorDescriptor, CallInterfaceDescriptor) 511 }; 512 513 514 class CallConstructDescriptor : public CallInterfaceDescriptor { 515 public: 516 DECLARE_DESCRIPTOR(CallConstructDescriptor, CallInterfaceDescriptor) 517 }; 518 519 520 class RegExpConstructResultDescriptor : public CallInterfaceDescriptor { 521 public: 522 DECLARE_DESCRIPTOR(RegExpConstructResultDescriptor, CallInterfaceDescriptor) 523 }; 524 525 526 class LoadGlobalViaContextDescriptor : public CallInterfaceDescriptor { 527 public: 528 DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(LoadGlobalViaContextDescriptor, 529 CallInterfaceDescriptor) 530 531 static const Register SlotRegister(); 532 }; 533 534 535 class StoreGlobalViaContextDescriptor : public CallInterfaceDescriptor { 536 public: 537 DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(StoreGlobalViaContextDescriptor, 538 CallInterfaceDescriptor) 539 540 static const Register SlotRegister(); 541 static const Register ValueRegister(); 542 }; 543 544 545 class TransitionElementsKindDescriptor : public CallInterfaceDescriptor { 546 public: 547 DECLARE_DESCRIPTOR(TransitionElementsKindDescriptor, CallInterfaceDescriptor) 548 }; 549 550 551 class AllocateHeapNumberDescriptor : public CallInterfaceDescriptor { 552 public: 553 DECLARE_DESCRIPTOR(AllocateHeapNumberDescriptor, CallInterfaceDescriptor) 554 }; 555 556 557 class AllocateMutableHeapNumberDescriptor : public CallInterfaceDescriptor { 558 public: 559 DECLARE_DESCRIPTOR(AllocateMutableHeapNumberDescriptor, 560 CallInterfaceDescriptor) 561 }; 562 563 564 class AllocateInNewSpaceDescriptor : public CallInterfaceDescriptor { 565 public: 566 DECLARE_DESCRIPTOR(AllocateInNewSpaceDescriptor, CallInterfaceDescriptor) 567 }; 568 569 570 class ArrayConstructorConstantArgCountDescriptor 571 : public CallInterfaceDescriptor { 572 public: 573 DECLARE_DESCRIPTOR(ArrayConstructorConstantArgCountDescriptor, 574 CallInterfaceDescriptor) 575 }; 576 577 578 class ArrayConstructorDescriptor : public CallInterfaceDescriptor { 579 public: 580 DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(ArrayConstructorDescriptor, 581 CallInterfaceDescriptor) 582 }; 583 584 585 class InternalArrayConstructorConstantArgCountDescriptor 586 : public CallInterfaceDescriptor { 587 public: 588 DECLARE_DESCRIPTOR(InternalArrayConstructorConstantArgCountDescriptor, 589 CallInterfaceDescriptor) 590 }; 591 592 593 class InternalArrayConstructorDescriptor : public CallInterfaceDescriptor { 594 public: 595 DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE( 596 InternalArrayConstructorDescriptor, CallInterfaceDescriptor) 597 }; 598 599 600 class CompareDescriptor : public CallInterfaceDescriptor { 601 public: 602 DECLARE_DESCRIPTOR(CompareDescriptor, CallInterfaceDescriptor) 603 }; 604 605 606 class CompareNilDescriptor : public CallInterfaceDescriptor { 607 public: 608 DECLARE_DESCRIPTOR(CompareNilDescriptor, CallInterfaceDescriptor) 609 }; 610 611 612 class ToBooleanDescriptor : public CallInterfaceDescriptor { 613 public: 614 DECLARE_DESCRIPTOR(ToBooleanDescriptor, CallInterfaceDescriptor) 615 }; 616 617 618 class BinaryOpDescriptor : public CallInterfaceDescriptor { 619 public: 620 DECLARE_DESCRIPTOR(BinaryOpDescriptor, CallInterfaceDescriptor) 621 }; 622 623 624 class BinaryOpWithAllocationSiteDescriptor : public CallInterfaceDescriptor { 625 public: 626 DECLARE_DESCRIPTOR(BinaryOpWithAllocationSiteDescriptor, 627 CallInterfaceDescriptor) 628 }; 629 630 631 class StringAddDescriptor : public CallInterfaceDescriptor { 632 public: 633 DECLARE_DESCRIPTOR(StringAddDescriptor, CallInterfaceDescriptor) 634 }; 635 636 637 class StringCompareDescriptor : public CallInterfaceDescriptor { 638 public: 639 DECLARE_DESCRIPTOR(StringCompareDescriptor, CallInterfaceDescriptor) 640 641 enum ParameterIndices { kLeftIndex, kRightIndex, kParameterCount }; 642 static const Register LeftRegister(); 643 static const Register RightRegister(); 644 }; 645 646 647 class KeyedDescriptor : public CallInterfaceDescriptor { 648 public: 649 DECLARE_DESCRIPTOR(KeyedDescriptor, CallInterfaceDescriptor) 650 }; 651 652 653 class NamedDescriptor : public CallInterfaceDescriptor { 654 public: 655 DECLARE_DESCRIPTOR(NamedDescriptor, CallInterfaceDescriptor) 656 }; 657 658 659 class CallHandlerDescriptor : public CallInterfaceDescriptor { 660 public: 661 DECLARE_DESCRIPTOR(CallHandlerDescriptor, CallInterfaceDescriptor) 662 }; 663 664 665 class ArgumentAdaptorDescriptor : public CallInterfaceDescriptor { 666 public: 667 DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(ArgumentAdaptorDescriptor, 668 CallInterfaceDescriptor) 669 }; 670 671 672 class ApiFunctionDescriptor : public CallInterfaceDescriptor { 673 public: 674 DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(ApiFunctionDescriptor, 675 CallInterfaceDescriptor) 676 }; 677 678 679 class ApiAccessorDescriptor : public CallInterfaceDescriptor { 680 public: 681 DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(ApiAccessorDescriptor, 682 CallInterfaceDescriptor) 683 }; 684 685 686 class ApiGetterDescriptor : public CallInterfaceDescriptor { 687 public: 688 DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(ApiGetterDescriptor, 689 CallInterfaceDescriptor) 690 691 static const Register function_address(); 692 }; 693 694 695 class ArgumentsAccessReadDescriptor : public CallInterfaceDescriptor { 696 public: 697 DECLARE_DESCRIPTOR(ArgumentsAccessReadDescriptor, CallInterfaceDescriptor) 698 699 static const Register index(); 700 static const Register parameter_count(); 701 }; 702 703 704 class ArgumentsAccessNewDescriptor : public CallInterfaceDescriptor { 705 public: 706 DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(ArgumentsAccessNewDescriptor, 707 CallInterfaceDescriptor) 708 709 static const Register function(); 710 static const Register parameter_count(); 711 static const Register parameter_pointer(); 712 }; 713 714 715 class RestParamAccessDescriptor : public CallInterfaceDescriptor { 716 public: 717 DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(RestParamAccessDescriptor, 718 CallInterfaceDescriptor) 719 static const Register parameter_count(); 720 static const Register parameter_pointer(); 721 static const Register rest_parameter_index(); 722 }; 723 724 725 class StoreArrayLiteralElementDescriptor : public CallInterfaceDescriptor { 726 public: 727 DECLARE_DESCRIPTOR(StoreArrayLiteralElementDescriptor, 728 CallInterfaceDescriptor) 729 }; 730 731 732 class MathPowTaggedDescriptor : public CallInterfaceDescriptor { 733 public: 734 DECLARE_DESCRIPTOR(MathPowTaggedDescriptor, CallInterfaceDescriptor) 735 736 static const Register exponent(); 737 }; 738 739 740 class MathPowIntegerDescriptor : public CallInterfaceDescriptor { 741 public: 742 DECLARE_DESCRIPTOR(MathPowIntegerDescriptor, CallInterfaceDescriptor) 743 744 static const Register exponent(); 745 }; 746 747 748 class ContextOnlyDescriptor : public CallInterfaceDescriptor { 749 public: 750 DECLARE_DESCRIPTOR(ContextOnlyDescriptor, CallInterfaceDescriptor) 751 }; 752 753 754 class GrowArrayElementsDescriptor : public CallInterfaceDescriptor { 755 public: 756 DECLARE_DESCRIPTOR(GrowArrayElementsDescriptor, CallInterfaceDescriptor) 757 758 enum RegisterInfo { kObjectIndex, kKeyIndex }; 759 static const Register ObjectRegister(); 760 static const Register KeyRegister(); 761 }; 762 763 764 class InterpreterPushArgsAndCallDescriptor : public CallInterfaceDescriptor { 765 public: 766 DECLARE_DESCRIPTOR(InterpreterPushArgsAndCallDescriptor, 767 CallInterfaceDescriptor) 768 }; 769 770 771 class InterpreterPushArgsAndConstructDescriptor 772 : public CallInterfaceDescriptor { 773 public: 774 DECLARE_DESCRIPTOR(InterpreterPushArgsAndConstructDescriptor, 775 CallInterfaceDescriptor) 776 }; 777 778 779 class InterpreterCEntryDescriptor : public CallInterfaceDescriptor { 780 public: 781 DECLARE_DESCRIPTOR(InterpreterCEntryDescriptor, CallInterfaceDescriptor) 782 }; 783 784 785 #undef DECLARE_DESCRIPTOR 786 787 788 // We define the association between CallDescriptors::Key and the specialized 789 // descriptor here to reduce boilerplate and mistakes. 790 #define DEF_KEY(name) \ 791 CallDescriptors::Key name##Descriptor::key() { return CallDescriptors::name; } 792 INTERFACE_DESCRIPTOR_LIST(DEF_KEY) 793 #undef DEF_KEY 794 } // namespace internal 795 } // namespace v8 796 797 798 #if V8_TARGET_ARCH_ARM64 799 #include "src/arm64/interface-descriptors-arm64.h" 800 #elif V8_TARGET_ARCH_ARM 801 #include "src/arm/interface-descriptors-arm.h" 802 #endif 803 804 #endif // V8_CALL_INTERFACE_DESCRIPTOR_H_ 805