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 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
628 bool IrregexpInterpreter::Match(Isolate* isolate, | 628 bool IrregexpInterpreter::Match(Isolate* isolate, |
629 Handle<ByteArray> code_array, | 629 Handle<ByteArray> code_array, |
630 Handle<String> subject, | 630 Handle<String> subject, |
631 int* registers, | 631 int* registers, |
632 int start_position) { | 632 int start_position) { |
633 ASSERT(subject->IsFlat()); | 633 ASSERT(subject->IsFlat()); |
634 | 634 |
635 AssertNoAllocation a; | 635 AssertNoAllocation a; |
636 const byte* code_base = code_array->GetDataStartAddress(); | 636 const byte* code_base = code_array->GetDataStartAddress(); |
637 uc16 previous_char = '\n'; | 637 uc16 previous_char = '\n'; |
638 String::FlatContent subject_content = subject->GetFlatContent(a); | 638 String::FlatContent subject_content = subject->GetFlatContent(); |
639 if (subject_content.IsAscii()) { | 639 if (subject_content.IsAscii()) { |
640 Vector<const char> subject_vector = subject_content.ToAsciiVector(); | 640 Vector<const char> subject_vector = subject_content.ToAsciiVector(); |
641 if (start_position != 0) previous_char = subject_vector[start_position - 1]; | 641 if (start_position != 0) previous_char = subject_vector[start_position - 1]; |
642 return RawMatch(isolate, | 642 return RawMatch(isolate, |
643 code_base, | 643 code_base, |
644 subject_vector, | 644 subject_vector, |
645 registers, | 645 registers, |
646 start_position, | 646 start_position, |
647 previous_char); | 647 previous_char); |
648 } else { | 648 } else { |
649 ASSERT(subject_content.IsTwoByte()); | 649 ASSERT(subject_content.IsTwoByte()); |
650 Vector<const uc16> subject_vector = subject_content.ToUC16Vector(); | 650 Vector<const uc16> subject_vector = subject_content.ToUC16Vector(); |
651 if (start_position != 0) previous_char = subject_vector[start_position - 1]; | 651 if (start_position != 0) previous_char = subject_vector[start_position - 1]; |
652 return RawMatch(isolate, | 652 return RawMatch(isolate, |
653 code_base, | 653 code_base, |
654 subject_vector, | 654 subject_vector, |
655 registers, | 655 registers, |
656 start_position, | 656 start_position, |
657 previous_char); | 657 previous_char); |
658 } | 658 } |
659 } | 659 } |
660 | 660 |
661 } } // namespace v8::internal | 661 } } // namespace v8::internal |
OLD | NEW |