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

Unified Diff: src/string-search.h

Issue 11818025: Continues Latin-1 support. All tests pass with ENABLE_LATIN_1 flag. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: ARM fix Created 7 years, 11 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/objects-inl.h ('K') | « src/runtime.cc ('k') | src/v8conversions.cc » ('j') | 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 ae5f60809d0cd904599448704aba88071306f1ba..882f747b5a56c275e3c2fdffe1feb06abad8ce8d 100644
--- a/src/string-search.h
+++ b/src/string-search.h
@@ -53,7 +53,11 @@ class StringSearchBase {
// a potentially less efficient searching, but is a safe approximation.
// For needles using only characters in the same Unicode 256-code point page,
// there is no search speed degradation.
+#ifndef ENABLE_LATIN_1
static const int kAsciiAlphabetSize = 128;
+#else
+ static const int kAsciiAlphabetSize = 256;
+#endif
static const int kUC16AlphabetSize = Isolate::kUC16AlphabetSize;
// Bad-char shift table stored in the state. It's length is the alphabet size.
@@ -61,7 +65,7 @@ class StringSearchBase {
// to compensate for the algorithmic overhead compared to simple brute force.
static const int kBMMinPatternLength = 7;
- static inline bool IsOneByteString(Vector<const char> string) {
+ static inline bool IsOneByteString(Vector<const uint8_t> string) {
return true;
}
@@ -150,13 +154,21 @@ class StringSearch : private StringSearchBase {
void PopulateBoyerMooreTable();
+ static inline bool exceedsOneByte(uint8_t c) {
+ return false;
Yang 2013/01/09 15:39:30 Don't we still need to gate this with ENABLE_LATIN
+ }
+
+ static inline bool exceedsOneByte(uint16_t c) {
+ return c > String::kMaxOneByteCharCodeU;
+ }
+
static inline int CharOccurrence(int* bad_char_occurrence,
SubjectChar char_code) {
if (sizeof(SubjectChar) == 1) {
return bad_char_occurrence[static_cast<int>(char_code)];
}
if (sizeof(PatternChar) == 1) {
- if (static_cast<unsigned int>(char_code) > String::kMaxOneByteCharCodeU) {
+ if (exceedsOneByte(char_code)) {
return -1;
}
return bad_char_occurrence[static_cast<unsigned int>(char_code)];
@@ -223,8 +235,7 @@ int StringSearch<PatternChar, SubjectChar>::SingleCharSearch(
return static_cast<int>(pos - subject.start());
} else {
if (sizeof(PatternChar) > sizeof(SubjectChar)) {
- if (static_cast<uc16>(pattern_first_char) >
- String::kMaxOneByteCharCodeU) {
+ if (exceedsOneByte(pattern_first_char)) {
return -1;
}
}
« src/objects-inl.h ('K') | « src/runtime.cc ('k') | src/v8conversions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698