Commit 0e2b1aaa authored by Jaroslav Sevcik's avatar Jaroslav Sevcik Committed by Commit Bot

[regexp] Refactor fast path check for replace

Bug: v8:8361
Change-Id: If5d7e8dd6c4e800ce6f8b82d197c29111bc8707d
Reviewed-on: https://chromium-review.googlesource.com/c/1340296Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Commit-Queue: Jaroslav Sevcik <jarin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57709}
parent 7acffecc
......@@ -1735,15 +1735,19 @@ RUNTIME_FUNCTION(Runtime_RegExpReplace) {
string = String::Flatten(isolate, string);
// Fast-path for unmodified JSRegExps.
const bool functional_replace = replace_obj->IsCallable();
// Fast-path for unmodified JSRegExps (and non-functional replace).
if (RegExpUtils::IsUnmodifiedRegExp(isolate, recv)) {
// We should never get here with functional replace because unmodified
// regexp and functional replace should be fully handled in CSA code.
CHECK(!functional_replace);
RETURN_RESULT_OR_FAILURE(
isolate, RegExpReplace(isolate, Handle<JSRegExp>::cast(recv), string,
replace_obj));
}
const uint32_t length = string->length();
const bool functional_replace = replace_obj->IsCallable();
Handle<String> replace;
if (!functional_replace) {
......
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