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

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

Issue 1601653006: [regexp] back refs must not start/end in the middle of a surrogate pair (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@unicodeclass
Patch Set: rebase and addressed comments 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
« no previous file with comments | « src/regexp/jsregexp.cc ('k') | src/regexp/regexp-macro-assembler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
11 namespace v8 { 11 namespace v8 {
12 namespace internal { 12 namespace internal {
13 13
14 static const uc32 kLeadSurrogateStart = 0xd800;
15 static const uc32 kLeadSurrogateEnd = 0xdbff;
16 static const uc32 kTrailSurrogateStart = 0xdc00;
17 static const uc32 kTrailSurrogateEnd = 0xdfff;
18 static const uc32 kNonBmpStart = 0x10000;
19 static const uc32 kNonBmpEnd = 0x10ffff;
20
14 struct DisjunctDecisionRow { 21 struct DisjunctDecisionRow {
15 RegExpCharacterClass cc; 22 RegExpCharacterClass cc;
16 Label* on_match; 23 Label* on_match;
17 }; 24 };
18 25
19 26
20 class RegExpMacroAssembler { 27 class RegExpMacroAssembler {
21 public: 28 public:
22 // The implementation must be able to handle at least: 29 // The implementation must be able to handle at least:
23 static const int kMaxRegister = (1 << 16) - 1; 30 static const int kMaxRegister = (1 << 16) - 1;
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 virtual void WriteCurrentPositionToRegister(int reg, int cp_offset) = 0; 152 virtual void WriteCurrentPositionToRegister(int reg, int cp_offset) = 0;
146 virtual void ClearRegisters(int reg_from, int reg_to) = 0; 153 virtual void ClearRegisters(int reg_from, int reg_to) = 0;
147 virtual void WriteStackPointerToRegister(int reg) = 0; 154 virtual void WriteStackPointerToRegister(int reg) = 0;
148 155
149 // Compares two-byte strings case insensitively. 156 // Compares two-byte strings case insensitively.
150 // Called from generated RegExp code. 157 // Called from generated RegExp code.
151 static int CaseInsensitiveCompareUC16(Address byte_offset1, 158 static int CaseInsensitiveCompareUC16(Address byte_offset1,
152 Address byte_offset2, 159 Address byte_offset2,
153 size_t byte_length, Isolate* isolate); 160 size_t byte_length, Isolate* isolate);
154 161
162 // Check that we are not in the middle of a surrogate pair.
163 void CheckNotInSurrogatePair(int cp_offset, Label* on_failure);
164
155 // Controls the generation of large inlined constants in the code. 165 // Controls the generation of large inlined constants in the code.
156 void set_slow_safe(bool ssc) { slow_safe_compiler_ = ssc; } 166 void set_slow_safe(bool ssc) { slow_safe_compiler_ = ssc; }
157 bool slow_safe() { return slow_safe_compiler_; } 167 bool slow_safe() { return slow_safe_compiler_; }
158 168
159 enum GlobalMode { NOT_GLOBAL, GLOBAL, GLOBAL_NO_ZERO_LENGTH_CHECK }; 169 enum GlobalMode { NOT_GLOBAL, GLOBAL, GLOBAL_NO_ZERO_LENGTH_CHECK };
160 // Set whether the regular expression has the global flag. Exiting due to 170 // Set whether the regular expression has the global flag. Exiting due to
161 // a failure in a global regexp may still mean success overall. 171 // a failure in a global regexp may still mean success overall.
162 inline void set_global_mode(GlobalMode mode) { global_mode_ = mode; } 172 inline void set_global_mode(GlobalMode mode) { global_mode_ = mode; }
163 inline bool global() { return global_mode_ != NOT_GLOBAL; } 173 inline bool global() { return global_mode_ != NOT_GLOBAL; }
164 inline bool global_with_zero_length_check() { 174 inline bool global_with_zero_length_check() {
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 int output_size, 249 int output_size,
240 Isolate* isolate); 250 Isolate* isolate);
241 }; 251 };
242 252
243 #endif // V8_INTERPRETED_REGEXP 253 #endif // V8_INTERPRETED_REGEXP
244 254
245 } // namespace internal 255 } // namespace internal
246 } // namespace v8 256 } // namespace v8
247 257
248 #endif // V8_REGEXP_REGEXP_MACRO_ASSEMBLER_H_ 258 #endif // V8_REGEXP_REGEXP_MACRO_ASSEMBLER_H_
OLDNEW
« no previous file with comments | « src/regexp/jsregexp.cc ('k') | src/regexp/regexp-macro-assembler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698