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

Unified Diff: src/x64/regexp-macro-assembler-x64.cc

Issue 3850005: Use finite-length end-anchored regexps to reduce part of regexp that is searched. (Closed)
Patch Set: Addressed review comments. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/x64/regexp-macro-assembler-x64.h ('k') | test/mjsunit/regexp.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/x64/regexp-macro-assembler-x64.cc
diff --git a/src/x64/regexp-macro-assembler-x64.cc b/src/x64/regexp-macro-assembler-x64.cc
index 91e2b449e015fe0ec42ad2c113a2c95c44864dcc..fa0e642e5eb815fd379cd07f9df6da28d0de3a66 100644
--- a/src/x64/regexp-macro-assembler-x64.cc
+++ b/src/x64/regexp-macro-assembler-x64.cc
@@ -145,7 +145,6 @@ int RegExpMacroAssemblerX64::stack_limit_slack() {
void RegExpMacroAssemblerX64::AdvanceCurrentPosition(int by) {
if (by != 0) {
- Label inside_string;
__ addq(rdi, Immediate(by * char_size()));
}
}
@@ -1053,6 +1052,19 @@ void RegExpMacroAssemblerX64::ReadStackPointerFromRegister(int reg) {
}
+void RegExpMacroAssemblerX64::SetCurrentPositionFromEnd(int by) {
+ NearLabel after_position;
+ __ cmpq(rdi, Immediate(-by * char_size()));
+ __ j(above_equal, &after_position);
+ __ movq(rdi, Immediate(-by * char_size()));
+ // On RegExp code entry (where this operation is used), the character before
+ // the current position is expected to be already loaded.
+ // We have advenced the position, so it's safe to read backwards.
+ LoadCurrentCharacterUnchecked(-1, 1);
+ __ bind(&after_position);
+}
+
+
void RegExpMacroAssemblerX64::SetRegister(int register_index, int to) {
ASSERT(register_index >= num_saved_registers_); // Reserved for positions!
__ movq(register_location(register_index), Immediate(to));
« no previous file with comments | « src/x64/regexp-macro-assembler-x64.h ('k') | test/mjsunit/regexp.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698