| Index: src/arm/regexp-macro-assembler-arm.cc
|
| diff --git a/src/arm/regexp-macro-assembler-arm.cc b/src/arm/regexp-macro-assembler-arm.cc
|
| index 11790e5183e54857bfeb00af3566d2e779037676..399b24a18ab8942af4bcfb326c40dfa2679d8add 100644
|
| --- a/src/arm/regexp-macro-assembler-arm.cc
|
| +++ b/src/arm/regexp-macro-assembler-arm.cc
|
| @@ -796,7 +796,7 @@ Handle<HeapObject> RegExpMacroAssemblerARM::GetCode(Handle<String> source) {
|
| for (int i = 0; i < num_saved_registers_; i += 2) {
|
| __ ldr(r2, register_location(i));
|
| __ ldr(r3, register_location(i + 1));
|
| - if (global()) {
|
| + if (i == 0 && global_with_zero_length_match()) {
|
| // Keep capture start in r4 for the zero-length check later.
|
| __ mov(r4, r2);
|
| }
|
| @@ -834,18 +834,22 @@ Handle<HeapObject> RegExpMacroAssemblerARM::GetCode(Handle<String> source) {
|
|
|
| // Prepare r0 to initialize registers with its value in the next run.
|
| __ ldr(r0, MemOperand(frame_pointer(), kInputStartMinusOne));
|
| - // Special case for zero-length matches.
|
| - // r4: capture start index
|
| - __ cmp(current_input_offset(), r4);
|
| - // Not a zero-length match, restart.
|
| - __ b(ne, &load_char_start_regexp);
|
| - // Offset from the end is zero if we already reached the end.
|
| - __ cmp(current_input_offset(), Operand(0));
|
| - __ b(eq, &exit_label_);
|
| - // Advance current position after a zero-length match.
|
| - __ add(current_input_offset(),
|
| - current_input_offset(),
|
| - Operand((mode_ == UC16) ? 2 : 1));
|
| +
|
| + if (global_with_zero_length_match()) {
|
| + // Special case for zero-length matches.
|
| + // r4: capture start index
|
| + __ cmp(current_input_offset(), r4);
|
| + // Not a zero-length match, restart.
|
| + __ b(ne, &load_char_start_regexp);
|
| + // Offset from the end is zero if we already reached the end.
|
| + __ cmp(current_input_offset(), Operand(0));
|
| + __ b(eq, &exit_label_);
|
| + // Advance current position after a zero-length match.
|
| + __ add(current_input_offset(),
|
| + current_input_offset(),
|
| + Operand((mode_ == UC16) ? 2 : 1));
|
| + }
|
| +
|
| __ b(&load_char_start_regexp);
|
| } else {
|
| __ mov(r0, Operand(SUCCESS));
|
|
|