| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 | 5 |
| 6 #ifndef V8_REGEXP_JSREGEXP_INL_H_ | 6 #ifndef V8_REGEXP_JSREGEXP_INL_H_ |
| 7 #define V8_REGEXP_JSREGEXP_INL_H_ | 7 #define V8_REGEXP_JSREGEXP_INL_H_ |
| 8 | 8 |
| 9 #include "src/allocation.h" | 9 #include "src/allocation.h" |
| 10 #include "src/handles.h" | 10 #include "src/handles.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 int last_end_index = last_match[1]; | 40 int last_end_index = last_match[1]; |
| 41 | 41 |
| 42 if (regexp_->TypeTag() == JSRegExp::ATOM) { | 42 if (regexp_->TypeTag() == JSRegExp::ATOM) { |
| 43 num_matches_ = RegExpImpl::AtomExecRaw(regexp_, | 43 num_matches_ = RegExpImpl::AtomExecRaw(regexp_, |
| 44 subject_, | 44 subject_, |
| 45 last_end_index, | 45 last_end_index, |
| 46 register_array_, | 46 register_array_, |
| 47 register_array_size_); | 47 register_array_size_); |
| 48 } else { | 48 } else { |
| 49 int last_start_index = last_match[0]; | 49 int last_start_index = last_match[0]; |
| 50 if (last_start_index == last_end_index) last_end_index++; | 50 if (last_start_index == last_end_index) { |
| 51 // Zero-length match. Advance by one code point. |
| 52 last_end_index = AdvanceZeroLength(last_end_index); |
| 53 } |
| 51 if (last_end_index > subject_->length()) { | 54 if (last_end_index > subject_->length()) { |
| 52 num_matches_ = 0; // Signal failed match. | 55 num_matches_ = 0; // Signal failed match. |
| 53 return NULL; | 56 return NULL; |
| 54 } | 57 } |
| 55 num_matches_ = RegExpImpl::IrregexpExecRaw(regexp_, | 58 num_matches_ = RegExpImpl::IrregexpExecRaw(regexp_, |
| 56 subject_, | 59 subject_, |
| 57 last_end_index, | 60 last_end_index, |
| 58 register_array_, | 61 register_array_, |
| 59 register_array_size_); | 62 register_array_size_); |
| 60 } | 63 } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 75 index -= registers_per_match_; | 78 index -= registers_per_match_; |
| 76 } | 79 } |
| 77 return ®ister_array_[index]; | 80 return ®ister_array_[index]; |
| 78 } | 81 } |
| 79 | 82 |
| 80 | 83 |
| 81 } // namespace internal | 84 } // namespace internal |
| 82 } // namespace v8 | 85 } // namespace v8 |
| 83 | 86 |
| 84 #endif // V8_REGEXP_JSREGEXP_INL_H_ | 87 #endif // V8_REGEXP_JSREGEXP_INL_H_ |
| OLD | NEW |