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

Unified Diff: src/string-search.h

Issue 2814373002: [string] Widen StringIndexOf fast path (Closed)
Patch Set: Address comments 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/external-reference-table.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/string-search.h
diff --git a/src/string-search.h b/src/string-search.h
index 7db09934f5449ca8f3e0e3d7e6b25819f2e103d2..637d000c567872af9c97f12ec18f015ad1d1e252 100644
--- a/src/string-search.h
+++ b/src/string-search.h
@@ -563,6 +563,19 @@ int SearchString(Isolate* isolate,
return search.Search(subject, start_index);
}
+// A wrapper function around SearchString that wraps raw pointers to the subject
+// and pattern as vectors before calling SearchString. Used from the
+// StringIndexOf builtin.
+template <typename SubjectChar, typename PatternChar>
+int SearchStringRaw(Isolate* isolate, const SubjectChar* subject_ptr,
+ int subject_length, const PatternChar* pattern_ptr,
+ int pattern_length, int start_index) {
+ DisallowHeapAllocation no_gc;
+ Vector<const SubjectChar> subject(subject_ptr, subject_length);
+ Vector<const PatternChar> pattern(pattern_ptr, pattern_length);
+ return SearchString(isolate, subject, pattern, start_index);
+}
+
} // namespace internal
} // namespace v8
« no previous file with comments | « src/external-reference-table.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698