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

Side by Side Diff: src/regexp/regexp-macro-assembler.h

Issue 1599303002: [regexp] implement case-insensitive unicode regexps. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@unicodeclass
Patch Set: fix mips Created 4 years, 11 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
OLDNEW
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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 virtual void CheckCharacterAfterAnd(unsigned c, 69 virtual void CheckCharacterAfterAnd(unsigned c,
70 unsigned and_with, 70 unsigned and_with,
71 Label* on_equal) = 0; 71 Label* on_equal) = 0;
72 virtual void CheckCharacterGT(uc16 limit, Label* on_greater) = 0; 72 virtual void CheckCharacterGT(uc16 limit, Label* on_greater) = 0;
73 virtual void CheckCharacterLT(uc16 limit, Label* on_less) = 0; 73 virtual void CheckCharacterLT(uc16 limit, Label* on_less) = 0;
74 virtual void CheckGreedyLoop(Label* on_tos_equals_current_position) = 0; 74 virtual void CheckGreedyLoop(Label* on_tos_equals_current_position) = 0;
75 virtual void CheckNotAtStart(int cp_offset, Label* on_not_at_start) = 0; 75 virtual void CheckNotAtStart(int cp_offset, Label* on_not_at_start) = 0;
76 virtual void CheckNotBackReference(int start_reg, bool read_backward, 76 virtual void CheckNotBackReference(int start_reg, bool read_backward,
77 Label* on_no_match) = 0; 77 Label* on_no_match) = 0;
78 virtual void CheckNotBackReferenceIgnoreCase(int start_reg, 78 virtual void CheckNotBackReferenceIgnoreCase(int start_reg,
79 bool read_backward, 79 bool read_backward, bool unicode,
80 Label* on_no_match) = 0; 80 Label* on_no_match) = 0;
81 // Check the current character for a match with a literal character. If we 81 // Check the current character for a match with a literal character. If we
82 // fail to match then goto the on_failure label. End of input always 82 // fail to match then goto the on_failure label. End of input always
83 // matches. If the label is NULL then we should pop a backtrack address off 83 // matches. If the label is NULL then we should pop a backtrack address off
84 // the stack and go to that. 84 // the stack and go to that.
85 virtual void CheckNotCharacter(unsigned c, Label* on_not_equal) = 0; 85 virtual void CheckNotCharacter(unsigned c, Label* on_not_equal) = 0;
86 virtual void CheckNotCharacterAfterAnd(unsigned c, 86 virtual void CheckNotCharacterAfterAnd(unsigned c,
87 unsigned and_with, 87 unsigned and_with,
88 Label* on_not_equal) = 0; 88 Label* on_not_equal) = 0;
89 // Subtract a constant from the current character, then and with the given 89 // Subtract a constant from the current character, then and with the given
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 virtual void ReadCurrentPositionFromRegister(int reg) = 0; 139 virtual void ReadCurrentPositionFromRegister(int reg) = 0;
140 virtual void ReadStackPointerFromRegister(int reg) = 0; 140 virtual void ReadStackPointerFromRegister(int reg) = 0;
141 virtual void SetCurrentPositionFromEnd(int by) = 0; 141 virtual void SetCurrentPositionFromEnd(int by) = 0;
142 virtual void SetRegister(int register_index, int to) = 0; 142 virtual void SetRegister(int register_index, int to) = 0;
143 // Return whether the matching (with a global regexp) will be restarted. 143 // Return whether the matching (with a global regexp) will be restarted.
144 virtual bool Succeed() = 0; 144 virtual bool Succeed() = 0;
145 virtual void WriteCurrentPositionToRegister(int reg, int cp_offset) = 0; 145 virtual void WriteCurrentPositionToRegister(int reg, int cp_offset) = 0;
146 virtual void ClearRegisters(int reg_from, int reg_to) = 0; 146 virtual void ClearRegisters(int reg_from, int reg_to) = 0;
147 virtual void WriteStackPointerToRegister(int reg) = 0; 147 virtual void WriteStackPointerToRegister(int reg) = 0;
148 148
149 // Compares two-byte strings case insensitively.
150 // Called from generated RegExp code.
151 static int CaseInsensitiveCompareUC16(Address byte_offset1,
152 Address byte_offset2,
153 size_t byte_length, Isolate* isolate);
154
149 // Controls the generation of large inlined constants in the code. 155 // Controls the generation of large inlined constants in the code.
150 void set_slow_safe(bool ssc) { slow_safe_compiler_ = ssc; } 156 void set_slow_safe(bool ssc) { slow_safe_compiler_ = ssc; }
151 bool slow_safe() { return slow_safe_compiler_; } 157 bool slow_safe() { return slow_safe_compiler_; }
152 158
153 enum GlobalMode { NOT_GLOBAL, GLOBAL, GLOBAL_NO_ZERO_LENGTH_CHECK }; 159 enum GlobalMode { NOT_GLOBAL, GLOBAL, GLOBAL_NO_ZERO_LENGTH_CHECK };
154 // Set whether the regular expression has the global flag. Exiting due to 160 // Set whether the regular expression has the global flag. Exiting due to
155 // a failure in a global regexp may still mean success overall. 161 // a failure in a global regexp may still mean success overall.
156 inline void set_global_mode(GlobalMode mode) { global_mode_ = mode; } 162 inline void set_global_mode(GlobalMode mode) { global_mode_ = mode; }
157 inline bool global() { return global_mode_ != NOT_GLOBAL; } 163 inline bool global() { return global_mode_ != NOT_GLOBAL; }
158 inline bool global_with_zero_length_check() { 164 inline bool global_with_zero_length_check() {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 virtual ~NativeRegExpMacroAssembler(); 198 virtual ~NativeRegExpMacroAssembler();
193 virtual bool CanReadUnaligned(); 199 virtual bool CanReadUnaligned();
194 200
195 static Result Match(Handle<Code> regexp, 201 static Result Match(Handle<Code> regexp,
196 Handle<String> subject, 202 Handle<String> subject,
197 int* offsets_vector, 203 int* offsets_vector,
198 int offsets_vector_length, 204 int offsets_vector_length,
199 int previous_index, 205 int previous_index,
200 Isolate* isolate); 206 Isolate* isolate);
201 207
202 // Compares two-byte strings case insensitively.
203 // Called from generated RegExp code.
204 static int CaseInsensitiveCompareUC16(Address byte_offset1,
205 Address byte_offset2,
206 size_t byte_length,
207 Isolate* isolate);
208
209 // Called from RegExp if the backtrack stack limit is hit. 208 // Called from RegExp if the backtrack stack limit is hit.
210 // Tries to expand the stack. Returns the new stack-pointer if 209 // Tries to expand the stack. Returns the new stack-pointer if
211 // successful, and updates the stack_top address, or returns 0 if unable 210 // successful, and updates the stack_top address, or returns 0 if unable
212 // to grow the stack. 211 // to grow the stack.
213 // This function must not trigger a garbage collection. 212 // This function must not trigger a garbage collection.
214 static Address GrowStack(Address stack_pointer, Address* stack_top, 213 static Address GrowStack(Address stack_pointer, Address* stack_top,
215 Isolate* isolate); 214 Isolate* isolate);
216 215
217 static const byte* StringCharacterPosition(String* subject, int start_index); 216 static const byte* StringCharacterPosition(String* subject, int start_index);
218 217
(...skipping 21 matching lines...) Expand all
240 int output_size, 239 int output_size,
241 Isolate* isolate); 240 Isolate* isolate);
242 }; 241 };
243 242
244 #endif // V8_INTERPRETED_REGEXP 243 #endif // V8_INTERPRETED_REGEXP
245 244
246 } // namespace internal 245 } // namespace internal
247 } // namespace v8 246 } // namespace v8
248 247
249 #endif // V8_REGEXP_REGEXP_MACRO_ASSEMBLER_H_ 248 #endif // V8_REGEXP_REGEXP_MACRO_ASSEMBLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698