Commit 7d15175a authored by jgruber's avatar jgruber Committed by Commit bot

Revert of [regexp] Add stub for RegExpExec instead of inlining (patchset #1...

Revert of [regexp] Add stub for RegExpExec instead of inlining (patchset #1 id:1 of https://codereview.chromium.org/2677073004/ )

Reason for revert:
Doesn't fix perf regressions in crbug.com/688972 and introduces new ones for RegExp in crbug.com/689395.

Original issue's description:
> [regexp] Add stub for RegExpExec instead of inlining
>
> The code produced for RegExpExec is quite large, and we ended up completely
> inlining it several spots.  This CL moves RegExpPrototypeExecBody into two
> stubs (one each for fast and slow paths) and converts inlined uses into stub
> calls. This decreases the local x64 snapshot size by around 80K.
>
> BUG=chromium:688972
>
> Review-Url: https://codereview.chromium.org/2677073004
> Cr-Commit-Position: refs/heads/master@{#42965}
> Committed: https://chromium.googlesource.com/v8/v8/+/5ea144afe3fd98896fc097a3523de9ab0cb8cd61

TBR=yangguo@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=chromium:688972

Review-Url: https://codereview.chromium.org/2679063003
Cr-Commit-Position: refs/heads/master@{#42985}
parent f4739ea8
...@@ -340,33 +340,6 @@ Node* RegExpBuiltinsAssembler::RegExpPrototypeExecBodyWithoutResult( ...@@ -340,33 +340,6 @@ Node* RegExpBuiltinsAssembler::RegExpPrototypeExecBodyWithoutResult(
return var_result.value(); return var_result.value();
} }
// Wrapper around RegExpPrototypeExecBody to reduce code duplication.
TF_BUILTIN(RegExpExecInternalFast, RegExpBuiltinsAssembler) {
typedef RegExpExecInternalDescriptor Descriptor;
Node* const regexp = Parameter(Descriptor::kReceiver);
Node* const string = Parameter(Descriptor::kString);
Node* const context = Parameter(Descriptor::kContext);
CSA_ASSERT(this, HasInstanceType(regexp, JS_REGEXP_TYPE));
CSA_ASSERT(this, IsString(string));
Return(RegExpPrototypeExecBody(context, regexp, string, true));
}
// Wrapper around RegExpPrototypeExecBody to reduce code duplication.
TF_BUILTIN(RegExpExecInternalSlow, RegExpBuiltinsAssembler) {
typedef RegExpExecInternalDescriptor Descriptor;
Node* const regexp = Parameter(Descriptor::kReceiver);
Node* const string = Parameter(Descriptor::kString);
Node* const context = Parameter(Descriptor::kContext);
CSA_ASSERT(this, IsString(string));
Return(RegExpPrototypeExecBody(context, regexp, string, false));
}
// ES#sec-regexp.prototype.exec // ES#sec-regexp.prototype.exec
// RegExp.prototype.exec ( string ) // RegExp.prototype.exec ( string )
Node* RegExpBuiltinsAssembler::RegExpPrototypeExecBody(Node* const context, Node* RegExpBuiltinsAssembler::RegExpPrototypeExecBody(Node* const context,
...@@ -525,14 +498,16 @@ TF_BUILTIN(RegExpPrototypeExec, RegExpBuiltinsAssembler) { ...@@ -525,14 +498,16 @@ TF_BUILTIN(RegExpPrototypeExec, RegExpBuiltinsAssembler) {
Bind(&if_isfastpath); Bind(&if_isfastpath);
{ {
Callable exec_callable = CodeFactory::RegExpExecInternal(isolate(), true); Node* const result =
Return(CallStub(exec_callable, context, receiver, string)); RegExpPrototypeExecBody(context, receiver, string, true);
Return(result);
} }
Bind(&if_isslowpath); Bind(&if_isslowpath);
{ {
Callable exec_callable = CodeFactory::RegExpExecInternal(isolate(), false); Node* const result =
Return(CallStub(exec_callable, context, receiver, string)); RegExpPrototypeExecBody(context, receiver, string, false);
Return(result);
} }
} }
...@@ -1249,8 +1224,7 @@ Node* RegExpBuiltinsAssembler::RegExpExec(Node* context, Node* regexp, ...@@ -1249,8 +1224,7 @@ Node* RegExpBuiltinsAssembler::RegExpExec(Node* context, Node* regexp,
Bind(&if_isfastpath); Bind(&if_isfastpath);
{ {
Callable exec_callable = CodeFactory::RegExpExecInternal(isolate, true); Node* const result = RegExpPrototypeExecBody(context, regexp, string, true);
Node* const result = CallStub(exec_callable, context, regexp, string);
var_result.Bind(result); var_result.Bind(result);
Goto(&out); Goto(&out);
} }
...@@ -1292,8 +1266,8 @@ Node* RegExpBuiltinsAssembler::RegExpExec(Node* context, Node* regexp, ...@@ -1292,8 +1266,8 @@ Node* RegExpBuiltinsAssembler::RegExpExec(Node* context, Node* regexp,
ThrowIfNotInstanceType(context, regexp, JS_REGEXP_TYPE, ThrowIfNotInstanceType(context, regexp, JS_REGEXP_TYPE,
"RegExp.prototype.exec"); "RegExp.prototype.exec");
Callable exec_callable = CodeFactory::RegExpExecInternal(isolate, false); Node* const result =
Node* const result = CallStub(exec_callable, context, regexp, string); RegExpPrototypeExecBody(context, regexp, string, false);
var_result.Bind(result); var_result.Bind(result);
Goto(&out); Goto(&out);
} }
...@@ -1550,12 +1524,10 @@ void RegExpBuiltinsAssembler::RegExpPrototypeMatchBody(Node* const context, ...@@ -1550,12 +1524,10 @@ void RegExpBuiltinsAssembler::RegExpPrototypeMatchBody(Node* const context,
Bind(&if_isnotglobal); Bind(&if_isnotglobal);
{ {
if (is_fastpath) { Node* const result =
Callable exec_callable = CodeFactory::RegExpExecInternal(isolate, true); is_fastpath ? RegExpPrototypeExecBody(context, regexp, string, true)
Return(CallStub(exec_callable, context, regexp, string)); : RegExpExec(context, regexp, string);
} else { Return(result);
Return(RegExpExec(context, regexp, string));
}
} }
Bind(&if_isglobal); Bind(&if_isglobal);
......
...@@ -675,9 +675,6 @@ class Isolate; ...@@ -675,9 +675,6 @@ class Isolate;
CPP(ReflectSet) \ CPP(ReflectSet) \
CPP(ReflectSetPrototypeOf) \ CPP(ReflectSetPrototypeOf) \
\ \
TFS(RegExpExecInternalFast, BUILTIN, kNoExtraICState, RegExpExecInternal) \
TFS(RegExpExecInternalSlow, BUILTIN, kNoExtraICState, RegExpExecInternal) \
\
/* RegExp */ \ /* RegExp */ \
CPP(RegExpCapture1Getter) \ CPP(RegExpCapture1Getter) \
CPP(RegExpCapture2Getter) \ CPP(RegExpCapture2Getter) \
......
...@@ -264,14 +264,6 @@ TFS_BUILTIN(StringGreaterThanOrEqual) ...@@ -264,14 +264,6 @@ TFS_BUILTIN(StringGreaterThanOrEqual)
#undef TFS_BUILTIN #undef TFS_BUILTIN
// static
Callable CodeFactory::RegExpExecInternal(Isolate* isolate, bool is_fastpath) {
Handle<Code> code(is_fastpath
? isolate->builtins()->RegExpExecInternalFast()
: isolate->builtins()->RegExpExecInternalSlow());
return Callable(code, RegExpExecInternalDescriptor(isolate));
}
// static // static
Callable CodeFactory::StringAdd(Isolate* isolate, StringAddFlags flags, Callable CodeFactory::StringAdd(Isolate* isolate, StringAddFlags flags,
PretenureFlag pretenure_flag) { PretenureFlag pretenure_flag) {
......
...@@ -96,13 +96,8 @@ class V8_EXPORT_PRIVATE CodeFactory final { ...@@ -96,13 +96,8 @@ class V8_EXPORT_PRIVATE CodeFactory final {
OrdinaryToPrimitiveHint hint); OrdinaryToPrimitiveHint hint);
static Callable NumberToString(Isolate* isolate); static Callable NumberToString(Isolate* isolate);
// Platform-dependent entry point into the generated irregexp matcher code.
static Callable RegExpExec(Isolate* isolate); static Callable RegExpExec(Isolate* isolate);
// Implements part of the specced glue logic around RegExp.prototype.exec.
// Usually results in a call to CodeFactory::RegExpExec.
static Callable RegExpExecInternal(Isolate* isolate, bool is_fastpath);
static Callable Add(Isolate* isolate); static Callable Add(Isolate* isolate);
static Callable Subtract(Isolate* isolate); static Callable Subtract(Isolate* isolate);
static Callable Multiply(Isolate* isolate); static Callable Multiply(Isolate* isolate);
......
...@@ -52,7 +52,6 @@ class PlatformInterfaceDescriptor; ...@@ -52,7 +52,6 @@ class PlatformInterfaceDescriptor;
V(ConstructStub) \ V(ConstructStub) \
V(ConstructTrampoline) \ V(ConstructTrampoline) \
V(RegExpExec) \ V(RegExpExec) \
V(RegExpExecInternal) \
V(RegExpReplace) \ V(RegExpReplace) \
V(RegExpSplit) \ V(RegExpSplit) \
V(CopyFastSmiOrObjectElements) \ V(CopyFastSmiOrObjectElements) \
...@@ -658,13 +657,6 @@ class RegExpExecDescriptor : public CallInterfaceDescriptor { ...@@ -658,13 +657,6 @@ class RegExpExecDescriptor : public CallInterfaceDescriptor {
CallInterfaceDescriptor) CallInterfaceDescriptor)
}; };
class RegExpExecInternalDescriptor : public CallInterfaceDescriptor {
public:
DEFINE_PARAMETERS(kReceiver, kString)
DECLARE_DEFAULT_DESCRIPTOR(RegExpExecInternalDescriptor,
CallInterfaceDescriptor, kParameterCount)
};
class RegExpReplaceDescriptor : public CallInterfaceDescriptor { class RegExpReplaceDescriptor : public CallInterfaceDescriptor {
public: public:
DEFINE_PARAMETERS(kReceiver, kString, kReplaceValue) DEFINE_PARAMETERS(kReceiver, kString, kReplaceValue)
......
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