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

Side by Side Diff: src/regexp/jsregexp.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/ia32/regexp-macro-assembler-ia32.cc ('k') | src/regexp/jsregexp.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 #ifndef V8_REGEXP_JSREGEXP_H_ 5 #ifndef V8_REGEXP_JSREGEXP_H_
6 #define V8_REGEXP_JSREGEXP_H_ 6 #define V8_REGEXP_JSREGEXP_H_
7 7
8 #include "src/allocation.h" 8 #include "src/allocation.h"
9 #include "src/assembler.h" 9 #include "src/assembler.h"
10 #include "src/regexp/regexp-ast.h" 10 #include "src/regexp/regexp-ast.h"
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 static Handle<JSArray> SetLastMatchInfo(Handle<JSArray> last_match_info, 115 static Handle<JSArray> SetLastMatchInfo(Handle<JSArray> last_match_info,
116 Handle<String> subject, 116 Handle<String> subject,
117 int capture_count, 117 int capture_count,
118 int32_t* match); 118 int32_t* match);
119 119
120 120
121 class GlobalCache { 121 class GlobalCache {
122 public: 122 public:
123 GlobalCache(Handle<JSRegExp> regexp, 123 GlobalCache(Handle<JSRegExp> regexp,
124 Handle<String> subject, 124 Handle<String> subject,
125 bool is_global,
126 Isolate* isolate); 125 Isolate* isolate);
127 126
128 INLINE(~GlobalCache()); 127 INLINE(~GlobalCache());
129 128
130 // Fetch the next entry in the cache for global regexp match results. 129 // Fetch the next entry in the cache for global regexp match results.
131 // This does not set the last match info. Upon failure, NULL is returned. 130 // This does not set the last match info. Upon failure, NULL is returned.
132 // The cause can be checked with Result(). The previous 131 // The cause can be checked with Result(). The previous
133 // result is still in available in memory when a failure happens. 132 // result is still in available in memory when a failure happens.
134 INLINE(int32_t* FetchNext()); 133 INLINE(int32_t* FetchNext());
135 134
136 INLINE(int32_t* LastSuccessfulMatch()); 135 INLINE(int32_t* LastSuccessfulMatch());
137 136
138 INLINE(bool HasException()) { return num_matches_ < 0; } 137 INLINE(bool HasException()) { return num_matches_ < 0; }
139 138
140 private: 139 private:
140 int AdvanceZeroLength(int last_index);
141
141 int num_matches_; 142 int num_matches_;
142 int max_matches_; 143 int max_matches_;
143 int current_match_index_; 144 int current_match_index_;
144 int registers_per_match_; 145 int registers_per_match_;
145 // Pointer to the last set of captures. 146 // Pointer to the last set of captures.
146 int32_t* register_array_; 147 int32_t* register_array_;
147 int register_array_size_; 148 int register_array_size_;
148 Handle<JSRegExp> regexp_; 149 Handle<JSRegExp> regexp_;
149 Handle<String> subject_; 150 Handle<String> subject_;
150 }; 151 };
(...skipping 1429 matching lines...) Expand 10 before | Expand all | Expand 10 after
1580 static const int kStringOffset = 0; 1581 static const int kStringOffset = 0;
1581 static const int kPatternOffset = 1; 1582 static const int kPatternOffset = 1;
1582 static const int kArrayOffset = 2; 1583 static const int kArrayOffset = 2;
1583 static const int kLastMatchOffset = 3; 1584 static const int kLastMatchOffset = 3;
1584 }; 1585 };
1585 1586
1586 } // namespace internal 1587 } // namespace internal
1587 } // namespace v8 1588 } // namespace v8
1588 1589
1589 #endif // V8_REGEXP_JSREGEXP_H_ 1590 #endif // V8_REGEXP_JSREGEXP_H_
OLDNEW
« no previous file with comments | « src/regexp/ia32/regexp-macro-assembler-ia32.cc ('k') | src/regexp/jsregexp.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698