diff options
Diffstat (limited to 'deps/v8/src/runtime/runtime-regexp.cc')
-rw-r--r-- | deps/v8/src/runtime/runtime-regexp.cc | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/deps/v8/src/runtime/runtime-regexp.cc b/deps/v8/src/runtime/runtime-regexp.cc index e197e16e11..980339ee5e 100644 --- a/deps/v8/src/runtime/runtime-regexp.cc +++ b/deps/v8/src/runtime/runtime-regexp.cc @@ -613,20 +613,6 @@ V8_WARN_UNUSED_RESULT static Object StringReplaceGlobalRegExpWithString( JSRegExp::Type typeTag = regexp->TypeTag(); if (typeTag == JSRegExp::IRREGEXP) { - // Force tier up to native code for global replaces. The global replace is - // implemented differently for native code and bytecode execution, where the - // native code expects an array to store all the matches, and the bytecode - // matches one at a time, so it's easier to tier-up to native code from the - // start. - if (FLAG_regexp_tier_up) { - regexp->MarkTierUpForNextExec(); - if (FLAG_trace_regexp_tier_up) { - PrintF( - "Forcing tier-up of JSRegExp object %p in " - "StringReplaceGlobalRegExpWithString\n", - reinterpret_cast<void*>(regexp->ptr())); - } - } // Ensure the RegExp is compiled so we can access the capture-name map. if (RegExp::IrregexpPrepare(isolate, regexp, subject) == -1) { DCHECK(isolate->has_pending_exception()); @@ -1349,6 +1335,19 @@ V8_WARN_UNUSED_RESULT MaybeHandle<String> RegExpReplace( RETURN_ON_EXCEPTION(isolate, RegExpUtils::SetLastIndex(isolate, regexp, 0), String); + // Force tier up to native code for global replaces. The global replace is + // implemented differently for native code and bytecode execution, where the + // native code expects an array to store all the matches, and the bytecode + // matches one at a time, so it's easier to tier-up to native code from the + // start. + if (FLAG_regexp_tier_up && regexp->TypeTag() == JSRegExp::IRREGEXP) { + regexp->MarkTierUpForNextExec(); + if (FLAG_trace_regexp_tier_up) { + PrintF("Forcing tier-up of JSRegExp object %p in RegExpReplace\n", + reinterpret_cast<void*>(regexp->ptr())); + } + } + if (replace->length() == 0) { if (string->IsOneByteRepresentation()) { Object result = |