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

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

Issue 1775933005: Revert of Rework CallApi*Stubs. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 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/ic/x87/handler-compiler-x87.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 "src/assembler.h" 8 #include "src/assembler.h"
9 #include "src/macro-assembler.h" 9 #include "src/macro-assembler.h"
10 10
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 V(Compare) \ 60 V(Compare) \
61 V(ToBoolean) \ 61 V(ToBoolean) \
62 V(BinaryOp) \ 62 V(BinaryOp) \
63 V(BinaryOpWithAllocationSite) \ 63 V(BinaryOpWithAllocationSite) \
64 V(StringAdd) \ 64 V(StringAdd) \
65 V(StringCompare) \ 65 V(StringCompare) \
66 V(Keyed) \ 66 V(Keyed) \
67 V(Named) \ 67 V(Named) \
68 V(CallHandler) \ 68 V(CallHandler) \
69 V(ArgumentAdaptor) \ 69 V(ArgumentAdaptor) \
70 V(ApiCallbackWith0Args) \ 70 V(ApiFunction) \
71 V(ApiCallbackWith1Args) \ 71 V(ApiAccessor) \
72 V(ApiCallbackWith2Args) \
73 V(ApiCallbackWith3Args) \
74 V(ApiCallbackWith4Args) \
75 V(ApiCallbackWith5Args) \
76 V(ApiCallbackWith6Args) \
77 V(ApiCallbackWith7Args) \
78 V(ApiGetter) \ 72 V(ApiGetter) \
79 V(LoadGlobalViaContext) \ 73 V(LoadGlobalViaContext) \
80 V(StoreGlobalViaContext) \ 74 V(StoreGlobalViaContext) \
81 V(MathPowTagged) \ 75 V(MathPowTagged) \
82 V(MathPowInteger) \ 76 V(MathPowInteger) \
83 V(ContextOnly) \ 77 V(ContextOnly) \
84 V(GrowArrayElements) \ 78 V(GrowArrayElements) \
85 V(InterpreterDispatch) \ 79 V(InterpreterDispatch) \
86 V(InterpreterPushArgsAndCall) \ 80 V(InterpreterPushArgsAndCall) \
87 V(InterpreterPushArgsAndConstruct) \ 81 V(InterpreterPushArgsAndConstruct) \
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 return BuildDefaultFunctionType(isolate, register_param_count); 192 return BuildDefaultFunctionType(isolate, register_param_count);
199 } 193 }
200 194
201 virtual void InitializePlatformSpecific(CallInterfaceDescriptorData* data) { 195 virtual void InitializePlatformSpecific(CallInterfaceDescriptorData* data) {
202 UNREACHABLE(); 196 UNREACHABLE();
203 } 197 }
204 198
205 void Initialize(Isolate* isolate, CallDescriptors::Key key) { 199 void Initialize(Isolate* isolate, CallDescriptors::Key key) {
206 if (!data()->IsInitialized()) { 200 if (!data()->IsInitialized()) {
207 CallInterfaceDescriptorData* d = isolate->call_descriptor_data(key); 201 CallInterfaceDescriptorData* d = isolate->call_descriptor_data(key);
208 DCHECK(d == data()); // d should be a modifiable pointer to data().
209 InitializePlatformSpecific(d); 202 InitializePlatformSpecific(d);
210 FunctionType* function_type = BuildCallInterfaceDescriptorFunctionType( 203 FunctionType* function_type = BuildCallInterfaceDescriptorFunctionType(
211 isolate, d->register_param_count()); 204 isolate, d->register_param_count());
212 d->InitializePlatformIndependent(function_type); 205 d->InitializePlatformIndependent(function_type);
213 } 206 }
214 } 207 }
215 208
216 private: 209 private:
217 const CallInterfaceDescriptorData* data_; 210 const CallInterfaceDescriptorData* data_;
218 }; 211 };
219 212
220 #define DECLARE_DESCRIPTOR_WITH_BASE(name, base) \
221 public: \
222 explicit name(Isolate* isolate) : base(isolate, key()) { \
223 Initialize(isolate, key()); \
224 } \
225 static inline CallDescriptors::Key key();
226 213
227 #define DECLARE_DESCRIPTOR(name, base) \ 214 #define DECLARE_DESCRIPTOR(name, base) \
228 DECLARE_DESCRIPTOR_WITH_BASE(name, base) \ 215 explicit name(Isolate* isolate) : base(isolate, key()) { \
216 Initialize(isolate, key()); \
217 } \
218 \
229 protected: \ 219 protected: \
230 void InitializePlatformSpecific(CallInterfaceDescriptorData* data) override; \ 220 void InitializePlatformSpecific(CallInterfaceDescriptorData* data) override; \
231 name(Isolate* isolate, CallDescriptors::Key key) : base(isolate, key) {} \ 221 name(Isolate* isolate, CallDescriptors::Key key) : base(isolate, key) {} \
232 \ 222 \
233 public: 223 public: \
224 static inline CallDescriptors::Key key();
234 225
235 #define DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(name, base) \ 226 #define DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(name, base) \
236 DECLARE_DESCRIPTOR(name, base) \ 227 DECLARE_DESCRIPTOR(name, base) \
237 protected: \ 228 protected: \
238 FunctionType* BuildCallInterfaceDescriptorFunctionType( \ 229 FunctionType* BuildCallInterfaceDescriptorFunctionType( \
239 Isolate* isolate, int register_param_count) override; \ 230 Isolate* isolate, int register_param_count) override; \
240 \ 231 \
241 public: 232 public:
242 233
243 #define DECLARE_DESCRIPTOR_WITH_BASE_AND_FUNCTION_TYPE_ARG(name, base, arg) \
244 DECLARE_DESCRIPTOR_WITH_BASE(name, base) \
245 protected: \
246 FunctionType* BuildCallInterfaceDescriptorFunctionType( \
247 Isolate* isolate, int register_param_count) override { \
248 return BuildCallInterfaceDescriptorFunctionTypeWithArg( \
249 isolate, register_param_count, arg); \
250 } \
251 \
252 public:
253
254 class VoidDescriptor : public CallInterfaceDescriptor { 234 class VoidDescriptor : public CallInterfaceDescriptor {
255 public: 235 public:
256 DECLARE_DESCRIPTOR(VoidDescriptor, CallInterfaceDescriptor) 236 DECLARE_DESCRIPTOR(VoidDescriptor, CallInterfaceDescriptor)
257 }; 237 };
258 238
259 239
260 // LoadDescriptor is used by all stubs that implement Load/KeyedLoad ICs. 240 // LoadDescriptor is used by all stubs that implement Load/KeyedLoad ICs.
261 class LoadDescriptor : public CallInterfaceDescriptor { 241 class LoadDescriptor : public CallInterfaceDescriptor {
262 public: 242 public:
263 DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(LoadDescriptor, 243 DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(LoadDescriptor,
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
702 DECLARE_DESCRIPTOR(CallHandlerDescriptor, CallInterfaceDescriptor) 682 DECLARE_DESCRIPTOR(CallHandlerDescriptor, CallInterfaceDescriptor)
703 }; 683 };
704 684
705 685
706 class ArgumentAdaptorDescriptor : public CallInterfaceDescriptor { 686 class ArgumentAdaptorDescriptor : public CallInterfaceDescriptor {
707 public: 687 public:
708 DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(ArgumentAdaptorDescriptor, 688 DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(ArgumentAdaptorDescriptor,
709 CallInterfaceDescriptor) 689 CallInterfaceDescriptor)
710 }; 690 };
711 691
712 // The ApiCallback*Descriptors have a lot of boilerplate. The superclass 692
713 // ApiCallbackDescriptorBase contains all the logic, and the 693 class ApiFunctionDescriptor : public CallInterfaceDescriptor {
714 // ApiCallbackWith*ArgsDescriptor merely instantiate these with a
715 // parameter for the number of args.
716 //
717 // The base class is not meant to be instantiated directly and has no
718 // public constructors to ensure this is so.
719 //
720 // The simplest usage for all the ApiCallback*Descriptors is probably
721 // ApiCallbackDescriptorBase::ForArgs(isolate, argc)
722 //
723 class ApiCallbackDescriptorBase : public CallInterfaceDescriptor {
724 public: 694 public:
725 static CallInterfaceDescriptor ForArgs(Isolate* isolate, int argc); 695 DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(ApiFunctionDescriptor,
726 696 CallInterfaceDescriptor)
727 protected:
728 ApiCallbackDescriptorBase(Isolate* isolate, CallDescriptors::Key key)
729 : CallInterfaceDescriptor(isolate, key) {}
730 void InitializePlatformSpecific(CallInterfaceDescriptorData* data) override;
731 FunctionType* BuildCallInterfaceDescriptorFunctionTypeWithArg(
732 Isolate* isolate, int parameter_count, int argc);
733 };
734
735 class ApiCallbackWith0ArgsDescriptor : public ApiCallbackDescriptorBase {
736 public:
737 DECLARE_DESCRIPTOR_WITH_BASE_AND_FUNCTION_TYPE_ARG(
738 ApiCallbackWith0ArgsDescriptor, ApiCallbackDescriptorBase, 0)
739 };
740
741 class ApiCallbackWith1ArgsDescriptor : public ApiCallbackDescriptorBase {
742 public:
743 DECLARE_DESCRIPTOR_WITH_BASE_AND_FUNCTION_TYPE_ARG(
744 ApiCallbackWith1ArgsDescriptor, ApiCallbackDescriptorBase, 1)
745 };
746
747 class ApiCallbackWith2ArgsDescriptor : public ApiCallbackDescriptorBase {
748 public:
749 DECLARE_DESCRIPTOR_WITH_BASE_AND_FUNCTION_TYPE_ARG(
750 ApiCallbackWith2ArgsDescriptor, ApiCallbackDescriptorBase, 2)
751 };
752
753 class ApiCallbackWith3ArgsDescriptor : public ApiCallbackDescriptorBase {
754 public:
755 DECLARE_DESCRIPTOR_WITH_BASE_AND_FUNCTION_TYPE_ARG(
756 ApiCallbackWith3ArgsDescriptor, ApiCallbackDescriptorBase, 3)
757 };
758
759 class ApiCallbackWith4ArgsDescriptor : public ApiCallbackDescriptorBase {
760 public:
761 DECLARE_DESCRIPTOR_WITH_BASE_AND_FUNCTION_TYPE_ARG(
762 ApiCallbackWith4ArgsDescriptor, ApiCallbackDescriptorBase, 4)
763 };
764
765 class ApiCallbackWith5ArgsDescriptor : public ApiCallbackDescriptorBase {
766 public:
767 DECLARE_DESCRIPTOR_WITH_BASE_AND_FUNCTION_TYPE_ARG(
768 ApiCallbackWith5ArgsDescriptor, ApiCallbackDescriptorBase, 5)
769 };
770
771 class ApiCallbackWith6ArgsDescriptor : public ApiCallbackDescriptorBase {
772 public:
773 DECLARE_DESCRIPTOR_WITH_BASE_AND_FUNCTION_TYPE_ARG(
774 ApiCallbackWith6ArgsDescriptor, ApiCallbackDescriptorBase, 6)
775 };
776
777 class ApiCallbackWith7ArgsDescriptor : public ApiCallbackDescriptorBase {
778 public:
779 DECLARE_DESCRIPTOR_WITH_BASE_AND_FUNCTION_TYPE_ARG(
780 ApiCallbackWith7ArgsDescriptor, ApiCallbackDescriptorBase, 7)
781 }; 697 };
782 698
783 699
700 class ApiAccessorDescriptor : public CallInterfaceDescriptor {
701 public:
702 DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(ApiAccessorDescriptor,
703 CallInterfaceDescriptor)
704 };
705
706
784 class ApiGetterDescriptor : public CallInterfaceDescriptor { 707 class ApiGetterDescriptor : public CallInterfaceDescriptor {
785 public: 708 public:
786 DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(ApiGetterDescriptor, 709 DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(ApiGetterDescriptor,
787 CallInterfaceDescriptor) 710 CallInterfaceDescriptor)
788 711
789 static const Register function_address(); 712 static const Register function_address();
790 }; 713 };
791 714
792 715
793 class MathPowTaggedDescriptor : public CallInterfaceDescriptor { 716 class MathPowTaggedDescriptor : public CallInterfaceDescriptor {
(...skipping 20 matching lines...) Expand all
814 737
815 class GrowArrayElementsDescriptor : public CallInterfaceDescriptor { 738 class GrowArrayElementsDescriptor : public CallInterfaceDescriptor {
816 public: 739 public:
817 DECLARE_DESCRIPTOR(GrowArrayElementsDescriptor, CallInterfaceDescriptor) 740 DECLARE_DESCRIPTOR(GrowArrayElementsDescriptor, CallInterfaceDescriptor)
818 741
819 enum RegisterInfo { kObjectIndex, kKeyIndex }; 742 enum RegisterInfo { kObjectIndex, kKeyIndex };
820 static const Register ObjectRegister(); 743 static const Register ObjectRegister();
821 static const Register KeyRegister(); 744 static const Register KeyRegister();
822 }; 745 };
823 746
824 class InterpreterDispatchDescriptor : public CallInterfaceDescriptor { 747 class InterpreterDispatchDescriptor : public CallInterfaceDescriptor {
825 public: 748 public:
826 DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(InterpreterDispatchDescriptor, 749 DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(InterpreterDispatchDescriptor,
827 CallInterfaceDescriptor) 750 CallInterfaceDescriptor)
828 751
829 static const int kAccumulatorParameter = 0; 752 static const int kAccumulatorParameter = 0;
830 static const int kRegisterFileParameter = 1; 753 static const int kRegisterFileParameter = 1;
831 static const int kBytecodeOffsetParameter = 2; 754 static const int kBytecodeOffsetParameter = 2;
832 static const int kBytecodeArrayParameter = 3; 755 static const int kBytecodeArrayParameter = 3;
833 static const int kDispatchTableParameter = 4; 756 static const int kDispatchTableParameter = 4;
834 static const int kContextParameter = 5; 757 static const int kContextParameter = 5;
(...skipping 12 matching lines...) Expand all
847 DECLARE_DESCRIPTOR(InterpreterPushArgsAndConstructDescriptor, 770 DECLARE_DESCRIPTOR(InterpreterPushArgsAndConstructDescriptor,
848 CallInterfaceDescriptor) 771 CallInterfaceDescriptor)
849 }; 772 };
850 773
851 774
852 class InterpreterCEntryDescriptor : public CallInterfaceDescriptor { 775 class InterpreterCEntryDescriptor : public CallInterfaceDescriptor {
853 public: 776 public:
854 DECLARE_DESCRIPTOR(InterpreterCEntryDescriptor, CallInterfaceDescriptor) 777 DECLARE_DESCRIPTOR(InterpreterCEntryDescriptor, CallInterfaceDescriptor)
855 }; 778 };
856 779
857 #undef DECLARE_DESCRIPTOR_WITH_BASE
858 #undef DECLARE_DESCRIPTOR 780 #undef DECLARE_DESCRIPTOR
859 #undef DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE 781
860 #undef DECLARE_DESCRIPTOR_WITH_BASE_AND_FUNCTION_TYPE_ARG
861 782
862 // We define the association between CallDescriptors::Key and the specialized 783 // We define the association between CallDescriptors::Key and the specialized
863 // descriptor here to reduce boilerplate and mistakes. 784 // descriptor here to reduce boilerplate and mistakes.
864 #define DEF_KEY(name) \ 785 #define DEF_KEY(name) \
865 CallDescriptors::Key name##Descriptor::key() { return CallDescriptors::name; } 786 CallDescriptors::Key name##Descriptor::key() { return CallDescriptors::name; }
866 INTERFACE_DESCRIPTOR_LIST(DEF_KEY) 787 INTERFACE_DESCRIPTOR_LIST(DEF_KEY)
867 #undef DEF_KEY 788 #undef DEF_KEY
868 } // namespace internal 789 } // namespace internal
869 } // namespace v8 790 } // namespace v8
870 791
871 792
872 #if V8_TARGET_ARCH_ARM64 793 #if V8_TARGET_ARCH_ARM64
873 #include "src/arm64/interface-descriptors-arm64.h" 794 #include "src/arm64/interface-descriptors-arm64.h"
874 #elif V8_TARGET_ARCH_ARM 795 #elif V8_TARGET_ARCH_ARM
875 #include "src/arm/interface-descriptors-arm.h" 796 #include "src/arm/interface-descriptors-arm.h"
876 #endif 797 #endif
877 798
878 #endif // V8_CALL_INTERFACE_DESCRIPTOR_H_ 799 #endif // V8_CALL_INTERFACE_DESCRIPTOR_H_
OLDNEW
« no previous file with comments | « src/ic/x87/handler-compiler-x87.cc ('k') | src/interface-descriptors.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698