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

Unified Diff: src/objects.cc

Issue 2813843002: [string] Add a fast path to String.p.replace (Closed)
Patch Set: Don't scan twice Created 3 years, 8 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/objects.h ('k') | src/runtime/runtime.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index cc8056402d88dc3859facd8fe85e530a686a196c..5fd0893216759a666231427ce0965566831666e2 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -11440,8 +11440,10 @@ int String::IndexOf(Isolate* isolate, Handle<String> receiver,
}
MaybeHandle<String> String::GetSubstitution(Isolate* isolate, Match* match,
- Handle<String> replacement) {
+ Handle<String> replacement,
+ int start_index) {
DCHECK_IMPLIES(match->HasNamedCaptures(), FLAG_harmony_regexp_named_captures);
+ DCHECK_GE(start_index, 0);
Factory* factory = isolate->factory();
@@ -11452,7 +11454,8 @@ MaybeHandle<String> String::GetSubstitution(Isolate* isolate, Match* match,
Handle<String> dollar_string =
factory->LookupSingleCharacterStringFromCode('$');
- int next_dollar_ix = String::IndexOf(isolate, replacement, dollar_string, 0);
+ int next_dollar_ix =
+ String::IndexOf(isolate, replacement, dollar_string, start_index);
if (next_dollar_ix < 0) {
return replacement;
}
« no previous file with comments | « src/objects.h ('k') | src/runtime/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698