Index: src/arm64/regexp-macro-assembler-arm64.cc |
diff --git a/src/arm64/regexp-macro-assembler-arm64.cc b/src/arm64/regexp-macro-assembler-arm64.cc |
index 490facd8f7963700892a0ba9232513ef71f2da8f..536580ab55200599cfa7544478798a8981cd411a 100644 |
--- a/src/arm64/regexp-macro-assembler-arm64.cc |
+++ b/src/arm64/regexp-macro-assembler-arm64.cc |
@@ -1481,7 +1481,12 @@ void RegExpMacroAssemblerARM64::BranchOrBacktrack(Condition condition, |
if (to == NULL) { |
to = &backtrack_label_; |
} |
- __ B(condition, to); |
+ // TODO(ulan): do direct jump when jump distance is known and fits in imm19. |
+ Condition inverted_condition = InvertCondition(condition); |
+ Label no_branch; |
+ __ B(inverted_condition, &no_branch); |
+ __ B(to); |
+ __ Bind(&no_branch); |
} |
void RegExpMacroAssemblerARM64::CompareAndBranchOrBacktrack(Register reg, |
@@ -1492,11 +1497,15 @@ void RegExpMacroAssemblerARM64::CompareAndBranchOrBacktrack(Register reg, |
if (to == NULL) { |
to = &backtrack_label_; |
} |
+ // TODO(ulan): do direct jump when jump distance is known and fits in imm19. |
+ Label no_branch; |
if (condition == eq) { |
- __ Cbz(reg, to); |
+ __ Cbnz(reg, &no_branch); |
} else { |
- __ Cbnz(reg, to); |
+ __ Cbz(reg, &no_branch); |
} |
+ __ B(to); |
+ __ Bind(&no_branch); |
} else { |
__ Cmp(reg, immediate); |
BranchOrBacktrack(condition, to); |