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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 1204 matching lines...) Expand 10 before | Expand all | Expand 10 after
1215 position = w10; 1215 position = w10;
1216 __ Add(position, current_input_offset(), cp_offset * char_size()); 1216 __ Add(position, current_input_offset(), cp_offset * char_size());
1217 } 1217 }
1218 StoreRegister(reg, position); 1218 StoreRegister(reg, position);
1219 } 1219 }
1220 1220
1221 1221
1222 void RegExpMacroAssemblerA64::ClearRegisters(int reg_from, int reg_to) { 1222 void RegExpMacroAssemblerA64::ClearRegisters(int reg_from, int reg_to) {
1223 ASSERT(reg_from <= reg_to); 1223 ASSERT(reg_from <= reg_to);
1224 int num_registers = reg_to - reg_from + 1; 1224 int num_registers = reg_to - reg_from + 1;
1225
1226 // If the first capture register is cached in a hardware register but not
1227 // aligned on a 64-bit one, we need to clear the first one specifically.
1228 if ((reg_from < kNumCachedRegisters) && ((reg_from % 2) != 0)) {
1229 StoreRegister(reg_from, non_position_value());
1230 num_registers--;
1231 reg_from++;
1232 }
1233
1234 // Clear cached registers in pairs as far as possible.
1235 while ((num_registers >= 2) && (reg_from < kNumCachedRegisters)) {
1236 ASSERT(GetRegisterState(reg_from) == CACHED_LSW);
1237 __ Mov(GetCachedRegister(reg_from), twice_non_position_value());
1238 reg_from += 2;
1239 num_registers -= 2;
1240 }
1241
1225 if ((num_registers % 2) == 1) { 1242 if ((num_registers % 2) == 1) {
1226 StoreRegister(reg_from, non_position_value()); 1243 StoreRegister(reg_from, non_position_value());
1227 num_registers--; 1244 num_registers--;
1228 reg_from++; 1245 reg_from++;
1229 } 1246 }
1230 // Clear cached registers. 1247
1231 while ((reg_from <= reg_to) && (reg_from < kNumCachedRegisters)) {
1232 ASSERT(GetRegisterState(reg_from) != STACKED);
1233 __ Mov(GetCachedRegister(reg_from), twice_non_position_value());
1234 reg_from += 2;
1235 num_registers -= 2;
1236 }
1237 if (num_registers > 0) { 1248 if (num_registers > 0) {
1249 // If there are some remaining registers, they are stored on the stack.
1250 ASSERT(reg_from >= kNumCachedRegisters);
1251
1238 // Move down the indexes of the registers on stack to get the correct offset 1252 // Move down the indexes of the registers on stack to get the correct offset
1239 // in memory. 1253 // in memory.
1240 reg_from -= kNumCachedRegisters; 1254 reg_from -= kNumCachedRegisters;
1241 reg_to -= kNumCachedRegisters; 1255 reg_to -= kNumCachedRegisters;
1242 // We should not unroll the loop for less than 2 registers. 1256 // We should not unroll the loop for less than 2 registers.
1243 STATIC_ASSERT(kNumRegistersToUnroll > 2); 1257 STATIC_ASSERT(kNumRegistersToUnroll > 2);
1244 // We position the base pointer to (reg_from + 1). 1258 // We position the base pointer to (reg_from + 1).
1245 int base_offset = kFirstRegisterOnStack - 1259 int base_offset = kFirstRegisterOnStack -
1246 kWRegSizeInBytes - (kWRegSizeInBytes * reg_from); 1260 kWRegSizeInBytes - (kWRegSizeInBytes * reg_from);
1247 if (num_registers > kNumRegistersToUnroll) { 1261 if (num_registers > kNumRegistersToUnroll) {
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
1691 __ Ldrh(current_character(), MemOperand(input_end(), offset, SXTW)); 1705 __ Ldrh(current_character(), MemOperand(input_end(), offset, SXTW));
1692 } 1706 }
1693 } 1707 }
1694 } 1708 }
1695 1709
1696 #endif // V8_INTERPRETED_REGEXP 1710 #endif // V8_INTERPRETED_REGEXP
1697 1711
1698 }} // namespace v8::internal 1712 }} // namespace v8::internal
1699 1713
1700 #endif // V8_TARGET_ARCH_A64 1714 #endif // V8_TARGET_ARCH_A64
OLDNEW
« 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