OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
699 SetLastCaptureCount(array, capture_register_count); | 699 SetLastCaptureCount(array, capture_register_count); |
700 SetLastSubject(array, *subject); | 700 SetLastSubject(array, *subject); |
701 SetLastInput(array, *subject); | 701 SetLastInput(array, *subject); |
702 return last_match_info; | 702 return last_match_info; |
703 } | 703 } |
704 | 704 |
705 | 705 |
706 RegExpImpl::GlobalCache::GlobalCache(Handle<JSRegExp> regexp, | 706 RegExpImpl::GlobalCache::GlobalCache(Handle<JSRegExp> regexp, |
707 Handle<String> subject, | 707 Handle<String> subject, |
708 bool is_global, | 708 bool is_global, |
709 Isolate* isolate) | 709 Isolate* isolate) { |
710 : register_array_(NULL), | |
711 register_array_size_(0), | |
712 regexp_(regexp), | |
713 subject_(subject) { | |
714 #ifdef V8_INTERPRETED_REGEXP | 710 #ifdef V8_INTERPRETED_REGEXP |
715 bool interpreted = true; | 711 bool interpreted = true; |
716 #else | 712 #else |
717 bool interpreted = false; | 713 bool interpreted = false; |
718 #endif // V8_INTERPRETED_REGEXP | 714 #endif // V8_INTERPRETED_REGEXP |
719 | 715 |
| 716 regexp_ = regexp; |
| 717 subject_ = subject; |
| 718 |
720 if (regexp_->TypeTag() == JSRegExp::ATOM) { | 719 if (regexp_->TypeTag() == JSRegExp::ATOM) { |
721 static const int kAtomRegistersPerMatch = 2; | 720 static const int kAtomRegistersPerMatch = 2; |
722 registers_per_match_ = kAtomRegistersPerMatch; | 721 registers_per_match_ = kAtomRegistersPerMatch; |
723 // There is no distinction between interpreted and native for atom regexps. | 722 // There is no distinction between interpreted and native for atom regexps. |
724 interpreted = false; | 723 interpreted = false; |
725 } else { | 724 } else { |
726 registers_per_match_ = RegExpImpl::IrregexpPrepare(regexp_, subject_); | 725 registers_per_match_ = RegExpImpl::IrregexpPrepare(regexp_, subject_); |
727 if (registers_per_match_ < 0) { | 726 if (registers_per_match_ < 0) { |
728 num_matches_ = -1; // Signal exception. | 727 num_matches_ = -1; // Signal exception. |
729 return; | 728 return; |
(...skipping 5429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6159 } | 6158 } |
6160 | 6159 |
6161 return compiler.Assemble(¯o_assembler, | 6160 return compiler.Assemble(¯o_assembler, |
6162 node, | 6161 node, |
6163 data->capture_count, | 6162 data->capture_count, |
6164 pattern); | 6163 pattern); |
6165 } | 6164 } |
6166 | 6165 |
6167 | 6166 |
6168 }} // namespace v8::internal | 6167 }} // namespace v8::internal |
OLD | NEW |