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)); |