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

Unified Diff: src/messages.cc

Issue 2351643002: [builtins] Move StringIndexOf to a builtin. (Closed)
Patch Set: Fix signed vs unsigned comparison Created 4 years, 3 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/js/string.js ('k') | src/objects.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/messages.cc
diff --git a/src/messages.cc b/src/messages.cc
index cc6349d73c52cfa15b5fb7aa96250ea84ef9b549..b9a8d977fe7611cf69d04fbd949f7828e2201925 100644
--- a/src/messages.cc
+++ b/src/messages.cc
@@ -499,7 +499,11 @@ void AppendFileLocation(Isolate* isolate, JSStackFrame* call_site,
int StringIndexOf(Isolate* isolate, Handle<String> subject,
Handle<String> pattern) {
if (pattern->length() > subject->length()) return -1;
- return String::IndexOf(isolate, subject, pattern, 0);
+ Object* index = String::IndexOf(isolate, subject, pattern,
+ isolate->factory()->undefined_value());
+ int index_int;
+ if (index->ToInt32(&index_int)) return index_int;
+ return -1;
}
// Returns true iff
« no previous file with comments | « src/js/string.js ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698