mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 831754 part 2 - Add patchable call instruction, x86/x64 part. r=dvander a=nonlibxul
This commit is contained in:
parent
97406e74ca
commit
7cad99bba1
@ -1246,6 +1246,12 @@ class AssemblerX86Shared
|
||||
JS_ASSERT(*ptr == 0xE9);
|
||||
*ptr = 0x3D;
|
||||
}
|
||||
static void ToggleCall(CodeLocationLabel inst, bool enabled) {
|
||||
uint8_t *ptr = (uint8_t *)inst.raw();
|
||||
JS_ASSERT(*ptr == 0x3D || // CMP
|
||||
*ptr == 0xE8); // CALL
|
||||
*ptr = enabled ? 0xE8 : 0x3D;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace ion
|
||||
|
@ -558,6 +558,15 @@ class Assembler : public AssemblerX86Shared
|
||||
addPendingJump(src, target->raw(), Relocation::IONCODE);
|
||||
}
|
||||
|
||||
// Emit a CALL or CMP (nop) instruction. ToggleCall can be used to patch
|
||||
// this instruction.
|
||||
CodeOffsetLabel toggledCall(IonCode *target, bool enabled) {
|
||||
CodeOffsetLabel offset(size());
|
||||
JmpSrc src = enabled ? masm.call() : masm.cmp_eax();
|
||||
addPendingJump(src, target->raw(), Relocation::IONCODE);
|
||||
return offset;
|
||||
}
|
||||
|
||||
// Do not mask shared implementations.
|
||||
using AssemblerX86Shared::call;
|
||||
|
||||
|
@ -369,6 +369,15 @@ class Assembler : public AssemblerX86Shared
|
||||
addPendingJump(src, target.asPointer(), Relocation::HARDCODED);
|
||||
}
|
||||
|
||||
// Emit a CALL or CMP (nop) instruction. ToggleCall can be used to patch
|
||||
// this instruction.
|
||||
CodeOffsetLabel toggledCall(IonCode *target, bool enabled) {
|
||||
CodeOffsetLabel offset(size());
|
||||
JmpSrc src = enabled ? masm.call() : masm.cmp_eax();
|
||||
addPendingJump(src, target->raw(), Relocation::IONCODE);
|
||||
return offset;
|
||||
}
|
||||
|
||||
// Re-routes pending jumps to an external target, flushing the label in the
|
||||
// process.
|
||||
void retarget(Label *label, void *target, Relocation::Kind reloc) {
|
||||
|
Loading…
Reference in New Issue
Block a user