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

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

Issue 1630633002: [regexp] correctly advance zero length matches for global/unicode. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@backrefbounds
Patch Set: fix test 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/arm64/regexp-macro-assembler-arm64.cc ('k') | src/regexp/jsregexp.h » ('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 #if V8_TARGET_ARCH_IA32 5 #if V8_TARGET_ARCH_IA32
6 6
7 #include "src/regexp/ia32/regexp-macro-assembler-ia32.h" 7 #include "src/regexp/ia32/regexp-macro-assembler-ia32.h"
8 8
9 #include "src/log.h" 9 #include "src/log.h"
10 #include "src/macro-assembler.h" 10 #include "src/macro-assembler.h"
(...skipping 811 matching lines...) Expand 10 before | Expand all | Expand 10 after
822 if (global_with_zero_length_check()) { 822 if (global_with_zero_length_check()) {
823 // Special case for zero-length matches. 823 // Special case for zero-length matches.
824 // edx: capture start index 824 // edx: capture start index
825 __ cmp(edi, edx); 825 __ cmp(edi, edx);
826 // Not a zero-length match, restart. 826 // Not a zero-length match, restart.
827 __ j(not_equal, &load_char_start_regexp); 827 __ j(not_equal, &load_char_start_regexp);
828 // edi (offset from the end) is zero if we already reached the end. 828 // edi (offset from the end) is zero if we already reached the end.
829 __ test(edi, edi); 829 __ test(edi, edi);
830 __ j(zero, &exit_label_, Label::kNear); 830 __ j(zero, &exit_label_, Label::kNear);
831 // Advance current position after a zero-length match. 831 // Advance current position after a zero-length match.
832 Label advance;
833 __ bind(&advance);
832 if (mode_ == UC16) { 834 if (mode_ == UC16) {
833 __ add(edi, Immediate(2)); 835 __ add(edi, Immediate(2));
834 } else { 836 } else {
835 __ inc(edi); 837 __ inc(edi);
836 } 838 }
839 if (global_unicode()) CheckNotInSurrogatePair(0, &advance);
837 } 840 }
838
839 __ jmp(&load_char_start_regexp); 841 __ jmp(&load_char_start_regexp);
840 } else { 842 } else {
841 __ mov(eax, Immediate(SUCCESS)); 843 __ mov(eax, Immediate(SUCCESS));
842 } 844 }
843 } 845 }
844 846
845 __ bind(&exit_label_); 847 __ bind(&exit_label_);
846 if (global()) { 848 if (global()) {
847 // Return the number of successful captures. 849 // Return the number of successful captures.
848 __ mov(eax, Operand(ebp, kSuccessfulCaptures)); 850 __ mov(eax, Operand(ebp, kSuccessfulCaptures));
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
1261 1263
1262 1264
1263 #undef __ 1265 #undef __
1264 1266
1265 #endif // V8_INTERPRETED_REGEXP 1267 #endif // V8_INTERPRETED_REGEXP
1266 1268
1267 } // namespace internal 1269 } // namespace internal
1268 } // namespace v8 1270 } // namespace v8
1269 1271
1270 #endif // V8_TARGET_ARCH_IA32 1272 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/regexp/arm64/regexp-macro-assembler-arm64.cc ('k') | src/regexp/jsregexp.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698