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

Unified Diff: src/string-search.h

Issue 2814373002: [string] Widen StringIndexOf fast path (Closed)
Patch Set: Fix search type 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
« src/builtins/builtins-string-gen.cc ('K') | « 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..619e5e6739c46ce900fa6544d9e4c19401d07678 100644
--- a/src/string-search.h
+++ b/src/string-search.h
@@ -563,6 +563,18 @@ 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) {
Camillo Bruni 2017/04/18 14:12:36 DisallowHeapAllocation no_gc();
jgruber 2017/04/19 06:59:05 Good idea, done.
+ 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
« src/builtins/builtins-string-gen.cc ('K') | « src/external-reference-table.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698