Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(176)

Side by Side Diff: src/regexp/jsregexp-inl.h

Issue 1630633002: [regexp] correctly advance zero length matches for global/unicode. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@backrefbounds
Patch Set: fix test Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/regexp/jsregexp.cc ('k') | src/regexp/mips/regexp-macro-assembler-mips.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
75 index -= registers_per_match_; 78 index -= registers_per_match_;
76 } 79 }
77 return &register_array_[index]; 80 return &register_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_
OLDNEW
« no previous file with comments | « src/regexp/jsregexp.cc ('k') | src/regexp/mips/regexp-macro-assembler-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698