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

Side by Side Diff: runtime/vm/regexp_assembler.h

Issue 982873004: Thread/Isolate refactoring: new(Isolate) -> new(Zone) (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef VM_REGEXP_ASSEMBLER_H_ 5 #ifndef VM_REGEXP_ASSEMBLER_H_
6 #define VM_REGEXP_ASSEMBLER_H_ 6 #define VM_REGEXP_ASSEMBLER_H_
7 7
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/intermediate_language.h" 9 #include "vm/intermediate_language.h"
10 #include "vm/object.h" 10 #include "vm/object.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 enum { 77 enum {
78 kParamStringIndex = 0, 78 kParamStringIndex = 0,
79 kParamStartOffsetIndex, 79 kParamStartOffsetIndex,
80 kParamCount 80 kParamCount
81 }; 81 };
82 82
83 enum IrregexpImplementation { 83 enum IrregexpImplementation {
84 kIRImplementation 84 kIRImplementation
85 }; 85 };
86 86
87 explicit RegExpMacroAssembler(Isolate* isolate); 87 explicit RegExpMacroAssembler(Zone* zone);
88 virtual ~RegExpMacroAssembler(); 88 virtual ~RegExpMacroAssembler();
89 // The maximal number of pushes between stack checks. Users must supply 89 // The maximal number of pushes between stack checks. Users must supply
90 // kCheckStackLimit flag to push operations (instead of kNoStackLimitCheck) 90 // kCheckStackLimit flag to push operations (instead of kNoStackLimitCheck)
91 // at least once for every stack_limit() pushes that are executed. 91 // at least once for every stack_limit() pushes that are executed.
92 virtual intptr_t stack_limit_slack() = 0; 92 virtual intptr_t stack_limit_slack() = 0;
93 virtual bool CanReadUnaligned() = 0; 93 virtual bool CanReadUnaligned() = 0;
94 virtual void AdvanceCurrentPosition(intptr_t by) = 0; // Signed cp change. 94 virtual void AdvanceCurrentPosition(intptr_t by) = 0; // Signed cp change.
95 virtual void AdvanceRegister(intptr_t reg, intptr_t by) = 0; // r[reg] += by. 95 virtual void AdvanceRegister(intptr_t reg, intptr_t by) = 0; // r[reg] += by.
96 // Continues execution from the position pushed on the top of the backtrack 96 // Continues execution from the position pushed on the top of the backtrack
97 // stack by an earlier PushBacktrack(BlockLabel*). 97 // stack by an earlier PushBacktrack(BlockLabel*).
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 202
203 enum GlobalMode { NOT_GLOBAL, GLOBAL, GLOBAL_NO_ZERO_LENGTH_CHECK }; 203 enum GlobalMode { NOT_GLOBAL, GLOBAL, GLOBAL_NO_ZERO_LENGTH_CHECK };
204 // Set whether the regular expression has the global flag. Exiting due to 204 // Set whether the regular expression has the global flag. Exiting due to
205 // a failure in a global regexp may still mean success overall. 205 // a failure in a global regexp may still mean success overall.
206 inline void set_global_mode(GlobalMode mode) { global_mode_ = mode; } 206 inline void set_global_mode(GlobalMode mode) { global_mode_ = mode; }
207 inline bool global() { return global_mode_ != NOT_GLOBAL; } 207 inline bool global() { return global_mode_ != NOT_GLOBAL; }
208 inline bool global_with_zero_length_check() { 208 inline bool global_with_zero_length_check() {
209 return global_mode_ == GLOBAL; 209 return global_mode_ == GLOBAL;
210 } 210 }
211 211
212 Isolate* isolate() const { return isolate_; } 212 Zone* zone() const { return zone_; }
213 213
214 private: 214 private:
215 bool slow_safe_compiler_; 215 bool slow_safe_compiler_;
216 bool global_mode_; 216 bool global_mode_;
217 Isolate* isolate_; 217 Zone* zone_;
218 }; 218 };
219 219
220 220
221 class IRRegExpMacroAssembler : public RegExpMacroAssembler { 221 class IRRegExpMacroAssembler : public RegExpMacroAssembler {
222 public: 222 public:
223 // Type of input string to generate code for. 223 // Type of input string to generate code for.
224 enum Mode { ASCII = 1, UC16 = 2 }; 224 enum Mode { ASCII = 1, UC16 = 2 };
225 225
226 // Result of calling generated native RegExp code. 226 // Result of calling generated native RegExp code.
227 // RETRY: Something significant changed during execution, and the matching 227 // RETRY: Something significant changed during execution, and the matching
228 // should be retried from scratch. 228 // should be retried from scratch.
229 // EXCEPTION: Something failed during execution. If no exception has been 229 // EXCEPTION: Something failed during execution. If no exception has been
230 // thrown, it's an internal out-of-memory, and the caller should 230 // thrown, it's an internal out-of-memory, and the caller should
231 // throw the exception. 231 // throw the exception.
232 // FAILURE: Matching failed. 232 // FAILURE: Matching failed.
233 // SUCCESS: Matching succeeded, and the output array has been filled with 233 // SUCCESS: Matching succeeded, and the output array has been filled with
234 // capture positions. 234 // capture positions.
235 enum Result { RETRY = -2, EXCEPTION = -1, FAILURE = 0, SUCCESS = 1 }; 235 enum Result { RETRY = -2, EXCEPTION = -1, FAILURE = 0, SUCCESS = 1 };
236 236
237 IRRegExpMacroAssembler(intptr_t specialization_cid, 237 IRRegExpMacroAssembler(intptr_t specialization_cid,
238 intptr_t capture_count, 238 intptr_t capture_count,
239 const ParsedFunction* parsed_function, 239 const ParsedFunction* parsed_function,
240 const ZoneGrowableArray<const ICData*>& ic_data_array, 240 const ZoneGrowableArray<const ICData*>& ic_data_array,
241 Isolate* isolate); 241 Zone* zone);
242 virtual ~IRRegExpMacroAssembler(); 242 virtual ~IRRegExpMacroAssembler();
243 243
244 virtual bool CanReadUnaligned(); 244 virtual bool CanReadUnaligned();
245 245
246 // Compares two-byte strings case insensitively. 246 // Compares two-byte strings case insensitively.
247 // Called from generated RegExp code. 247 // Called from generated RegExp code.
248 static RawBool* CaseInsensitiveCompareUC16( 248 static RawBool* CaseInsensitiveCompareUC16(
249 RawString* str_raw, 249 RawString* str_raw,
250 RawSmi* lhs_index_raw, 250 RawSmi* lhs_index_raw,
251 RawSmi* rhs_index_raw, 251 RawSmi* rhs_index_raw,
252 RawSmi* length_raw); 252 RawSmi* length_raw);
253 253
254 static RawArray* Execute(const Function& function, 254 static RawArray* Execute(const Function& function,
255 const String& input, 255 const String& input,
256 const Smi& start_offset, 256 const Smi& start_offset,
257 Isolate* isolate); 257 Zone* zone);
258 258
259 virtual bool IsClosed() const { return (current_instruction_ == NULL); } 259 virtual bool IsClosed() const { return (current_instruction_ == NULL); }
260 260
261 virtual intptr_t stack_limit_slack(); 261 virtual intptr_t stack_limit_slack();
262 virtual void AdvanceCurrentPosition(intptr_t by); 262 virtual void AdvanceCurrentPosition(intptr_t by);
263 virtual void AdvanceRegister(intptr_t reg, intptr_t by); 263 virtual void AdvanceRegister(intptr_t reg, intptr_t by);
264 virtual void Backtrack(); 264 virtual void Backtrack();
265 virtual void BindBlock(BlockLabel* label); 265 virtual void BindBlock(BlockLabel* label);
266 virtual void CheckAtStart(BlockLabel* on_at_start); 266 virtual void CheckAtStart(BlockLabel* on_at_start);
267 virtual void CheckCharacter(uint32_t c, BlockLabel* on_equal); 267 virtual void CheckCharacter(uint32_t c, BlockLabel* on_equal);
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 IdAllocator temp_id_; 640 IdAllocator temp_id_;
641 IdAllocator arg_id_; 641 IdAllocator arg_id_;
642 IdAllocator local_id_; 642 IdAllocator local_id_;
643 IdAllocator indirect_id_; 643 IdAllocator indirect_id_;
644 }; 644 };
645 645
646 646
647 } // namespace dart 647 } // namespace dart
648 648
649 #endif // VM_REGEXP_ASSEMBLER_H_ 649 #endif // VM_REGEXP_ASSEMBLER_H_
OLDNEW
« runtime/vm/regexp.cc ('K') | « runtime/vm/regexp.cc ('k') | runtime/vm/regexp_assembler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698