Bug 1389401 - MIPS: Add MacroAssembler::storeRegsInMask. r=luke

see Bug 1322093
This commit is contained in:
loongson 2017-08-11 00:49:00 -04:00
Родитель 13b3220ca3
Коммит 765e5d359a
3 изменённых файлов: 67 добавлений и 1 удалений

Просмотреть файл

@ -429,7 +429,7 @@ class MacroAssembler : public MacroAssemblerSpecific
// |dest|. |dest| should point to the end of the reserved space, so the
// first register will be stored at |dest.offset - sizeof(register)|.
void storeRegsInMask(LiveRegisterSet set, Address dest, Register scratch)
DEFINED_ON(arm, arm64, x86_shared);
DEFINED_ON(arm, arm64, mips32, mips64, x86_shared);
void PopRegsInMask(LiveRegisterSet set);
void PopRegsInMask(LiveGeneralRegisterSet set);

Просмотреть файл

@ -2119,6 +2119,39 @@ MacroAssembler::PopRegsInMaskIgnore(LiveRegisterSet set, LiveRegisterSet ignore)
MOZ_ASSERT(diffG == 0);
}
void
MacroAssembler::storeRegsInMask(LiveRegisterSet set, Address dest, Register)
{
FloatRegisterSet fpuSet(set.fpus().reduceSetForPush());
unsigned numFpu = fpuSet.size();
int32_t diffF = fpuSet.getPushSizeInBytes();
int32_t diffG = set.gprs().size() * sizeof(intptr_t);
MOZ_ASSERT(dest.offset >= diffG + diffF);
for (GeneralRegisterBackwardIterator iter(set.gprs()); iter.more(); ++iter) {
diffG -= sizeof(intptr_t);
dest.offset -= sizeof(intptr_t);
storePtr(*iter, dest);
}
MOZ_ASSERT(diffG == 0);
for (FloatRegisterBackwardIterator iter(fpuSet); iter.more(); ++iter) {
FloatRegister reg = *iter;
diffF -= reg.size();
numFpu -= 1;
dest.offset -= reg.size();
if (reg.isDouble())
storeDouble(reg, dest);
else if (reg.isSingle())
storeFloat32(reg, dest);
else
MOZ_CRASH("Unknown register type.");
}
MOZ_ASSERT(numFpu == 0);
diffF -= diffF % sizeof(uintptr_t);
MOZ_ASSERT(diffF == 0);
}
// ===============================================================
// ABI function calls.

Просмотреть файл

@ -2277,6 +2277,39 @@ MacroAssembler::PopRegsInMaskIgnore(LiveRegisterSet set, LiveRegisterSet ignore)
freeStack(reserved);
}
void
MacroAssembler::storeRegsInMask(LiveRegisterSet set, Address dest, Register)
{
FloatRegisterSet fpuSet(set.fpus().reduceSetForPush());
unsigned numFpu = fpuSet.size();
int32_t diffF = fpuSet.getPushSizeInBytes();
int32_t diffG = set.gprs().size() * sizeof(intptr_t);
MOZ_ASSERT(dest.offset >= diffG + diffF);
for (GeneralRegisterBackwardIterator iter(set.gprs()); iter.more(); ++iter) {
diffG -= sizeof(intptr_t);
dest.offset -= sizeof(intptr_t);
storePtr(*iter, dest);
}
MOZ_ASSERT(diffG == 0);
for (FloatRegisterBackwardIterator iter(fpuSet); iter.more(); ++iter) {
FloatRegister reg = *iter;
diffF -= reg.size();
numFpu -= 1;
dest.offset -= reg.size();
if (reg.isDouble())
storeDouble(reg, dest);
else if (reg.isSingle())
storeFloat32(reg, dest);
else
MOZ_CRASH("Unknown register type.");
}
MOZ_ASSERT(numFpu == 0);
diffF -= diffF % sizeof(uintptr_t);
MOZ_ASSERT(diffF == 0);
}
// ===============================================================
// ABI function calls.