OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 } | 61 } |
62 } | 62 } |
63 return true; | 63 return true; |
64 } | 64 } |
65 | 65 |
66 | 66 |
67 static bool BackRefMatchesNoCase(Canonicalize* interp_canonicalize, | 67 static bool BackRefMatchesNoCase(Canonicalize* interp_canonicalize, |
68 int from, | 68 int from, |
69 int current, | 69 int current, |
70 int len, | 70 int len, |
71 Vector<const char> subject) { | 71 Vector<const uint8_t> subject) { |
72 for (int i = 0; i < len; i++) { | 72 for (int i = 0; i < len; i++) { |
73 unsigned int old_char = subject[from++]; | 73 unsigned int old_char = subject[from++]; |
74 unsigned int new_char = subject[current++]; | 74 unsigned int new_char = subject[current++]; |
75 if (old_char == new_char) continue; | 75 if (old_char == new_char) continue; |
76 if (old_char - 'A' <= 'Z' - 'A') old_char |= 0x20; | 76 if (old_char - 'A' <= 'Z' - 'A') old_char |= 0x20; |
77 if (new_char - 'A' <= 'Z' - 'A') new_char |= 0x20; | 77 if (new_char - 'A' <= 'Z' - 'A') new_char |= 0x20; |
78 if (old_char != new_char) return false; | 78 if (old_char != new_char) return false; |
79 } | 79 } |
80 return true; | 80 return true; |
81 } | 81 } |
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
610 Handle<String> subject, | 610 Handle<String> subject, |
611 int* registers, | 611 int* registers, |
612 int start_position) { | 612 int start_position) { |
613 ASSERT(subject->IsFlat()); | 613 ASSERT(subject->IsFlat()); |
614 | 614 |
615 AssertNoAllocation a; | 615 AssertNoAllocation a; |
616 const byte* code_base = code_array->GetDataStartAddress(); | 616 const byte* code_base = code_array->GetDataStartAddress(); |
617 uc16 previous_char = '\n'; | 617 uc16 previous_char = '\n'; |
618 String::FlatContent subject_content = subject->GetFlatContent(); | 618 String::FlatContent subject_content = subject->GetFlatContent(); |
619 if (subject_content.IsAscii()) { | 619 if (subject_content.IsAscii()) { |
620 Vector<const char> subject_vector = subject_content.ToAsciiVector(); | 620 Vector<const uint8_t> subject_vector = subject_content.ToOneByteVector(); |
621 if (start_position != 0) previous_char = subject_vector[start_position - 1]; | 621 if (start_position != 0) previous_char = subject_vector[start_position - 1]; |
622 return RawMatch(isolate, | 622 return RawMatch(isolate, |
623 code_base, | 623 code_base, |
624 subject_vector, | 624 subject_vector, |
625 registers, | 625 registers, |
626 start_position, | 626 start_position, |
627 previous_char); | 627 previous_char); |
628 } else { | 628 } else { |
629 ASSERT(subject_content.IsTwoByte()); | 629 ASSERT(subject_content.IsTwoByte()); |
630 Vector<const uc16> subject_vector = subject_content.ToUC16Vector(); | 630 Vector<const uc16> subject_vector = subject_content.ToUC16Vector(); |
631 if (start_position != 0) previous_char = subject_vector[start_position - 1]; | 631 if (start_position != 0) previous_char = subject_vector[start_position - 1]; |
632 return RawMatch(isolate, | 632 return RawMatch(isolate, |
633 code_base, | 633 code_base, |
634 subject_vector, | 634 subject_vector, |
635 registers, | 635 registers, |
636 start_position, | 636 start_position, |
637 previous_char); | 637 previous_char); |
638 } | 638 } |
639 } | 639 } |
640 | 640 |
641 } } // namespace v8::internal | 641 } } // namespace v8::internal |
OLD | NEW |