Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1222)

Unified Diff: src/a64/regexp-macro-assembler-a64.cc

Issue 145293004: A64: Fix a bug in RegExpMacroAssemblerA64::ClearRegisters(). (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698