Index: src/interface-descriptors.h |
diff --git a/src/interface-descriptors.h b/src/interface-descriptors.h |
index ebd54566bfc1a4b175b0d67851aae0fbca6e3ce9..d62bee52039fd406d23df241a977f1b42f1190cf 100644 |
--- a/src/interface-descriptors.h |
+++ b/src/interface-descriptors.h |
@@ -67,14 +67,8 @@ |
V(Named) \ |
V(CallHandler) \ |
V(ArgumentAdaptor) \ |
- V(ApiCallbackWith0Args) \ |
- V(ApiCallbackWith1Args) \ |
- V(ApiCallbackWith2Args) \ |
- V(ApiCallbackWith3Args) \ |
- V(ApiCallbackWith4Args) \ |
- V(ApiCallbackWith5Args) \ |
- V(ApiCallbackWith6Args) \ |
- V(ApiCallbackWith7Args) \ |
+ V(ApiFunction) \ |
+ V(ApiAccessor) \ |
V(ApiGetter) \ |
V(LoadGlobalViaContext) \ |
V(StoreGlobalViaContext) \ |
@@ -205,7 +199,6 @@ |
void Initialize(Isolate* isolate, CallDescriptors::Key key) { |
if (!data()->IsInitialized()) { |
CallInterfaceDescriptorData* d = isolate->call_descriptor_data(key); |
- DCHECK(d == data()); // d should be a modifiable pointer to data(). |
InitializePlatformSpecific(d); |
FunctionType* function_type = BuildCallInterfaceDescriptorFunctionType( |
isolate, d->register_param_count()); |
@@ -217,20 +210,18 @@ |
const CallInterfaceDescriptorData* data_; |
}; |
-#define DECLARE_DESCRIPTOR_WITH_BASE(name, base) \ |
- public: \ |
- explicit name(Isolate* isolate) : base(isolate, key()) { \ |
- Initialize(isolate, key()); \ |
- } \ |
- static inline CallDescriptors::Key key(); |
#define DECLARE_DESCRIPTOR(name, base) \ |
- DECLARE_DESCRIPTOR_WITH_BASE(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: |
+ public: \ |
+ static inline CallDescriptors::Key key(); |
#define DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(name, base) \ |
DECLARE_DESCRIPTOR(name, base) \ |
@@ -238,17 +229,6 @@ |
FunctionType* BuildCallInterfaceDescriptorFunctionType( \ |
Isolate* isolate, int register_param_count) override; \ |
\ |
- public: |
- |
-#define DECLARE_DESCRIPTOR_WITH_BASE_AND_FUNCTION_TYPE_ARG(name, base, arg) \ |
- DECLARE_DESCRIPTOR_WITH_BASE(name, base) \ |
- protected: \ |
- FunctionType* BuildCallInterfaceDescriptorFunctionType( \ |
- Isolate* isolate, int register_param_count) override { \ |
- return BuildCallInterfaceDescriptorFunctionTypeWithArg( \ |
- isolate, register_param_count, arg); \ |
- } \ |
- \ |
public: |
class VoidDescriptor : public CallInterfaceDescriptor { |
@@ -709,75 +689,18 @@ |
CallInterfaceDescriptor) |
}; |
-// The ApiCallback*Descriptors have a lot of boilerplate. The superclass |
-// ApiCallbackDescriptorBase contains all the logic, and the |
-// ApiCallbackWith*ArgsDescriptor merely instantiate these with a |
-// parameter for the number of args. |
-// |
-// The base class is not meant to be instantiated directly and has no |
-// public constructors to ensure this is so. |
-// |
-// The simplest usage for all the ApiCallback*Descriptors is probably |
-// ApiCallbackDescriptorBase::ForArgs(isolate, argc) |
-// |
-class ApiCallbackDescriptorBase : public CallInterfaceDescriptor { |
- public: |
- static CallInterfaceDescriptor ForArgs(Isolate* isolate, int argc); |
- |
- protected: |
- ApiCallbackDescriptorBase(Isolate* isolate, CallDescriptors::Key key) |
- : CallInterfaceDescriptor(isolate, key) {} |
- void InitializePlatformSpecific(CallInterfaceDescriptorData* data) override; |
- FunctionType* BuildCallInterfaceDescriptorFunctionTypeWithArg( |
- Isolate* isolate, int parameter_count, int argc); |
-}; |
- |
-class ApiCallbackWith0ArgsDescriptor : public ApiCallbackDescriptorBase { |
- public: |
- DECLARE_DESCRIPTOR_WITH_BASE_AND_FUNCTION_TYPE_ARG( |
- ApiCallbackWith0ArgsDescriptor, ApiCallbackDescriptorBase, 0) |
-}; |
- |
-class ApiCallbackWith1ArgsDescriptor : public ApiCallbackDescriptorBase { |
- public: |
- DECLARE_DESCRIPTOR_WITH_BASE_AND_FUNCTION_TYPE_ARG( |
- ApiCallbackWith1ArgsDescriptor, ApiCallbackDescriptorBase, 1) |
-}; |
- |
-class ApiCallbackWith2ArgsDescriptor : public ApiCallbackDescriptorBase { |
- public: |
- DECLARE_DESCRIPTOR_WITH_BASE_AND_FUNCTION_TYPE_ARG( |
- ApiCallbackWith2ArgsDescriptor, ApiCallbackDescriptorBase, 2) |
-}; |
- |
-class ApiCallbackWith3ArgsDescriptor : public ApiCallbackDescriptorBase { |
- public: |
- DECLARE_DESCRIPTOR_WITH_BASE_AND_FUNCTION_TYPE_ARG( |
- ApiCallbackWith3ArgsDescriptor, ApiCallbackDescriptorBase, 3) |
-}; |
- |
-class ApiCallbackWith4ArgsDescriptor : public ApiCallbackDescriptorBase { |
- public: |
- DECLARE_DESCRIPTOR_WITH_BASE_AND_FUNCTION_TYPE_ARG( |
- ApiCallbackWith4ArgsDescriptor, ApiCallbackDescriptorBase, 4) |
-}; |
- |
-class ApiCallbackWith5ArgsDescriptor : public ApiCallbackDescriptorBase { |
- public: |
- DECLARE_DESCRIPTOR_WITH_BASE_AND_FUNCTION_TYPE_ARG( |
- ApiCallbackWith5ArgsDescriptor, ApiCallbackDescriptorBase, 5) |
-}; |
- |
-class ApiCallbackWith6ArgsDescriptor : public ApiCallbackDescriptorBase { |
- public: |
- DECLARE_DESCRIPTOR_WITH_BASE_AND_FUNCTION_TYPE_ARG( |
- ApiCallbackWith6ArgsDescriptor, ApiCallbackDescriptorBase, 6) |
-}; |
- |
-class ApiCallbackWith7ArgsDescriptor : public ApiCallbackDescriptorBase { |
- public: |
- DECLARE_DESCRIPTOR_WITH_BASE_AND_FUNCTION_TYPE_ARG( |
- ApiCallbackWith7ArgsDescriptor, ApiCallbackDescriptorBase, 7) |
+ |
+class ApiFunctionDescriptor : public CallInterfaceDescriptor { |
+ public: |
+ DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(ApiFunctionDescriptor, |
+ CallInterfaceDescriptor) |
+}; |
+ |
+ |
+class ApiAccessorDescriptor : public CallInterfaceDescriptor { |
+ public: |
+ DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(ApiAccessorDescriptor, |
+ CallInterfaceDescriptor) |
}; |
@@ -821,7 +744,7 @@ |
static const Register KeyRegister(); |
}; |
-class InterpreterDispatchDescriptor : public CallInterfaceDescriptor { |
+class InterpreterDispatchDescriptor : public CallInterfaceDescriptor { |
public: |
DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(InterpreterDispatchDescriptor, |
CallInterfaceDescriptor) |
@@ -854,10 +777,8 @@ |
DECLARE_DESCRIPTOR(InterpreterCEntryDescriptor, CallInterfaceDescriptor) |
}; |
-#undef DECLARE_DESCRIPTOR_WITH_BASE |
#undef DECLARE_DESCRIPTOR |
-#undef DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE |
-#undef DECLARE_DESCRIPTOR_WITH_BASE_AND_FUNCTION_TYPE_ARG |
+ |
// We define the association between CallDescriptors::Key and the specialized |
// descriptor here to reduce boilerplate and mistakes. |