| Index: src/interface-descriptors.h
|
| diff --git a/src/interface-descriptors.h b/src/interface-descriptors.h
|
| index 6fc1a345ec450f38b5e761c5a4011fdc129e282b..ff6c2c3ccb75b8e17f45de630d5bf8243601d8d8 100644
|
| --- a/src/interface-descriptors.h
|
| +++ b/src/interface-descriptors.h
|
| @@ -59,42 +59,51 @@ class PlatformInterfaceDescriptor;
|
| V(StoreArrayLiteralElement) \
|
| V(MathPowTagged) \
|
| V(MathPowInteger) \
|
| - V(MathRoundVariant) \
|
| V(ContextOnly) \
|
| - V(GrowArrayElements)
|
| + V(GrowArrayElements) \
|
| + V(MathRoundVariant)
|
|
|
|
|
| class CallInterfaceDescriptorData {
|
| public:
|
| - CallInterfaceDescriptorData() : register_param_count_(-1) {}
|
| + CallInterfaceDescriptorData()
|
| + : stack_paramater_count_(-1),
|
| + register_param_count_(-1),
|
| + function_type_(nullptr) {}
|
|
|
| // A copy of the passed in registers and param_representations is made
|
| // and owned by the CallInterfaceDescriptorData.
|
|
|
| + void InitializePlatformIndependent(int stack_paramater_count,
|
| + Type::FunctionType* function_type) {
|
| + function_type_ = function_type;
|
| + stack_paramater_count_ = stack_paramater_count;
|
| + }
|
| +
|
| // TODO(mvstanton): Instead of taking parallel arrays register and
|
| // param_representations, how about a struct that puts the representation
|
| // and register side by side (eg, RegRep(r1, Representation::Tagged()).
|
| // The same should go for the CodeStubDescriptor class.
|
| - void Initialize(int register_parameter_count, Register* registers,
|
| - Representation* param_representations,
|
| - PlatformInterfaceDescriptor* platform_descriptor = NULL);
|
| + void InitializePlatformSpecific(
|
| + int register_parameter_count, Register* registers,
|
| + PlatformInterfaceDescriptor* platform_descriptor = NULL);
|
|
|
| bool IsInitialized() const { return register_param_count_ >= 0; }
|
|
|
| int register_param_count() const { return register_param_count_; }
|
| Register register_param(int index) const { return register_params_[index]; }
|
| Register* register_params() const { return register_params_.get(); }
|
| - Representation register_param_representation(int index) const {
|
| - return register_param_representations_[index];
|
| - }
|
| - Representation* register_param_representations() const {
|
| - return register_param_representations_.get();
|
| + Type* register_param_type(int index) const {
|
| + return function_type_->Parameter(index);
|
| }
|
| PlatformInterfaceDescriptor* platform_specific_descriptor() const {
|
| return platform_specific_descriptor_;
|
| }
|
|
|
| + Type::FunctionType* function_type() const { return function_type_; }
|
| +
|
| private:
|
| + int stack_paramater_count_;
|
| int register_param_count_;
|
|
|
| // The Register params are allocated dynamically by the
|
| @@ -102,11 +111,9 @@ class CallInterfaceDescriptorData {
|
| // arrays of Registers cause creation of runtime static initializers
|
| // which we don't want.
|
| SmartArrayPointer<Register> register_params_;
|
| - // Specifies Representations for the stub's parameter. Points to an array of
|
| - // Representations of the same length of the numbers of parameters to the
|
| - // stub, or if NULL (the default value), Representation of each parameter
|
| - // assumed to be Tagged().
|
| - SmartArrayPointer<Representation> register_param_representations_;
|
| +
|
| + // Specifies types for parameters and return
|
| + Type::FunctionType* function_type_;
|
|
|
| PlatformInterfaceDescriptor* platform_specific_descriptor_;
|
|
|
| @@ -128,6 +135,7 @@ class CallDescriptors {
|
| class CallInterfaceDescriptor {
|
| public:
|
| CallInterfaceDescriptor() : data_(NULL) {}
|
| + virtual ~CallInterfaceDescriptor() {}
|
|
|
| CallInterfaceDescriptor(Isolate* isolate, CallDescriptors::Key key)
|
| : data_(isolate->call_descriptor_data(key)) {}
|
| @@ -142,13 +150,9 @@ class CallInterfaceDescriptor {
|
| return data()->register_param(index);
|
| }
|
|
|
| - Representation GetParameterRepresentation(int index) const {
|
| + Type* GetParameterType(int index) const {
|
| DCHECK(index < data()->register_param_count());
|
| - if (data()->register_param_representations() == NULL) {
|
| - return Representation::Tagged();
|
| - }
|
| -
|
| - return data()->register_param_representation(index);
|
| + return data()->register_param_type(index);
|
| }
|
|
|
| // "Environment" versions of parameter functions. The first register
|
| @@ -161,8 +165,8 @@ class CallInterfaceDescriptor {
|
| return GetParameterRegister(index + 1);
|
| }
|
|
|
| - Representation GetEnvironmentParameterRepresentation(int index) const {
|
| - return GetParameterRepresentation(index + 1);
|
| + Type* GetEnvironmentParameterType(int index) const {
|
| + return GetParameterType(index + 1);
|
| }
|
|
|
| // Some platforms have extra information to associate with the descriptor.
|
| @@ -170,36 +174,70 @@ class CallInterfaceDescriptor {
|
| return data()->platform_specific_descriptor();
|
| }
|
|
|
| + Type::FunctionType* GetFunctionType() const {
|
| + return data()->function_type();
|
| + }
|
| +
|
| static const Register ContextRegister();
|
|
|
| const char* DebugName(Isolate* isolate) const;
|
|
|
| + static Type::FunctionType* BuildDefaultFunctionType(Isolate* isolate,
|
| + int paramater_count);
|
| +
|
| protected:
|
| const CallInterfaceDescriptorData* data() const { return data_; }
|
|
|
| + virtual Type::FunctionType* BuildCallInterfaceDescriptorFunctionType(
|
| + Isolate* isolate, int register_param_count) {
|
| + return BuildDefaultFunctionType(isolate, register_param_count);
|
| + }
|
| +
|
| + virtual void InitializePlatformSpecific(CallInterfaceDescriptorData* data) {
|
| + UNREACHABLE();
|
| + }
|
| +
|
| + void Initialize(Isolate* isolate, CallDescriptors::Key key) {
|
| + if (!data()->IsInitialized()) {
|
| + CallInterfaceDescriptorData* d = isolate->call_descriptor_data(key);
|
| + InitializePlatformSpecific(d);
|
| + Type::FunctionType* function_type =
|
| + BuildCallInterfaceDescriptorFunctionType(isolate,
|
| + d->register_param_count());
|
| + d->InitializePlatformIndependent(0, function_type);
|
| + }
|
| + }
|
| +
|
| private:
|
| const CallInterfaceDescriptorData* data_;
|
| };
|
|
|
|
|
| -#define DECLARE_DESCRIPTOR(name, base) \
|
| - explicit name(Isolate* isolate) : base(isolate, key()) { \
|
| - if (!data()->IsInitialized()) \
|
| - Initialize(isolate->call_descriptor_data(key())); \
|
| - } \
|
| - \
|
| - protected: \
|
| - void Initialize(CallInterfaceDescriptorData* data); \
|
| - name(Isolate* isolate, CallDescriptors::Key key) : base(isolate, key) {} \
|
| - \
|
| - public: \
|
| +#define DECLARE_DESCRIPTOR(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: \
|
| static inline CallDescriptors::Key key();
|
|
|
|
|
| +#define DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(name, base) \
|
| + DECLARE_DESCRIPTOR(name, base) \
|
| + protected: \
|
| + virtual Type::FunctionType* BuildCallInterfaceDescriptorFunctionType( \
|
| + Isolate* isolate, int register_param_count) override; \
|
| + \
|
| + public:
|
| // LoadDescriptor is used by all stubs that implement Load/KeyedLoad ICs.
|
| class LoadDescriptor : public CallInterfaceDescriptor {
|
| public:
|
| - DECLARE_DESCRIPTOR(LoadDescriptor, CallInterfaceDescriptor)
|
| + DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(LoadDescriptor,
|
| + CallInterfaceDescriptor)
|
|
|
| enum ParameterIndices { kReceiverIndex, kNameIndex, kSlotIndex };
|
| static const Register ReceiverRegister();
|
| @@ -260,7 +298,8 @@ class InstanceofDescriptor : public CallInterfaceDescriptor {
|
|
|
| class VectorStoreICTrampolineDescriptor : public StoreDescriptor {
|
| public:
|
| - DECLARE_DESCRIPTOR(VectorStoreICTrampolineDescriptor, StoreDescriptor)
|
| + DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(
|
| + VectorStoreICTrampolineDescriptor, StoreDescriptor)
|
|
|
| enum ParameterIndices { kReceiverIndex, kNameIndex, kValueIndex, kSlotIndex };
|
|
|
| @@ -270,7 +309,8 @@ class VectorStoreICTrampolineDescriptor : public StoreDescriptor {
|
|
|
| class VectorStoreICDescriptor : public VectorStoreICTrampolineDescriptor {
|
| public:
|
| - DECLARE_DESCRIPTOR(VectorStoreICDescriptor, VectorStoreICTrampolineDescriptor)
|
| + DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(
|
| + VectorStoreICDescriptor, VectorStoreICTrampolineDescriptor)
|
|
|
| enum ParameterIndices {
|
| kReceiverIndex,
|
| @@ -286,7 +326,8 @@ class VectorStoreICDescriptor : public VectorStoreICTrampolineDescriptor {
|
|
|
| class LoadWithVectorDescriptor : public LoadDescriptor {
|
| public:
|
| - DECLARE_DESCRIPTOR(LoadWithVectorDescriptor, LoadDescriptor)
|
| + DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(LoadWithVectorDescriptor,
|
| + LoadDescriptor)
|
|
|
| enum ParameterIndices {
|
| kReceiverIndex,
|
| @@ -331,7 +372,8 @@ class TypeofDescriptor : public CallInterfaceDescriptor {
|
|
|
| class FastCloneShallowArrayDescriptor : public CallInterfaceDescriptor {
|
| public:
|
| - DECLARE_DESCRIPTOR(FastCloneShallowArrayDescriptor, CallInterfaceDescriptor)
|
| + DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(FastCloneShallowArrayDescriptor,
|
| + CallInterfaceDescriptor)
|
| };
|
|
|
|
|
| @@ -343,7 +385,8 @@ class FastCloneShallowObjectDescriptor : public CallInterfaceDescriptor {
|
|
|
| class CreateAllocationSiteDescriptor : public CallInterfaceDescriptor {
|
| public:
|
| - DECLARE_DESCRIPTOR(CreateAllocationSiteDescriptor, CallInterfaceDescriptor)
|
| + DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(CreateAllocationSiteDescriptor,
|
| + CallInterfaceDescriptor)
|
| };
|
|
|
|
|
| @@ -356,7 +399,8 @@ class CreateWeakCellDescriptor : public CallInterfaceDescriptor {
|
| kParameterCount
|
| };
|
|
|
| - DECLARE_DESCRIPTOR(CreateWeakCellDescriptor, CallInterfaceDescriptor)
|
| + DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(CreateWeakCellDescriptor,
|
| + CallInterfaceDescriptor)
|
| };
|
|
|
|
|
| @@ -368,16 +412,16 @@ class CallFunctionDescriptor : public CallInterfaceDescriptor {
|
|
|
| class CallFunctionWithFeedbackDescriptor : public CallInterfaceDescriptor {
|
| public:
|
| - DECLARE_DESCRIPTOR(CallFunctionWithFeedbackDescriptor,
|
| - CallInterfaceDescriptor)
|
| + DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(
|
| + CallFunctionWithFeedbackDescriptor, CallInterfaceDescriptor)
|
| };
|
|
|
|
|
| class CallFunctionWithFeedbackAndVectorDescriptor
|
| : public CallInterfaceDescriptor {
|
| public:
|
| - DECLARE_DESCRIPTOR(CallFunctionWithFeedbackAndVectorDescriptor,
|
| - CallInterfaceDescriptor)
|
| + DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(
|
| + CallFunctionWithFeedbackAndVectorDescriptor, CallInterfaceDescriptor)
|
| };
|
|
|
|
|
| @@ -415,7 +459,8 @@ class ArrayConstructorConstantArgCountDescriptor
|
|
|
| class ArrayConstructorDescriptor : public CallInterfaceDescriptor {
|
| public:
|
| - DECLARE_DESCRIPTOR(ArrayConstructorDescriptor, CallInterfaceDescriptor)
|
| + DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(ArrayConstructorDescriptor,
|
| + CallInterfaceDescriptor)
|
| };
|
|
|
|
|
| @@ -429,8 +474,8 @@ class InternalArrayConstructorConstantArgCountDescriptor
|
|
|
| class InternalArrayConstructorDescriptor : public CallInterfaceDescriptor {
|
| public:
|
| - DECLARE_DESCRIPTOR(InternalArrayConstructorDescriptor,
|
| - CallInterfaceDescriptor)
|
| + DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(
|
| + InternalArrayConstructorDescriptor, CallInterfaceDescriptor)
|
| };
|
|
|
|
|
| @@ -491,25 +536,29 @@ class CallHandlerDescriptor : public CallInterfaceDescriptor {
|
|
|
| class ArgumentAdaptorDescriptor : public CallInterfaceDescriptor {
|
| public:
|
| - DECLARE_DESCRIPTOR(ArgumentAdaptorDescriptor, CallInterfaceDescriptor)
|
| + DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(ArgumentAdaptorDescriptor,
|
| + CallInterfaceDescriptor)
|
| };
|
|
|
|
|
| class ApiFunctionDescriptor : public CallInterfaceDescriptor {
|
| public:
|
| - DECLARE_DESCRIPTOR(ApiFunctionDescriptor, CallInterfaceDescriptor)
|
| + DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(ApiFunctionDescriptor,
|
| + CallInterfaceDescriptor)
|
| };
|
|
|
|
|
| class ApiAccessorDescriptor : public CallInterfaceDescriptor {
|
| public:
|
| - DECLARE_DESCRIPTOR(ApiAccessorDescriptor, CallInterfaceDescriptor)
|
| + DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(ApiAccessorDescriptor,
|
| + CallInterfaceDescriptor)
|
| };
|
|
|
|
|
| class ApiGetterDescriptor : public CallInterfaceDescriptor {
|
| public:
|
| - DECLARE_DESCRIPTOR(ApiGetterDescriptor, CallInterfaceDescriptor)
|
| + DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(ApiGetterDescriptor,
|
| + CallInterfaceDescriptor)
|
|
|
| static const Register function_address();
|
| };
|
| @@ -549,7 +598,8 @@ class MathPowIntegerDescriptor : public CallInterfaceDescriptor {
|
|
|
| class MathRoundVariantDescriptor : public CallInterfaceDescriptor {
|
| public:
|
| - DECLARE_DESCRIPTOR(MathRoundVariantDescriptor, CallInterfaceDescriptor)
|
| + DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(MathRoundVariantDescriptor,
|
| + CallInterfaceDescriptor)
|
| };
|
|
|
|
|
|
|