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

Side by Side Diff: src/regexp/x64/regexp-macro-assembler-x64.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, 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/regexp-macro-assembler.h ('k') | src/runtime/runtime-regexp.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 #if V8_TARGET_ARCH_X64 5 #if V8_TARGET_ARCH_X64
6 6
7 #include "src/regexp/x64/regexp-macro-assembler-x64.h" 7 #include "src/regexp/x64/regexp-macro-assembler-x64.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 859 matching lines...) Expand 10 before | Expand all | Expand 10 after
870 if (global_with_zero_length_check()) { 870 if (global_with_zero_length_check()) {
871 // Special case for zero-length matches. 871 // Special case for zero-length matches.
872 // rdx: capture start index 872 // rdx: capture start index
873 __ cmpp(rdi, rdx); 873 __ cmpp(rdi, rdx);
874 // Not a zero-length match, restart. 874 // Not a zero-length match, restart.
875 __ j(not_equal, &load_char_start_regexp); 875 __ j(not_equal, &load_char_start_regexp);
876 // rdi (offset from the end) is zero if we already reached the end. 876 // rdi (offset from the end) is zero if we already reached the end.
877 __ testp(rdi, rdi); 877 __ testp(rdi, rdi);
878 __ j(zero, &exit_label_, Label::kNear); 878 __ j(zero, &exit_label_, Label::kNear);
879 // Advance current position after a zero-length match. 879 // Advance current position after a zero-length match.
880 Label advance;
881 __ bind(&advance);
880 if (mode_ == UC16) { 882 if (mode_ == UC16) {
881 __ addq(rdi, Immediate(2)); 883 __ addq(rdi, Immediate(2));
882 } else { 884 } else {
883 __ incq(rdi); 885 __ incq(rdi);
884 } 886 }
887 if (global_unicode()) CheckNotInSurrogatePair(0, &advance);
885 } 888 }
886 889
887 __ jmp(&load_char_start_regexp); 890 __ jmp(&load_char_start_regexp);
888 } else { 891 } else {
889 __ movp(rax, Immediate(SUCCESS)); 892 __ movp(rax, Immediate(SUCCESS));
890 } 893 }
891 } 894 }
892 895
893 __ bind(&exit_label_); 896 __ bind(&exit_label_);
894 if (global()) { 897 if (global()) {
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after
1391 } 1394 }
1392 1395
1393 #undef __ 1396 #undef __
1394 1397
1395 #endif // V8_INTERPRETED_REGEXP 1398 #endif // V8_INTERPRETED_REGEXP
1396 1399
1397 } // namespace internal 1400 } // namespace internal
1398 } // namespace v8 1401 } // namespace v8
1399 1402
1400 #endif // V8_TARGET_ARCH_X64 1403 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/regexp/regexp-macro-assembler.h ('k') | src/runtime/runtime-regexp.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698