OLD | NEW |
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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 static Handle<JSArray> SetLastMatchInfo(Handle<JSArray> last_match_info, | 114 static Handle<JSArray> SetLastMatchInfo(Handle<JSArray> last_match_info, |
115 Handle<String> subject, | 115 Handle<String> subject, |
116 int capture_count, | 116 int capture_count, |
117 int32_t* match); | 117 int32_t* match); |
118 | 118 |
119 | 119 |
120 class GlobalCache { | 120 class GlobalCache { |
121 public: | 121 public: |
122 GlobalCache(Handle<JSRegExp> regexp, | 122 GlobalCache(Handle<JSRegExp> regexp, |
123 Handle<String> subject, | 123 Handle<String> subject, |
124 bool is_global, | |
125 Isolate* isolate); | 124 Isolate* isolate); |
126 | 125 |
127 INLINE(~GlobalCache()); | 126 INLINE(~GlobalCache()); |
128 | 127 |
129 // Fetch the next entry in the cache for global regexp match results. | 128 // Fetch the next entry in the cache for global regexp match results. |
130 // This does not set the last match info. Upon failure, NULL is returned. | 129 // This does not set the last match info. Upon failure, NULL is returned. |
131 // The cause can be checked with Result(). The previous | 130 // The cause can be checked with Result(). The previous |
132 // result is still in available in memory when a failure happens. | 131 // result is still in available in memory when a failure happens. |
133 INLINE(int32_t* FetchNext()); | 132 INLINE(int32_t* FetchNext()); |
134 | 133 |
135 INLINE(int32_t* LastSuccessfulMatch()); | 134 INLINE(int32_t* LastSuccessfulMatch()); |
136 | 135 |
137 INLINE(bool HasException()) { return num_matches_ < 0; } | 136 INLINE(bool HasException()) { return num_matches_ < 0; } |
138 | 137 |
139 private: | 138 private: |
| 139 int AdvanceZeroLength(int last_index); |
| 140 |
140 int num_matches_; | 141 int num_matches_; |
141 int max_matches_; | 142 int max_matches_; |
142 int current_match_index_; | 143 int current_match_index_; |
143 int registers_per_match_; | 144 int registers_per_match_; |
144 // Pointer to the last set of captures. | 145 // Pointer to the last set of captures. |
145 int32_t* register_array_; | 146 int32_t* register_array_; |
146 int register_array_size_; | 147 int register_array_size_; |
147 Handle<JSRegExp> regexp_; | 148 Handle<JSRegExp> regexp_; |
148 Handle<String> subject_; | 149 Handle<String> subject_; |
149 }; | 150 }; |
(...skipping 1426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1576 static const int kStringOffset = 0; | 1577 static const int kStringOffset = 0; |
1577 static const int kPatternOffset = 1; | 1578 static const int kPatternOffset = 1; |
1578 static const int kArrayOffset = 2; | 1579 static const int kArrayOffset = 2; |
1579 static const int kLastMatchOffset = 3; | 1580 static const int kLastMatchOffset = 3; |
1580 }; | 1581 }; |
1581 | 1582 |
1582 } // namespace internal | 1583 } // namespace internal |
1583 } // namespace v8 | 1584 } // namespace v8 |
1584 | 1585 |
1585 #endif // V8_REGEXP_JSREGEXP_H_ | 1586 #endif // V8_REGEXP_JSREGEXP_H_ |
OLD | NEW |