Chromium Code Reviews| 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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 153 virtual void ClearRegisters(int reg_from, int reg_to) = 0; | 153 virtual void ClearRegisters(int reg_from, int reg_to) = 0; |
| 154 virtual void WriteStackPointerToRegister(int reg) = 0; | 154 virtual void WriteStackPointerToRegister(int reg) = 0; |
| 155 | 155 |
| 156 // Check that we are not in the middle of a surrogate pair. | 156 // Check that we are not in the middle of a surrogate pair. |
| 157 void CheckNotInSurrogatePair(int cp_offset, Label* on_failure); | 157 void CheckNotInSurrogatePair(int cp_offset, Label* on_failure); |
| 158 | 158 |
| 159 // Controls the generation of large inlined constants in the code. | 159 // Controls the generation of large inlined constants in the code. |
| 160 void set_slow_safe(bool ssc) { slow_safe_compiler_ = ssc; } | 160 void set_slow_safe(bool ssc) { slow_safe_compiler_ = ssc; } |
| 161 bool slow_safe() { return slow_safe_compiler_; } | 161 bool slow_safe() { return slow_safe_compiler_; } |
| 162 | 162 |
| 163 enum GlobalMode { NOT_GLOBAL, GLOBAL, GLOBAL_NO_ZERO_LENGTH_CHECK }; | 163 enum GlobalMode { |
| 164 NOT_GLOBAL, | |
| 165 GLOBAL_NO_ZERO_LENGTH_CHECK, | |
| 166 GLOBAL, | |
| 167 GLOBAL_UNICODE | |
|
erikcorry
2016/01/27 10:31:31
You need a warning here that the ordering of the m
Yang
2016/01/27 12:19:20
I was thinking about adding a static check below,
| |
| 168 }; | |
| 164 // Set whether the regular expression has the global flag. Exiting due to | 169 // Set whether the regular expression has the global flag. Exiting due to |
| 165 // a failure in a global regexp may still mean success overall. | 170 // a failure in a global regexp may still mean success overall. |
| 166 inline void set_global_mode(GlobalMode mode) { global_mode_ = mode; } | 171 inline void set_global_mode(GlobalMode mode) { global_mode_ = mode; } |
| 167 inline bool global() { return global_mode_ != NOT_GLOBAL; } | 172 inline bool global() { return global_mode_ != NOT_GLOBAL; } |
| 168 inline bool global_with_zero_length_check() { | 173 inline bool global_with_zero_length_check() { return global_mode_ >= GLOBAL; } |
| 169 return global_mode_ == GLOBAL; | 174 inline bool global_unicode() { return global_mode_ == GLOBAL_UNICODE; } |
| 170 } | |
| 171 | 175 |
| 172 Isolate* isolate() const { return isolate_; } | 176 Isolate* isolate() const { return isolate_; } |
| 173 Zone* zone() const { return zone_; } | 177 Zone* zone() const { return zone_; } |
| 174 | 178 |
| 175 private: | 179 private: |
| 176 bool slow_safe_compiler_; | 180 bool slow_safe_compiler_; |
| 177 bool global_mode_; | 181 GlobalMode global_mode_; |
| 178 Isolate* isolate_; | 182 Isolate* isolate_; |
| 179 Zone* zone_; | 183 Zone* zone_; |
| 180 }; | 184 }; |
| 181 | 185 |
| 182 | 186 |
| 183 #ifndef V8_INTERPRETED_REGEXP // Avoid compiling unused code. | 187 #ifndef V8_INTERPRETED_REGEXP // Avoid compiling unused code. |
| 184 | 188 |
| 185 class NativeRegExpMacroAssembler: public RegExpMacroAssembler { | 189 class NativeRegExpMacroAssembler: public RegExpMacroAssembler { |
| 186 public: | 190 public: |
| 187 // Type of input string to generate code for. | 191 // Type of input string to generate code for. |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 250 int output_size, | 254 int output_size, |
| 251 Isolate* isolate); | 255 Isolate* isolate); |
| 252 }; | 256 }; |
| 253 | 257 |
| 254 #endif // V8_INTERPRETED_REGEXP | 258 #endif // V8_INTERPRETED_REGEXP |
| 255 | 259 |
| 256 } // namespace internal | 260 } // namespace internal |
| 257 } // namespace v8 | 261 } // namespace v8 |
| 258 | 262 |
| 259 #endif // V8_REGEXP_REGEXP_MACRO_ASSEMBLER_H_ | 263 #endif // V8_REGEXP_REGEXP_MACRO_ASSEMBLER_H_ |
| OLD | NEW |