| 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 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 611 | 611 |
| 612 | 612 |
| 613 RegExpImpl::IrregexpResult IrregexpInterpreter::Match( | 613 RegExpImpl::IrregexpResult IrregexpInterpreter::Match( |
| 614 Isolate* isolate, | 614 Isolate* isolate, |
| 615 Handle<ByteArray> code_array, | 615 Handle<ByteArray> code_array, |
| 616 Handle<String> subject, | 616 Handle<String> subject, |
| 617 int* registers, | 617 int* registers, |
| 618 int start_position) { | 618 int start_position) { |
| 619 ASSERT(subject->IsFlat()); | 619 ASSERT(subject->IsFlat()); |
| 620 | 620 |
| 621 AssertNoAllocation a; | 621 DisallowHeapAllocation no_gc; |
| 622 const byte* code_base = code_array->GetDataStartAddress(); | 622 const byte* code_base = code_array->GetDataStartAddress(); |
| 623 uc16 previous_char = '\n'; | 623 uc16 previous_char = '\n'; |
| 624 String::FlatContent subject_content = subject->GetFlatContent(); | 624 String::FlatContent subject_content = subject->GetFlatContent(); |
| 625 if (subject_content.IsAscii()) { | 625 if (subject_content.IsAscii()) { |
| 626 Vector<const uint8_t> subject_vector = subject_content.ToOneByteVector(); | 626 Vector<const uint8_t> subject_vector = subject_content.ToOneByteVector(); |
| 627 if (start_position != 0) previous_char = subject_vector[start_position - 1]; | 627 if (start_position != 0) previous_char = subject_vector[start_position - 1]; |
| 628 return RawMatch(isolate, | 628 return RawMatch(isolate, |
| 629 code_base, | 629 code_base, |
| 630 subject_vector, | 630 subject_vector, |
| 631 registers, | 631 registers, |
| 632 start_position, | 632 start_position, |
| 633 previous_char); | 633 previous_char); |
| 634 } else { | 634 } else { |
| 635 ASSERT(subject_content.IsTwoByte()); | 635 ASSERT(subject_content.IsTwoByte()); |
| 636 Vector<const uc16> subject_vector = subject_content.ToUC16Vector(); | 636 Vector<const uc16> subject_vector = subject_content.ToUC16Vector(); |
| 637 if (start_position != 0) previous_char = subject_vector[start_position - 1]; | 637 if (start_position != 0) previous_char = subject_vector[start_position - 1]; |
| 638 return RawMatch(isolate, | 638 return RawMatch(isolate, |
| 639 code_base, | 639 code_base, |
| 640 subject_vector, | 640 subject_vector, |
| 641 registers, | 641 registers, |
| 642 start_position, | 642 start_position, |
| 643 previous_char); | 643 previous_char); |
| 644 } | 644 } |
| 645 } | 645 } |
| 646 | 646 |
| 647 } } // namespace v8::internal | 647 } } // namespace v8::internal |
| OLD | NEW |