Revision: 18837
Author:   [email protected]
Date:     Fri Jan 24 16:43:03 2014 UTC
Log:      A64: Fix a bug in RegExpMacroAssemblerA64::ClearRegisters().

BUG=
[email protected]

Review URL: https://codereview.chromium.org/145293004
http://code.google.com/p/v8/source/detail?r=18837

Modified:
 /branches/experimental/a64/src/a64/regexp-macro-assembler-a64.cc

=======================================
--- /branches/experimental/a64/src/a64/regexp-macro-assembler-a64.cc Thu Jan 23 13:43:44 2014 UTC +++ /branches/experimental/a64/src/a64/regexp-macro-assembler-a64.cc Fri Jan 24 16:43:03 2014 UTC
@@ -1222,19 +1222,33 @@
 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.

Reply via email to