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

Unified Diff: src/jsregexp.cc

Issue 11880045: Cleanup latin-1 conversion check in regexp engine (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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
« no previous file with comments | « no previous file | src/unicode.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/jsregexp.cc
diff --git a/src/jsregexp.cc b/src/jsregexp.cc
index a3efb859ac66867d6931f9f1f8affb84254a9e44..f6e2e7f905052dfff5d8e38c26ca40abaf4d801c 100644
--- a/src/jsregexp.cc
+++ b/src/jsregexp.cc
@@ -2875,23 +2875,9 @@ RegExpNode* TextNode::FilterASCII(int depth, bool ignore_case) {
if (!ignore_case) return set_replacement(NULL);
// Here, we need to check for characters whose upper and lower cases
// are outside the Latin-1 range.
- // TODO(dcarney): Replace this code with a simple
- // table lookup in unibrow::Latin-1.
- // TODO(dcarney): Test cases!.
- unibrow::uchar result;
- int chars;
- chars = unibrow::ToLowercase::Convert(quarks[j], 0, &result, NULL);
- if (chars > 1 ||
- (chars == 1 && result <= String::kMaxOneByteCharCodeU)) {
- continue;
- }
- chars = unibrow::ToUppercase::Convert(quarks[j], 0, &result, NULL);
- if (chars > 1 ||
- (chars == 1 && result <= String::kMaxOneByteCharCodeU)) {
- continue;
+ if (!unibrow::Latin1::NonLatin1CanBeConvertedToLatin1(quarks[j])) {
+ return set_replacement(NULL);
}
- // This character is definitely not in the Latin-1 range.
- return set_replacement(NULL);
#endif
}
} else {
« no previous file with comments | « no previous file | src/unicode.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698