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

Unified Diff: src/runtime/runtime-strings.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/runtime/runtime.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime/runtime-strings.cc
diff --git a/src/runtime/runtime-strings.cc b/src/runtime/runtime-strings.cc
index 1ef04ed467f66112cc7dd4dcdb978ba9716896be..99fbf2d475a640dbb8783719b1b0b037744fcf15 100644
--- a/src/runtime/runtime-strings.cc
+++ b/src/runtime/runtime-strings.cc
@@ -17,11 +17,12 @@ namespace internal {
RUNTIME_FUNCTION(Runtime_GetSubstitution) {
HandleScope scope(isolate);
- DCHECK_EQ(4, args.length());
+ DCHECK_EQ(5, args.length());
CONVERT_ARG_HANDLE_CHECKED(String, matched, 0);
CONVERT_ARG_HANDLE_CHECKED(String, subject, 1);
CONVERT_SMI_ARG_CHECKED(position, 2);
CONVERT_ARG_HANDLE_CHECKED(String, replacement, 3);
+ CONVERT_SMI_ARG_CHECKED(start_index, 4);
// A simple match without captures.
class SimpleMatch : public String::Match {
@@ -58,7 +59,8 @@ RUNTIME_FUNCTION(Runtime_GetSubstitution) {
SimpleMatch match(matched, prefix, suffix);
RETURN_RESULT_OR_FAILURE(
- isolate, String::GetSubstitution(isolate, &match, replacement));
+ isolate,
+ String::GetSubstitution(isolate, &match, replacement, start_index));
}
// This may return an empty MaybeHandle if an exception is thrown or
« no previous file with comments | « src/runtime/runtime.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698