Bug 914561 - Add AbsoluteAddress load32/store32 on x86/x64. r=nbp

This commit is contained in:
Jed Davis 2014-03-27 19:20:19 -07:00
parent 44d028c42e
commit 232e47276f
2 changed files with 28 additions and 2 deletions

View File

@ -78,6 +78,8 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared
using MacroAssemblerX86Shared::Pop;
using MacroAssemblerX86Shared::callWithExitFrame;
using MacroAssemblerX86Shared::branch32;
using MacroAssemblerX86Shared::load32;
using MacroAssemblerX86Shared::store32;
MacroAssemblerX64()
: inCall_(false),
@ -662,7 +664,7 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared
movq(Operand(address), dest);
} else {
mov(ImmPtr(address.addr), ScratchReg);
movq(Operand(ScratchReg, 0x0), dest);
loadPtr(Address(ScratchReg, 0x0), dest);
}
}
void loadPtr(const Address &address, Register dest) {
@ -678,6 +680,14 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared
loadPtr(src, dest);
shlq(Imm32(1), dest);
}
void load32(const AbsoluteAddress &address, Register dest) {
if (JSC::X86Assembler::isAddressImmediate(address.addr)) {
movl(Operand(address), dest);
} else {
mov(ImmPtr(address.addr), ScratchReg);
load32(Address(ScratchReg, 0x0), dest);
}
}
void storePtr(ImmWord imm, const Address &address) {
if ((intptr_t)imm.value <= INT32_MAX && (intptr_t)imm.value >= INT32_MIN) {
movq(Imm32((int32_t)imm.value), Operand(address));
@ -704,7 +714,15 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared
movq(src, Operand(address));
} else {
mov(ImmPtr(address.addr), ScratchReg);
movq(src, Operand(ScratchReg, 0x0));
storePtr(src, Address(ScratchReg, 0x0));
}
}
void store32(const Register &src, const AbsoluteAddress &address) {
if (JSC::X86Assembler::isAddressImmediate(address.addr)) {
movl(src, Operand(address));
} else {
mov(ImmPtr(address.addr), ScratchReg);
store32(src, Address(ScratchReg, 0x0));
}
}
void rshiftPtr(Imm32 imm, Register dest) {

View File

@ -69,6 +69,8 @@ class MacroAssemblerX86 : public MacroAssemblerX86Shared
using MacroAssemblerX86Shared::Pop;
using MacroAssemblerX86Shared::callWithExitFrame;
using MacroAssemblerX86Shared::branch32;
using MacroAssemblerX86Shared::load32;
using MacroAssemblerX86Shared::store32;
MacroAssemblerX86()
: inCall_(false),
@ -662,6 +664,9 @@ class MacroAssemblerX86 : public MacroAssemblerX86Shared
void loadPrivate(const Address &src, Register dest) {
movl(payloadOf(src), dest);
}
void load32(const AbsoluteAddress &address, Register dest) {
movl(Operand(address), dest);
}
void storePtr(ImmWord imm, const Address &address) {
movl(Imm32(imm.value), Operand(address));
}
@ -680,6 +685,9 @@ class MacroAssemblerX86 : public MacroAssemblerX86Shared
void storePtr(Register src, const AbsoluteAddress &address) {
movl(src, Operand(address));
}
void store32(Register src, const AbsoluteAddress &address) {
movl(src, Operand(address));
}
void setStackArg(const Register &reg, uint32_t arg) {
movl(reg, Operand(esp, arg * sizeof(intptr_t)));