mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 916912 - Remove Operand(void*) overload (r=jandem)
--HG-- extra : rebase_source : 26dd0e59e2a2ca660f74c13466dfe213683e53a3
This commit is contained in:
parent
36540f419c
commit
af4b33cc27
@ -169,8 +169,8 @@ struct ImmMaybeNurseryPtr : public ImmGCPtr
|
||||
struct AbsoluteAddress {
|
||||
void *addr;
|
||||
|
||||
explicit AbsoluteAddress(void *addr)
|
||||
: addr(addr)
|
||||
explicit AbsoluteAddress(const void *addr)
|
||||
: addr(const_cast<void*>(addr))
|
||||
{ }
|
||||
|
||||
AbsoluteAddress offset(ptrdiff_t delta) {
|
||||
@ -178,6 +178,20 @@ struct AbsoluteAddress {
|
||||
}
|
||||
};
|
||||
|
||||
// The same as AbsoluteAddress except that the intention is to patch this
|
||||
// instruction. The initial value of the immediate is 'addr' and this value is
|
||||
// either clobbered or used in the patching process.
|
||||
struct PatchedAbsoluteAddress {
|
||||
void *addr;
|
||||
|
||||
explicit PatchedAbsoluteAddress()
|
||||
: addr(NULL)
|
||||
{ }
|
||||
explicit PatchedAbsoluteAddress(const void *addr)
|
||||
: addr(const_cast<void*>(addr))
|
||||
{ }
|
||||
};
|
||||
|
||||
// Specifies an address computed in the form of a register base and a constant,
|
||||
// 32-bit offset.
|
||||
struct Address
|
||||
|
@ -163,10 +163,6 @@ class Operand
|
||||
: kind_(MEM_ADDRESS32),
|
||||
disp_(reinterpret_cast<int32_t>(address.addr))
|
||||
{ }
|
||||
explicit Operand(const void *address)
|
||||
: kind_(MEM_ADDRESS32),
|
||||
disp_(reinterpret_cast<int32_t>(address))
|
||||
{ }
|
||||
|
||||
Address toAddress() {
|
||||
JS_ASSERT(kind() == MEM_REG_DISP);
|
||||
@ -459,16 +455,6 @@ class Assembler : public AssemblerX86Shared
|
||||
label->reset();
|
||||
}
|
||||
|
||||
void movsd(const double *dp, const FloatRegister &dest) {
|
||||
JS_ASSERT(HasSSE2());
|
||||
masm.movsd_mr((const void *)dp, dest.code());
|
||||
}
|
||||
|
||||
void movss(const float *dp, const FloatRegister &dest) {
|
||||
JS_ASSERT(HasSSE2());
|
||||
masm.movss_mr((const void *)dp, dest.code());
|
||||
}
|
||||
|
||||
// Move a 32-bit immediate into a register where the immediate can be
|
||||
// patched.
|
||||
CodeOffsetLabel movlWithPatch(Imm32 imm, Register dest) {
|
||||
@ -476,38 +462,6 @@ class Assembler : public AssemblerX86Shared
|
||||
return masm.currentOffset();
|
||||
}
|
||||
|
||||
// Load from *addr where addr can be patched.
|
||||
CodeOffsetLabel movlWithPatch(void *addr, Register dest) {
|
||||
masm.movl_mr(addr, dest.code());
|
||||
return masm.currentOffset();
|
||||
}
|
||||
CodeOffsetLabel movsdWithPatch(void *addr, FloatRegister dest) {
|
||||
JS_ASSERT(HasSSE2());
|
||||
masm.movsd_mr(addr, dest.code());
|
||||
return masm.currentOffset();
|
||||
}
|
||||
CodeOffsetLabel movssWithPatch(void *addr, FloatRegister dest) {
|
||||
JS_ASSERT(HasSSE2());
|
||||
masm.movss_mr(addr, dest.code());
|
||||
return masm.currentOffset();
|
||||
}
|
||||
|
||||
// Store to *addr where addr can be patched
|
||||
CodeOffsetLabel movlWithPatch(Register src, void *addr) {
|
||||
masm.movl_rm(src.code(), addr);
|
||||
return masm.currentOffset();
|
||||
}
|
||||
CodeOffsetLabel movsdWithPatch(FloatRegister dest, void *addr) {
|
||||
JS_ASSERT(HasSSE2());
|
||||
masm.movsd_rm(dest.code(), addr);
|
||||
return masm.currentOffset();
|
||||
}
|
||||
CodeOffsetLabel movssWithPatch(FloatRegister dest, void *addr) {
|
||||
JS_ASSERT(HasSSE2());
|
||||
masm.movss_rm(dest.code(), addr);
|
||||
return masm.currentOffset();
|
||||
}
|
||||
|
||||
// Load from *(base + disp32) where disp32 can be patched.
|
||||
CodeOffsetLabel movsblWithPatch(Address src, Register dest) {
|
||||
masm.movsbl_mr_disp32(src.offset, src.base.code(), dest.code());
|
||||
@ -565,62 +519,64 @@ class Assembler : public AssemblerX86Shared
|
||||
}
|
||||
|
||||
// Load from *(addr + index*scale) where addr can be patched.
|
||||
CodeOffsetLabel movlWithPatch(void *addr, Register index, Scale scale, Register dest) {
|
||||
masm.movl_mr(addr, index.code(), scale, dest.code());
|
||||
CodeOffsetLabel movlWithPatch(PatchedAbsoluteAddress addr, Register index, Scale scale,
|
||||
Register dest)
|
||||
{
|
||||
masm.movl_mr(addr.addr, index.code(), scale, dest.code());
|
||||
return masm.currentOffset();
|
||||
}
|
||||
|
||||
// Load from *address where address can be patched.
|
||||
CodeOffsetLabel movsblWithPatch(const AbsoluteAddress &src, Register dest) {
|
||||
// Load from *src where src can be patched.
|
||||
CodeOffsetLabel movsblWithPatch(const PatchedAbsoluteAddress &src, Register dest) {
|
||||
masm.movsbl_mr(src.addr, dest.code());
|
||||
return masm.currentOffset();
|
||||
}
|
||||
CodeOffsetLabel movzblWithPatch(const AbsoluteAddress &src, Register dest) {
|
||||
CodeOffsetLabel movzblWithPatch(const PatchedAbsoluteAddress &src, Register dest) {
|
||||
masm.movzbl_mr(src.addr, dest.code());
|
||||
return masm.currentOffset();
|
||||
}
|
||||
CodeOffsetLabel movswlWithPatch(const AbsoluteAddress &src, Register dest) {
|
||||
CodeOffsetLabel movswlWithPatch(const PatchedAbsoluteAddress &src, Register dest) {
|
||||
masm.movswl_mr(src.addr, dest.code());
|
||||
return masm.currentOffset();
|
||||
}
|
||||
CodeOffsetLabel movzwlWithPatch(const AbsoluteAddress &src, Register dest) {
|
||||
CodeOffsetLabel movzwlWithPatch(const PatchedAbsoluteAddress &src, Register dest) {
|
||||
masm.movzwl_mr(src.addr, dest.code());
|
||||
return masm.currentOffset();
|
||||
}
|
||||
CodeOffsetLabel movlWithPatch(const AbsoluteAddress &src, Register dest) {
|
||||
CodeOffsetLabel movlWithPatch(const PatchedAbsoluteAddress &src, Register dest) {
|
||||
masm.movl_mr(src.addr, dest.code());
|
||||
return masm.currentOffset();
|
||||
}
|
||||
CodeOffsetLabel movssWithPatch(const AbsoluteAddress &src, FloatRegister dest) {
|
||||
CodeOffsetLabel movssWithPatch(const PatchedAbsoluteAddress &src, FloatRegister dest) {
|
||||
JS_ASSERT(HasSSE2());
|
||||
masm.movss_mr(src.addr, dest.code());
|
||||
return masm.currentOffset();
|
||||
}
|
||||
CodeOffsetLabel movsdWithPatch(const AbsoluteAddress &src, FloatRegister dest) {
|
||||
CodeOffsetLabel movsdWithPatch(const PatchedAbsoluteAddress &src, FloatRegister dest) {
|
||||
JS_ASSERT(HasSSE2());
|
||||
masm.movsd_mr(src.addr, dest.code());
|
||||
return masm.currentOffset();
|
||||
}
|
||||
|
||||
// Store to *address where address can be patched.
|
||||
CodeOffsetLabel movbWithPatch(Register src, const AbsoluteAddress &dest) {
|
||||
// Store to *dest where dest can be patched.
|
||||
CodeOffsetLabel movbWithPatch(Register src, const PatchedAbsoluteAddress &dest) {
|
||||
masm.movb_rm(src.code(), dest.addr);
|
||||
return masm.currentOffset();
|
||||
}
|
||||
CodeOffsetLabel movwWithPatch(Register src, const AbsoluteAddress &dest) {
|
||||
CodeOffsetLabel movwWithPatch(Register src, const PatchedAbsoluteAddress &dest) {
|
||||
masm.movw_rm(src.code(), dest.addr);
|
||||
return masm.currentOffset();
|
||||
}
|
||||
CodeOffsetLabel movlWithPatch(Register src, const AbsoluteAddress &dest) {
|
||||
CodeOffsetLabel movlWithPatch(Register src, const PatchedAbsoluteAddress &dest) {
|
||||
masm.movl_rm(src.code(), dest.addr);
|
||||
return masm.currentOffset();
|
||||
}
|
||||
CodeOffsetLabel movssWithPatch(FloatRegister src, const AbsoluteAddress &dest) {
|
||||
CodeOffsetLabel movssWithPatch(FloatRegister src, const PatchedAbsoluteAddress &dest) {
|
||||
JS_ASSERT(HasSSE2());
|
||||
masm.movss_rm(src.code(), dest.addr);
|
||||
return masm.currentOffset();
|
||||
}
|
||||
CodeOffsetLabel movsdWithPatch(FloatRegister src, const AbsoluteAddress &dest) {
|
||||
CodeOffsetLabel movsdWithPatch(FloatRegister src, const PatchedAbsoluteAddress &dest) {
|
||||
JS_ASSERT(HasSSE2());
|
||||
masm.movsd_rm(src.code(), dest.addr);
|
||||
return masm.currentOffset();
|
||||
|
@ -277,8 +277,7 @@ CodeGeneratorX86::visitInterruptCheck(LInterruptCheck *lir)
|
||||
if (!ool)
|
||||
return false;
|
||||
|
||||
void *interrupt = (void*)&GetIonContext()->runtime->interrupt;
|
||||
masm.cmpl(Operand(interrupt), Imm32(0));
|
||||
masm.cmpl(Operand(AbsoluteAddress(&GetIonContext()->runtime->interrupt)), Imm32(0));
|
||||
masm.j(Assembler::NonZero, ool->entry());
|
||||
masm.bind(ool->rejoin());
|
||||
return true;
|
||||
@ -494,10 +493,11 @@ CodeGeneratorX86::visitAsmJSLoadHeap(LAsmJSLoadHeap *ins)
|
||||
const LDefinition *out = ins->output();
|
||||
|
||||
if (ptr->isConstant()) {
|
||||
JS_ASSERT(mir->skipBoundsCheck());
|
||||
int32_t ptrImm = ptr->toConstant()->toInt32();
|
||||
JS_ASSERT(ptrImm >= 0);
|
||||
AbsoluteAddress srcAddr((void *) ptrImm);
|
||||
// The constant displacement still needs to be added to the as-yet-unknown
|
||||
// base address of the heap. For now, embed the displacement as an
|
||||
// immediate in the instruction. This displacement will fixed up when the
|
||||
// base address is known during dynamic linking (AsmJSModule::initHeap).
|
||||
PatchedAbsoluteAddress srcAddr((void *) ptr->toConstant()->toInt32());
|
||||
return loadViewTypeElement(vt, srcAddr, out);
|
||||
}
|
||||
|
||||
@ -534,7 +534,7 @@ bool
|
||||
CodeGeneratorX86::visitOutOfLineLoadTypedArrayOutOfBounds(OutOfLineLoadTypedArrayOutOfBounds *ool)
|
||||
{
|
||||
if (ool->dest().isFloat()) {
|
||||
masm.movsd(&js_NaN, ool->dest().fpu());
|
||||
masm.loadConstantDouble(js_NaN, ool->dest().fpu());
|
||||
} else {
|
||||
Register destReg = ool->dest().gpr();
|
||||
masm.xorl(destReg, destReg);
|
||||
@ -613,10 +613,11 @@ CodeGeneratorX86::visitAsmJSStoreHeap(LAsmJSStoreHeap *ins)
|
||||
const LAllocation *ptr = ins->ptr();
|
||||
|
||||
if (ptr->isConstant()) {
|
||||
JS_ASSERT(mir->skipBoundsCheck());
|
||||
int32_t ptrImm = ptr->toConstant()->toInt32();
|
||||
JS_ASSERT(ptrImm >= 0);
|
||||
AbsoluteAddress dstAddr((void *) ptrImm);
|
||||
// The constant displacement still needs to be added to the as-yet-unknown
|
||||
// base address of the heap. For now, embed the displacement as an
|
||||
// immediate in the instruction. This displacement will fixed up when the
|
||||
// base address is known during dynamic linking (AsmJSModule::initHeap).
|
||||
PatchedAbsoluteAddress dstAddr((void *) ptr->toConstant()->toInt32());
|
||||
return storeViewTypeElement(vt, value, dstAddr);
|
||||
}
|
||||
|
||||
@ -652,9 +653,9 @@ CodeGeneratorX86::visitAsmJSLoadGlobalVar(LAsmJSLoadGlobalVar *ins)
|
||||
|
||||
CodeOffsetLabel label;
|
||||
if (mir->type() == MIRType_Int32)
|
||||
label = masm.movlWithPatch(NULL, ToRegister(ins->output()));
|
||||
label = masm.movlWithPatch(PatchedAbsoluteAddress(), ToRegister(ins->output()));
|
||||
else
|
||||
label = masm.movsdWithPatch(NULL, ToFloatRegister(ins->output()));
|
||||
label = masm.movsdWithPatch(PatchedAbsoluteAddress(), ToFloatRegister(ins->output()));
|
||||
|
||||
return gen->noteGlobalAccess(label.offset(), mir->globalDataOffset());
|
||||
}
|
||||
@ -669,9 +670,9 @@ CodeGeneratorX86::visitAsmJSStoreGlobalVar(LAsmJSStoreGlobalVar *ins)
|
||||
|
||||
CodeOffsetLabel label;
|
||||
if (type == MIRType_Int32)
|
||||
label = masm.movlWithPatch(ToRegister(ins->value()), NULL);
|
||||
label = masm.movlWithPatch(ToRegister(ins->value()), PatchedAbsoluteAddress());
|
||||
else
|
||||
label = masm.movsdWithPatch(ToFloatRegister(ins->value()), NULL);
|
||||
label = masm.movsdWithPatch(ToFloatRegister(ins->value()), PatchedAbsoluteAddress());
|
||||
|
||||
return gen->noteGlobalAccess(label.offset(), mir->globalDataOffset());
|
||||
}
|
||||
@ -683,7 +684,7 @@ CodeGeneratorX86::visitAsmJSLoadFuncPtr(LAsmJSLoadFuncPtr *ins)
|
||||
|
||||
Register index = ToRegister(ins->index());
|
||||
Register out = ToRegister(ins->output());
|
||||
CodeOffsetLabel label = masm.movlWithPatch(NULL, index, TimesFour, out);
|
||||
CodeOffsetLabel label = masm.movlWithPatch(PatchedAbsoluteAddress(), index, TimesFour, out);
|
||||
|
||||
return gen->noteGlobalAccess(label.offset(), mir->globalDataOffset());
|
||||
}
|
||||
@ -694,7 +695,7 @@ CodeGeneratorX86::visitAsmJSLoadFFIFunc(LAsmJSLoadFFIFunc *ins)
|
||||
MAsmJSLoadFFIFunc *mir = ins->mir();
|
||||
|
||||
Register out = ToRegister(ins->output());
|
||||
CodeOffsetLabel label = masm.movlWithPatch(NULL, out);
|
||||
CodeOffsetLabel label = masm.movlWithPatch(PatchedAbsoluteAddress(), out);
|
||||
|
||||
return gen->noteGlobalAccess(label.offset(), mir->globalDataOffset());
|
||||
}
|
||||
|
@ -1042,8 +1042,7 @@ class MacroAssemblerX86 : public MacroAssemblerX86Shared
|
||||
// Save an exit frame (which must be aligned to the stack pointer) to
|
||||
// ThreadData::ionTop of the main thread.
|
||||
void linkExitFrame() {
|
||||
JSRuntime *runtime = GetIonContext()->runtime;
|
||||
movl(StackPointer, Operand(&runtime->mainThread.ionTop));
|
||||
movl(StackPointer, Operand(AbsoluteAddress(&GetIonContext()->runtime->mainThread.ionTop)));
|
||||
}
|
||||
|
||||
void callWithExitFrame(IonCode *target, Register dynStack) {
|
||||
|
Loading…
Reference in New Issue
Block a user