Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(183)

Side by Side Diff: src/interface-descriptors.h

Issue 2352163004: [stubs] ApiCallbackDescriptor cleanup - make it independent on the number of JS parameters. (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/ia32/interface-descriptors-ia32.cc ('k') | src/interface-descriptors.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 V(CountOp) \ 77 V(CountOp) \
78 V(StringAdd) \ 78 V(StringAdd) \
79 V(StringCompare) \ 79 V(StringCompare) \
80 V(Keyed) \ 80 V(Keyed) \
81 V(Named) \ 81 V(Named) \
82 V(HasProperty) \ 82 V(HasProperty) \
83 V(ForInFilter) \ 83 V(ForInFilter) \
84 V(GetProperty) \ 84 V(GetProperty) \
85 V(CallHandler) \ 85 V(CallHandler) \
86 V(ArgumentAdaptor) \ 86 V(ArgumentAdaptor) \
87 V(ApiCallbackWith0Args) \ 87 V(ApiCallback) \
88 V(ApiCallbackWith1Args) \
89 V(ApiCallbackWith2Args) \
90 V(ApiCallbackWith3Args) \
91 V(ApiCallbackWith4Args) \
92 V(ApiCallbackWith5Args) \
93 V(ApiCallbackWith6Args) \
94 V(ApiCallbackWith7Args) \
95 V(ApiGetter) \ 88 V(ApiGetter) \
96 V(StoreGlobalViaContext) \ 89 V(StoreGlobalViaContext) \
97 V(MathPowTagged) \ 90 V(MathPowTagged) \
98 V(MathPowInteger) \ 91 V(MathPowInteger) \
99 V(GrowArrayElements) \ 92 V(GrowArrayElements) \
100 V(InterpreterDispatch) \ 93 V(InterpreterDispatch) \
101 V(InterpreterPushArgsAndCall) \ 94 V(InterpreterPushArgsAndCall) \
102 V(InterpreterPushArgsAndConstruct) \ 95 V(InterpreterPushArgsAndConstruct) \
103 V(InterpreterPushArgsAndConstructArray) \ 96 V(InterpreterPushArgsAndConstructArray) \
104 V(InterpreterCEntry) \ 97 V(InterpreterCEntry) \
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after
744 737
745 738
746 class ArgumentAdaptorDescriptor : public CallInterfaceDescriptor { 739 class ArgumentAdaptorDescriptor : public CallInterfaceDescriptor {
747 public: 740 public:
748 DEFINE_PARAMETERS(kFunction, kNewTarget, kActualArgumentsCount, 741 DEFINE_PARAMETERS(kFunction, kNewTarget, kActualArgumentsCount,
749 kExpectedArgumentsCount) 742 kExpectedArgumentsCount)
750 DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(ArgumentAdaptorDescriptor, 743 DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(ArgumentAdaptorDescriptor,
751 CallInterfaceDescriptor) 744 CallInterfaceDescriptor)
752 }; 745 };
753 746
754 // The ApiCallback*Descriptors have a lot of boilerplate. The superclass 747 class ApiCallbackDescriptor : public CallInterfaceDescriptor {
755 // ApiCallbackDescriptorBase contains all the logic, and the
756 // ApiCallbackWith*ArgsDescriptor merely instantiate these with a
757 // parameter for the number of args.
758 //
759 // The base class is not meant to be instantiated directly and has no
760 // public constructors to ensure this is so.
761 //
762 // The simplest usage for all the ApiCallback*Descriptors is probably
763 // ApiCallbackDescriptorBase::ForArgs(isolate, argc)
764 //
765 class ApiCallbackDescriptorBase : public CallInterfaceDescriptor {
766 public: 748 public:
767 DEFINE_PARAMETERS(kFunction, kCallData, kHolder, kApiFunctionAddress) 749 DEFINE_PARAMETERS(kFunction, kCallData, kHolder, kApiFunctionAddress)
768 static CallInterfaceDescriptor ForArgs(Isolate* isolate, int argc); 750 DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(ApiCallbackDescriptor,
769 751 CallInterfaceDescriptor)
770 protected:
771 virtual int extra_args() const { return 0; }
772 ApiCallbackDescriptorBase(Isolate* isolate, CallDescriptors::Key key)
773 : CallInterfaceDescriptor(isolate, key) {}
774 void InitializePlatformSpecific(CallInterfaceDescriptorData* data) override;
775 void InitializePlatformIndependent(
776 CallInterfaceDescriptorData* data) override;
777 }; 752 };
778 753
779 class ApiCallbackWith0ArgsDescriptor : public ApiCallbackDescriptorBase {
780 public:
781 DECLARE_DESCRIPTOR_WITH_BASE_AND_FUNCTION_TYPE_ARG(
782 ApiCallbackWith0ArgsDescriptor, ApiCallbackDescriptorBase, 0)
783 };
784
785 class ApiCallbackWith1ArgsDescriptor : public ApiCallbackDescriptorBase {
786 public:
787 DECLARE_DESCRIPTOR_WITH_BASE_AND_FUNCTION_TYPE_ARG(
788 ApiCallbackWith1ArgsDescriptor, ApiCallbackDescriptorBase, 1)
789 };
790
791 class ApiCallbackWith2ArgsDescriptor : public ApiCallbackDescriptorBase {
792 public:
793 DECLARE_DESCRIPTOR_WITH_BASE_AND_FUNCTION_TYPE_ARG(
794 ApiCallbackWith2ArgsDescriptor, ApiCallbackDescriptorBase, 2)
795 };
796
797 class ApiCallbackWith3ArgsDescriptor : public ApiCallbackDescriptorBase {
798 public:
799 DECLARE_DESCRIPTOR_WITH_BASE_AND_FUNCTION_TYPE_ARG(
800 ApiCallbackWith3ArgsDescriptor, ApiCallbackDescriptorBase, 3)
801 };
802
803 class ApiCallbackWith4ArgsDescriptor : public ApiCallbackDescriptorBase {
804 public:
805 DECLARE_DESCRIPTOR_WITH_BASE_AND_FUNCTION_TYPE_ARG(
806 ApiCallbackWith4ArgsDescriptor, ApiCallbackDescriptorBase, 4)
807 };
808
809 class ApiCallbackWith5ArgsDescriptor : public ApiCallbackDescriptorBase {
810 public:
811 DECLARE_DESCRIPTOR_WITH_BASE_AND_FUNCTION_TYPE_ARG(
812 ApiCallbackWith5ArgsDescriptor, ApiCallbackDescriptorBase, 5)
813 };
814
815 class ApiCallbackWith6ArgsDescriptor : public ApiCallbackDescriptorBase {
816 public:
817 DECLARE_DESCRIPTOR_WITH_BASE_AND_FUNCTION_TYPE_ARG(
818 ApiCallbackWith6ArgsDescriptor, ApiCallbackDescriptorBase, 6)
819 };
820
821 class ApiCallbackWith7ArgsDescriptor : public ApiCallbackDescriptorBase {
822 public:
823 DECLARE_DESCRIPTOR_WITH_BASE_AND_FUNCTION_TYPE_ARG(
824 ApiCallbackWith7ArgsDescriptor, ApiCallbackDescriptorBase, 7)
825 };
826
827
828 class ApiGetterDescriptor : public CallInterfaceDescriptor { 754 class ApiGetterDescriptor : public CallInterfaceDescriptor {
829 public: 755 public:
830 DEFINE_PARAMETERS(kReceiver, kHolder, kCallback) 756 DEFINE_PARAMETERS(kReceiver, kHolder, kCallback)
831 DECLARE_DESCRIPTOR(ApiGetterDescriptor, CallInterfaceDescriptor) 757 DECLARE_DESCRIPTOR(ApiGetterDescriptor, CallInterfaceDescriptor)
832 758
833 static const Register ReceiverRegister(); 759 static const Register ReceiverRegister();
834 static const Register HolderRegister(); 760 static const Register HolderRegister();
835 static const Register CallbackRegister(); 761 static const Register CallbackRegister();
836 }; 762 };
837 763
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
923 } // namespace v8 849 } // namespace v8
924 850
925 851
926 #if V8_TARGET_ARCH_ARM64 852 #if V8_TARGET_ARCH_ARM64
927 #include "src/arm64/interface-descriptors-arm64.h" 853 #include "src/arm64/interface-descriptors-arm64.h"
928 #elif V8_TARGET_ARCH_ARM 854 #elif V8_TARGET_ARCH_ARM
929 #include "src/arm/interface-descriptors-arm.h" 855 #include "src/arm/interface-descriptors-arm.h"
930 #endif 856 #endif
931 857
932 #endif // V8_CALL_INTERFACE_DESCRIPTOR_H_ 858 #endif // V8_CALL_INTERFACE_DESCRIPTOR_H_
OLDNEW
« no previous file with comments | « src/ia32/interface-descriptors-ia32.cc ('k') | src/interface-descriptors.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698