Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(715)

Unified Diff: src/builtins/builtins-regexp.cc

Issue 2677073004: [regexp] Add stub for RegExpExec instead of inlining (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/builtins/builtins.h ('k') | src/code-factory.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/builtins/builtins-regexp.cc
diff --git a/src/builtins/builtins-regexp.cc b/src/builtins/builtins-regexp.cc
index 4d8340d71ea3853d41bae497daf0b901d1cf36ed..f6ca8bb2c16a0c7e16dc537c130b731e5b2735de 100644
--- a/src/builtins/builtins-regexp.cc
+++ b/src/builtins/builtins-regexp.cc
@@ -340,6 +340,33 @@ Node* RegExpBuiltinsAssembler::RegExpPrototypeExecBodyWithoutResult(
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
// RegExp.prototype.exec ( string )
Node* RegExpBuiltinsAssembler::RegExpPrototypeExecBody(Node* const context,
@@ -498,16 +525,14 @@ TF_BUILTIN(RegExpPrototypeExec, RegExpBuiltinsAssembler) {
Bind(&if_isfastpath);
{
- Node* const result =
- RegExpPrototypeExecBody(context, receiver, string, true);
- Return(result);
+ Callable exec_callable = CodeFactory::RegExpExecInternal(isolate(), true);
+ Return(CallStub(exec_callable, context, receiver, string));
}
Bind(&if_isslowpath);
{
- Node* const result =
- RegExpPrototypeExecBody(context, receiver, string, false);
- Return(result);
+ Callable exec_callable = CodeFactory::RegExpExecInternal(isolate(), false);
+ Return(CallStub(exec_callable, context, receiver, string));
}
}
@@ -1224,7 +1249,8 @@ Node* RegExpBuiltinsAssembler::RegExpExec(Node* context, Node* regexp,
Bind(&if_isfastpath);
{
- Node* const result = RegExpPrototypeExecBody(context, regexp, string, true);
+ Callable exec_callable = CodeFactory::RegExpExecInternal(isolate, true);
+ Node* const result = CallStub(exec_callable, context, regexp, string);
var_result.Bind(result);
Goto(&out);
}
@@ -1266,8 +1292,8 @@ Node* RegExpBuiltinsAssembler::RegExpExec(Node* context, Node* regexp,
ThrowIfNotInstanceType(context, regexp, JS_REGEXP_TYPE,
"RegExp.prototype.exec");
- Node* const result =
- RegExpPrototypeExecBody(context, regexp, string, false);
+ Callable exec_callable = CodeFactory::RegExpExecInternal(isolate, false);
+ Node* const result = CallStub(exec_callable, context, regexp, string);
var_result.Bind(result);
Goto(&out);
}
@@ -1524,10 +1550,12 @@ void RegExpBuiltinsAssembler::RegExpPrototypeMatchBody(Node* const context,
Bind(&if_isnotglobal);
{
- Node* const result =
- is_fastpath ? RegExpPrototypeExecBody(context, regexp, string, true)
- : RegExpExec(context, regexp, string);
- Return(result);
+ if (is_fastpath) {
+ Callable exec_callable = CodeFactory::RegExpExecInternal(isolate, true);
+ Return(CallStub(exec_callable, context, regexp, string));
+ } else {
+ Return(RegExpExec(context, regexp, string));
+ }
}
Bind(&if_isglobal);
« no previous file with comments | « src/builtins/builtins.h ('k') | src/code-factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698