Bug 1138141 - x64: Add some padding after pushing an odd number of float32 registers. r=bbouvier

This commit is contained in:
Nicolas B. Pierron 2015-03-09 18:21:42 +01:00
parent 80219bece3
commit 09fb377e19
2 changed files with 14 additions and 1 deletions

View File

@ -56,6 +56,9 @@ MacroAssembler::PushRegsInMask(RegisterSet set, FloatRegisterSet simdSet)
storeUnalignedInt32x4(*iter, Address(StackPointer, diffF));
}
MOZ_ASSERT(numSimd == 0);
// x64 padding to keep the stack aligned on uintptr_t. Keep in sync with
// GetPushBytesInSize.
diffF -= diffF % sizeof(uintptr_t);
MOZ_ASSERT(diffF == 0);
}
@ -101,6 +104,9 @@ MacroAssembler::PopRegsInMaskIgnore(RegisterSet set, RegisterSet ignore, FloatRe
}
freeStack(reservedF);
MOZ_ASSERT(numDouble == 0);
// x64 padding to keep the stack aligned on uintptr_t. Keep in sync with
// GetPushBytesInSize.
diffF -= diffF % sizeof(uintptr_t);
MOZ_ASSERT(diffF == 0);
// On x86, use pop to pop the integer registers, if we're not going to

View File

@ -334,9 +334,16 @@ FloatRegister::GetPushSizeInBytes(const FloatRegisterSet &s)
SetType set32b = singleSet & ~set64b & ~set128b;
static_assert(Codes::AllPhysMask <= 0xffff, "We can safely use CountPopulation32");
uint32_t count32b = mozilla::CountPopulation32(set32b);
// If we have an odd number of 32 bits values, then we increase the size to
// keep the stack aligned on 8 bytes. Note: Keep in sync with
// PushRegsInMask, and PopRegsInMaskIgnore.
count32b += count32b & 1;
return mozilla::CountPopulation32(set128b) * (4 * sizeof(int32_t))
+ mozilla::CountPopulation32(set64b) * sizeof(double)
+ mozilla::CountPopulation32(set32b) * sizeof(float);
+ count32b * sizeof(float);
}
uint32_t
FloatRegister::getRegisterDumpOffsetInBytes()