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 {
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
// CallInterfaceDescriptor. Isolate behavior for those cases with this macro.
// An attempt to retrieve a descriptor will fail.
......@@ -2125,7 +2119,7 @@ class RegExpExecStub: public PlatformCodeStub {
public:
explicit RegExpExecStub(Isolate* isolate) : PlatformCodeStub(isolate) { }
DEFINE_ON_STACK_CALL_INTERFACE_DESCRIPTOR(4);
DEFINE_CALL_INTERFACE_DESCRIPTOR(RegExpExec);
DEFINE_PLATFORM_CODE_STUB(RegExpExec, PlatformCodeStub);
};
......@@ -3123,7 +3117,7 @@ class SubStringStub : public PlatformCodeStub {
public:
explicit SubStringStub(Isolate* isolate) : PlatformCodeStub(isolate) {}
DEFINE_ON_STACK_CALL_INTERFACE_DESCRIPTOR(3);
DEFINE_CALL_INTERFACE_DESCRIPTOR(SubString);
DEFINE_PLATFORM_CODE_STUB(SubString, PlatformCodeStub);
};
......
......@@ -272,39 +272,6 @@ void ContextOnlyDescriptor::InitializePlatformSpecific(
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(
CallInterfaceDescriptorData* data) {
Register registers[] = {ObjectRegister(), KeyRegister()};
......
......@@ -18,13 +18,6 @@ class PlatformInterfaceDescriptor;
#define INTERFACE_DESCRIPTOR_LIST(V) \
V(Void) \
V(ContextOnly) \
V(OnStackWith1Args) \
V(OnStackWith2Args) \
V(OnStackWith3Args) \
V(OnStackWith4Args) \
V(OnStackWith5Args) \
V(OnStackWith6Args) \
V(OnStackWith7Args) \
V(Load) \
V(LoadWithVector) \
V(LoadGlobal) \
......@@ -53,6 +46,7 @@ class PlatformInterfaceDescriptor;
V(CallTrampoline) \
V(ConstructStub) \
V(ConstructTrampoline) \
V(RegExpExec) \
V(RegExpConstructResult) \
V(CopyFastSmiOrObjectElements) \
V(TransitionElementsKind) \
......@@ -77,6 +71,7 @@ class PlatformInterfaceDescriptor;
V(CountOp) \
V(StringAdd) \
V(StringCompare) \
V(SubString) \
V(Keyed) \
V(Named) \
V(HasProperty) \
......@@ -264,11 +259,18 @@ class CallInterfaceDescriptor {
\
public:
#define DECLARE_DESCRIPTOR_WITH_BASE_AND_FUNCTION_TYPE_ARG(name, base, arg) \
DECLARE_DESCRIPTOR_WITH_BASE(name, base) \
protected: \
int extra_args() const override { return arg; } \
\
#define DECLARE_DESCRIPTOR_WITH_STACK_ARGS(name, base) \
DECLARE_DESCRIPTOR_WITH_BASE(name, base) \
protected: \
void InitializePlatformIndependent(CallInterfaceDescriptorData* data) \
override { \
data->InitializePlatformIndependent(0, kParameterCount, NULL); \
} \
void InitializePlatformSpecific(CallInterfaceDescriptorData* data) \
override { \
data->InitializePlatformSpecific(0, nullptr); \
} \
\
public:
#define DEFINE_PARAMETERS(...) \
......@@ -289,74 +291,6 @@ class ContextOnlyDescriptor : public 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.
class LoadDescriptor : public CallInterfaceDescriptor {
public:
......@@ -598,6 +532,12 @@ class CallConstructDescriptor : public 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 {
public:
......@@ -717,6 +657,13 @@ class StringCompareDescriptor : public CallInterfaceDescriptor {
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.
class KeyedDescriptor : public CallInterfaceDescriptor {
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