зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1364908 - Add MacroAssembler::branchToComputedAddress. r=jandem
This commit is contained in:
Родитель
e1a4ed2946
Коммит
d6ec64d163
|
@ -1266,6 +1266,9 @@ class MacroAssembler : public MacroAssemblerSpecific
|
||||||
inline void branchTestStringTruthy(bool truthy, const ValueOperand& value, Label* label)
|
inline void branchTestStringTruthy(bool truthy, const ValueOperand& value, Label* label)
|
||||||
DEFINED_ON(arm, arm64, mips32, mips64, x86_shared);
|
DEFINED_ON(arm, arm64, mips32, mips64, x86_shared);
|
||||||
|
|
||||||
|
// Create an unconditional branch to the address given as argument.
|
||||||
|
inline void branchToComputedAddress(const BaseIndex& address) PER_ARCH;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
// Implementation for branch* methods.
|
// Implementation for branch* methods.
|
||||||
|
|
|
@ -2057,6 +2057,21 @@ MacroAssembler::branchTestMagic(Condition cond, const Address& valaddr, JSWhyMag
|
||||||
branch32(cond, ToPayload(valaddr), Imm32(why), label);
|
branch32(cond, ToPayload(valaddr), Imm32(why), label);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
MacroAssembler::branchToComputedAddress(const BaseIndex& addr)
|
||||||
|
{
|
||||||
|
MOZ_ASSERT(addr.base == pc, "Unsupported jump from any other addresses.");
|
||||||
|
MOZ_ASSERT(addr.offset == 0, "NYI: offsets from pc should be shifted by the number of instructions.");
|
||||||
|
|
||||||
|
Register base = addr.base;
|
||||||
|
uint32_t scale = Imm32::ShiftOf(addr.scale).value;
|
||||||
|
|
||||||
|
ma_ldr(DTRAddr(base, DtrRegImmShift(addr.index, LSL, scale)), pc);
|
||||||
|
// When loading from pc, the pc is shifted to the next instruction, we
|
||||||
|
// add one extra instruction to accomodate for this shifted offset.
|
||||||
|
breakpoint();
|
||||||
|
}
|
||||||
|
|
||||||
// ========================================================================
|
// ========================================================================
|
||||||
// Memory access primitives.
|
// Memory access primitives.
|
||||||
void
|
void
|
||||||
|
|
|
@ -1656,6 +1656,12 @@ MacroAssembler::branchTestMagic(Condition cond, const Address& valaddr, JSWhyMag
|
||||||
B(label, cond);
|
B(label, cond);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
MacroAssembler::branchToComputedAddress(const BaseIndex& addr)
|
||||||
|
{
|
||||||
|
MOZ_CRASH("branchToComputedAddress");
|
||||||
|
}
|
||||||
|
|
||||||
// ========================================================================
|
// ========================================================================
|
||||||
// Memory access primitives.
|
// Memory access primitives.
|
||||||
void
|
void
|
||||||
|
|
|
@ -772,6 +772,13 @@ MacroAssembler::branchTestMagic(Condition cond, const Address& valaddr, JSWhyMag
|
||||||
cmpPtr(valaddr, ImmWord(magic));
|
cmpPtr(valaddr, ImmWord(magic));
|
||||||
j(cond, label);
|
j(cond, label);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
MacroAssembler::branchToComputedAddress(const BaseIndex& address)
|
||||||
|
{
|
||||||
|
jmp(Operand(address));
|
||||||
|
}
|
||||||
|
|
||||||
// ========================================================================
|
// ========================================================================
|
||||||
// Truncate floating point.
|
// Truncate floating point.
|
||||||
|
|
||||||
|
|
|
@ -1871,10 +1871,10 @@ CodeGeneratorX86Shared::emitTableSwitchDispatch(MTableSwitch* mir, Register inde
|
||||||
|
|
||||||
// Compute the position where a pointer to the right case stands.
|
// Compute the position where a pointer to the right case stands.
|
||||||
masm.mov(ool->jumpLabel()->patchAt(), base);
|
masm.mov(ool->jumpLabel()->patchAt(), base);
|
||||||
Operand pointer = Operand(base, index, ScalePointer);
|
BaseIndex pointer(base, index, ScalePointer);
|
||||||
|
|
||||||
// Jump to the right case
|
// Jump to the right case
|
||||||
masm.jmp(pointer);
|
masm.branchToComputedAddress(pointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -922,6 +922,12 @@ MacroAssembler::branchTestMagic(Condition cond, const Address& valaddr, JSWhyMag
|
||||||
branch32(cond, ToPayload(valaddr), Imm32(why), label);
|
branch32(cond, ToPayload(valaddr), Imm32(why), label);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
MacroAssembler::branchToComputedAddress(const BaseIndex& addr)
|
||||||
|
{
|
||||||
|
jmp(Operand(addr));
|
||||||
|
}
|
||||||
|
|
||||||
// ========================================================================
|
// ========================================================================
|
||||||
// Truncate floating point.
|
// Truncate floating point.
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче