| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-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 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 498 } | 498 } |
| 499 | 499 |
| 500 LOG(RegExpExecEvent(regexp, previous_index, two_byte_subject)); | 500 LOG(RegExpExecEvent(regexp, previous_index, two_byte_subject)); |
| 501 | 501 |
| 502 FixedArray* irregexp = | 502 FixedArray* irregexp = |
| 503 FixedArray::cast(regexp->DataAt(JSRegExp::kIrregexpDataIndex)); | 503 FixedArray::cast(regexp->DataAt(JSRegExp::kIrregexpDataIndex)); |
| 504 int tag = Smi::cast(irregexp->get(kIrregexpImplementationIndex))->value(); | 504 int tag = Smi::cast(irregexp->get(kIrregexpImplementationIndex))->value(); |
| 505 | 505 |
| 506 switch (tag) { | 506 switch (tag) { |
| 507 case RegExpMacroAssembler::kIA32Implementation: { | 507 case RegExpMacroAssembler::kIA32Implementation: { |
| 508 #ifndef ARM |
| 508 Code* code = Code::cast(irregexp->get(kIrregexpCodeIndex)); | 509 Code* code = Code::cast(irregexp->get(kIrregexpCodeIndex)); |
| 509 Address start_addr = | 510 Address start_addr = |
| 510 Handle<SeqTwoByteString>::cast(two_byte_subject)->GetCharsAddress(); | 511 Handle<SeqTwoByteString>::cast(two_byte_subject)->GetCharsAddress(); |
| 511 int string_offset = | 512 int string_offset = |
| 512 start_addr - reinterpret_cast<Address>(*two_byte_subject); | 513 start_addr - reinterpret_cast<Address>(*two_byte_subject); |
| 513 int start_offset = string_offset + previous_index * sizeof(uc16); | 514 int start_offset = string_offset + previous_index * sizeof(uc16); |
| 514 int end_offset = | 515 int end_offset = |
| 515 string_offset + two_byte_subject->length() * sizeof(uc16); | 516 string_offset + two_byte_subject->length() * sizeof(uc16); |
| 516 rc = RegExpMacroAssemblerIA32::Execute(code, | 517 rc = RegExpMacroAssemblerIA32::Execute(code, |
| 517 two_byte_subject.location(), | 518 two_byte_subject.location(), |
| 518 start_offset, | 519 start_offset, |
| 519 end_offset, | 520 end_offset, |
| 520 offsets_vector, | 521 offsets_vector, |
| 521 previous_index == 0); | 522 previous_index == 0); |
| 522 if (rc) { | 523 if (rc) { |
| 523 // Capture values are relative to start_offset only. | 524 // Capture values are relative to start_offset only. |
| 524 for (int i = 0; i < offsets_vector_length; i++) { | 525 for (int i = 0; i < offsets_vector_length; i++) { |
| 525 if (offsets_vector[i] >= 0) { | 526 if (offsets_vector[i] >= 0) { |
| 526 offsets_vector[i] += previous_index; | 527 offsets_vector[i] += previous_index; |
| 527 } | 528 } |
| 528 } | 529 } |
| 529 } | 530 } |
| 530 break; | 531 break; |
| 532 #else |
| 533 UNIMPLEMENTED(); |
| 534 break; |
| 535 #endif |
| 531 } | 536 } |
| 532 case RegExpMacroAssembler::kBytecodeImplementation: { | 537 case RegExpMacroAssembler::kBytecodeImplementation: { |
| 533 Handle<ByteArray> byte_codes = IrregexpCode(regexp); | 538 Handle<ByteArray> byte_codes = IrregexpCode(regexp); |
| 534 | 539 |
| 535 rc = IrregexpInterpreter::Match(byte_codes, | 540 rc = IrregexpInterpreter::Match(byte_codes, |
| 536 two_byte_subject, | 541 two_byte_subject, |
| 537 offsets_vector, | 542 offsets_vector, |
| 538 previous_index); | 543 previous_index); |
| 539 break; | 544 break; |
| 540 } | 545 } |
| (...skipping 2190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2731 } | 2736 } |
| 2732 EmbeddedVector<byte, 1024> codes; | 2737 EmbeddedVector<byte, 1024> codes; |
| 2733 RegExpMacroAssemblerIrregexp macro_assembler(codes); | 2738 RegExpMacroAssemblerIrregexp macro_assembler(codes); |
| 2734 return compiler.Assemble(¯o_assembler, | 2739 return compiler.Assemble(¯o_assembler, |
| 2735 node, | 2740 node, |
| 2736 input->capture_count); | 2741 input->capture_count); |
| 2737 } | 2742 } |
| 2738 | 2743 |
| 2739 | 2744 |
| 2740 }} // namespace v8::internal | 2745 }} // namespace v8::internal |
| OLD | NEW |