bug 894251: NEVER use mov to move the address of a call target. The tracer has no clue how to deal with a single instruction move (r=jandem)

This commit is contained in:
Marty Rosenberg 2013-07-26 03:50:22 -04:00
Родитель 769cb44b6f
Коммит 9590164ca2
2 изменённых файлов: 38 добавлений и 8 удалений

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

@ -389,11 +389,11 @@ MacroAssemblerARM::ma_mov(const ImmGCPtr &ptr, Register dest)
// before to recover the pointer, and not after.
writeDataRelocation(ptr);
RelocStyle rs;
if (hasMOVWT()) {
if (hasMOVWT())
rs = L_MOVWT;
} else {
else
rs = L_LDR;
}
ma_movPatchable(Imm32(ptr.value), dest, Always, rs);
}
@ -1527,7 +1527,13 @@ MacroAssemblerARMCompat::callWithExitFrame(IonCode *target)
Push(Imm32(descriptor)); // descriptor
addPendingJump(m_buffer.nextOffset(), target->raw(), Relocation::IONCODE);
ma_mov(Imm32((int) target->raw()), ScratchRegister);
RelocStyle rs;
if (hasMOVWT())
rs = L_MOVWT;
else
rs = L_LDR;
ma_movPatchable(Imm32((int) target->raw()), ScratchRegister, Always, rs);
ma_callIonHalfPush(ScratchRegister);
}
@ -1539,7 +1545,13 @@ MacroAssemblerARMCompat::callWithExitFrame(IonCode *target, Register dynStack)
Push(dynStack); // descriptor
addPendingJump(m_buffer.nextOffset(), target->raw(), Relocation::IONCODE);
ma_mov(Imm32((int) target->raw()), ScratchRegister);
RelocStyle rs;
if (hasMOVWT())
rs = L_MOVWT;
else
rs = L_LDR;
ma_movPatchable(Imm32((int) target->raw()), ScratchRegister, Always, rs);
ma_callIonHalfPush(ScratchRegister);
}
@ -2970,7 +2982,13 @@ MacroAssemblerARM::ma_callIonHalfPush(const Register r)
void
MacroAssemblerARM::ma_call(void *dest)
{
ma_mov(Imm32((uint32_t)dest), CallReg);
RelocStyle rs;
if (hasMOVWT())
rs = L_MOVWT;
else
rs = L_LDR;
ma_movPatchable(Imm32((uint32_t) dest), CallReg, Always, rs);
as_blx(CallReg);
}

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

@ -516,13 +516,25 @@ class MacroAssemblerARMCompat : public MacroAssemblerARM
void call(IonCode *c) {
BufferOffset bo = m_buffer.nextOffset();
addPendingJump(bo, c->raw(), Relocation::IONCODE);
ma_mov(Imm32((uint32_t)c->raw()), ScratchRegister);
RelocStyle rs;
if (hasMOVWT())
rs = L_MOVWT;
else
rs = L_LDR;
ma_movPatchable(Imm32((int) c->raw()), ScratchRegister, Always, rs);
ma_callIonHalfPush(ScratchRegister);
}
void branch(IonCode *c) {
BufferOffset bo = m_buffer.nextOffset();
addPendingJump(bo, c->raw(), Relocation::IONCODE);
ma_mov(Imm32((uint32_t)c->raw()), ScratchRegister);
RelocStyle rs;
if (hasMOVWT())
rs = L_MOVWT;
else
rs = L_LDR;
ma_movPatchable(Imm32((int) c->raw()), ScratchRegister, Always, rs);
ma_bx(ScratchRegister);
}
void branch(const Register reg) {