Chromium Code Reviews| Index: src/jsregexp.cc |
| diff --git a/src/jsregexp.cc b/src/jsregexp.cc |
| index 813208c9590e651749321a818351488629da4f1f..384af62071af5dab457270d6f88c6854fbd9c8a3 100644 |
| --- a/src/jsregexp.cc |
| +++ b/src/jsregexp.cc |
| @@ -1681,7 +1681,7 @@ static int GetCaseIndependentLetters(Isolate* isolate, |
| letters[0] = character; |
| length = 1; |
| } |
| - if (!ascii_subject || character <= String::kMaxAsciiCharCode) { |
| + if (!ascii_subject || character <= String::kMaxOneByteCharCode) { |
| return length; |
| } |
| // The standard requires that non-ASCII characters cannot have ASCII |
| @@ -1732,7 +1732,7 @@ static inline bool EmitAtomNonLetter(Isolate* isolate, |
| bool checked = false; |
| // We handle the length > 1 case in a later pass. |
| if (length == 1) { |
| - if (ascii && c > String::kMaxAsciiCharCodeU) { |
| + if (ascii && c > String::kMaxOneByteCharCodeU) { |
| // Can't match - see above. |
| return false; // Bounds not checked. |
| } |
| @@ -1753,7 +1753,7 @@ static bool ShortCutEmitCharacterPair(RegExpMacroAssembler* macro_assembler, |
| Label* on_failure) { |
| uc16 char_mask; |
| if (ascii) { |
| - char_mask = String::kMaxAsciiCharCode; |
| + char_mask = String::kMaxOneByteCharCode; |
| } else { |
| char_mask = String::kMaxUtf16CodeUnit; |
| } |
| @@ -2007,7 +2007,7 @@ static void SplitSearchSpace(ZoneList<int>* ranges, |
| // range with a single not-taken branch, speeding up this important |
| // character range (even non-ASCII charset-based text has spaces and |
| // punctuation). |
| - if (*border - 1 > String::kMaxAsciiCharCode && // ASCII case. |
| + if (*border - 1 > String::kMaxOneByteCharCode && // ASCII case. |
|
Yang
2013/01/07 16:15:07
Change comment.
|
| end_index - start_index > (*new_start_index - start_index) * 2 && |
| last - first > kSize * 2 && |
| binary_chop_index > *new_start_index && |
| @@ -2211,7 +2211,7 @@ static void EmitCharClass(RegExpMacroAssembler* macro_assembler, |
| int max_char; |
| if (ascii) { |
| - max_char = String::kMaxAsciiCharCode; |
| + max_char = String::kMaxOneByteCharCode; |
| } else { |
| max_char = String::kMaxUtf16CodeUnit; |
| } |
| @@ -2513,7 +2513,7 @@ bool QuickCheckDetails::Rationalize(bool asc) { |
| bool found_useful_op = false; |
| uint32_t char_mask; |
| if (asc) { |
| - char_mask = String::kMaxAsciiCharCode; |
| + char_mask = String::kMaxOneByteCharCode; |
| } else { |
| char_mask = String::kMaxUtf16CodeUnit; |
| } |
| @@ -2522,7 +2522,7 @@ bool QuickCheckDetails::Rationalize(bool asc) { |
| int char_shift = 0; |
| for (int i = 0; i < characters_; i++) { |
| Position* pos = &positions_[i]; |
| - if ((pos->mask & String::kMaxAsciiCharCode) != 0) { |
| + if ((pos->mask & String::kMaxOneByteCharCode) != 0) { |
| found_useful_op = true; |
| } |
| mask_ |= (pos->mask & char_mask) << char_shift; |
| @@ -2565,7 +2565,7 @@ bool RegExpNode::EmitQuickCheck(RegExpCompiler* compiler, |
| // load so the value is already masked down. |
| uint32_t char_mask; |
| if (compiler->ascii()) { |
|
Yang
2013/01/07 16:15:07
Maybe onebyte() instead of ascii()?
|
| - char_mask = String::kMaxAsciiCharCode; |
| + char_mask = String::kMaxOneByteCharCode; |
| } else { |
| char_mask = String::kMaxUtf16CodeUnit; |
| } |
| @@ -2575,7 +2575,7 @@ bool RegExpNode::EmitQuickCheck(RegExpCompiler* compiler, |
| // For 2-character preloads in ASCII mode or 1-character preloads in |
| // TWO_BYTE mode we also use a 16 bit load with zero extend. |
| if (details->characters() == 2 && compiler->ascii()) { |
| - if ((mask & 0x7f7f) == 0x7f7f) need_mask = false; |
| + if ((mask & 0xffff) == 0xffff) need_mask = false; |
| } else if (details->characters() == 1 && !compiler->ascii()) { |
| if ((mask & 0xffff) == 0xffff) need_mask = false; |
| } else { |
| @@ -2617,7 +2617,7 @@ void TextNode::GetQuickCheckDetails(QuickCheckDetails* details, |
| int characters = details->characters(); |
| int char_mask; |
| if (compiler->ascii()) { |
| - char_mask = String::kMaxAsciiCharCode; |
| + char_mask = String::kMaxOneByteCharCode; |
| } else { |
| char_mask = String::kMaxUtf16CodeUnit; |
| } |
| @@ -2865,7 +2865,7 @@ RegExpNode* TextNode::FilterASCII(int depth) { |
| // We don't need special handling for case independence |
| // because of the rule that case independence cannot make |
| // a non-ASCII character match an ASCII character. |
| - if (quarks[j] > String::kMaxAsciiCharCode) { |
| + if (quarks[j] > String::kMaxOneByteCharCode) { |
|
Yang
2013/01/07 16:15:07
Does the comment still hold true for the Latin1 ch
|
| return set_replacement(NULL); |
| } |
| } |
| @@ -2881,12 +2881,12 @@ RegExpNode* TextNode::FilterASCII(int depth) { |
| if (cc->is_negated()) { |
| if (range_count != 0 && |
| ranges->at(0).from() == 0 && |
| - ranges->at(0).to() >= String::kMaxAsciiCharCode) { |
| + ranges->at(0).to() >= String::kMaxOneByteCharCode) { |
| return set_replacement(NULL); |
| } |
| } else { |
| if (range_count == 0 || |
| - ranges->at(0).from() > String::kMaxAsciiCharCode) { |
| + ranges->at(0).from() > String::kMaxOneByteCharCode) { |
| return set_replacement(NULL); |
| } |
| } |
| @@ -3299,7 +3299,7 @@ void TextNode::TextEmitPass(RegExpCompiler* compiler, |
| switch (pass) { |
| case NON_ASCII_MATCH: |
| ASSERT(ascii); |
| - if (quarks[j] > String::kMaxAsciiCharCode) { |
| + if (quarks[j] > String::kMaxOneByteCharCode) { |
| assembler->GoTo(backtrack); |
| return; |
| } |
| @@ -3498,7 +3498,7 @@ RegExpNode* TextNode::GetSuccessorOfOmnivorousTextNode( |
| if (ranges->length() != 1) return NULL; |
| uint32_t max_char; |
| if (compiler->ascii()) { |
| - max_char = String::kMaxAsciiCharCode; |
| + max_char = String::kMaxOneByteCharCode; |
| } else { |
| max_char = String::kMaxUtf16CodeUnit; |
| } |
| @@ -3698,7 +3698,7 @@ BoyerMooreLookahead::BoyerMooreLookahead( |
| : length_(length), |
| compiler_(compiler) { |
| if (compiler->ascii()) { |
| - max_char_ = String::kMaxAsciiCharCode; |
| + max_char_ = String::kMaxOneByteCharCode; |
| } else { |
| max_char_ = String::kMaxUtf16CodeUnit; |
| } |
| @@ -5337,8 +5337,8 @@ void CharacterRange::AddCaseEquivalents(ZoneList<CharacterRange>* ranges, |
| uc16 bottom = from(); |
| uc16 top = to(); |
| if (is_ascii) { |
| - if (bottom > String::kMaxAsciiCharCode) return; |
| - if (top > String::kMaxAsciiCharCode) top = String::kMaxAsciiCharCode; |
| + if (bottom > String::kMaxOneByteCharCode) return; |
| + if (top > String::kMaxOneByteCharCode) top = String::kMaxOneByteCharCode; |
| } |
| unibrow::uchar chars[unibrow::Ecma262UnCanonicalize::kMaxWidth]; |
| if (top == bottom) { |
| @@ -5885,7 +5885,7 @@ void TextNode::FillInBMInfo(int initial_offset, |
| int length = GetCaseIndependentLetters( |
| ISOLATE, |
| character, |
| - bm->max_char() == String::kMaxAsciiCharCode, |
| + bm->max_char() == String::kMaxOneByteCharCode, |
| chars); |
| for (int j = 0; j < length; j++) { |
| bm->Set(offset, chars[j]); |