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

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: 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_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 851 matching lines...) Expand 10 before | Expand all | Expand 10 after
862 if (global_with_zero_length_check()) { 862 if (global_with_zero_length_check()) {
863 // Special case for zero-length matches. 863 // Special case for zero-length matches.
864 // rdx: capture start index 864 // rdx: capture start index
865 __ cmpp(rdi, rdx); 865 __ cmpp(rdi, rdx);
866 // Not a zero-length match, restart. 866 // Not a zero-length match, restart.
867 __ j(not_equal, &load_char_start_regexp); 867 __ j(not_equal, &load_char_start_regexp);
868 // rdi (offset from the end) is zero if we already reached the end. 868 // rdi (offset from the end) is zero if we already reached the end.
869 __ testp(rdi, rdi); 869 __ testp(rdi, rdi);
870 __ j(zero, &exit_label_, Label::kNear); 870 __ j(zero, &exit_label_, Label::kNear);
871 // Advance current position after a zero-length match. 871 // Advance current position after a zero-length match.
872 Label advance;
873 __ bind(&advance);
872 if (mode_ == UC16) { 874 if (mode_ == UC16) {
873 __ addq(rdi, Immediate(2)); 875 __ addq(rdi, Immediate(2));
874 } else { 876 } else {
875 __ incq(rdi); 877 __ incq(rdi);
876 } 878 }
879 if (global_unicode()) CheckNotInSurrogatePair(0, &advance);
877 } 880 }
878 881
879 __ jmp(&load_char_start_regexp); 882 __ jmp(&load_char_start_regexp);
880 } else { 883 } else {
881 __ movp(rax, Immediate(SUCCESS)); 884 __ movp(rax, Immediate(SUCCESS));
882 } 885 }
883 } 886 }
884 887
885 __ bind(&exit_label_); 888 __ bind(&exit_label_);
886 if (global()) { 889 if (global()) {
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after
1383 } 1386 }
1384 1387
1385 #undef __ 1388 #undef __
1386 1389
1387 #endif // V8_INTERPRETED_REGEXP 1390 #endif // V8_INTERPRETED_REGEXP
1388 1391
1389 } // namespace internal 1392 } // namespace internal
1390 } // namespace v8 1393 } // namespace v8
1391 1394
1392 #endif // V8_TARGET_ARCH_X64 1395 #endif // V8_TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698