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

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

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 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 #include "src/regexp/regexp-macro-assembler.h" 5 #include "src/regexp/regexp-macro-assembler.h"
6 6
7 #include "src/assembler.h" 7 #include "src/assembler.h"
8 #include "src/isolate-inl.h" 8 #include "src/isolate-inl.h"
9 #include "src/regexp/regexp-stack.h" 9 #include "src/regexp/regexp-stack.h"
10 #include "src/simulator.h" 10 #include "src/simulator.h"
11 11
12 namespace v8 { 12 namespace v8 {
13 namespace internal { 13 namespace internal {
14 14
15 RegExpMacroAssembler::RegExpMacroAssembler(Isolate* isolate, Zone* zone) 15 RegExpMacroAssembler::RegExpMacroAssembler(Isolate* isolate, Zone* zone)
16 : slow_safe_compiler_(false), 16 : slow_safe_compiler_(false),
17 global_mode_(NOT_GLOBAL), 17 global_mode_(NOT_GLOBAL),
18 isolate_(isolate), 18 isolate_(isolate),
19 zone_(zone) {} 19 zone_(zone) {}
20 20
21 21
22 RegExpMacroAssembler::~RegExpMacroAssembler() { 22 RegExpMacroAssembler::~RegExpMacroAssembler() {
23 } 23 }
24 24
25 25
26 void RegExpMacroAssembler::CheckNotInSurrogatePair(int cp_offset,
27 Label* on_failure) {
28 Label ok;
29 // Check that current character is not a trail surrogate.
30 LoadCurrentCharacter(cp_offset, &ok, true, 1);
erikcorry 2016/01/26 16:25:06 True, 1 are default args and not needed.
Yang 2016/01/27 09:06:06 Done.
31 CheckCharacterNotInRange(kTrailSurrogateStart, kTrailSurrogateEnd, &ok);
32 // Check that previous character is not a lead surrogate.
33 LoadCurrentCharacter(cp_offset - 1, &ok, true, 1);
34 CheckCharacterNotInRange(kLeadSurrogateStart, kLeadSurrogateEnd, &ok);
erikcorry 2016/01/26 16:25:06 CheckCharacterInRange(on_failure) ?
Yang 2016/01/27 09:06:06 Done.
35 // Looks like we are right in between a lead and a trail surrogate.
36 GoTo(on_failure);
37 Bind(&ok);
38 }
39
40
26 #ifndef V8_INTERPRETED_REGEXP // Avoid unused code, e.g., on ARM. 41 #ifndef V8_INTERPRETED_REGEXP // Avoid unused code, e.g., on ARM.
27 42
28 NativeRegExpMacroAssembler::NativeRegExpMacroAssembler(Isolate* isolate, 43 NativeRegExpMacroAssembler::NativeRegExpMacroAssembler(Isolate* isolate,
29 Zone* zone) 44 Zone* zone)
30 : RegExpMacroAssembler(isolate, zone) {} 45 : RegExpMacroAssembler(isolate, zone) {}
31 46
32 47
33 NativeRegExpMacroAssembler::~NativeRegExpMacroAssembler() { 48 NativeRegExpMacroAssembler::~NativeRegExpMacroAssembler() {
34 } 49 }
35 50
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 } 309 }
295 *stack_base = new_stack_base; 310 *stack_base = new_stack_base;
296 intptr_t stack_content_size = old_stack_base - stack_pointer; 311 intptr_t stack_content_size = old_stack_base - stack_pointer;
297 return new_stack_base - stack_content_size; 312 return new_stack_base - stack_content_size;
298 } 313 }
299 314
300 #endif // V8_INTERPRETED_REGEXP 315 #endif // V8_INTERPRETED_REGEXP
301 316
302 } // namespace internal 317 } // namespace internal
303 } // namespace v8 318 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698