Bug 969436 - Changed the SafepointReader constructor to properly read safepoints, depending on the size of PackedRegisterMask; r=Nicolas B. Pierron

This commit is contained in:
Ben Hackett 2014-03-24 18:09:00 +01:00
parent 31ff8cb6de
commit b5def56582

View File

@ -43,12 +43,20 @@ SafepointWriter::writeOsiCallPointOffset(uint32_t osiCallPointOffset)
static void
WriteRegisterMask(CompactBufferWriter &stream, uint32_t bits)
{
if (sizeof(PackedRegisterMask) == 8)
if (sizeof(PackedRegisterMask) == 1)
stream.writeByte(bits);
else
stream.writeUnsigned(bits);
}
static int32_t
ReadRegisterMask(CompactBufferReader &stream)
{
if (sizeof(PackedRegisterMask) == 1)
return stream.readByte();
return stream.readUnsigned();
}
void
SafepointWriter::writeGcRegs(LSafepoint *safepoint)
{
@ -342,20 +350,20 @@ SafepointReader::SafepointReader(IonScript *script, const SafepointIndex *si)
osiCallPointOffset_ = stream_.readUnsigned();
// gcSpills is a subset of allGprSpills.
allGprSpills_ = GeneralRegisterSet(stream_.readUnsigned());
allGprSpills_ = GeneralRegisterSet(ReadRegisterMask(stream_));
if (allGprSpills_.empty()) {
gcSpills_ = allGprSpills_;
valueSpills_ = allGprSpills_;
slotsOrElementsSpills_ = allGprSpills_;
} else {
gcSpills_ = GeneralRegisterSet(stream_.readUnsigned());
slotsOrElementsSpills_ = GeneralRegisterSet(stream_.readUnsigned());
gcSpills_ = GeneralRegisterSet(ReadRegisterMask(stream_));
slotsOrElementsSpills_ = GeneralRegisterSet(ReadRegisterMask(stream_));
#ifdef JS_PUNBOX64
valueSpills_ = GeneralRegisterSet(stream_.readUnsigned());
valueSpills_ = GeneralRegisterSet(stream_.ReadRegisterMask(stream_));
#endif
}
allFloatSpills_ = FloatRegisterSet(stream_.readUnsigned());
allFloatSpills_ = FloatRegisterSet(ReadRegisterMask(stream_));
advanceFromGcRegs();
}