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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « src/external-reference-table.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_STRING_SEARCH_H_ 5 #ifndef V8_STRING_SEARCH_H_
6 #define V8_STRING_SEARCH_H_ 6 #define V8_STRING_SEARCH_H_
7 7
8 #include "src/isolate.h" 8 #include "src/isolate.h"
9 #include "src/vector.h" 9 #include "src/vector.h"
10 10
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 // for each search. 556 // for each search.
557 template <typename SubjectChar, typename PatternChar> 557 template <typename SubjectChar, typename PatternChar>
558 int SearchString(Isolate* isolate, 558 int SearchString(Isolate* isolate,
559 Vector<const SubjectChar> subject, 559 Vector<const SubjectChar> subject,
560 Vector<const PatternChar> pattern, 560 Vector<const PatternChar> pattern,
561 int start_index) { 561 int start_index) {
562 StringSearch<PatternChar, SubjectChar> search(isolate, pattern); 562 StringSearch<PatternChar, SubjectChar> search(isolate, pattern);
563 return search.Search(subject, start_index); 563 return search.Search(subject, start_index);
564 } 564 }
565 565
566 // A wrapper function around SearchString that wraps raw pointers to the subject
567 // and pattern as vectors before calling SearchString. Used from the
568 // StringIndexOf builtin.
569 template <typename SubjectChar, typename PatternChar>
570 int SearchStringRaw(Isolate* isolate, const SubjectChar* subject_ptr,
571 int subject_length, const PatternChar* pattern_ptr,
572 int pattern_length, int start_index) {
573 DisallowHeapAllocation no_gc;
574 Vector<const SubjectChar> subject(subject_ptr, subject_length);
575 Vector<const PatternChar> pattern(pattern_ptr, pattern_length);
576 return SearchString(isolate, subject, pattern, start_index);
577 }
578
566 } // namespace internal 579 } // namespace internal
567 } // namespace v8 580 } // namespace v8
568 581
569 #endif // V8_STRING_SEARCH_H_ 582 #endif // V8_STRING_SEARCH_H_
OLDNEW
« 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