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

Unified 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, 11 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/regexp/jsregexp-inl.h
diff --git a/src/regexp/jsregexp-inl.h b/src/regexp/jsregexp-inl.h
index 3eb7c3c1704b998b6bebe5b06bbbed65d156ffc3..ca7a9fe9918630719570c68a86ac4ec9629c794c 100644
--- a/src/regexp/jsregexp-inl.h
+++ b/src/regexp/jsregexp-inl.h
@@ -47,7 +47,10 @@ int32_t* RegExpImpl::GlobalCache::FetchNext() {
register_array_size_);
} else {
int last_start_index = last_match[0];
- if (last_start_index == last_end_index) last_end_index++;
+ if (last_start_index == last_end_index) {
+ // Zero-length match. Advance by one code point.
+ last_end_index = AdvanceZeroLength(last_end_index);
+ }
if (last_end_index > subject_->length()) {
num_matches_ = 0; // Signal failed match.
return NULL;
« 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