OLD | NEW |
1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 2008 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 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 break; | 562 break; |
563 } | 563 } |
564 } | 564 } |
565 } | 565 } |
566 | 566 |
567 | 567 |
568 bool IrregexpInterpreter::Match(Handle<ByteArray> code_array, | 568 bool IrregexpInterpreter::Match(Handle<ByteArray> code_array, |
569 Handle<String> subject, | 569 Handle<String> subject, |
570 int* registers, | 570 int* registers, |
571 int start_position) { | 571 int start_position) { |
572 ASSERT(subject->IsFlat(StringShape(*subject))); | 572 ASSERT(subject->IsFlat()); |
573 | 573 |
574 AssertNoAllocation a; | 574 AssertNoAllocation a; |
575 const byte* code_base = code_array->GetDataStartAddress(); | 575 const byte* code_base = code_array->GetDataStartAddress(); |
576 StringShape subject_shape(*subject); | |
577 uc16 previous_char = '\n'; | 576 uc16 previous_char = '\n'; |
578 if (subject_shape.IsAsciiRepresentation()) { | 577 if (StringShape(*subject).IsAsciiRepresentation()) { |
579 Vector<const char> subject_vector = subject->ToAsciiVector(); | 578 Vector<const char> subject_vector = subject->ToAsciiVector(); |
580 if (start_position != 0) previous_char = subject_vector[start_position - 1]; | 579 if (start_position != 0) previous_char = subject_vector[start_position - 1]; |
581 return RawMatch(code_base, | 580 return RawMatch(code_base, |
582 subject_vector, | 581 subject_vector, |
583 registers, | 582 registers, |
584 start_position, | 583 start_position, |
585 previous_char); | 584 previous_char); |
586 } else { | 585 } else { |
587 Vector<const uc16> subject_vector = subject->ToUC16Vector(); | 586 Vector<const uc16> subject_vector = subject->ToUC16Vector(); |
588 if (start_position != 0) previous_char = subject_vector[start_position - 1]; | 587 if (start_position != 0) previous_char = subject_vector[start_position - 1]; |
589 return RawMatch(code_base, | 588 return RawMatch(code_base, |
590 subject_vector, | 589 subject_vector, |
591 registers, | 590 registers, |
592 start_position, | 591 start_position, |
593 previous_char); | 592 previous_char); |
594 } | 593 } |
595 } | 594 } |
596 | 595 |
597 } } // namespace v8::internal | 596 } } // namespace v8::internal |
OLD | NEW |