Commit 14a87d96 authored by ishell's avatar ishell Committed by Commit bot

[stubs] Remove OnStackArgsDescriptor and friends.

Each stub should have more meaningful descriptor instead.

BUG=v8:5407

Review-Url: https://codereview.chromium.org/2356163002
Cr-Commit-Position: refs/heads/master@{#39593}
parent a8951a96
...@@ -488,12 +488,6 @@ class CodeStub BASE_EMBEDDED { ...@@ -488,12 +488,6 @@ class CodeStub BASE_EMBEDDED {
return Descriptor(isolate()); \ return Descriptor(isolate()); \
} }
#define DEFINE_ON_STACK_CALL_INTERFACE_DESCRIPTOR(PARAMETER_COUNT) \
public: \
CallInterfaceDescriptor GetCallInterfaceDescriptor() const override { \
return OnStackArgsDescriptorBase::ForArgs(isolate(), PARAMETER_COUNT); \
}
// There are some code stubs we just can't describe right now with a // There are some code stubs we just can't describe right now with a
// CallInterfaceDescriptor. Isolate behavior for those cases with this macro. // CallInterfaceDescriptor. Isolate behavior for those cases with this macro.
// An attempt to retrieve a descriptor will fail. // An attempt to retrieve a descriptor will fail.
...@@ -2125,7 +2119,7 @@ class RegExpExecStub: public PlatformCodeStub { ...@@ -2125,7 +2119,7 @@ class RegExpExecStub: public PlatformCodeStub {
public: public:
explicit RegExpExecStub(Isolate* isolate) : PlatformCodeStub(isolate) { } explicit RegExpExecStub(Isolate* isolate) : PlatformCodeStub(isolate) { }
DEFINE_ON_STACK_CALL_INTERFACE_DESCRIPTOR(4); DEFINE_CALL_INTERFACE_DESCRIPTOR(RegExpExec);
DEFINE_PLATFORM_CODE_STUB(RegExpExec, PlatformCodeStub); DEFINE_PLATFORM_CODE_STUB(RegExpExec, PlatformCodeStub);
}; };
...@@ -3123,7 +3117,7 @@ class SubStringStub : public PlatformCodeStub { ...@@ -3123,7 +3117,7 @@ class SubStringStub : public PlatformCodeStub {
public: public:
explicit SubStringStub(Isolate* isolate) : PlatformCodeStub(isolate) {} explicit SubStringStub(Isolate* isolate) : PlatformCodeStub(isolate) {}
DEFINE_ON_STACK_CALL_INTERFACE_DESCRIPTOR(3); DEFINE_CALL_INTERFACE_DESCRIPTOR(SubString);
DEFINE_PLATFORM_CODE_STUB(SubString, PlatformCodeStub); DEFINE_PLATFORM_CODE_STUB(SubString, PlatformCodeStub);
}; };
......
...@@ -272,39 +272,6 @@ void ContextOnlyDescriptor::InitializePlatformSpecific( ...@@ -272,39 +272,6 @@ void ContextOnlyDescriptor::InitializePlatformSpecific(
data->InitializePlatformSpecific(0, nullptr); data->InitializePlatformSpecific(0, nullptr);
} }
CallInterfaceDescriptor OnStackArgsDescriptorBase::ForArgs(
Isolate* isolate, int parameter_count) {
switch (parameter_count) {
case 1:
return OnStackWith1ArgsDescriptor(isolate);
case 2:
return OnStackWith2ArgsDescriptor(isolate);
case 3:
return OnStackWith3ArgsDescriptor(isolate);
case 4:
return OnStackWith4ArgsDescriptor(isolate);
case 5:
return OnStackWith5ArgsDescriptor(isolate);
case 6:
return OnStackWith6ArgsDescriptor(isolate);
case 7:
return OnStackWith7ArgsDescriptor(isolate);
default:
UNREACHABLE();
return VoidDescriptor(isolate);
}
}
void OnStackArgsDescriptorBase::InitializePlatformIndependent(
CallInterfaceDescriptorData* data) {
data->InitializePlatformIndependent(0, extra_args(), NULL);
}
void OnStackArgsDescriptorBase::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
data->InitializePlatformSpecific(0, nullptr);
}
void GrowArrayElementsDescriptor::InitializePlatformSpecific( void GrowArrayElementsDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) { CallInterfaceDescriptorData* data) {
Register registers[] = {ObjectRegister(), KeyRegister()}; Register registers[] = {ObjectRegister(), KeyRegister()};
......
...@@ -18,13 +18,6 @@ class PlatformInterfaceDescriptor; ...@@ -18,13 +18,6 @@ class PlatformInterfaceDescriptor;
#define INTERFACE_DESCRIPTOR_LIST(V) \ #define INTERFACE_DESCRIPTOR_LIST(V) \
V(Void) \ V(Void) \
V(ContextOnly) \ V(ContextOnly) \
V(OnStackWith1Args) \
V(OnStackWith2Args) \
V(OnStackWith3Args) \
V(OnStackWith4Args) \
V(OnStackWith5Args) \
V(OnStackWith6Args) \
V(OnStackWith7Args) \
V(Load) \ V(Load) \
V(LoadWithVector) \ V(LoadWithVector) \
V(LoadGlobal) \ V(LoadGlobal) \
...@@ -53,6 +46,7 @@ class PlatformInterfaceDescriptor; ...@@ -53,6 +46,7 @@ class PlatformInterfaceDescriptor;
V(CallTrampoline) \ V(CallTrampoline) \
V(ConstructStub) \ V(ConstructStub) \
V(ConstructTrampoline) \ V(ConstructTrampoline) \
V(RegExpExec) \
V(RegExpConstructResult) \ V(RegExpConstructResult) \
V(CopyFastSmiOrObjectElements) \ V(CopyFastSmiOrObjectElements) \
V(TransitionElementsKind) \ V(TransitionElementsKind) \
...@@ -77,6 +71,7 @@ class PlatformInterfaceDescriptor; ...@@ -77,6 +71,7 @@ class PlatformInterfaceDescriptor;
V(CountOp) \ V(CountOp) \
V(StringAdd) \ V(StringAdd) \
V(StringCompare) \ V(StringCompare) \
V(SubString) \
V(Keyed) \ V(Keyed) \
V(Named) \ V(Named) \
V(HasProperty) \ V(HasProperty) \
...@@ -264,11 +259,18 @@ class CallInterfaceDescriptor { ...@@ -264,11 +259,18 @@ class CallInterfaceDescriptor {
\ \
public: public:
#define DECLARE_DESCRIPTOR_WITH_BASE_AND_FUNCTION_TYPE_ARG(name, base, arg) \ #define DECLARE_DESCRIPTOR_WITH_STACK_ARGS(name, base) \
DECLARE_DESCRIPTOR_WITH_BASE(name, base) \ DECLARE_DESCRIPTOR_WITH_BASE(name, base) \
protected: \ protected: \
int extra_args() const override { return arg; } \ void InitializePlatformIndependent(CallInterfaceDescriptorData* data) \
\ override { \
data->InitializePlatformIndependent(0, kParameterCount, NULL); \
} \
void InitializePlatformSpecific(CallInterfaceDescriptorData* data) \
override { \
data->InitializePlatformSpecific(0, nullptr); \
} \
\
public: public:
#define DEFINE_PARAMETERS(...) \ #define DEFINE_PARAMETERS(...) \
...@@ -289,74 +291,6 @@ class ContextOnlyDescriptor : public CallInterfaceDescriptor { ...@@ -289,74 +291,6 @@ class ContextOnlyDescriptor : public CallInterfaceDescriptor {
DECLARE_DESCRIPTOR(ContextOnlyDescriptor, CallInterfaceDescriptor) DECLARE_DESCRIPTOR(ContextOnlyDescriptor, CallInterfaceDescriptor)
}; };
// The OnStackWith*ArgsDescriptors have a lot of boilerplate. The superclass
// OnStackArgsDescriptorBase is not meant to be instantiated directly and has no
// public constructors to ensure this is so.contains all the logic, and the
//
// Use OnStackArgsDescriptorBase::ForArgs(isolate, parameter_count) to
// instantiate a descriptor with the number of args.
class OnStackArgsDescriptorBase : public CallInterfaceDescriptor {
public:
static CallInterfaceDescriptor ForArgs(Isolate* isolate, int parameter_count);
protected:
virtual int extra_args() const { return 0; }
OnStackArgsDescriptorBase(Isolate* isolate, CallDescriptors::Key key)
: CallInterfaceDescriptor(isolate, key) {}
void InitializePlatformSpecific(CallInterfaceDescriptorData* data) override;
void InitializePlatformIndependent(
CallInterfaceDescriptorData* data) override;
};
class OnStackWith1ArgsDescriptor : public OnStackArgsDescriptorBase {
public:
DECLARE_DESCRIPTOR_WITH_BASE_AND_FUNCTION_TYPE_ARG(OnStackWith1ArgsDescriptor,
OnStackArgsDescriptorBase,
1)
};
class OnStackWith2ArgsDescriptor : public OnStackArgsDescriptorBase {
public:
DECLARE_DESCRIPTOR_WITH_BASE_AND_FUNCTION_TYPE_ARG(OnStackWith2ArgsDescriptor,
OnStackArgsDescriptorBase,
2)
};
class OnStackWith3ArgsDescriptor : public OnStackArgsDescriptorBase {
public:
DECLARE_DESCRIPTOR_WITH_BASE_AND_FUNCTION_TYPE_ARG(OnStackWith3ArgsDescriptor,
OnStackArgsDescriptorBase,
3)
};
class OnStackWith4ArgsDescriptor : public OnStackArgsDescriptorBase {
public:
DECLARE_DESCRIPTOR_WITH_BASE_AND_FUNCTION_TYPE_ARG(OnStackWith4ArgsDescriptor,
OnStackArgsDescriptorBase,
4)
};
class OnStackWith5ArgsDescriptor : public OnStackArgsDescriptorBase {
public:
DECLARE_DESCRIPTOR_WITH_BASE_AND_FUNCTION_TYPE_ARG(OnStackWith5ArgsDescriptor,
OnStackArgsDescriptorBase,
5)
};
class OnStackWith6ArgsDescriptor : public OnStackArgsDescriptorBase {
public:
DECLARE_DESCRIPTOR_WITH_BASE_AND_FUNCTION_TYPE_ARG(OnStackWith6ArgsDescriptor,
OnStackArgsDescriptorBase,
6)
};
class OnStackWith7ArgsDescriptor : public OnStackArgsDescriptorBase {
public:
DECLARE_DESCRIPTOR_WITH_BASE_AND_FUNCTION_TYPE_ARG(OnStackWith7ArgsDescriptor,
OnStackArgsDescriptorBase,
7)
};
// LoadDescriptor is used by all stubs that implement Load/KeyedLoad ICs. // LoadDescriptor is used by all stubs that implement Load/KeyedLoad ICs.
class LoadDescriptor : public CallInterfaceDescriptor { class LoadDescriptor : public CallInterfaceDescriptor {
public: public:
...@@ -598,6 +532,12 @@ class CallConstructDescriptor : public CallInterfaceDescriptor { ...@@ -598,6 +532,12 @@ class CallConstructDescriptor : public CallInterfaceDescriptor {
DECLARE_DESCRIPTOR(CallConstructDescriptor, CallInterfaceDescriptor) DECLARE_DESCRIPTOR(CallConstructDescriptor, CallInterfaceDescriptor)
}; };
class RegExpExecDescriptor : public CallInterfaceDescriptor {
public:
DEFINE_PARAMETERS(kRegExpObject, kString, kPreviousIndex, kLastMatchInfo)
DECLARE_DESCRIPTOR_WITH_STACK_ARGS(RegExpExecDescriptor,
CallInterfaceDescriptor)
};
class RegExpConstructResultDescriptor : public CallInterfaceDescriptor { class RegExpConstructResultDescriptor : public CallInterfaceDescriptor {
public: public:
...@@ -717,6 +657,13 @@ class StringCompareDescriptor : public CallInterfaceDescriptor { ...@@ -717,6 +657,13 @@ class StringCompareDescriptor : public CallInterfaceDescriptor {
static const Register RightRegister(); static const Register RightRegister();
}; };
class SubStringDescriptor : public CallInterfaceDescriptor {
public:
DEFINE_PARAMETERS(kString, kFrom, kTo)
DECLARE_DESCRIPTOR_WITH_STACK_ARGS(SubStringDescriptor,
CallInterfaceDescriptor)
};
// TODO(ishell): not used, remove. // TODO(ishell): not used, remove.
class KeyedDescriptor : public CallInterfaceDescriptor { class KeyedDescriptor : public CallInterfaceDescriptor {
public: public:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment