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

Side by Side Diff: src/string-search.h

Issue 6577036: [Isolates] Merge from bleeding_edge to isolates, revisions 6100-6300. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/isolates/
Patch Set: '' Created 9 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « src/string.js ('k') | src/token.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 // Bad-char shift table stored in the state. It's length is the alphabet size. 59 // Bad-char shift table stored in the state. It's length is the alphabet size.
60 // For patterns below this length, the skip length of Boyer-Moore is too short 60 // For patterns below this length, the skip length of Boyer-Moore is too short
61 // to compensate for the algorithmic overhead compared to simple brute force. 61 // to compensate for the algorithmic overhead compared to simple brute force.
62 static const int kBMMinPatternLength = 7; 62 static const int kBMMinPatternLength = 7;
63 63
64 static inline bool IsAsciiString(Vector<const char>) { 64 static inline bool IsAsciiString(Vector<const char>) {
65 return true; 65 return true;
66 } 66 }
67 67
68 static inline bool IsAsciiString(Vector<const uc16> string) { 68 static inline bool IsAsciiString(Vector<const uc16> string) {
69 for (int i = 0, n = string.length(); i < n; i++) { 69 return String::IsAscii(string.start(), string.length());
70 if (static_cast<unsigned>(string[i]) > String::kMaxAsciiCharCodeU) {
71 return false;
72 }
73 }
74 return true;
75 } 70 }
76 71
77 friend class Isolate; 72 friend class Isolate;
78 }; 73 };
79 74
80 75
81 template <typename PatternChar, typename SubjectChar> 76 template <typename PatternChar, typename SubjectChar>
82 class StringSearch : private StringSearchBase { 77 class StringSearch : private StringSearchBase {
83 public: 78 public:
84 StringSearch(Isolate* isolate, Vector<const PatternChar> pattern) 79 StringSearch(Isolate* isolate, Vector<const PatternChar> pattern)
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 Vector<const SubjectChar> subject, 559 Vector<const SubjectChar> subject,
565 Vector<const PatternChar> pattern, 560 Vector<const PatternChar> pattern,
566 int start_index) { 561 int start_index) {
567 StringSearch<PatternChar, SubjectChar> search(isolate, pattern); 562 StringSearch<PatternChar, SubjectChar> search(isolate, pattern);
568 return search.Search(subject, start_index); 563 return search.Search(subject, start_index);
569 } 564 }
570 565
571 }} // namespace v8::internal 566 }} // namespace v8::internal
572 567
573 #endif // V8_STRING_SEARCH_H_ 568 #endif // V8_STRING_SEARCH_H_
OLDNEW
« no previous file with comments | « src/string.js ('k') | src/token.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698