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

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: 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 #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 804 matching lines...) Expand 10 before | Expand all | Expand 10 after
815 if (global_with_zero_length_check()) { 815 if (global_with_zero_length_check()) {
816 // Special case for zero-length matches. 816 // Special case for zero-length matches.
817 // edx: capture start index 817 // edx: capture start index
818 __ cmp(edi, edx); 818 __ cmp(edi, edx);
819 // Not a zero-length match, restart. 819 // Not a zero-length match, restart.
820 __ j(not_equal, &load_char_start_regexp); 820 __ j(not_equal, &load_char_start_regexp);
821 // edi (offset from the end) is zero if we already reached the end. 821 // edi (offset from the end) is zero if we already reached the end.
822 __ test(edi, edi); 822 __ test(edi, edi);
823 __ j(zero, &exit_label_, Label::kNear); 823 __ j(zero, &exit_label_, Label::kNear);
824 // Advance current position after a zero-length match. 824 // Advance current position after a zero-length match.
825 Label advance;
826 __ bind(&advance);
825 if (mode_ == UC16) { 827 if (mode_ == UC16) {
826 __ add(edi, Immediate(2)); 828 __ add(edi, Immediate(2));
827 } else { 829 } else {
828 __ inc(edi); 830 __ inc(edi);
829 } 831 }
832 if (global_unicode()) CheckNotInSurrogatePair(0, &advance);
830 } 833 }
831
832 __ jmp(&load_char_start_regexp); 834 __ jmp(&load_char_start_regexp);
833 } else { 835 } else {
834 __ mov(eax, Immediate(SUCCESS)); 836 __ mov(eax, Immediate(SUCCESS));
835 } 837 }
836 } 838 }
837 839
838 __ bind(&exit_label_); 840 __ bind(&exit_label_);
839 if (global()) { 841 if (global()) {
840 // Return the number of successful captures. 842 // Return the number of successful captures.
841 __ mov(eax, Operand(ebp, kSuccessfulCaptures)); 843 __ mov(eax, Operand(ebp, kSuccessfulCaptures));
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
1254 1256
1255 1257
1256 #undef __ 1258 #undef __
1257 1259
1258 #endif // V8_INTERPRETED_REGEXP 1260 #endif // V8_INTERPRETED_REGEXP
1259 1261
1260 } // namespace internal 1262 } // namespace internal
1261 } // namespace v8 1263 } // namespace v8
1262 1264
1263 #endif // V8_TARGET_ARCH_IA32 1265 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698