| Index: src/builtins/builtins-string.cc
|
| diff --git a/src/builtins/builtins-string.cc b/src/builtins/builtins-string.cc
|
| index dddd32a8cd04a1c78ccf6a159e91df86d343f1e1..0e11bd71ded296cc4be0c142e0a02061aff5dfc9 100644
|
| --- a/src/builtins/builtins-string.cc
|
| +++ b/src/builtins/builtins-string.cc
|
| @@ -1115,12 +1115,12 @@ void StringBuiltinsAssembler::MaybeCallFunctionAtSymbol(
|
| }
|
|
|
| // Take the fast path for RegExps.
|
| - if (regexp_call != nullptr) {
|
| + {
|
| Label stub_call(this), slow_lookup(this);
|
|
|
| RegExpBuiltinsAssembler regexp_asm(state());
|
| - regexp_asm.BranchIfFastRegExp(context, object_map, &stub_call,
|
| - &slow_lookup);
|
| + Node* const is_fastregexp = regexp_asm.IsFastRegExpMap(context, object_map);
|
| + Branch(is_fastregexp, &stub_call, &slow_lookup);
|
|
|
| Bind(&stub_call);
|
| Return(regexp_call());
|
| @@ -1160,10 +1160,18 @@ TF_BUILTIN(StringPrototypeReplace, StringBuiltinsAssembler) {
|
| RequireObjectCoercible(context, receiver, "String.prototype.replace");
|
|
|
| // Redirect to replacer method if {search[@@replace]} is not undefined.
|
| - // TODO(jgruber): Call RegExp.p.replace stub for fast path.
|
|
|
| MaybeCallFunctionAtSymbol(
|
| - context, search, isolate()->factory()->replace_symbol(), nullptr,
|
| + context, search, isolate()->factory()->replace_symbol(),
|
| + [=]() {
|
| + Callable tostring_callable = CodeFactory::ToString(isolate());
|
| + Node* const subject_string =
|
| + CallStub(tostring_callable, context, receiver);
|
| +
|
| + Callable replace_callable = CodeFactory::RegExpReplace(isolate());
|
| + return CallStub(replace_callable, context, search, subject_string,
|
| + replace);
|
| + },
|
| [=](Node* fn) {
|
| Callable call_callable = CodeFactory::Call(isolate());
|
| return CallJS(call_callable, context, fn, search, receiver, replace);
|
| @@ -1317,10 +1325,18 @@ TF_BUILTIN(StringPrototypeSplit, StringBuiltinsAssembler) {
|
| RequireObjectCoercible(context, receiver, "String.prototype.split");
|
|
|
| // Redirect to splitter method if {separator[@@split]} is not undefined.
|
| - // TODO(jgruber): Call RegExp.p.split stub for fast path.
|
|
|
| MaybeCallFunctionAtSymbol(
|
| - context, separator, isolate()->factory()->split_symbol(), nullptr,
|
| + context, separator, isolate()->factory()->split_symbol(),
|
| + [=]() {
|
| + Callable tostring_callable = CodeFactory::ToString(isolate());
|
| + Node* const subject_string =
|
| + CallStub(tostring_callable, context, receiver);
|
| +
|
| + Callable split_callable = CodeFactory::RegExpSplit(isolate());
|
| + return CallStub(split_callable, context, separator, subject_string,
|
| + limit);
|
| + },
|
| [=](Node* fn) {
|
| Callable call_callable = CodeFactory::Call(isolate());
|
| return CallJS(call_callable, context, fn, separator, receiver, limit);
|
|
|