| 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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 Loading... |
| 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_ |
| OLD | NEW |