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

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 and addressed comments Created 4 years, 10 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/regexp-macro-assembler.h ('k') | test/mjsunit/harmony/unicode-regexp-backrefs.js » ('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 #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"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 if (s1[0] != s2[0]) { 81 if (s1[0] != s2[0]) {
82 return 0; 82 return 0;
83 } 83 }
84 } 84 }
85 } 85 }
86 } 86 }
87 return 1; 87 return 1;
88 } 88 }
89 89
90 90
91 void RegExpMacroAssembler::CheckNotInSurrogatePair(int cp_offset,
92 Label* on_failure) {
93 Label ok;
94 // Check that current character is not a trail surrogate.
95 LoadCurrentCharacter(cp_offset, &ok);
96 CheckCharacterNotInRange(kTrailSurrogateStart, kTrailSurrogateEnd, &ok);
97 // Check that previous character is not a lead surrogate.
98 LoadCurrentCharacter(cp_offset - 1, &ok);
99 CheckCharacterInRange(kLeadSurrogateStart, kLeadSurrogateEnd, on_failure);
100 Bind(&ok);
101 }
102
103
91 #ifndef V8_INTERPRETED_REGEXP // Avoid unused code, e.g., on ARM. 104 #ifndef V8_INTERPRETED_REGEXP // Avoid unused code, e.g., on ARM.
92 105
93 NativeRegExpMacroAssembler::NativeRegExpMacroAssembler(Isolate* isolate, 106 NativeRegExpMacroAssembler::NativeRegExpMacroAssembler(Isolate* isolate,
94 Zone* zone) 107 Zone* zone)
95 : RegExpMacroAssembler(isolate, zone) {} 108 : RegExpMacroAssembler(isolate, zone) {}
96 109
97 110
98 NativeRegExpMacroAssembler::~NativeRegExpMacroAssembler() { 111 NativeRegExpMacroAssembler::~NativeRegExpMacroAssembler() {
99 } 112 }
100 113
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 } 338 }
326 *stack_base = new_stack_base; 339 *stack_base = new_stack_base;
327 intptr_t stack_content_size = old_stack_base - stack_pointer; 340 intptr_t stack_content_size = old_stack_base - stack_pointer;
328 return new_stack_base - stack_content_size; 341 return new_stack_base - stack_content_size;
329 } 342 }
330 343
331 #endif // V8_INTERPRETED_REGEXP 344 #endif // V8_INTERPRETED_REGEXP
332 345
333 } // namespace internal 346 } // namespace internal
334 } // namespace v8 347 } // namespace v8
OLDNEW
« no previous file with comments | « src/regexp/regexp-macro-assembler.h ('k') | test/mjsunit/harmony/unicode-regexp-backrefs.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698