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 |