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

Unified Diff: src/runtime/runtime-strings.cc

Issue 2350963004: [builtins] Move StringIndexOf to a C++ builtin. (Closed)
Patch Set: Fix formatting errors Created 4 years, 2 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.cc ('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 393e18fbf0bc2694dfde76f0b33c2ba63a45c963..2d515c2bc3b12a40c904c6610e6d9565fe8f580f 100644
--- a/src/runtime/runtime-strings.cc
+++ b/src/runtime/runtime-strings.cc
@@ -90,17 +90,8 @@ RUNTIME_FUNCTION(Runtime_StringReplaceOneCharWithString) {
RUNTIME_FUNCTION(Runtime_StringIndexOf) {
HandleScope scope(isolate);
DCHECK(args.length() == 3);
-
- CONVERT_ARG_HANDLE_CHECKED(String, sub, 0);
- CONVERT_ARG_HANDLE_CHECKED(String, pat, 1);
- CONVERT_ARG_HANDLE_CHECKED(Object, index, 2);
-
- uint32_t start_index = 0;
- if (!index->ToArrayIndex(&start_index)) return Smi::FromInt(-1);
-
- CHECK(start_index <= static_cast<uint32_t>(sub->length()));
- int position = String::IndexOf(isolate, sub, pat, start_index);
- return Smi::FromInt(position);
+ return String::IndexOf(isolate, args.at<Object>(0), args.at<Object>(1),
+ args.at<Object>(2));
}
RUNTIME_FUNCTION(Runtime_StringLastIndexOf) {
« no previous file with comments | « src/objects.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698