Chromium Code Reviews| Index: src/builtins/builtins-regexp.cc |
| diff --git a/src/builtins/builtins-regexp.cc b/src/builtins/builtins-regexp.cc |
| index 969cb19751d7ade0fa968fca2fb10a4704bd2f04..c477ad33c27419068e46434b7391a890bc67913d 100644 |
| --- a/src/builtins/builtins-regexp.cc |
| +++ b/src/builtins/builtins-regexp.cc |
| @@ -455,10 +455,12 @@ Node* RegExpBuiltinsAssembler::IrregexpExec(Node* const context, |
| Branch(IsTheHole(pending_exception), &stack_overflow, &rethrow); |
| Bind(&stack_overflow); |
| - TailCallRuntime(Runtime::kThrowStackOverflow, context); |
| + CallRuntime(Runtime::kThrowStackOverflow, context); |
| + Unreachable(); |
| Bind(&rethrow); |
| - TailCallRuntime(Runtime::kRegExpExecReThrow, context); |
| + CallRuntime(Runtime::kRegExpExecReThrow, context); |
| + Unreachable(); |
| } |
| Bind(&runtime); |
| @@ -736,6 +738,17 @@ void RegExpBuiltinsAssembler::BranchIfFastRegExpResult(Node* context, Node* map, |
| if_ismodified); |
| } |
| +// Slow path stub for RegExpPrototypeExec to decrease code size. |
| +TF_BUILTIN(RegExpPrototypeExecSlow, RegExpBuiltinsAssembler) { |
| + typedef GenericTagged2Descriptor Descriptor; |
| + |
| + Node* const regexp = Parameter(Descriptor::kFirst); |
| + Node* const string = Parameter(Descriptor::kSecond); |
| + Node* const context = Parameter(Descriptor::kContext); |
| + |
| + Return(RegExpPrototypeExecBody(context, regexp, string, false)); |
| +} |
| + |
| // ES#sec-regexp.prototype.exec |
| // RegExp.prototype.exec ( string ) |
| TF_BUILTIN(RegExpPrototypeExec, RegExpBuiltinsAssembler) { |
| @@ -764,8 +777,11 @@ TF_BUILTIN(RegExpPrototypeExec, RegExpBuiltinsAssembler) { |
| Bind(&if_isslowpath); |
| { |
| - Node* const result = |
| - RegExpPrototypeExecBody(context, receiver, string, false); |
| + Handle<Code> code = isolate()->builtins()->RegExpPrototypeExecSlow(); |
| + const auto desc = GenericTagged2Descriptor(isolate()); |
| + Callable callable(code, desc); |
| + |
| + Node* const result = CallStub(callable, context, receiver, string); |
| Return(result); |
| } |
| } |
| @@ -1482,11 +1498,7 @@ Node* RegExpBuiltinsAssembler::RegExpExec(Node* context, Node* regexp, |
| BranchIfFastRegExp(context, map, &if_isfastpath, &if_isslowpath); |
|
Igor Sheludko
2017/03/13 16:30:32
I guess it's better to skip this check and jump di
jgruber
2017/03/17 09:51:22
Done.
|
| Bind(&if_isfastpath); |
| - { |
| - Node* const result = RegExpPrototypeExecBody(context, regexp, string, true); |
| - var_result.Bind(result); |
| - Goto(&out); |
| - } |
| + Unreachable(); |
| Bind(&if_isslowpath); |
| { |
| @@ -1525,8 +1537,11 @@ Node* RegExpBuiltinsAssembler::RegExpExec(Node* context, Node* regexp, |
| ThrowIfNotInstanceType(context, regexp, JS_REGEXP_TYPE, |
| "RegExp.prototype.exec"); |
| - Node* const result = |
| - RegExpPrototypeExecBody(context, regexp, string, false); |
| + Handle<Code> code = isolate->builtins()->RegExpPrototypeExecSlow(); |
| + const auto desc = GenericTagged2Descriptor(isolate); |
| + Callable callable(code, desc); |
| + |
| + Node* const result = CallStub(callable, context, regexp, string); |
| var_result.Bind(result); |
| Goto(&out); |
| } |