Index: src/arm/macro-assembler-arm.cc |
diff --git a/src/arm/macro-assembler-arm.cc b/src/arm/macro-assembler-arm.cc |
index dc1dc1da9b68de5ce5753500fe4155ca951a00fb..37a4e0e8b1cc73dd412d37b8b0ac09e20df9dc76 100644 |
--- a/src/arm/macro-assembler-arm.cc |
+++ b/src/arm/macro-assembler-arm.cc |
@@ -642,20 +642,24 @@ void MacroAssembler::PopSafepointRegisters() { |
void MacroAssembler::PushSafepointRegistersAndDoubles() { |
+ // Number of d-regs not known at snapshot time. |
+ ASSERT(!Serializer::enabled()); |
PushSafepointRegisters(); |
- sub(sp, sp, Operand(DwVfpRegister::kNumAllocatableRegisters * |
+ sub(sp, sp, Operand(DwVfpRegister::NumAllocatableRegisters() * |
kDoubleSize)); |
- for (int i = 0; i < DwVfpRegister::kNumAllocatableRegisters; i++) { |
+ for (int i = 0; i < DwVfpRegister::NumAllocatableRegisters(); i++) { |
vstr(DwVfpRegister::FromAllocationIndex(i), sp, i * kDoubleSize); |
} |
} |
void MacroAssembler::PopSafepointRegistersAndDoubles() { |
- for (int i = 0; i < DwVfpRegister::kNumAllocatableRegisters; i++) { |
+ // Number of d-regs not known at snapshot time. |
+ ASSERT(!Serializer::enabled()); |
+ for (int i = 0; i < DwVfpRegister::NumAllocatableRegisters(); i++) { |
vldr(DwVfpRegister::FromAllocationIndex(i), sp, i * kDoubleSize); |
} |
- add(sp, sp, Operand(DwVfpRegister::kNumAllocatableRegisters * |
+ add(sp, sp, Operand(DwVfpRegister::NumAllocatableRegisters() * |
kDoubleSize)); |
PopSafepointRegisters(); |
} |
@@ -690,8 +694,10 @@ MemOperand MacroAssembler::SafepointRegisterSlot(Register reg) { |
MemOperand MacroAssembler::SafepointRegistersAndDoublesSlot(Register reg) { |
+ // Number of d-regs not known at snapshot time. |
+ ASSERT(!Serializer::enabled()); |
// General purpose registers are pushed last on the stack. |
- int doubles_size = DwVfpRegister::kNumAllocatableRegisters * kDoubleSize; |
+ int doubles_size = DwVfpRegister::NumAllocatableRegisters() * kDoubleSize; |
int register_offset = SafepointRegisterStackIndex(reg.code()) * kPointerSize; |
return MemOperand(sp, doubles_size + register_offset); |
} |
@@ -831,6 +837,50 @@ void MacroAssembler::Vmov(const DwVfpRegister dst, |
} |
+void MacroAssembler::Vpop(Register base, |
+ const DwVfpRegister first, |
+ const DwVfpRegister last, |
+ Condition cond) { |
+ ASSERT(CpuFeatures::IsEnabled(VFP2)); |
+ ASSERT_LE(first.code(), last.code()); |
+ |
+ const int first_code = first.code(); |
+ const int last_code = last.code(); |
+ const int count = last_code - first_code + 1; |
+ |
+ if (count <= 16) { |
+ vldm(ia_w, base, first, last, cond); |
+ } else { |
+ // Since we are increasing the address, load the first registers first. |
+ ASSERT(first_code < 16 && last_code >= 16); |
+ vldm(ia_w, base, first, d15, cond); |
+ vldm(ia_w, base, d16, last, cond); |
+ } |
+} |
+ |
+ |
+void MacroAssembler::Vpush(Register base, |
+ const DwVfpRegister first, |
+ const DwVfpRegister last, |
+ Condition cond) { |
+ ASSERT(CpuFeatures::IsEnabled(VFP2)); |
+ ASSERT_LE(first.code(), last.code()); |
+ |
+ const int first_code = first.code(); |
+ const int last_code = last.code(); |
+ const int count = last_code - first_code + 1; |
+ |
+ if (count <= 16) { |
+ vstm(db_w, base, first, last, cond); |
+ } else { |
+ // Since we are decreasing the address, write the last registers first. |
+ ASSERT(first_code < 16 && last_code >= 16); |
+ vstm(db_w, base, d16, last, cond); |
+ vstm(db_w, base, first, d15, cond); |
+ } |
+} |
+ |
+ |
void MacroAssembler::EnterFrame(StackFrame::Type type) { |
// r0-r3: preserved |
stm(db_w, sp, cp.bit() | fp.bit() | lr.bit()); |
@@ -878,12 +928,15 @@ void MacroAssembler::EnterExitFrame(bool save_doubles, int stack_space) { |
// Optionally save all double registers. |
if (save_doubles) { |
+ // Number of d-regs not known at snapshot time. |
+ ASSERT(!Serializer::enabled()); |
DwVfpRegister first = d0; |
DwVfpRegister last = |
- DwVfpRegister::from_code(DwVfpRegister::kNumRegisters - 1); |
- vstm(db_w, sp, first, last); |
+ DwVfpRegister::from_code(DwVfpRegister::NumAvailableRegisters() - 1); |
+ Vpush(sp, first, last); |
// Note that d0 will be accessible at |
- // fp - 2 * kPointerSize - DwVfpRegister::kNumRegisters * kDoubleSize, |
+ // fp - 2 * kPointerSize - |
+ // DwVfpRegister::NumAvailableRegisters() * kDoubleSize, |
// since the sp slot and code slot were pushed after the fp. |
} |
@@ -938,13 +991,16 @@ void MacroAssembler::LeaveExitFrame(bool save_doubles, |
Register argument_count) { |
// Optionally restore all double registers. |
if (save_doubles) { |
+ // Number of d-regs not known at snapshot time. |
+ ASSERT(!Serializer::enabled()); |
// Calculate the stack location of the saved doubles and restore them. |
const int offset = 2 * kPointerSize; |
- sub(r3, fp, Operand(offset + DwVfpRegister::kNumRegisters * kDoubleSize)); |
+ sub(r3, fp, Operand(offset + DwVfpRegister::NumAvailableRegisters() * |
+ kDoubleSize)); |
DwVfpRegister first = d0; |
DwVfpRegister last = |
- DwVfpRegister::from_code(DwVfpRegister::kNumRegisters - 1); |
- vldm(ia, r3, first, last); |
+ DwVfpRegister::from_code(DwVfpRegister::NumAvailableRegisters() - 1); |
+ Vpop(r3, first, last); |
} |
// Clear top frame. |