mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 917991 - IonMonkey: Various x86 MoveEmitter cleanups. r=jandem
This commit is contained in:
parent
06f521a291
commit
c4dd429013
@ -140,7 +140,7 @@ MoveEmitterX86::~MoveEmitterX86()
|
|||||||
assertDone();
|
assertDone();
|
||||||
}
|
}
|
||||||
|
|
||||||
Operand
|
Address
|
||||||
MoveEmitterX86::cycleSlot()
|
MoveEmitterX86::cycleSlot()
|
||||||
{
|
{
|
||||||
if (pushedAtCycle_ == -1) {
|
if (pushedAtCycle_ == -1) {
|
||||||
@ -149,7 +149,19 @@ MoveEmitterX86::cycleSlot()
|
|||||||
pushedAtCycle_ = masm.framePushed();
|
pushedAtCycle_ = masm.framePushed();
|
||||||
}
|
}
|
||||||
|
|
||||||
return Operand(StackPointer, masm.framePushed() - pushedAtCycle_);
|
return Address(StackPointer, masm.framePushed() - pushedAtCycle_);
|
||||||
|
}
|
||||||
|
|
||||||
|
Address
|
||||||
|
MoveEmitterX86::toAddress(const MoveOperand &operand) const
|
||||||
|
{
|
||||||
|
if (operand.base() != StackPointer)
|
||||||
|
return Address(operand.base(), operand.disp());
|
||||||
|
|
||||||
|
JS_ASSERT(operand.disp() >= 0);
|
||||||
|
|
||||||
|
// Otherwise, the stack offset may need to be adjusted.
|
||||||
|
return Address(StackPointer, operand.disp() + (masm.framePushed() - pushedAtStart_));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Warning, do not use the resulting operand with pop instructions, since they
|
// Warning, do not use the resulting operand with pop instructions, since they
|
||||||
@ -158,15 +170,8 @@ MoveEmitterX86::cycleSlot()
|
|||||||
Operand
|
Operand
|
||||||
MoveEmitterX86::toOperand(const MoveOperand &operand) const
|
MoveEmitterX86::toOperand(const MoveOperand &operand) const
|
||||||
{
|
{
|
||||||
if (operand.isMemory() || operand.isEffectiveAddress() || operand.isFloatAddress()) {
|
if (operand.isMemory() || operand.isEffectiveAddress() || operand.isFloatAddress())
|
||||||
if (operand.base() != StackPointer)
|
return Operand(toAddress(operand));
|
||||||
return Operand(operand.base(), operand.disp());
|
|
||||||
|
|
||||||
JS_ASSERT(operand.disp() >= 0);
|
|
||||||
|
|
||||||
// Otherwise, the stack offset may need to be adjusted.
|
|
||||||
return Operand(StackPointer, operand.disp() + (masm.framePushed() - pushedAtStart_));
|
|
||||||
}
|
|
||||||
if (operand.isGeneralReg())
|
if (operand.isGeneralReg())
|
||||||
return Operand(operand.reg());
|
return Operand(operand.reg());
|
||||||
|
|
||||||
@ -209,16 +214,13 @@ MoveEmitterX86::breakCycle(const MoveOperand &to, Move::Kind kind)
|
|||||||
// the original move to continue.
|
// the original move to continue.
|
||||||
if (kind == Move::DOUBLE) {
|
if (kind == Move::DOUBLE) {
|
||||||
if (to.isMemory()) {
|
if (to.isMemory()) {
|
||||||
masm.loadDouble(toOperand(to), ScratchFloatReg);
|
masm.loadDouble(toAddress(to), ScratchFloatReg);
|
||||||
masm.storeDouble(ScratchFloatReg, cycleSlot());
|
masm.storeDouble(ScratchFloatReg, cycleSlot());
|
||||||
} else {
|
} else {
|
||||||
masm.storeDouble(to.floatReg(), cycleSlot());
|
masm.storeDouble(to.floatReg(), cycleSlot());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (to.isMemory())
|
masm.Push(toOperand(to));
|
||||||
masm.Push(toOperand(to));
|
|
||||||
else
|
|
||||||
masm.Push(to.reg());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -234,7 +236,7 @@ MoveEmitterX86::completeCycle(const MoveOperand &to, Move::Kind kind)
|
|||||||
if (kind == Move::DOUBLE) {
|
if (kind == Move::DOUBLE) {
|
||||||
if (to.isMemory()) {
|
if (to.isMemory()) {
|
||||||
masm.loadDouble(cycleSlot(), ScratchFloatReg);
|
masm.loadDouble(cycleSlot(), ScratchFloatReg);
|
||||||
masm.storeDouble(ScratchFloatReg, toOperand(to));
|
masm.storeDouble(ScratchFloatReg, toAddress(to));
|
||||||
} else {
|
} else {
|
||||||
masm.loadDouble(cycleSlot(), to.floatReg());
|
masm.loadDouble(cycleSlot(), to.floatReg());
|
||||||
}
|
}
|
||||||
@ -255,14 +257,14 @@ MoveEmitterX86::emitGeneralMove(const MoveOperand &from, const MoveOperand &to)
|
|||||||
} else if (to.isGeneralReg()) {
|
} else if (to.isGeneralReg()) {
|
||||||
JS_ASSERT(from.isMemory() || from.isEffectiveAddress());
|
JS_ASSERT(from.isMemory() || from.isEffectiveAddress());
|
||||||
if (from.isMemory())
|
if (from.isMemory())
|
||||||
masm.mov(toOperand(from), to.reg());
|
masm.loadPtr(toAddress(from), to.reg());
|
||||||
else
|
else
|
||||||
masm.lea(toOperand(from), to.reg());
|
masm.lea(toOperand(from), to.reg());
|
||||||
} else if (from.isMemory()) {
|
} else if (from.isMemory()) {
|
||||||
// Memory to memory gpr move.
|
// Memory to memory gpr move.
|
||||||
#ifdef JS_CPU_X64
|
#ifdef JS_CPU_X64
|
||||||
// x64 has a ScratchReg. Use it.
|
// x64 has a ScratchReg. Use it.
|
||||||
masm.mov(toOperand(from), ScratchReg);
|
masm.loadPtr(toAddress(from), ScratchReg);
|
||||||
masm.mov(ScratchReg, toOperand(to));
|
masm.mov(ScratchReg, toOperand(to));
|
||||||
#else
|
#else
|
||||||
// No ScratchReg; bounce it off the stack.
|
// No ScratchReg; bounce it off the stack.
|
||||||
@ -292,12 +294,12 @@ MoveEmitterX86::emitDoubleMove(const MoveOperand &from, const MoveOperand &to)
|
|||||||
if (from.isFloatReg()) {
|
if (from.isFloatReg()) {
|
||||||
masm.movsd(from.floatReg(), toOperand(to));
|
masm.movsd(from.floatReg(), toOperand(to));
|
||||||
} else if (to.isFloatReg()) {
|
} else if (to.isFloatReg()) {
|
||||||
masm.loadDouble(toOperand(from), to.floatReg());
|
masm.loadDouble(toAddress(from), to.floatReg());
|
||||||
} else {
|
} else {
|
||||||
// Memory to memory float move.
|
// Memory to memory float move.
|
||||||
JS_ASSERT(from.isMemory());
|
JS_ASSERT(from.isMemory());
|
||||||
masm.loadDouble(toOperand(from), ScratchFloatReg);
|
masm.loadDouble(toAddress(from), ScratchFloatReg);
|
||||||
masm.storeDouble(ScratchFloatReg, toOperand(to));
|
masm.storeDouble(ScratchFloatReg, toAddress(to));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,7 +31,8 @@ class MoveEmitterX86
|
|||||||
int32_t pushedAtCycle_;
|
int32_t pushedAtCycle_;
|
||||||
|
|
||||||
void assertDone();
|
void assertDone();
|
||||||
Operand cycleSlot();
|
Address cycleSlot();
|
||||||
|
Address toAddress(const MoveOperand &operand) const;
|
||||||
Operand toOperand(const MoveOperand &operand) const;
|
Operand toOperand(const MoveOperand &operand) const;
|
||||||
Operand toPopOperand(const MoveOperand &operand) const;
|
Operand toPopOperand(const MoveOperand &operand) const;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user