Reviewers: m.m.capewell,
Message:
Committed patchset #1 manually as r18837 (presubmit successful).
Description:
A64: Fix a bug in RegExpMacroAssemblerA64::ClearRegisters().
BUG=
[email protected]
Committed: https://code.google.com/p/v8/source/detail?r=18837
Please review this at https://codereview.chromium.org/145293004/
SVN Base: https://v8.googlecode.com/svn/branches/experimental/a64
Affected files (+18, -4 lines):
M src/a64/regexp-macro-assembler-a64.cc
Index: src/a64/regexp-macro-assembler-a64.cc
diff --git a/src/a64/regexp-macro-assembler-a64.cc
b/src/a64/regexp-macro-assembler-a64.cc
index
49feba6f76a0c4db6a0ceec279d5890c87972c0c..f7e01a546359f4363ec52711df745118b20f787b
100644
--- a/src/a64/regexp-macro-assembler-a64.cc
+++ b/src/a64/regexp-macro-assembler-a64.cc
@@ -1222,19 +1222,33 @@ void
RegExpMacroAssemblerA64::WriteCurrentPositionToRegister(int reg,
void RegExpMacroAssemblerA64::ClearRegisters(int reg_from, int reg_to) {
ASSERT(reg_from <= reg_to);
int num_registers = reg_to - reg_from + 1;
- if ((num_registers % 2) == 1) {
+
+ // If the first capture register is cached in a hardware register but not
+ // aligned on a 64-bit one, we need to clear the first one specifically.
+ if ((reg_from < kNumCachedRegisters) && ((reg_from % 2) != 0)) {
StoreRegister(reg_from, non_position_value());
num_registers--;
reg_from++;
}
- // Clear cached registers.
- while ((reg_from <= reg_to) && (reg_from < kNumCachedRegisters)) {
- ASSERT(GetRegisterState(reg_from) != STACKED);
+
+ // Clear cached registers in pairs as far as possible.
+ while ((num_registers >= 2) && (reg_from < kNumCachedRegisters)) {
+ ASSERT(GetRegisterState(reg_from) == CACHED_LSW);
__ Mov(GetCachedRegister(reg_from), twice_non_position_value());
reg_from += 2;
num_registers -= 2;
}
+
+ if ((num_registers % 2) == 1) {
+ StoreRegister(reg_from, non_position_value());
+ num_registers--;
+ reg_from++;
+ }
+
if (num_registers > 0) {
+ // If there are some remaining registers, they are stored on the stack.
+ ASSERT(reg_from >= kNumCachedRegisters);
+
// Move down the indexes of the registers on stack to get the correct
offset
// in memory.
reg_from -= kNumCachedRegisters;
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.