| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_CALL_INTERFACE_DESCRIPTOR_H_ | 5 #ifndef V8_CALL_INTERFACE_DESCRIPTOR_H_ |
| 6 #define V8_CALL_INTERFACE_DESCRIPTOR_H_ | 6 #define V8_CALL_INTERFACE_DESCRIPTOR_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "src/assembler.h" | 10 #include "src/assembler.h" |
| 11 #include "src/macro-assembler.h" | 11 #include "src/macro-assembler.h" |
| 12 | 12 |
| 13 namespace v8 { | 13 namespace v8 { |
| 14 namespace internal { | 14 namespace internal { |
| 15 | 15 |
| 16 class PlatformInterfaceDescriptor; | 16 class PlatformInterfaceDescriptor; |
| 17 | 17 |
| 18 #define INTERFACE_DESCRIPTOR_LIST(V) \ | 18 #define INTERFACE_DESCRIPTOR_LIST(V) \ |
| 19 V(Void) \ | 19 V(Void) \ |
| 20 V(ContextOnly) \ | 20 V(ContextOnly) \ |
| 21 V(OnStackWith1Args) \ | |
| 22 V(OnStackWith2Args) \ | |
| 23 V(OnStackWith3Args) \ | |
| 24 V(OnStackWith4Args) \ | |
| 25 V(OnStackWith5Args) \ | |
| 26 V(OnStackWith6Args) \ | |
| 27 V(OnStackWith7Args) \ | |
| 28 V(Load) \ | 21 V(Load) \ |
| 29 V(LoadWithVector) \ | 22 V(LoadWithVector) \ |
| 30 V(LoadGlobal) \ | 23 V(LoadGlobal) \ |
| 31 V(LoadGlobalWithVector) \ | 24 V(LoadGlobalWithVector) \ |
| 32 V(Store) \ | 25 V(Store) \ |
| 33 V(StoreWithVector) \ | 26 V(StoreWithVector) \ |
| 34 V(StoreTransition) \ | 27 V(StoreTransition) \ |
| 35 V(VarArgFunction) \ | 28 V(VarArgFunction) \ |
| 36 V(FastNewClosure) \ | 29 V(FastNewClosure) \ |
| 37 V(FastNewFunctionContext) \ | 30 V(FastNewFunctionContext) \ |
| 38 V(FastNewObject) \ | 31 V(FastNewObject) \ |
| 39 V(FastNewRestParameter) \ | 32 V(FastNewRestParameter) \ |
| 40 V(FastNewSloppyArguments) \ | 33 V(FastNewSloppyArguments) \ |
| 41 V(FastNewStrictArguments) \ | 34 V(FastNewStrictArguments) \ |
| 42 V(TypeConversion) \ | 35 V(TypeConversion) \ |
| 43 V(Typeof) \ | 36 V(Typeof) \ |
| 44 V(FastCloneRegExp) \ | 37 V(FastCloneRegExp) \ |
| 45 V(FastCloneShallowArray) \ | 38 V(FastCloneShallowArray) \ |
| 46 V(FastCloneShallowObject) \ | 39 V(FastCloneShallowObject) \ |
| 47 V(CreateAllocationSite) \ | 40 V(CreateAllocationSite) \ |
| 48 V(CreateWeakCell) \ | 41 V(CreateWeakCell) \ |
| 49 V(CallFunction) \ | 42 V(CallFunction) \ |
| 50 V(CallFunctionWithFeedback) \ | 43 V(CallFunctionWithFeedback) \ |
| 51 V(CallFunctionWithFeedbackAndVector) \ | 44 V(CallFunctionWithFeedbackAndVector) \ |
| 52 V(CallConstruct) \ | 45 V(CallConstruct) \ |
| 53 V(CallTrampoline) \ | 46 V(CallTrampoline) \ |
| 54 V(ConstructStub) \ | 47 V(ConstructStub) \ |
| 55 V(ConstructTrampoline) \ | 48 V(ConstructTrampoline) \ |
| 49 V(RegExpExec) \ |
| 56 V(RegExpConstructResult) \ | 50 V(RegExpConstructResult) \ |
| 57 V(CopyFastSmiOrObjectElements) \ | 51 V(CopyFastSmiOrObjectElements) \ |
| 58 V(TransitionElementsKind) \ | 52 V(TransitionElementsKind) \ |
| 59 V(AllocateHeapNumber) \ | 53 V(AllocateHeapNumber) \ |
| 60 V(AllocateFloat32x4) \ | 54 V(AllocateFloat32x4) \ |
| 61 V(AllocateInt32x4) \ | 55 V(AllocateInt32x4) \ |
| 62 V(AllocateUint32x4) \ | 56 V(AllocateUint32x4) \ |
| 63 V(AllocateBool32x4) \ | 57 V(AllocateBool32x4) \ |
| 64 V(AllocateInt16x8) \ | 58 V(AllocateInt16x8) \ |
| 65 V(AllocateUint16x8) \ | 59 V(AllocateUint16x8) \ |
| 66 V(AllocateBool16x8) \ | 60 V(AllocateBool16x8) \ |
| 67 V(AllocateInt8x16) \ | 61 V(AllocateInt8x16) \ |
| 68 V(AllocateUint8x16) \ | 62 V(AllocateUint8x16) \ |
| 69 V(AllocateBool8x16) \ | 63 V(AllocateBool8x16) \ |
| 70 V(ArrayNoArgumentConstructor) \ | 64 V(ArrayNoArgumentConstructor) \ |
| 71 V(ArraySingleArgumentConstructor) \ | 65 V(ArraySingleArgumentConstructor) \ |
| 72 V(ArrayNArgumentsConstructor) \ | 66 V(ArrayNArgumentsConstructor) \ |
| 73 V(Compare) \ | 67 V(Compare) \ |
| 74 V(BinaryOp) \ | 68 V(BinaryOp) \ |
| 75 V(BinaryOpWithAllocationSite) \ | 69 V(BinaryOpWithAllocationSite) \ |
| 76 V(BinaryOpWithVector) \ | 70 V(BinaryOpWithVector) \ |
| 77 V(CountOp) \ | 71 V(CountOp) \ |
| 78 V(StringAdd) \ | 72 V(StringAdd) \ |
| 79 V(StringCompare) \ | 73 V(StringCompare) \ |
| 74 V(SubString) \ |
| 80 V(Keyed) \ | 75 V(Keyed) \ |
| 81 V(Named) \ | 76 V(Named) \ |
| 82 V(HasProperty) \ | 77 V(HasProperty) \ |
| 83 V(ForInFilter) \ | 78 V(ForInFilter) \ |
| 84 V(GetProperty) \ | 79 V(GetProperty) \ |
| 85 V(CallHandler) \ | 80 V(CallHandler) \ |
| 86 V(ArgumentAdaptor) \ | 81 V(ArgumentAdaptor) \ |
| 87 V(ApiCallback) \ | 82 V(ApiCallback) \ |
| 88 V(ApiGetter) \ | 83 V(ApiGetter) \ |
| 89 V(StoreGlobalViaContext) \ | 84 V(StoreGlobalViaContext) \ |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 public: | 252 public: |
| 258 | 253 |
| 259 #define DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(name, base) \ | 254 #define DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(name, base) \ |
| 260 DECLARE_DESCRIPTOR(name, base) \ | 255 DECLARE_DESCRIPTOR(name, base) \ |
| 261 protected: \ | 256 protected: \ |
| 262 void InitializePlatformIndependent(CallInterfaceDescriptorData* data) \ | 257 void InitializePlatformIndependent(CallInterfaceDescriptorData* data) \ |
| 263 override; \ | 258 override; \ |
| 264 \ | 259 \ |
| 265 public: | 260 public: |
| 266 | 261 |
| 267 #define DECLARE_DESCRIPTOR_WITH_BASE_AND_FUNCTION_TYPE_ARG(name, base, arg) \ | 262 #define DECLARE_DESCRIPTOR_WITH_STACK_ARGS(name, base) \ |
| 268 DECLARE_DESCRIPTOR_WITH_BASE(name, base) \ | 263 DECLARE_DESCRIPTOR_WITH_BASE(name, base) \ |
| 269 protected: \ | 264 protected: \ |
| 270 int extra_args() const override { return arg; } \ | 265 void InitializePlatformIndependent(CallInterfaceDescriptorData* data) \ |
| 271 \ | 266 override { \ |
| 267 data->InitializePlatformIndependent(0, kParameterCount, NULL); \ |
| 268 } \ |
| 269 void InitializePlatformSpecific(CallInterfaceDescriptorData* data) \ |
| 270 override { \ |
| 271 data->InitializePlatformSpecific(0, nullptr); \ |
| 272 } \ |
| 273 \ |
| 272 public: | 274 public: |
| 273 | 275 |
| 274 #define DEFINE_PARAMETERS(...) \ | 276 #define DEFINE_PARAMETERS(...) \ |
| 275 enum ParameterIndices { \ | 277 enum ParameterIndices { \ |
| 276 __VA_ARGS__, \ | 278 __VA_ARGS__, \ |
| 277 \ | 279 \ |
| 278 kParameterCount, \ | 280 kParameterCount, \ |
| 279 kContext = kParameterCount /* implicit parameter */ \ | 281 kContext = kParameterCount /* implicit parameter */ \ |
| 280 }; | 282 }; |
| 281 | 283 |
| 282 class VoidDescriptor : public CallInterfaceDescriptor { | 284 class VoidDescriptor : public CallInterfaceDescriptor { |
| 283 public: | 285 public: |
| 284 DECLARE_DESCRIPTOR(VoidDescriptor, CallInterfaceDescriptor) | 286 DECLARE_DESCRIPTOR(VoidDescriptor, CallInterfaceDescriptor) |
| 285 }; | 287 }; |
| 286 | 288 |
| 287 class ContextOnlyDescriptor : public CallInterfaceDescriptor { | 289 class ContextOnlyDescriptor : public CallInterfaceDescriptor { |
| 288 public: | 290 public: |
| 289 DECLARE_DESCRIPTOR(ContextOnlyDescriptor, CallInterfaceDescriptor) | 291 DECLARE_DESCRIPTOR(ContextOnlyDescriptor, CallInterfaceDescriptor) |
| 290 }; | 292 }; |
| 291 | 293 |
| 292 // The OnStackWith*ArgsDescriptors have a lot of boilerplate. The superclass | |
| 293 // OnStackArgsDescriptorBase is not meant to be instantiated directly and has no | |
| 294 // public constructors to ensure this is so.contains all the logic, and the | |
| 295 // | |
| 296 // Use OnStackArgsDescriptorBase::ForArgs(isolate, parameter_count) to | |
| 297 // instantiate a descriptor with the number of args. | |
| 298 class OnStackArgsDescriptorBase : public CallInterfaceDescriptor { | |
| 299 public: | |
| 300 static CallInterfaceDescriptor ForArgs(Isolate* isolate, int parameter_count); | |
| 301 | |
| 302 protected: | |
| 303 virtual int extra_args() const { return 0; } | |
| 304 OnStackArgsDescriptorBase(Isolate* isolate, CallDescriptors::Key key) | |
| 305 : CallInterfaceDescriptor(isolate, key) {} | |
| 306 void InitializePlatformSpecific(CallInterfaceDescriptorData* data) override; | |
| 307 void InitializePlatformIndependent( | |
| 308 CallInterfaceDescriptorData* data) override; | |
| 309 }; | |
| 310 | |
| 311 class OnStackWith1ArgsDescriptor : public OnStackArgsDescriptorBase { | |
| 312 public: | |
| 313 DECLARE_DESCRIPTOR_WITH_BASE_AND_FUNCTION_TYPE_ARG(OnStackWith1ArgsDescriptor, | |
| 314 OnStackArgsDescriptorBase, | |
| 315 1) | |
| 316 }; | |
| 317 | |
| 318 class OnStackWith2ArgsDescriptor : public OnStackArgsDescriptorBase { | |
| 319 public: | |
| 320 DECLARE_DESCRIPTOR_WITH_BASE_AND_FUNCTION_TYPE_ARG(OnStackWith2ArgsDescriptor, | |
| 321 OnStackArgsDescriptorBase, | |
| 322 2) | |
| 323 }; | |
| 324 | |
| 325 class OnStackWith3ArgsDescriptor : public OnStackArgsDescriptorBase { | |
| 326 public: | |
| 327 DECLARE_DESCRIPTOR_WITH_BASE_AND_FUNCTION_TYPE_ARG(OnStackWith3ArgsDescriptor, | |
| 328 OnStackArgsDescriptorBase, | |
| 329 3) | |
| 330 }; | |
| 331 | |
| 332 class OnStackWith4ArgsDescriptor : public OnStackArgsDescriptorBase { | |
| 333 public: | |
| 334 DECLARE_DESCRIPTOR_WITH_BASE_AND_FUNCTION_TYPE_ARG(OnStackWith4ArgsDescriptor, | |
| 335 OnStackArgsDescriptorBase, | |
| 336 4) | |
| 337 }; | |
| 338 | |
| 339 class OnStackWith5ArgsDescriptor : public OnStackArgsDescriptorBase { | |
| 340 public: | |
| 341 DECLARE_DESCRIPTOR_WITH_BASE_AND_FUNCTION_TYPE_ARG(OnStackWith5ArgsDescriptor, | |
| 342 OnStackArgsDescriptorBase, | |
| 343 5) | |
| 344 }; | |
| 345 | |
| 346 class OnStackWith6ArgsDescriptor : public OnStackArgsDescriptorBase { | |
| 347 public: | |
| 348 DECLARE_DESCRIPTOR_WITH_BASE_AND_FUNCTION_TYPE_ARG(OnStackWith6ArgsDescriptor, | |
| 349 OnStackArgsDescriptorBase, | |
| 350 6) | |
| 351 }; | |
| 352 | |
| 353 class OnStackWith7ArgsDescriptor : public OnStackArgsDescriptorBase { | |
| 354 public: | |
| 355 DECLARE_DESCRIPTOR_WITH_BASE_AND_FUNCTION_TYPE_ARG(OnStackWith7ArgsDescriptor, | |
| 356 OnStackArgsDescriptorBase, | |
| 357 7) | |
| 358 }; | |
| 359 | |
| 360 // LoadDescriptor is used by all stubs that implement Load/KeyedLoad ICs. | 294 // LoadDescriptor is used by all stubs that implement Load/KeyedLoad ICs. |
| 361 class LoadDescriptor : public CallInterfaceDescriptor { | 295 class LoadDescriptor : public CallInterfaceDescriptor { |
| 362 public: | 296 public: |
| 363 DEFINE_PARAMETERS(kReceiver, kName, kSlot) | 297 DEFINE_PARAMETERS(kReceiver, kName, kSlot) |
| 364 DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(LoadDescriptor, | 298 DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(LoadDescriptor, |
| 365 CallInterfaceDescriptor) | 299 CallInterfaceDescriptor) |
| 366 | 300 |
| 367 static const Register ReceiverRegister(); | 301 static const Register ReceiverRegister(); |
| 368 static const Register NameRegister(); | 302 static const Register NameRegister(); |
| 369 static const Register SlotRegister(); | 303 static const Register SlotRegister(); |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 591 DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE( | 525 DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE( |
| 592 CallFunctionWithFeedbackAndVectorDescriptor, CallInterfaceDescriptor) | 526 CallFunctionWithFeedbackAndVectorDescriptor, CallInterfaceDescriptor) |
| 593 }; | 527 }; |
| 594 | 528 |
| 595 | 529 |
| 596 class CallConstructDescriptor : public CallInterfaceDescriptor { | 530 class CallConstructDescriptor : public CallInterfaceDescriptor { |
| 597 public: | 531 public: |
| 598 DECLARE_DESCRIPTOR(CallConstructDescriptor, CallInterfaceDescriptor) | 532 DECLARE_DESCRIPTOR(CallConstructDescriptor, CallInterfaceDescriptor) |
| 599 }; | 533 }; |
| 600 | 534 |
| 535 class RegExpExecDescriptor : public CallInterfaceDescriptor { |
| 536 public: |
| 537 DEFINE_PARAMETERS(kRegExpObject, kString, kPreviousIndex, kLastMatchInfo) |
| 538 DECLARE_DESCRIPTOR_WITH_STACK_ARGS(RegExpExecDescriptor, |
| 539 CallInterfaceDescriptor) |
| 540 }; |
| 601 | 541 |
| 602 class RegExpConstructResultDescriptor : public CallInterfaceDescriptor { | 542 class RegExpConstructResultDescriptor : public CallInterfaceDescriptor { |
| 603 public: | 543 public: |
| 604 DEFINE_PARAMETERS(kLength, kIndex, kInput) | 544 DEFINE_PARAMETERS(kLength, kIndex, kInput) |
| 605 DECLARE_DESCRIPTOR(RegExpConstructResultDescriptor, CallInterfaceDescriptor) | 545 DECLARE_DESCRIPTOR(RegExpConstructResultDescriptor, CallInterfaceDescriptor) |
| 606 }; | 546 }; |
| 607 | 547 |
| 608 | 548 |
| 609 class StoreGlobalViaContextDescriptor : public CallInterfaceDescriptor { | 549 class StoreGlobalViaContextDescriptor : public CallInterfaceDescriptor { |
| 610 public: | 550 public: |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 710 | 650 |
| 711 class StringCompareDescriptor : public CallInterfaceDescriptor { | 651 class StringCompareDescriptor : public CallInterfaceDescriptor { |
| 712 public: | 652 public: |
| 713 DEFINE_PARAMETERS(kLeft, kRight) | 653 DEFINE_PARAMETERS(kLeft, kRight) |
| 714 DECLARE_DESCRIPTOR(StringCompareDescriptor, CallInterfaceDescriptor) | 654 DECLARE_DESCRIPTOR(StringCompareDescriptor, CallInterfaceDescriptor) |
| 715 | 655 |
| 716 static const Register LeftRegister(); | 656 static const Register LeftRegister(); |
| 717 static const Register RightRegister(); | 657 static const Register RightRegister(); |
| 718 }; | 658 }; |
| 719 | 659 |
| 660 class SubStringDescriptor : public CallInterfaceDescriptor { |
| 661 public: |
| 662 DEFINE_PARAMETERS(kString, kFrom, kTo) |
| 663 DECLARE_DESCRIPTOR_WITH_STACK_ARGS(SubStringDescriptor, |
| 664 CallInterfaceDescriptor) |
| 665 }; |
| 666 |
| 720 // TODO(ishell): not used, remove. | 667 // TODO(ishell): not used, remove. |
| 721 class KeyedDescriptor : public CallInterfaceDescriptor { | 668 class KeyedDescriptor : public CallInterfaceDescriptor { |
| 722 public: | 669 public: |
| 723 DECLARE_DESCRIPTOR(KeyedDescriptor, CallInterfaceDescriptor) | 670 DECLARE_DESCRIPTOR(KeyedDescriptor, CallInterfaceDescriptor) |
| 724 }; | 671 }; |
| 725 | 672 |
| 726 // TODO(ishell): not used, remove | 673 // TODO(ishell): not used, remove |
| 727 class NamedDescriptor : public CallInterfaceDescriptor { | 674 class NamedDescriptor : public CallInterfaceDescriptor { |
| 728 public: | 675 public: |
| 729 DECLARE_DESCRIPTOR(NamedDescriptor, CallInterfaceDescriptor) | 676 DECLARE_DESCRIPTOR(NamedDescriptor, CallInterfaceDescriptor) |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 849 } // namespace v8 | 796 } // namespace v8 |
| 850 | 797 |
| 851 | 798 |
| 852 #if V8_TARGET_ARCH_ARM64 | 799 #if V8_TARGET_ARCH_ARM64 |
| 853 #include "src/arm64/interface-descriptors-arm64.h" | 800 #include "src/arm64/interface-descriptors-arm64.h" |
| 854 #elif V8_TARGET_ARCH_ARM | 801 #elif V8_TARGET_ARCH_ARM |
| 855 #include "src/arm/interface-descriptors-arm.h" | 802 #include "src/arm/interface-descriptors-arm.h" |
| 856 #endif | 803 #endif |
| 857 | 804 |
| 858 #endif // V8_CALL_INTERFACE_DESCRIPTOR_H_ | 805 #endif // V8_CALL_INTERFACE_DESCRIPTOR_H_ |
| OLD | NEW |