| 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 1817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1828 } | 1828 } |
| 1829 last_valid_range--; | 1829 last_valid_range--; |
| 1830 } | 1830 } |
| 1831 | 1831 |
| 1832 if (last_valid_range < 0) { | 1832 if (last_valid_range < 0) { |
| 1833 if (!cc->is_negated()) { | 1833 if (!cc->is_negated()) { |
| 1834 // TODO(plesner): We can remove this when the node level does our | 1834 // TODO(plesner): We can remove this when the node level does our |
| 1835 // ASCII optimizations for us. | 1835 // ASCII optimizations for us. |
| 1836 macro_assembler->GoTo(on_failure); | 1836 macro_assembler->GoTo(on_failure); |
| 1837 } | 1837 } |
| 1838 if (check_offset) { |
| 1839 macro_assembler->CheckPosition(cp_offset, on_failure); |
| 1840 } |
| 1838 return; | 1841 return; |
| 1839 } | 1842 } |
| 1840 | 1843 |
| 1841 if (last_valid_range == 0 && | 1844 if (last_valid_range == 0 && |
| 1842 !cc->is_negated() && | 1845 !cc->is_negated() && |
| 1843 ranges->at(0).IsEverything(max_char)) { | 1846 ranges->at(0).IsEverything(max_char)) { |
| 1844 // This is a common case hit by non-anchored expressions. | 1847 // This is a common case hit by non-anchored expressions. |
| 1845 // TODO(erikcorry): We should have a macro assembler instruction that just | |
| 1846 // checks for end of string without loading the character. | |
| 1847 if (check_offset) { | 1848 if (check_offset) { |
| 1848 macro_assembler->LoadCurrentCharacter(cp_offset, on_failure); | 1849 macro_assembler->CheckPosition(cp_offset, on_failure); |
| 1849 } | 1850 } |
| 1850 return; | 1851 return; |
| 1851 } | 1852 } |
| 1852 | 1853 |
| 1853 if (!preloaded) { | 1854 if (!preloaded) { |
| 1854 macro_assembler->LoadCurrentCharacter(cp_offset, on_failure, check_offset); | 1855 macro_assembler->LoadCurrentCharacter(cp_offset, on_failure, check_offset); |
| 1855 } | 1856 } |
| 1856 | 1857 |
| 1857 for (int i = 0; i < last_valid_range; i++) { | 1858 for (int i = 0; i < last_valid_range; i++) { |
| 1858 CharacterRange& range = ranges->at(i); | 1859 CharacterRange& range = ranges->at(i); |
| (...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2470 | 2471 |
| 2471 return on_success->Emit(compiler, &new_trace); | 2472 return on_success->Emit(compiler, &new_trace); |
| 2472 } | 2473 } |
| 2473 | 2474 |
| 2474 | 2475 |
| 2475 bool AssertionNode::Emit(RegExpCompiler* compiler, Trace* trace) { | 2476 bool AssertionNode::Emit(RegExpCompiler* compiler, Trace* trace) { |
| 2476 RegExpMacroAssembler* assembler = compiler->macro_assembler(); | 2477 RegExpMacroAssembler* assembler = compiler->macro_assembler(); |
| 2477 switch (type_) { | 2478 switch (type_) { |
| 2478 case AT_END: { | 2479 case AT_END: { |
| 2479 Label ok; | 2480 Label ok; |
| 2480 assembler->LoadCurrentCharacter(trace->cp_offset(), &ok); | 2481 assembler->CheckPosition(trace->cp_offset(), &ok); |
| 2481 assembler->GoTo(trace->backtrack()); | 2482 assembler->GoTo(trace->backtrack()); |
| 2482 assembler->Bind(&ok); | 2483 assembler->Bind(&ok); |
| 2483 break; | 2484 break; |
| 2484 } | 2485 } |
| 2485 case AT_START: | 2486 case AT_START: |
| 2486 assembler->CheckNotAtStart(trace->backtrack()); | 2487 assembler->CheckNotAtStart(trace->backtrack()); |
| 2487 break; | 2488 break; |
| 2488 case AFTER_NEWLINE: | 2489 case AFTER_NEWLINE: |
| 2489 return EmitHat(compiler, on_success(), trace); | 2490 return EmitHat(compiler, on_success(), trace); |
| 2490 case AT_NON_BOUNDARY: | 2491 case AT_NON_BOUNDARY: |
| (...skipping 2191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4682 EmbeddedVector<byte, 1024> codes; | 4683 EmbeddedVector<byte, 1024> codes; |
| 4683 RegExpMacroAssemblerIrregexp macro_assembler(codes); | 4684 RegExpMacroAssemblerIrregexp macro_assembler(codes); |
| 4684 return compiler.Assemble(¯o_assembler, | 4685 return compiler.Assemble(¯o_assembler, |
| 4685 node, | 4686 node, |
| 4686 data->capture_count, | 4687 data->capture_count, |
| 4687 pattern); | 4688 pattern); |
| 4688 } | 4689 } |
| 4689 | 4690 |
| 4690 | 4691 |
| 4691 }} // namespace v8::internal | 4692 }} // namespace v8::internal |
| OLD | NEW |