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

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

Issue 3844006: Limit end-anchored regexps to testing end of string where possible. (Closed)
Patch Set: Created 10 years, 2 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 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 } 138 }
139 139
140 140
141 int RegExpMacroAssemblerX64::stack_limit_slack() { 141 int RegExpMacroAssemblerX64::stack_limit_slack() {
142 return RegExpStack::kStackLimitSlack; 142 return RegExpStack::kStackLimitSlack;
143 } 143 }
144 144
145 145
146 void RegExpMacroAssemblerX64::AdvanceCurrentPosition(int by) { 146 void RegExpMacroAssemblerX64::AdvanceCurrentPosition(int by) {
147 if (by != 0) { 147 if (by != 0) {
148 Label inside_string;
149 __ addq(rdi, Immediate(by * char_size())); 148 __ addq(rdi, Immediate(by * char_size()));
150 } 149 }
151 } 150 }
152 151
153 152
154 void RegExpMacroAssemblerX64::AdvanceRegister(int reg, int by) { 153 void RegExpMacroAssemblerX64::AdvanceRegister(int reg, int by) {
155 ASSERT(reg >= 0); 154 ASSERT(reg >= 0);
156 ASSERT(reg < num_registers_); 155 ASSERT(reg < num_registers_);
157 if (by != 0) { 156 if (by != 0) {
158 __ addq(register_location(reg), Immediate(by)); 157 __ addq(register_location(reg), Immediate(by));
(...skipping 887 matching lines...) Expand 10 before | Expand all | Expand 10 after
1046 __ movq(rdi, register_location(reg)); 1045 __ movq(rdi, register_location(reg));
1047 } 1046 }
1048 1047
1049 1048
1050 void RegExpMacroAssemblerX64::ReadStackPointerFromRegister(int reg) { 1049 void RegExpMacroAssemblerX64::ReadStackPointerFromRegister(int reg) {
1051 __ movq(backtrack_stackpointer(), register_location(reg)); 1050 __ movq(backtrack_stackpointer(), register_location(reg));
1052 __ addq(backtrack_stackpointer(), Operand(rbp, kStackHighEnd)); 1051 __ addq(backtrack_stackpointer(), Operand(rbp, kStackHighEnd));
1053 } 1052 }
1054 1053
1055 1054
1055 void RegExpMacroAssemblerX64::SetCurrentPositionFromEnd(int by) {
1056 NearLabel after_position;
1057 __ cmpq(rdi, Immediate(-by * char_size()));
1058 __ j(greater_equal, &after_position);
1059 __ movq(rdi, Immediate(-by * char_size()));
1060 // On RegExp code entry (where this operation is used), the character before
1061 // the current position is expected to be already loaded.
1062 // We have advanced the position, so it's safe to read backwards.
1063 LoadCurrentCharacterUnchecked(-1, 1);
1064 __ bind(&after_position);
1065 }
1066
1067
1056 void RegExpMacroAssemblerX64::SetRegister(int register_index, int to) { 1068 void RegExpMacroAssemblerX64::SetRegister(int register_index, int to) {
1057 ASSERT(register_index >= num_saved_registers_); // Reserved for positions! 1069 ASSERT(register_index >= num_saved_registers_); // Reserved for positions!
1058 __ movq(register_location(register_index), Immediate(to)); 1070 __ movq(register_location(register_index), Immediate(to));
1059 } 1071 }
1060 1072
1061 1073
1062 void RegExpMacroAssemblerX64::Succeed() { 1074 void RegExpMacroAssemblerX64::Succeed() {
1063 __ jmp(&success_label_); 1075 __ jmp(&success_label_);
1064 } 1076 }
1065 1077
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
1363 } 1375 }
1364 } 1376 }
1365 1377
1366 #undef __ 1378 #undef __
1367 1379
1368 #endif // V8_INTERPRETED_REGEXP 1380 #endif // V8_INTERPRETED_REGEXP
1369 1381
1370 }} // namespace v8::internal 1382 }} // namespace v8::internal
1371 1383
1372 #endif // V8_TARGET_ARCH_X64 1384 #endif // V8_TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698