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..47c19c7e1f6fcdb04b547da39521ef1f7ad56c5b 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(greater_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 advanced 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)); |