Index: src/ia32/regexp-macro-assembler-ia32.cc |
diff --git a/src/ia32/regexp-macro-assembler-ia32.cc b/src/ia32/regexp-macro-assembler-ia32.cc |
index 2aab7a8d943194c01d613a159446f8f59bf480a9..e2853e88c2463d0bddb245a9dad41e29ff30e2e2 100644 |
--- a/src/ia32/regexp-macro-assembler-ia32.cc |
+++ b/src/ia32/regexp-macro-assembler-ia32.cc |
@@ -133,7 +133,6 @@ int RegExpMacroAssemblerIA32::stack_limit_slack() { |
void RegExpMacroAssemblerIA32::AdvanceCurrentPosition(int by) { |
if (by != 0) { |
- Label inside_string; |
__ add(Operand(edi), Immediate(by * char_size())); |
} |
} |
@@ -964,6 +963,17 @@ void RegExpMacroAssemblerIA32::ReadStackPointerFromRegister(int reg) { |
__ add(backtrack_stackpointer(), Operand(ebp, kStackHighEnd)); |
} |
+void RegExpMacroAssemblerIA32::SetCurrentPositionFromEnd(int by) { |
+ NearLabel after_position; |
+ __ cmp(edi, -by * char_size()); |
+ __ j(greater_equal, &after_position); |
+ __ mov(edi, -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 RegExpMacroAssemblerIA32::SetRegister(int register_index, int to) { |
ASSERT(register_index >= num_saved_registers_); // Reserved for positions! |