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_REGEXP_MACRO_ASSEMBLER_H_ | 5 #ifndef V8_REGEXP_REGEXP_MACRO_ASSEMBLER_H_ |
6 #define V8_REGEXP_REGEXP_MACRO_ASSEMBLER_H_ | 6 #define V8_REGEXP_REGEXP_MACRO_ASSEMBLER_H_ |
7 | 7 |
8 #include "src/assembler.h" | 8 #include "src/assembler.h" |
9 #include "src/regexp/regexp-ast.h" | 9 #include "src/regexp/regexp-ast.h" |
10 | 10 |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 Address byte_offset2, | 159 Address byte_offset2, |
160 size_t byte_length, Isolate* isolate); | 160 size_t byte_length, Isolate* isolate); |
161 | 161 |
162 // Check that we are not in the middle of a surrogate pair. | 162 // Check that we are not in the middle of a surrogate pair. |
163 void CheckNotInSurrogatePair(int cp_offset, Label* on_failure); | 163 void CheckNotInSurrogatePair(int cp_offset, Label* on_failure); |
164 | 164 |
165 // Controls the generation of large inlined constants in the code. | 165 // Controls the generation of large inlined constants in the code. |
166 void set_slow_safe(bool ssc) { slow_safe_compiler_ = ssc; } | 166 void set_slow_safe(bool ssc) { slow_safe_compiler_ = ssc; } |
167 bool slow_safe() { return slow_safe_compiler_; } | 167 bool slow_safe() { return slow_safe_compiler_; } |
168 | 168 |
169 enum GlobalMode { NOT_GLOBAL, GLOBAL, GLOBAL_NO_ZERO_LENGTH_CHECK }; | 169 enum GlobalMode { |
| 170 NOT_GLOBAL, |
| 171 GLOBAL_NO_ZERO_LENGTH_CHECK, |
| 172 GLOBAL, |
| 173 GLOBAL_UNICODE |
| 174 }; |
170 // Set whether the regular expression has the global flag. Exiting due to | 175 // Set whether the regular expression has the global flag. Exiting due to |
171 // a failure in a global regexp may still mean success overall. | 176 // a failure in a global regexp may still mean success overall. |
172 inline void set_global_mode(GlobalMode mode) { global_mode_ = mode; } | 177 inline void set_global_mode(GlobalMode mode) { global_mode_ = mode; } |
173 inline bool global() { return global_mode_ != NOT_GLOBAL; } | 178 inline bool global() { return global_mode_ != NOT_GLOBAL; } |
174 inline bool global_with_zero_length_check() { | 179 inline bool global_with_zero_length_check() { |
175 return global_mode_ == GLOBAL; | 180 return global_mode_ == GLOBAL || global_mode_ == GLOBAL_UNICODE; |
176 } | 181 } |
| 182 inline bool global_unicode() { return global_mode_ == GLOBAL_UNICODE; } |
177 | 183 |
178 Isolate* isolate() const { return isolate_; } | 184 Isolate* isolate() const { return isolate_; } |
179 Zone* zone() const { return zone_; } | 185 Zone* zone() const { return zone_; } |
180 | 186 |
181 private: | 187 private: |
182 bool slow_safe_compiler_; | 188 bool slow_safe_compiler_; |
183 bool global_mode_; | 189 GlobalMode global_mode_; |
184 Isolate* isolate_; | 190 Isolate* isolate_; |
185 Zone* zone_; | 191 Zone* zone_; |
186 }; | 192 }; |
187 | 193 |
188 | 194 |
189 #ifndef V8_INTERPRETED_REGEXP // Avoid compiling unused code. | 195 #ifndef V8_INTERPRETED_REGEXP // Avoid compiling unused code. |
190 | 196 |
191 class NativeRegExpMacroAssembler: public RegExpMacroAssembler { | 197 class NativeRegExpMacroAssembler: public RegExpMacroAssembler { |
192 public: | 198 public: |
193 // Type of input string to generate code for. | 199 // Type of input string to generate code for. |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 int output_size, | 255 int output_size, |
250 Isolate* isolate); | 256 Isolate* isolate); |
251 }; | 257 }; |
252 | 258 |
253 #endif // V8_INTERPRETED_REGEXP | 259 #endif // V8_INTERPRETED_REGEXP |
254 | 260 |
255 } // namespace internal | 261 } // namespace internal |
256 } // namespace v8 | 262 } // namespace v8 |
257 | 263 |
258 #endif // V8_REGEXP_REGEXP_MACRO_ASSEMBLER_H_ | 264 #endif // V8_REGEXP_REGEXP_MACRO_ASSEMBLER_H_ |
OLD | NEW |