Bug 817943 part 2. Make the x86-64 and ARM versions of passABIArg not generate no-op moves and add asserts to the moveResolver that there are no such moves. r=pierron,mjrosenberg

This commit is contained in:
Boris Zbarsky 2012-12-28 12:40:45 -08:00
parent a4c5ac5d5e
commit 497cb2e84e
3 changed files with 20 additions and 4 deletions

View File

@ -24,6 +24,8 @@ MoveResolver::resetState()
bool
MoveResolver::addMove(const MoveOperand &from, const MoveOperand &to, Move::Kind kind)
{
// Assert that we're not doing no-op moves.
JS_ASSERT(!(from == to));
PendingMove *pm = movePool_.allocate();
if (!pm)
return false;

View File

@ -2708,10 +2708,13 @@ MacroAssemblerARMCompat::passABIArg(const MoveOperand &from)
if (from.isDouble()) {
FloatRegister fr;
if (GetFloatArgReg(usedIntSlots_, usedFloatSlots_, &fr)) {
enoughMemory_ = moveResolver_.addMove(from, MoveOperand(fr), Move::DOUBLE);
if (!from.isFloatReg() || from.floatReg() != fr) {
enoughMemory_ = moveResolver_.addMove(from, MoveOperand(fr), Move::DOUBLE);
}
// else nothing to do; the value is in the right register already
} else {
// If (and only if) the integer registers have started spilling, do we
// need to take the double register's alignment into accoun
// need to take the double register's alignment into account
uint32_t disp = GetFloatArgStackDisp(usedIntSlots_, usedFloatSlots_, &padding_);
enoughMemory_ = moveResolver_.addMove(from, MoveOperand(sp, disp), Move::DOUBLE);
}
@ -2719,13 +2722,16 @@ MacroAssemblerARMCompat::passABIArg(const MoveOperand &from)
} else {
Register r;
if (GetIntArgReg(usedIntSlots_, usedFloatSlots_, &r)) {
enoughMemory_ = moveResolver_.addMove(from, MoveOperand(r), Move::GENERAL);
if (!from.isGeneralReg() || from.reg() != r) {
enoughMemory_ = moveResolver_.addMove(from, MoveOperand(r), Move::GENERAL);
}
// else nothing to do; the value is in the right register already
} else {
uint32_t disp = GetIntArgStackDisp(usedIntSlots_, usedFloatSlots_, &padding_);
fprintf(stderr, "Float on the stack! (%d)\n", disp);
enoughMemory_ = moveResolver_.addMove(from, MoveOperand(sp, disp), Move::GENERAL);
}
usedIntSlots_++;
usedIntSlots_++;
}
}

View File

@ -51,6 +51,10 @@ MacroAssemblerX64::passABIArg(const MoveOperand &from)
if (from.isDouble()) {
FloatRegister dest;
if (GetFloatArgReg(passedIntArgs_, passedFloatArgs_++, &dest)) {
if (from.isFloatReg() && from.floatReg() == dest) {
// Nothing to do; the value is in the right register already
return;
}
to = MoveOperand(dest);
} else {
to = MoveOperand(StackPointer, stackForCall_);
@ -60,6 +64,10 @@ MacroAssemblerX64::passABIArg(const MoveOperand &from)
} else {
Register dest;
if (GetIntArgReg(passedIntArgs_++, passedFloatArgs_, &dest)) {
if (from.isGeneralReg() && from.reg() == dest) {
// Nothing to do; the value is in the right register already
return;
}
to = MoveOperand(dest);
} else {
to = MoveOperand(StackPointer, stackForCall_);