mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1245112 - Part 2: Move MacroAssembler::branchPtr into generic macro assembler. r=nbp
This commit is contained in:
parent
324de88d70
commit
76c6cf4c25
@ -336,8 +336,64 @@ MacroAssembler::branchFunctionKind(Condition cond, JSFunction::FunctionKind kind
|
||||
branch32(cond, scratch, Imm32(bit), label);
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssembler::branchTestObjClass(Condition cond, Register obj, Register scratch, const js::Class* clasp,
|
||||
Label* label)
|
||||
{
|
||||
loadObjGroup(obj, scratch);
|
||||
branchPtr(cond, Address(scratch, ObjectGroup::offsetOfClasp()), ImmPtr(clasp), label);
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssembler::branchTestObjShape(Condition cond, Register obj, const Shape* shape, Label* label)
|
||||
{
|
||||
branchPtr(cond, Address(obj, JSObject::offsetOfShape()), ImmGCPtr(shape), label);
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssembler::branchTestObjShape(Condition cond, Register obj, Register shape, Label* label)
|
||||
{
|
||||
branchPtr(cond, Address(obj, JSObject::offsetOfShape()), shape, label);
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssembler::branchTestObjGroup(Condition cond, Register obj, ObjectGroup* group, Label* label)
|
||||
{
|
||||
branchPtr(cond, Address(obj, JSObject::offsetOfGroup()), ImmGCPtr(group), label);
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssembler::branchTestObjGroup(Condition cond, Register obj, Register group, Label* label)
|
||||
{
|
||||
branchPtr(cond, Address(obj, JSObject::offsetOfGroup()), group, label);
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssembler::branchTestProxyHandlerFamily(Condition cond, Register proxy, Register scratch,
|
||||
const void* handlerp, Label* label)
|
||||
{
|
||||
Address handlerAddr(proxy, ProxyObject::offsetOfHandler());
|
||||
loadPtr(handlerAddr, scratch);
|
||||
Address familyAddr(scratch, BaseProxyHandler::offsetOfFamily());
|
||||
branchPtr(cond, familyAddr, ImmPtr(handlerp), label);
|
||||
}
|
||||
|
||||
#ifndef JS_CODEGEN_ARM64
|
||||
|
||||
template <typename T>
|
||||
void
|
||||
MacroAssembler::branchStackPtr(Condition cond, T rhs, Label* label)
|
||||
{
|
||||
branchPtr(cond, getStackPointer(), rhs, label);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void
|
||||
MacroAssembler::branchStackPtrRhs(Condition cond, T lhs, Label* label)
|
||||
{
|
||||
branchPtr(cond, lhs, getStackPointer(), label);
|
||||
}
|
||||
|
||||
template <typename T> void
|
||||
MacroAssembler::addToStackPtr(T t)
|
||||
{
|
||||
|
@ -2538,6 +2538,13 @@ MacroAssembler::linkSelfReference(JitCode* code)
|
||||
|
||||
//}}} check_macroassembler_style
|
||||
|
||||
void
|
||||
MacroAssembler::BranchGCPtr::emit(MacroAssembler& masm)
|
||||
{
|
||||
MOZ_ASSERT(isInitialized());
|
||||
masm.branchPtr(cond(), reg(), ptr_, jump());
|
||||
}
|
||||
|
||||
namespace js {
|
||||
namespace jit {
|
||||
|
||||
|
@ -325,10 +325,7 @@ class MacroAssembler : public MacroAssemblerSpecific
|
||||
ptr_(ptr)
|
||||
{ }
|
||||
|
||||
void emit(MacroAssembler& masm) {
|
||||
MOZ_ASSERT(isInitialized());
|
||||
masm.branchPtr(cond(), reg(), ptr_, jump());
|
||||
}
|
||||
void emit(MacroAssembler& masm);
|
||||
};
|
||||
|
||||
mozilla::Maybe<AutoRooter> autoRooter_;
|
||||
@ -801,6 +798,25 @@ class MacroAssembler : public MacroAssemblerSpecific
|
||||
// ===============================================================
|
||||
// Branch functions
|
||||
|
||||
inline void branchPtr(Condition cond, Register lhs, Register rhs, Label* label) PER_SHARED_ARCH;
|
||||
inline void branchPtr(Condition cond, Register lhs, Imm32 rhs, Label* label) PER_SHARED_ARCH;
|
||||
inline void branchPtr(Condition cond, Register lhs, ImmPtr rhs, Label* label) PER_SHARED_ARCH;
|
||||
inline void branchPtr(Condition cond, Register lhs, ImmGCPtr rhs, Label* label) PER_SHARED_ARCH;
|
||||
inline void branchPtr(Condition cond, Register lhs, ImmWord rhs, Label* label) PER_SHARED_ARCH;
|
||||
|
||||
inline void branchPtr(Condition cond, const Address& lhs, Register rhs, Label* label) PER_SHARED_ARCH;
|
||||
inline void branchPtr(Condition cond, const Address& lhs, ImmPtr rhs, Label* label) PER_SHARED_ARCH;
|
||||
inline void branchPtr(Condition cond, const Address& lhs, ImmGCPtr rhs, Label* label) PER_SHARED_ARCH;
|
||||
inline void branchPtr(Condition cond, const Address& lhs, ImmWord rhs, Label* label) PER_SHARED_ARCH;
|
||||
|
||||
inline void branchPtr(Condition cond, const AbsoluteAddress& lhs, Register rhs, Label* label)
|
||||
DEFINED_ON(arm, arm64, mips_shared, x86, x64);
|
||||
inline void branchPtr(Condition cond, const AbsoluteAddress& lhs, ImmWord rhs, Label* label)
|
||||
DEFINED_ON(arm, arm64, mips_shared, x86, x64);
|
||||
|
||||
inline void branchPtr(Condition cond, wasm::SymbolicAddress lhs, Register rhs, Label* label)
|
||||
DEFINED_ON(arm, arm64, mips_shared, x86, x64);
|
||||
|
||||
// This function compares a Value (lhs) which is having a private pointer
|
||||
// boxed inside a js::Value, with a raw pointer (rhs).
|
||||
inline void branchPrivatePtr(Condition cond, const Address& lhs, Register rhs, Label* label) PER_ARCH;
|
||||
@ -832,30 +848,14 @@ class MacroAssembler : public MacroAssemblerSpecific
|
||||
loadObjGroup(objReg, dest);
|
||||
loadPtr(Address(dest, ObjectGroup::offsetOfClasp()), dest);
|
||||
}
|
||||
void branchTestObjClass(Condition cond, Register obj, Register scratch, const js::Class* clasp,
|
||||
Label* label) {
|
||||
loadObjGroup(obj, scratch);
|
||||
branchPtr(cond, Address(scratch, ObjectGroup::offsetOfClasp()), ImmPtr(clasp), label);
|
||||
}
|
||||
void branchTestObjShape(Condition cond, Register obj, const Shape* shape, Label* label) {
|
||||
branchPtr(cond, Address(obj, JSObject::offsetOfShape()), ImmGCPtr(shape), label);
|
||||
}
|
||||
void branchTestObjShape(Condition cond, Register obj, Register shape, Label* label) {
|
||||
branchPtr(cond, Address(obj, JSObject::offsetOfShape()), shape, label);
|
||||
}
|
||||
void branchTestObjGroup(Condition cond, Register obj, ObjectGroup* group, Label* label) {
|
||||
branchPtr(cond, Address(obj, JSObject::offsetOfGroup()), ImmGCPtr(group), label);
|
||||
}
|
||||
void branchTestObjGroup(Condition cond, Register obj, Register group, Label* label) {
|
||||
branchPtr(cond, Address(obj, JSObject::offsetOfGroup()), group, label);
|
||||
}
|
||||
void branchTestProxyHandlerFamily(Condition cond, Register proxy, Register scratch,
|
||||
const void* handlerp, Label* label) {
|
||||
Address handlerAddr(proxy, ProxyObject::offsetOfHandler());
|
||||
loadPtr(handlerAddr, scratch);
|
||||
Address familyAddr(scratch, BaseProxyHandler::offsetOfFamily());
|
||||
branchPtr(cond, familyAddr, ImmPtr(handlerp), label);
|
||||
}
|
||||
inline void branchTestObjClass(Condition cond, Register obj, Register scratch, const js::Class* clasp,
|
||||
Label* label);
|
||||
inline void branchTestObjShape(Condition cond, Register obj, const Shape* shape, Label* label);
|
||||
inline void branchTestObjShape(Condition cond, Register obj, Register shape, Label* label);
|
||||
inline void branchTestObjGroup(Condition cond, Register obj, ObjectGroup* group, Label* label);
|
||||
inline void branchTestObjGroup(Condition cond, Register obj, Register group, Label* label);
|
||||
inline void branchTestProxyHandlerFamily(Condition cond, Register proxy, Register scratch,
|
||||
const void* handlerp, Label* label);
|
||||
|
||||
template <typename Value>
|
||||
void branchTestMIRType(Condition cond, const Value& val, MIRType type, Label* label) {
|
||||
@ -1344,13 +1344,9 @@ class MacroAssembler : public MacroAssemblerSpecific
|
||||
branchTestPtr(cond, getStackPointer(), t, label);
|
||||
}
|
||||
template <typename T>
|
||||
void branchStackPtr(Condition cond, T rhs, Label* label) {
|
||||
branchPtr(cond, getStackPointer(), rhs, label);
|
||||
}
|
||||
inline void branchStackPtr(Condition cond, T rhs, Label* label);
|
||||
template <typename T>
|
||||
void branchStackPtrRhs(Condition cond, T lhs, Label* label) {
|
||||
branchPtr(cond, lhs, getStackPointer(), label);
|
||||
}
|
||||
inline void branchStackPtrRhs(Condition cond, T lhs, Label* label);
|
||||
#endif // !JS_CODEGEN_ARM64
|
||||
|
||||
public:
|
||||
|
@ -393,6 +393,90 @@ MacroAssembler::rshift64(Imm32 imm, Register64 dest)
|
||||
// ===============================================================
|
||||
// Branch functions
|
||||
|
||||
void
|
||||
MacroAssembler::branchPtr(Condition cond, Register lhs, Register rhs, Label* label)
|
||||
{
|
||||
branch32(cond, lhs, rhs, label);
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssembler::branchPtr(Condition cond, Register lhs, Imm32 rhs, Label* label)
|
||||
{
|
||||
branch32(cond, lhs, rhs, label);
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssembler::branchPtr(Condition cond, Register lhs, ImmPtr rhs, Label* label)
|
||||
{
|
||||
branchPtr(cond, lhs, ImmWord(uintptr_t(rhs.value)), label);
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssembler::branchPtr(Condition cond, Register lhs, ImmGCPtr rhs, Label* label)
|
||||
{
|
||||
ScratchRegisterScope scratch(*this);
|
||||
movePtr(rhs, scratch);
|
||||
branchPtr(cond, lhs, scratch, label);
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssembler::branchPtr(Condition cond, Register lhs, ImmWord rhs, Label* label)
|
||||
{
|
||||
branch32(cond, lhs, Imm32(rhs.value), label);
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssembler::branchPtr(Condition cond, const Address& lhs, Register rhs, Label* label)
|
||||
{
|
||||
branch32(cond, lhs, rhs, label);
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssembler::branchPtr(Condition cond, const Address& lhs, ImmPtr rhs, Label* label)
|
||||
{
|
||||
branchPtr(cond, lhs, ImmWord(uintptr_t(rhs.value)), label);
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssembler::branchPtr(Condition cond, const Address& lhs, ImmGCPtr rhs, Label* label)
|
||||
{
|
||||
AutoRegisterScope scratch2(*this, secondScratchReg_);
|
||||
loadPtr(lhs, scratch2);
|
||||
branchPtr(cond, scratch2, rhs, label);
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssembler::branchPtr(Condition cond, const Address& lhs, ImmWord rhs, Label* label)
|
||||
{
|
||||
AutoRegisterScope scratch2(*this, secondScratchReg_);
|
||||
loadPtr(lhs, scratch2);
|
||||
branchPtr(cond, scratch2, rhs, label);
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssembler::branchPtr(Condition cond, const AbsoluteAddress& lhs, Register rhs, Label* label)
|
||||
{
|
||||
ScratchRegisterScope scratch(*this);
|
||||
loadPtr(lhs, scratch);
|
||||
branchPtr(cond, scratch, rhs, label);
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssembler::branchPtr(Condition cond, const AbsoluteAddress& lhs, ImmWord rhs, Label* label)
|
||||
{
|
||||
ScratchRegisterScope scratch(*this);
|
||||
loadPtr(lhs, scratch);
|
||||
branchPtr(cond, scratch, rhs, label);
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssembler::branchPtr(Condition cond, wasm::SymbolicAddress lhs, Register rhs, Label* label)
|
||||
{
|
||||
ScratchRegisterScope scratch(*this);
|
||||
loadPtr(lhs, scratch);
|
||||
branchPtr(cond, scratch, rhs, label);
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssembler::branchPrivatePtr(Condition cond, const Address& lhs, Register rhs, Label* label)
|
||||
{
|
||||
|
@ -2963,18 +2963,18 @@ MacroAssemblerARMCompat::branchTestValue(Condition cond, const Address& valaddr,
|
||||
// Check payload before tag, since payload is more likely to differ.
|
||||
if (cond == NotEqual) {
|
||||
ma_ldr(ToPayload(valaddr), scratch);
|
||||
branchPtr(NotEqual, scratch, value.payloadReg(), label);
|
||||
asMasm().branchPtr(NotEqual, scratch, value.payloadReg(), label);
|
||||
|
||||
ma_ldr(ToType(valaddr), scratch);
|
||||
branchPtr(NotEqual, scratch, value.typeReg(), label);
|
||||
asMasm().branchPtr(NotEqual, scratch, value.typeReg(), label);
|
||||
} else {
|
||||
Label fallthrough;
|
||||
|
||||
ma_ldr(ToPayload(valaddr), scratch);
|
||||
branchPtr(NotEqual, scratch, value.payloadReg(), &fallthrough);
|
||||
asMasm().branchPtr(NotEqual, scratch, value.payloadReg(), &fallthrough);
|
||||
|
||||
ma_ldr(ToType(valaddr), scratch);
|
||||
branchPtr(Equal, scratch, value.typeReg(), label);
|
||||
asMasm().branchPtr(Equal, scratch, value.typeReg(), label);
|
||||
|
||||
bind(&fallthrough);
|
||||
}
|
||||
|
@ -818,9 +818,6 @@ class MacroAssemblerARMCompat : public MacroAssemblerARM
|
||||
load32(lhs, scratch2);
|
||||
branch32(cond, scratch2, rhs, label);
|
||||
}
|
||||
void branchPtr(Condition cond, const Address& lhs, Register rhs, Label* label) {
|
||||
branch32(cond, lhs, rhs, label);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void branchTestDouble(Condition cond, const T & t, Label* label) {
|
||||
@ -921,28 +918,6 @@ class MacroAssemblerARMCompat : public MacroAssemblerARM
|
||||
void branchTestPtr(Condition cond, const Address& lhs, Imm32 imm, Label* label) {
|
||||
branchTest32(cond, lhs, imm, label);
|
||||
}
|
||||
void branchPtr(Condition cond, Register lhs, Register rhs, Label* label) {
|
||||
branch32(cond, lhs, rhs, label);
|
||||
}
|
||||
void branchPtr(Condition cond, Register lhs, ImmGCPtr ptr, Label* label) {
|
||||
ScratchRegisterScope scratch(asMasm());
|
||||
movePtr(ptr, scratch);
|
||||
branchPtr(cond, lhs, scratch, label);
|
||||
}
|
||||
void branchPtr(Condition cond, Register lhs, ImmWord imm, Label* label) {
|
||||
branch32(cond, lhs, Imm32(imm.value), label);
|
||||
}
|
||||
void branchPtr(Condition cond, Register lhs, ImmPtr imm, Label* label) {
|
||||
branchPtr(cond, lhs, ImmWord(uintptr_t(imm.value)), label);
|
||||
}
|
||||
void branchPtr(Condition cond, Register lhs, wasm::SymbolicAddress imm, Label* label) {
|
||||
ScratchRegisterScope scratch(asMasm());
|
||||
movePtr(imm, scratch);
|
||||
branchPtr(cond, lhs, scratch, label);
|
||||
}
|
||||
void branchPtr(Condition cond, Register lhs, Imm32 imm, Label* label) {
|
||||
branch32(cond, lhs, imm, label);
|
||||
}
|
||||
void decBranchPtr(Condition cond, Register lhs, Imm32 imm, Label* label) {
|
||||
ma_sub(imm, lhs, SetCC);
|
||||
as_b(label, cond);
|
||||
@ -967,39 +942,6 @@ class MacroAssemblerARMCompat : public MacroAssemblerARM
|
||||
ma_cmp(scratch2, ptr);
|
||||
return jumpWithPatch(label, cond);
|
||||
}
|
||||
void branchPtr(Condition cond, Address addr, ImmGCPtr ptr, Label* label) {
|
||||
AutoRegisterScope scratch2(asMasm(), secondScratchReg_);
|
||||
ma_ldr(addr, scratch2);
|
||||
ma_cmp(scratch2, ptr);
|
||||
ma_b(label, cond);
|
||||
}
|
||||
void branchPtr(Condition cond, Address addr, ImmWord ptr, Label* label) {
|
||||
AutoRegisterScope scratch2(asMasm(), secondScratchReg_);
|
||||
ma_ldr(addr, scratch2);
|
||||
ma_cmp(scratch2, ptr);
|
||||
ma_b(label, cond);
|
||||
}
|
||||
void branchPtr(Condition cond, Address addr, ImmPtr ptr, Label* label) {
|
||||
branchPtr(cond, addr, ImmWord(uintptr_t(ptr.value)), label);
|
||||
}
|
||||
void branchPtr(Condition cond, AbsoluteAddress addr, Register ptr, Label* label) {
|
||||
ScratchRegisterScope scratch(asMasm());
|
||||
loadPtr(addr, scratch);
|
||||
ma_cmp(scratch, ptr);
|
||||
ma_b(label, cond);
|
||||
}
|
||||
void branchPtr(Condition cond, AbsoluteAddress addr, ImmWord ptr, Label* label) {
|
||||
ScratchRegisterScope scratch(asMasm());
|
||||
loadPtr(addr, scratch);
|
||||
ma_cmp(scratch, ptr);
|
||||
ma_b(label, cond);
|
||||
}
|
||||
void branchPtr(Condition cond, wasm::SymbolicAddress addr, Register ptr, Label* label) {
|
||||
ScratchRegisterScope scratch(asMasm());
|
||||
loadPtr(addr, scratch);
|
||||
ma_cmp(scratch, ptr);
|
||||
ma_b(label, cond);
|
||||
}
|
||||
void branch32(Condition cond, AbsoluteAddress lhs, Imm32 rhs, Label* label) {
|
||||
AutoRegisterScope scratch2(asMasm(), secondScratchReg_);
|
||||
loadPtr(lhs, scratch2); // ma_cmp will use the scratch register.
|
||||
|
@ -438,6 +438,118 @@ MacroAssembler::rshift64(Imm32 imm, Register64 dest)
|
||||
// ===============================================================
|
||||
// Branch functions
|
||||
|
||||
void
|
||||
MacroAssembler::branchPtr(Condition cond, Register lhs, Register rhs, Label* label)
|
||||
{
|
||||
Cmp(ARMRegister(lhs, 64), ARMRegister(rhs, 64));
|
||||
B(label, cond);
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssembler::branchPtr(Condition cond, Register lhs, Imm32 rhs, Label* label)
|
||||
{
|
||||
cmpPtr(lhs, rhs);
|
||||
B(label, cond);
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssembler::branchPtr(Condition cond, Register lhs, ImmPtr rhs, Label* label)
|
||||
{
|
||||
cmpPtr(lhs, rhs);
|
||||
B(label, cond);
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssembler::branchPtr(Condition cond, Register lhs, ImmGCPtr rhs, Label* label)
|
||||
{
|
||||
vixl::UseScratchRegisterScope temps(this);
|
||||
const Register scratch = temps.AcquireX().asUnsized();
|
||||
MOZ_ASSERT(scratch != lhs);
|
||||
movePtr(rhs, scratch);
|
||||
branchPtr(cond, lhs, scratch, label);
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssembler::branchPtr(Condition cond, Register lhs, ImmWord rhs, Label* label)
|
||||
{
|
||||
cmpPtr(lhs, rhs);
|
||||
B(label, cond);
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssembler::branchPtr(Condition cond, const Address& lhs, Register rhs, Label* label)
|
||||
{
|
||||
vixl::UseScratchRegisterScope temps(this);
|
||||
const Register scratch = temps.AcquireX().asUnsized();
|
||||
MOZ_ASSERT(scratch != lhs.base);
|
||||
MOZ_ASSERT(scratch != rhs);
|
||||
loadPtr(lhs, scratch);
|
||||
branchPtr(cond, scratch, rhs, label);
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssembler::branchPtr(Condition cond, const Address& lhs, ImmPtr rhs, Label* label)
|
||||
{
|
||||
vixl::UseScratchRegisterScope temps(this);
|
||||
const Register scratch = temps.AcquireX().asUnsized();
|
||||
MOZ_ASSERT(scratch != lhs.base);
|
||||
loadPtr(lhs, scratch);
|
||||
branchPtr(cond, scratch, rhs, label);
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssembler::branchPtr(Condition cond, const Address& lhs, ImmGCPtr rhs, Label* label)
|
||||
{
|
||||
vixl::UseScratchRegisterScope temps(this);
|
||||
const ARMRegister scratch1_64 = temps.AcquireX();
|
||||
const ARMRegister scratch2_64 = temps.AcquireX();
|
||||
MOZ_ASSERT(scratch1_64.asUnsized() != lhs.base);
|
||||
MOZ_ASSERT(scratch2_64.asUnsized() != lhs.base);
|
||||
|
||||
movePtr(rhs, scratch1_64.asUnsized());
|
||||
loadPtr(lhs, scratch2_64.asUnsized());
|
||||
branchPtr(cond, scratch2_64.asUnsized(), scratch1_64.asUnsized(), label);
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssembler::branchPtr(Condition cond, const Address& lhs, ImmWord rhs, Label* label)
|
||||
{
|
||||
vixl::UseScratchRegisterScope temps(this);
|
||||
const Register scratch = temps.AcquireX().asUnsized();
|
||||
MOZ_ASSERT(scratch != lhs.base);
|
||||
loadPtr(lhs, scratch);
|
||||
branchPtr(cond, scratch, rhs, label);
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssembler::branchPtr(Condition cond, const AbsoluteAddress& lhs, Register rhs, Label* label)
|
||||
{
|
||||
vixl::UseScratchRegisterScope temps(this);
|
||||
const Register scratch = temps.AcquireX().asUnsized();
|
||||
MOZ_ASSERT(scratch != rhs);
|
||||
loadPtr(lhs, scratch);
|
||||
branchPtr(cond, scratch, rhs, label);
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssembler::branchPtr(Condition cond, const AbsoluteAddress& lhs, ImmWord rhs, Label* label)
|
||||
{
|
||||
vixl::UseScratchRegisterScope temps(this);
|
||||
const Register scratch = temps.AcquireX().asUnsized();
|
||||
loadPtr(lhs, scratch);
|
||||
branchPtr(cond, scratch, rhs, label);
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssembler::branchPtr(Condition cond, wasm::SymbolicAddress lhs, Register rhs, Label* label)
|
||||
{
|
||||
vixl::UseScratchRegisterScope temps(this);
|
||||
const Register scratch = temps.AcquireX().asUnsized();
|
||||
MOZ_ASSERT(scratch != rhs);
|
||||
loadPtr(lhs, scratch);
|
||||
branchPtr(cond, scratch, rhs, label);
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssembler::branchPrivatePtr(Condition cond, const Address& lhs, Register rhs, Label* label)
|
||||
{
|
||||
@ -496,6 +608,20 @@ MacroAssemblerCompat::andStackPtrTo(T t)
|
||||
asMasm().andPtr(getStackPointer(), t);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void
|
||||
MacroAssemblerCompat::branchStackPtr(Condition cond, T rhs, Label* label)
|
||||
{
|
||||
asMasm().branchPtr(cond, getStackPointer(), rhs, label);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void
|
||||
MacroAssemblerCompat::branchStackPtrRhs(Condition cond, T lhs, Label* label)
|
||||
{
|
||||
asMasm().branchPtr(cond, lhs, getStackPointer(), label);
|
||||
}
|
||||
|
||||
} // namespace jit
|
||||
} // namespace js
|
||||
|
||||
|
@ -227,8 +227,8 @@ MacroAssemblerCompat::branchPtrInNurseryRange(Condition cond, Register ptr, Regi
|
||||
const Nursery& nursery = GetJitContext()->runtime->gcNursery();
|
||||
movePtr(ImmWord(-ptrdiff_t(nursery.start())), temp);
|
||||
asMasm().addPtr(ptr, temp);
|
||||
branchPtr(cond == Assembler::Equal ? Assembler::Below : Assembler::AboveOrEqual,
|
||||
temp, ImmWord(nursery.nurserySize()), label);
|
||||
asMasm().branchPtr(cond == Assembler::Equal ? Assembler::Below : Assembler::AboveOrEqual,
|
||||
temp, ImmWord(nursery.nurserySize()), label);
|
||||
}
|
||||
|
||||
void
|
||||
@ -249,8 +249,8 @@ MacroAssemblerCompat::branchValueIsNurseryObject(Condition cond, ValueOperand va
|
||||
|
||||
movePtr(ImmWord(-ptrdiff_t(start.asRawBits())), temp);
|
||||
asMasm().addPtr(value.valueReg(), temp);
|
||||
branchPtr(cond == Assembler::Equal ? Assembler::Below : Assembler::AboveOrEqual,
|
||||
temp, ImmWord(nursery.nurserySize()), label);
|
||||
asMasm().branchPtr(cond == Assembler::Equal ? Assembler::Below : Assembler::AboveOrEqual,
|
||||
temp, ImmWord(nursery.nurserySize()), label);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1061,13 +1061,9 @@ class MacroAssemblerCompat : public vixl::MacroAssembler
|
||||
branchTestPtr(cond, getStackPointer(), t, label);
|
||||
}
|
||||
template <typename T>
|
||||
void branchStackPtr(Condition cond, T rhs, Label* label) {
|
||||
branchPtr(cond, getStackPointer(), rhs, label);
|
||||
}
|
||||
void branchStackPtr(Condition cond, T rhs, Label* label);
|
||||
template <typename T>
|
||||
void branchStackPtrRhs(Condition cond, T lhs, Label* label) {
|
||||
branchPtr(cond, lhs, getStackPointer(), label);
|
||||
}
|
||||
void branchStackPtrRhs(Condition cond, T lhs, Label* label);
|
||||
|
||||
void testPtr(Register lhs, Register rhs) {
|
||||
Tst(ARMRegister(lhs, 64), Operand(ARMRegister(rhs, 64)));
|
||||
@ -1499,85 +1495,6 @@ class MacroAssemblerCompat : public vixl::MacroAssembler
|
||||
return jumpWithPatch(label, cond);
|
||||
}
|
||||
|
||||
void branchPtr(Condition cond, wasm::SymbolicAddress lhs, Register rhs, Label* label) {
|
||||
vixl::UseScratchRegisterScope temps(this);
|
||||
const Register scratch = temps.AcquireX().asUnsized();
|
||||
MOZ_ASSERT(scratch != rhs);
|
||||
loadPtr(lhs, scratch);
|
||||
branchPtr(cond, scratch, rhs, label);
|
||||
}
|
||||
void branchPtr(Condition cond, Address lhs, ImmWord ptr, Label* label) {
|
||||
vixl::UseScratchRegisterScope temps(this);
|
||||
const Register scratch = temps.AcquireX().asUnsized();
|
||||
MOZ_ASSERT(scratch != lhs.base);
|
||||
loadPtr(lhs, scratch);
|
||||
branchPtr(cond, scratch, ptr, label);
|
||||
}
|
||||
void branchPtr(Condition cond, Address lhs, ImmPtr ptr, Label* label) {
|
||||
vixl::UseScratchRegisterScope temps(this);
|
||||
const Register scratch = temps.AcquireX().asUnsized();
|
||||
MOZ_ASSERT(scratch != lhs.base);
|
||||
loadPtr(lhs, scratch);
|
||||
branchPtr(cond, scratch, ptr, label);
|
||||
}
|
||||
void branchPtr(Condition cond, Address lhs, Register ptr, Label* label) {
|
||||
vixl::UseScratchRegisterScope temps(this);
|
||||
const Register scratch = temps.AcquireX().asUnsized();
|
||||
MOZ_ASSERT(scratch != lhs.base);
|
||||
MOZ_ASSERT(scratch != ptr);
|
||||
loadPtr(lhs, scratch);
|
||||
branchPtr(cond, scratch, ptr, label);
|
||||
}
|
||||
void branchPtr(Condition cond, Register lhs, Imm32 imm, Label* label) {
|
||||
cmpPtr(lhs, imm);
|
||||
B(label, cond);
|
||||
}
|
||||
void branchPtr(Condition cond, Register lhs, ImmWord ptr, Label* label) {
|
||||
cmpPtr(lhs, ptr);
|
||||
B(label, cond);
|
||||
}
|
||||
void branchPtr(Condition cond, Register lhs, ImmPtr rhs, Label* label) {
|
||||
cmpPtr(lhs, rhs);
|
||||
B(label, cond);
|
||||
}
|
||||
void branchPtr(Condition cond, Register lhs, ImmGCPtr ptr, Label* label) {
|
||||
vixl::UseScratchRegisterScope temps(this);
|
||||
const Register scratch = temps.AcquireX().asUnsized();
|
||||
MOZ_ASSERT(scratch != lhs);
|
||||
movePtr(ptr, scratch);
|
||||
branchPtr(cond, lhs, scratch, label);
|
||||
}
|
||||
void branchPtr(Condition cond, Address lhs, ImmGCPtr ptr, Label* label) {
|
||||
vixl::UseScratchRegisterScope temps(this);
|
||||
const ARMRegister scratch1_64 = temps.AcquireX();
|
||||
const ARMRegister scratch2_64 = temps.AcquireX();
|
||||
MOZ_ASSERT(scratch1_64.asUnsized() != lhs.base);
|
||||
MOZ_ASSERT(scratch2_64.asUnsized() != lhs.base);
|
||||
|
||||
movePtr(ptr, scratch1_64.asUnsized());
|
||||
loadPtr(lhs, scratch2_64.asUnsized());
|
||||
cmp(scratch2_64, scratch1_64);
|
||||
B(cond, label);
|
||||
|
||||
}
|
||||
void branchPtr(Condition cond, Register lhs, Register rhs, Label* label) {
|
||||
Cmp(ARMRegister(lhs, 64), ARMRegister(rhs, 64));
|
||||
B(label, cond);
|
||||
}
|
||||
void branchPtr(Condition cond, AbsoluteAddress lhs, Register rhs, Label* label) {
|
||||
vixl::UseScratchRegisterScope temps(this);
|
||||
const Register scratch = temps.AcquireX().asUnsized();
|
||||
MOZ_ASSERT(scratch != rhs);
|
||||
loadPtr(lhs, scratch);
|
||||
branchPtr(cond, scratch, rhs, label);
|
||||
}
|
||||
void branchPtr(Condition cond, AbsoluteAddress lhs, ImmWord ptr, Label* label) {
|
||||
vixl::UseScratchRegisterScope temps(this);
|
||||
const Register scratch = temps.AcquireX().asUnsized();
|
||||
loadPtr(lhs, scratch);
|
||||
branchPtr(cond, scratch, ptr, label);
|
||||
}
|
||||
|
||||
void branchTestPtr(Condition cond, Register lhs, Register rhs, Label* label) {
|
||||
Tst(ARMRegister(lhs, 64), Operand(ARMRegister(rhs, 64)));
|
||||
B(label, cond);
|
||||
|
@ -191,6 +191,88 @@ MacroAssembler::negateDouble(FloatRegister reg)
|
||||
as_negd(reg, reg);
|
||||
}
|
||||
|
||||
// ===============================================================
|
||||
// Branch functions
|
||||
|
||||
void
|
||||
MacroAssembler::branchPtr(Condition cond, Register lhs, Register rhs, Label* label)
|
||||
{
|
||||
ma_b(lhs, rhs, label, cond);
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssembler::branchPtr(Condition cond, Register lhs, Imm32 rhs, Label* label)
|
||||
{
|
||||
ma_b(lhs, rhs, label, cond);
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssembler::branchPtr(Condition cond, Register lhs, ImmPtr rhs, Label* label)
|
||||
{
|
||||
ma_b(lhs, rhs, label, cond);
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssembler::branchPtr(Condition cond, Register lhs, ImmGCPtr rhs, Label* label)
|
||||
{
|
||||
ma_b(lhs, rhs, label, cond);
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssembler::branchPtr(Condition cond, Register lhs, ImmWord rhs, Label* label)
|
||||
{
|
||||
ma_b(lhs, rhs, label, cond);
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssembler::branchPtr(Condition cond, const Address& lhs, Register rhs, Label* label)
|
||||
{
|
||||
loadPtr(lhs, SecondScratchReg);
|
||||
branchPtr(cond, SecondScratchReg, rhs, label);
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssembler::branchPtr(Condition cond, const Address& lhs, ImmPtr rhs, Label* label)
|
||||
{
|
||||
loadPtr(lhs, SecondScratchReg);
|
||||
branchPtr(cond, SecondScratchReg, rhs, label);
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssembler::branchPtr(Condition cond, const Address& lhs, ImmGCPtr rhs, Label* label)
|
||||
{
|
||||
loadPtr(lhs, SecondScratchReg);
|
||||
branchPtr(cond, SecondScratchReg, rhs, label);
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssembler::branchPtr(Condition cond, const Address& lhs, ImmWord rhs, Label* label)
|
||||
{
|
||||
loadPtr(lhs, SecondScratchReg);
|
||||
branchPtr(cond, SecondScratchReg, rhs, label);
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssembler::branchPtr(Condition cond, const AbsoluteAddress& lhs, Register rhs, Label* label)
|
||||
{
|
||||
loadPtr(lhs, SecondScratchReg);
|
||||
branchPtr(cond, SecondScratchReg, rhs, label);
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssembler::branchPtr(Condition cond, const AbsoluteAddress& lhs, ImmWord rhs, Label* label)
|
||||
{
|
||||
loadPtr(lhs, SecondScratchReg);
|
||||
branchPtr(cond, SecondScratchReg, rhs, label);
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssembler::branchPtr(Condition cond, wasm::SymbolicAddress lhs, Register rhs, Label* label)
|
||||
{
|
||||
loadPtr(lhs, SecondScratchReg);
|
||||
branchPtr(cond, SecondScratchReg, rhs, label);
|
||||
}
|
||||
|
||||
//}}} check_macroassembler_style
|
||||
// ===============================================================
|
||||
|
||||
|
@ -275,7 +275,7 @@ void
|
||||
MacroAssemblerMIPSCompat::decBranchPtr(Condition cond, Register lhs, Imm32 imm, Label* label)
|
||||
{
|
||||
asMasm().subPtr(imm, lhs);
|
||||
branchPtr(cond, lhs, Imm32(0), label);
|
||||
asMasm().branchPtr(cond, lhs, Imm32(0), label);
|
||||
}
|
||||
|
||||
} // namespace jit
|
||||
|
@ -1485,11 +1485,11 @@ MacroAssemblerMIPSCompat::branchTestValue(Condition cond, const Address& valaddr
|
||||
|
||||
// Load tag.
|
||||
ma_lw(ScratchRegister, Address(valaddr.base, valaddr.offset + TAG_OFFSET));
|
||||
branchPtr(cond, ScratchRegister, value.typeReg(), label);
|
||||
asMasm().branchPtr(cond, ScratchRegister, value.typeReg(), label);
|
||||
|
||||
// Load payload
|
||||
ma_lw(ScratchRegister, Address(valaddr.base, valaddr.offset + PAYLOAD_OFFSET));
|
||||
branchPtr(cond, ScratchRegister, value.payloadReg(), label);
|
||||
asMasm().branchPtr(cond, ScratchRegister, value.payloadReg(), label);
|
||||
}
|
||||
|
||||
// unboxing code
|
||||
@ -2382,8 +2382,8 @@ MacroAssemblerMIPSCompat::branchPtrInNurseryRange(Condition cond, Register ptr,
|
||||
const Nursery& nursery = GetJitContext()->runtime->gcNursery();
|
||||
movePtr(ImmWord(-ptrdiff_t(nursery.start())), SecondScratchReg);
|
||||
asMasm().addPtr(ptr, SecondScratchReg);
|
||||
branchPtr(cond == Assembler::Equal ? Assembler::Below : Assembler::AboveOrEqual,
|
||||
SecondScratchReg, Imm32(nursery.nurserySize()), label);
|
||||
asMasm().branchPtr(cond == Assembler::Equal ? Assembler::Below : Assembler::AboveOrEqual,
|
||||
SecondScratchReg, Imm32(nursery.nurserySize()), label);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -415,10 +415,6 @@ class MacroAssemblerMIPSCompat : public MacroAssemblerMIPS
|
||||
load32(lhs, SecondScratchReg);
|
||||
ma_b(SecondScratchReg, rhs, label, cond);
|
||||
}
|
||||
void branchPtr(Condition cond, const Address& lhs, Register rhs, Label* label) {
|
||||
loadPtr(lhs, SecondScratchReg);
|
||||
ma_b(SecondScratchReg, rhs, label, cond);
|
||||
}
|
||||
|
||||
void branchTestDouble(Condition cond, const ValueOperand& value, Label* label);
|
||||
void branchTestDouble(Condition cond, Register tag, Label* label);
|
||||
@ -513,25 +509,6 @@ class MacroAssemblerMIPSCompat : public MacroAssemblerMIPS
|
||||
}
|
||||
void branchTest64(Condition cond, Register64 lhs, Register64 rhs, Register temp,
|
||||
Label* label);
|
||||
void branchPtr(Condition cond, Register lhs, Register rhs, Label* label) {
|
||||
ma_b(lhs, rhs, label, cond);
|
||||
}
|
||||
void branchPtr(Condition cond, Register lhs, ImmGCPtr ptr, Label* label) {
|
||||
ma_b(lhs, ptr, label, cond);
|
||||
}
|
||||
void branchPtr(Condition cond, Register lhs, ImmWord imm, Label* label) {
|
||||
ma_b(lhs, imm, label, cond);
|
||||
}
|
||||
void branchPtr(Condition cond, Register lhs, ImmPtr imm, Label* label) {
|
||||
ma_b(lhs, imm, label, cond);
|
||||
}
|
||||
void branchPtr(Condition cond, Register lhs, wasm::SymbolicAddress imm, Label* label) {
|
||||
movePtr(imm, SecondScratchReg);
|
||||
ma_b(lhs, SecondScratchReg, label, cond);
|
||||
}
|
||||
void branchPtr(Condition cond, Register lhs, Imm32 imm, Label* label) {
|
||||
ma_b(lhs, imm, label, cond);
|
||||
}
|
||||
inline void decBranchPtr(Condition cond, Register lhs, Imm32 imm, Label* label);
|
||||
|
||||
// higher level tag testing code
|
||||
@ -574,31 +551,6 @@ class MacroAssemblerMIPSCompat : public MacroAssemblerMIPS
|
||||
bind(&skipJump);
|
||||
return off;
|
||||
}
|
||||
void branchPtr(Condition cond, Address addr, ImmGCPtr ptr, Label* label) {
|
||||
loadPtr(addr, SecondScratchReg);
|
||||
ma_b(SecondScratchReg, ptr, label, cond);
|
||||
}
|
||||
|
||||
void branchPtr(Condition cond, Address addr, ImmWord ptr, Label* label) {
|
||||
loadPtr(addr, SecondScratchReg);
|
||||
ma_b(SecondScratchReg, ptr, label, cond);
|
||||
}
|
||||
void branchPtr(Condition cond, Address addr, ImmPtr ptr, Label* label) {
|
||||
loadPtr(addr, SecondScratchReg);
|
||||
ma_b(SecondScratchReg, ptr, label, cond);
|
||||
}
|
||||
void branchPtr(Condition cond, AbsoluteAddress addr, Register ptr, Label* label) {
|
||||
loadPtr(addr, SecondScratchReg);
|
||||
ma_b(SecondScratchReg, ptr, label, cond);
|
||||
}
|
||||
void branchPtr(Condition cond, AbsoluteAddress addr, ImmWord ptr, Label* label) {
|
||||
loadPtr(addr, SecondScratchReg);
|
||||
ma_b(SecondScratchReg, ptr, label, cond);
|
||||
}
|
||||
void branchPtr(Condition cond, wasm::SymbolicAddress addr, Register ptr, Label* label) {
|
||||
loadPtr(addr, SecondScratchReg);
|
||||
ma_b(SecondScratchReg, ptr, label, cond);
|
||||
}
|
||||
void branch32(Condition cond, AbsoluteAddress lhs, Imm32 rhs, Label* label) {
|
||||
load32(lhs, SecondScratchReg);
|
||||
ma_b(SecondScratchReg, rhs, label, cond);
|
||||
|
@ -221,7 +221,7 @@ void
|
||||
MacroAssemblerMIPS64Compat::decBranchPtr(Condition cond, Register lhs, Imm32 imm, Label* label)
|
||||
{
|
||||
asMasm().subPtr(imm, lhs);
|
||||
branchPtr(cond, lhs, Imm32(0), label);
|
||||
asMasm().branchPtr(cond, lhs, Imm32(0), label);
|
||||
}
|
||||
|
||||
} // namespace jit
|
||||
|
@ -2539,8 +2539,8 @@ MacroAssemblerMIPS64Compat::branchPtrInNurseryRange(Condition cond, Register ptr
|
||||
const Nursery& nursery = GetJitContext()->runtime->gcNursery();
|
||||
movePtr(ImmWord(-ptrdiff_t(nursery.start())), SecondScratchReg);
|
||||
asMasm().addPtr(ptr, SecondScratchReg);
|
||||
branchPtr(cond == Assembler::Equal ? Assembler::Below : Assembler::AboveOrEqual,
|
||||
SecondScratchReg, Imm32(nursery.nurserySize()), label);
|
||||
asMasm().branchPtr(cond == Assembler::Equal ? Assembler::Below : Assembler::AboveOrEqual,
|
||||
SecondScratchReg, Imm32(nursery.nurserySize()), label);
|
||||
}
|
||||
|
||||
void
|
||||
@ -2555,8 +2555,8 @@ MacroAssemblerMIPS64Compat::branchValueIsNurseryObject(Condition cond, ValueOper
|
||||
|
||||
movePtr(ImmWord(-ptrdiff_t(start.asRawBits())), SecondScratchReg);
|
||||
asMasm().addPtr(value.valueReg(), SecondScratchReg);
|
||||
branchPtr(cond == Assembler::Equal ? Assembler::Below : Assembler::AboveOrEqual,
|
||||
SecondScratchReg, Imm32(nursery.nurserySize()), label);
|
||||
asMasm().branchPtr(cond == Assembler::Equal ? Assembler::Below : Assembler::AboveOrEqual,
|
||||
SecondScratchReg, Imm32(nursery.nurserySize()), label);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -456,10 +456,6 @@ class MacroAssemblerMIPS64Compat : public MacroAssemblerMIPS64
|
||||
load32(lhs, SecondScratchReg);
|
||||
ma_b(SecondScratchReg, rhs, label, cond);
|
||||
}
|
||||
void branchPtr(Condition cond, const Address& lhs, Register rhs, Label* label) {
|
||||
loadPtr(lhs, SecondScratchReg);
|
||||
ma_b(SecondScratchReg, rhs, label, cond);
|
||||
}
|
||||
|
||||
void branchTestDouble(Condition cond, const ValueOperand& value, Label* label);
|
||||
void branchTestDouble(Condition cond, Register tag, Label* label);
|
||||
@ -556,25 +552,6 @@ class MacroAssemblerMIPS64Compat : public MacroAssemblerMIPS64
|
||||
Label* label) {
|
||||
branchTestPtr(cond, lhs.reg, rhs.reg, label);
|
||||
}
|
||||
void branchPtr(Condition cond, Register lhs, Register rhs, Label* label) {
|
||||
ma_b(lhs, rhs, label, cond);
|
||||
}
|
||||
void branchPtr(Condition cond, Register lhs, ImmGCPtr ptr, Label* label) {
|
||||
ma_b(lhs, ptr, label, cond);
|
||||
}
|
||||
void branchPtr(Condition cond, Register lhs, ImmWord imm, Label* label) {
|
||||
ma_b(lhs, imm, label, cond);
|
||||
}
|
||||
void branchPtr(Condition cond, Register lhs, ImmPtr imm, Label* label) {
|
||||
ma_b(lhs, imm, label, cond);
|
||||
}
|
||||
void branchPtr(Condition cond, Register lhs, wasm::SymbolicAddress imm, Label* label) {
|
||||
movePtr(imm, SecondScratchReg);
|
||||
ma_b(lhs, SecondScratchReg, label, cond);
|
||||
}
|
||||
void branchPtr(Condition cond, Register lhs, Imm32 imm, Label* label) {
|
||||
ma_b(lhs, imm, label, cond);
|
||||
}
|
||||
inline void decBranchPtr(Condition cond, Register lhs, Imm32 imm, Label* label);
|
||||
|
||||
// higher level tag testing code
|
||||
@ -607,31 +584,6 @@ class MacroAssemblerMIPS64Compat : public MacroAssemblerMIPS64
|
||||
bind(&skipJump);
|
||||
return off;
|
||||
}
|
||||
void branchPtr(Condition cond, Address addr, ImmGCPtr ptr, Label* label) {
|
||||
loadPtr(addr, SecondScratchReg);
|
||||
ma_b(SecondScratchReg, ptr, label, cond);
|
||||
}
|
||||
|
||||
void branchPtr(Condition cond, Address addr, ImmWord ptr, Label* label) {
|
||||
loadPtr(addr, SecondScratchReg);
|
||||
ma_b(SecondScratchReg, ptr, label, cond);
|
||||
}
|
||||
void branchPtr(Condition cond, Address addr, ImmPtr ptr, Label* label) {
|
||||
loadPtr(addr, SecondScratchReg);
|
||||
ma_b(SecondScratchReg, ptr, label, cond);
|
||||
}
|
||||
void branchPtr(Condition cond, AbsoluteAddress addr, Register ptr, Label* label) {
|
||||
loadPtr(addr, SecondScratchReg);
|
||||
ma_b(SecondScratchReg, ptr, label, cond);
|
||||
}
|
||||
void branchPtr(Condition cond, AbsoluteAddress addr, ImmWord ptr, Label* label) {
|
||||
loadPtr(addr, SecondScratchReg);
|
||||
ma_b(SecondScratchReg, ptr, label, cond);
|
||||
}
|
||||
void branchPtr(Condition cond, wasm::SymbolicAddress addr, Register ptr, Label* label) {
|
||||
loadPtr(addr, SecondScratchReg);
|
||||
ma_b(SecondScratchReg, ptr, label, cond);
|
||||
}
|
||||
void branch32(Condition cond, AbsoluteAddress lhs, Imm32 rhs, Label* label) {
|
||||
load32(lhs, SecondScratchReg);
|
||||
ma_b(SecondScratchReg, rhs, label, cond);
|
||||
|
@ -248,7 +248,6 @@ class MacroAssemblerNone : public Assembler
|
||||
template <typename T, typename S, typename L> void branchTest32(Condition, T, S, L) { MOZ_CRASH(); }
|
||||
template <typename T, typename S> void branchAdd32(Condition, T, S, Label*) { MOZ_CRASH(); }
|
||||
template <typename T, typename S> void branchSub32(Condition, T, S, Label*) { MOZ_CRASH(); }
|
||||
template <typename T, typename S> void branchPtr(Condition, T, S, Label*) { MOZ_CRASH(); }
|
||||
template <typename T, typename S> void branchTestPtr(Condition, T, S, Label*) { MOZ_CRASH(); }
|
||||
template <typename T, typename S> void branchDouble(DoubleCondition, T, S, Label*) { MOZ_CRASH(); }
|
||||
template <typename T, typename S> void branchFloat(DoubleCondition, T, S, Label*) { MOZ_CRASH(); }
|
||||
|
@ -222,6 +222,40 @@ MacroAssembler::rshift64(Imm32 imm, Register64 dest)
|
||||
// ===============================================================
|
||||
// Branch functions
|
||||
|
||||
void
|
||||
MacroAssembler::branchPtr(Condition cond, const AbsoluteAddress& lhs, Register rhs, Label* label)
|
||||
{
|
||||
ScratchRegisterScope scratch(*this);
|
||||
MOZ_ASSERT(rhs != scratch);
|
||||
if (X86Encoding::IsAddressImmediate(lhs.addr)) {
|
||||
branchPtrImpl(cond, Operand(lhs), rhs, label);
|
||||
} else {
|
||||
mov(ImmPtr(lhs.addr), scratch);
|
||||
branchPtrImpl(cond, Operand(scratch, 0x0), rhs, label);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssembler::branchPtr(Condition cond, const AbsoluteAddress& lhs, ImmWord rhs, Label* label)
|
||||
{
|
||||
if (X86Encoding::IsAddressImmediate(lhs.addr)) {
|
||||
branchPtrImpl(cond, Operand(lhs), rhs, label);
|
||||
} else {
|
||||
ScratchRegisterScope scratch(*this);
|
||||
mov(ImmPtr(lhs.addr), scratch);
|
||||
branchPtrImpl(cond, Operand(scratch, 0x0), rhs, label);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssembler::branchPtr(Condition cond, wasm::SymbolicAddress lhs, Register rhs, Label* label)
|
||||
{
|
||||
ScratchRegisterScope scratch(*this);
|
||||
MOZ_ASSERT(rhs != scratch);
|
||||
mov(lhs, scratch);
|
||||
branchPtrImpl(cond, Operand(scratch, 0x0), rhs, label);
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssembler::branchPrivatePtr(Condition cond, const Address& lhs, Register rhs, Label* label)
|
||||
{
|
||||
@ -242,6 +276,22 @@ MacroAssemblerX64::incrementInt32Value(const Address& addr)
|
||||
asMasm().addPtr(Imm32(1), addr);
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssemblerX64::branchTestValue(Condition cond, const Address& valaddr, const
|
||||
ValueOperand& value, Label* label)
|
||||
{
|
||||
MOZ_ASSERT(cond == Equal || cond == NotEqual);
|
||||
asMasm().branchPtr(cond, valaddr, value.valueReg(), label);
|
||||
}
|
||||
|
||||
template <typename T, typename S>
|
||||
void
|
||||
MacroAssemblerX64::branchPtrImpl(Condition cond, const T& lhs, const S& rhs, Label* label)
|
||||
{
|
||||
cmpPtr(Operand(lhs), rhs);
|
||||
j(cond, label);
|
||||
}
|
||||
|
||||
} // namespace jit
|
||||
} // namespace js
|
||||
|
||||
|
@ -120,6 +120,26 @@ MacroAssemblerX64::finish()
|
||||
MacroAssemblerX86Shared::finish();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
MacroAssemblerX64::boxValue(JSValueType type, Register src, Register dest)
|
||||
{
|
||||
MOZ_ASSERT(src != dest);
|
||||
|
||||
JSValueShiftedTag tag = (JSValueShiftedTag)JSVAL_TYPE_TO_SHIFTED_TAG(type);
|
||||
#ifdef DEBUG
|
||||
if (type == JSVAL_TYPE_INT32 || type == JSVAL_TYPE_BOOLEAN) {
|
||||
Label upper32BitsZeroed;
|
||||
movePtr(ImmWord(UINT32_MAX), dest);
|
||||
asMasm().branchPtr(Assembler::BelowOrEqual, src, dest, &upper32BitsZeroed);
|
||||
breakpoint();
|
||||
bind(&upper32BitsZeroed);
|
||||
}
|
||||
#endif
|
||||
mov(ImmShiftedTag(tag), dest);
|
||||
orq(src, dest);
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssemblerX64::handleFailureWithHandlerTail(void* handler)
|
||||
{
|
||||
@ -256,8 +276,8 @@ MacroAssemblerX64::branchPtrInNurseryRange(Condition cond, Register ptr, Registe
|
||||
const Nursery& nursery = GetJitContext()->runtime->gcNursery();
|
||||
movePtr(ImmWord(-ptrdiff_t(nursery.start())), scratch);
|
||||
asMasm().addPtr(ptr, scratch);
|
||||
branchPtr(cond == Assembler::Equal ? Assembler::Below : Assembler::AboveOrEqual,
|
||||
scratch, Imm32(nursery.nurserySize()), label);
|
||||
asMasm().branchPtr(cond == Assembler::Equal ? Assembler::Below : Assembler::AboveOrEqual,
|
||||
scratch, Imm32(nursery.nurserySize()), label);
|
||||
}
|
||||
|
||||
void
|
||||
@ -278,8 +298,8 @@ MacroAssemblerX64::branchValueIsNurseryObject(Condition cond, ValueOperand value
|
||||
ScratchRegisterScope scratch(asMasm());
|
||||
movePtr(ImmWord(-ptrdiff_t(start.asRawBits())), scratch);
|
||||
asMasm().addPtr(value.valueReg(), scratch);
|
||||
branchPtr(cond == Assembler::Equal ? Assembler::Below : Assembler::AboveOrEqual,
|
||||
scratch, Imm32(nursery.nurserySize()), label);
|
||||
asMasm().branchPtr(cond == Assembler::Equal ? Assembler::Below : Assembler::AboveOrEqual,
|
||||
scratch, Imm32(nursery.nurserySize()), label);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -200,22 +200,7 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared
|
||||
if (src.valueReg() != dest.valueReg())
|
||||
movq(src.valueReg(), dest.valueReg());
|
||||
}
|
||||
void boxValue(JSValueType type, Register src, Register dest) {
|
||||
MOZ_ASSERT(src != dest);
|
||||
|
||||
JSValueShiftedTag tag = (JSValueShiftedTag)JSVAL_TYPE_TO_SHIFTED_TAG(type);
|
||||
#ifdef DEBUG
|
||||
if (type == JSVAL_TYPE_INT32 || type == JSVAL_TYPE_BOOLEAN) {
|
||||
Label upper32BitsZeroed;
|
||||
movePtr(ImmWord(UINT32_MAX), dest);
|
||||
branchPtr(Assembler::BelowOrEqual, src, dest, &upper32BitsZeroed);
|
||||
breakpoint();
|
||||
bind(&upper32BitsZeroed);
|
||||
}
|
||||
#endif
|
||||
mov(ImmShiftedTag(tag), dest);
|
||||
orq(src, dest);
|
||||
}
|
||||
void boxValue(JSValueType type, Register src, Register dest);
|
||||
|
||||
Condition testUndefined(Condition cond, Register tag) {
|
||||
MOZ_ASSERT(cond == Equal || cond == NotEqual);
|
||||
@ -577,38 +562,8 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared
|
||||
j(cond, label);
|
||||
}
|
||||
|
||||
// Specialization for AbsoluteAddress.
|
||||
void branchPtr(Condition cond, AbsoluteAddress addr, Register ptr, Label* label) {
|
||||
ScratchRegisterScope scratch(asMasm());
|
||||
MOZ_ASSERT(ptr != scratch);
|
||||
if (X86Encoding::IsAddressImmediate(addr.addr)) {
|
||||
branchPtr(cond, Operand(addr), ptr, label);
|
||||
} else {
|
||||
mov(ImmPtr(addr.addr), scratch);
|
||||
branchPtr(cond, Operand(scratch, 0x0), ptr, label);
|
||||
}
|
||||
}
|
||||
void branchPtr(Condition cond, AbsoluteAddress addr, ImmWord ptr, Label* label) {
|
||||
if (X86Encoding::IsAddressImmediate(addr.addr)) {
|
||||
branchPtr(cond, Operand(addr), ptr, label);
|
||||
} else {
|
||||
ScratchRegisterScope scratch(asMasm());
|
||||
mov(ImmPtr(addr.addr), scratch);
|
||||
branchPtr(cond, Operand(scratch, 0x0), ptr, label);
|
||||
}
|
||||
}
|
||||
void branchPtr(Condition cond, wasm::SymbolicAddress addr, Register ptr, Label* label) {
|
||||
ScratchRegisterScope scratch(asMasm());
|
||||
MOZ_ASSERT(ptr != scratch);
|
||||
mov(addr, scratch);
|
||||
branchPtr(cond, Operand(scratch, 0x0), ptr, label);
|
||||
}
|
||||
|
||||
template <typename T, typename S>
|
||||
void branchPtr(Condition cond, const T& lhs, const S& ptr, Label* label) {
|
||||
cmpPtr(Operand(lhs), ptr);
|
||||
j(cond, label);
|
||||
}
|
||||
inline void branchPtrImpl(Condition cond, const T& lhs, const S& rhs, Label* label);
|
||||
|
||||
CodeOffsetJump jumpWithPatch(RepatchLabel* label, Label* documentation = nullptr) {
|
||||
JmpSrc src = jmpSrc(label);
|
||||
@ -631,10 +586,6 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared
|
||||
cmpPtr(lhs, ptr);
|
||||
return jumpWithPatch(label, cond);
|
||||
}
|
||||
void branchPtr(Condition cond, Register lhs, Register rhs, Label* label) {
|
||||
cmpPtr(lhs, rhs);
|
||||
j(cond, label);
|
||||
}
|
||||
void branchTestPtr(Condition cond, Register lhs, Register rhs, Label* label) {
|
||||
testPtr(lhs, rhs);
|
||||
j(cond, label);
|
||||
@ -998,12 +949,8 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared
|
||||
cmpPtr(value.valueReg(), scratch);
|
||||
j(cond, label);
|
||||
}
|
||||
void branchTestValue(Condition cond, const Address& valaddr, const ValueOperand& value,
|
||||
Label* label)
|
||||
{
|
||||
MOZ_ASSERT(cond == Equal || cond == NotEqual);
|
||||
branchPtr(cond, valaddr, value.valueReg(), label);
|
||||
}
|
||||
inline void branchTestValue(Condition cond, const Address& valaddr, const ValueOperand& value,
|
||||
Label* label);
|
||||
|
||||
void testNullSet(Condition cond, const ValueOperand& value, Register dest) {
|
||||
cond = testNull(cond, value);
|
||||
|
@ -180,6 +180,64 @@ MacroAssembler::negateDouble(FloatRegister reg)
|
||||
vxorpd(scratch, reg, reg); // s ^ 0x80000000000000
|
||||
}
|
||||
|
||||
// ===============================================================
|
||||
// Branch instructions
|
||||
|
||||
void
|
||||
MacroAssembler::branchPtr(Condition cond, Register lhs, Register rhs, Label* label)
|
||||
{
|
||||
cmpPtr(lhs, rhs);
|
||||
j(cond, label);
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssembler::branchPtr(Condition cond, Register lhs, Imm32 rhs, Label* label)
|
||||
{
|
||||
branchPtrImpl(cond, lhs, rhs, label);
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssembler::branchPtr(Condition cond, Register lhs, ImmPtr rhs, Label* label)
|
||||
{
|
||||
branchPtrImpl(cond, lhs, rhs, label);
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssembler::branchPtr(Condition cond, Register lhs, ImmGCPtr rhs, Label* label)
|
||||
{
|
||||
branchPtrImpl(cond, lhs, rhs, label);
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssembler::branchPtr(Condition cond, Register lhs, ImmWord rhs, Label* label)
|
||||
{
|
||||
branchPtrImpl(cond, lhs, rhs, label);
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssembler::branchPtr(Condition cond, const Address& lhs, Register rhs, Label* label)
|
||||
{
|
||||
branchPtrImpl(cond, lhs, rhs, label);
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssembler::branchPtr(Condition cond, const Address& lhs, ImmPtr rhs, Label* label)
|
||||
{
|
||||
branchPtrImpl(cond, lhs, rhs, label);
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssembler::branchPtr(Condition cond, const Address& lhs, ImmGCPtr rhs, Label* label)
|
||||
{
|
||||
branchPtrImpl(cond, lhs, rhs, label);
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssembler::branchPtr(Condition cond, const Address& lhs, ImmWord rhs, Label* label)
|
||||
{
|
||||
branchPtrImpl(cond, lhs, rhs, label);
|
||||
}
|
||||
|
||||
//}}} check_macroassembler_style
|
||||
// ===============================================================
|
||||
|
||||
|
@ -258,6 +258,25 @@ MacroAssembler::rshift64(Imm32 imm, Register64 dest)
|
||||
// ===============================================================
|
||||
// Branch functions
|
||||
|
||||
void
|
||||
MacroAssembler::branchPtr(Condition cond, const AbsoluteAddress& lhs, Register rhs, Label* label)
|
||||
{
|
||||
branchPtrImpl(cond, lhs, rhs, label);
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssembler::branchPtr(Condition cond, const AbsoluteAddress& lhs, ImmWord rhs, Label* label)
|
||||
{
|
||||
branchPtrImpl(cond, lhs, rhs, label);
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssembler::branchPtr(Condition cond, wasm::SymbolicAddress lhs, Register rhs, Label* label)
|
||||
{
|
||||
cmpl(rhs, lhs);
|
||||
j(cond, label);
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssembler::branchPrivatePtr(Condition cond, const Address& lhs, Register rhs, Label* label)
|
||||
{
|
||||
@ -290,6 +309,31 @@ MacroAssemblerX86::convertUInt32ToFloat32(Register src, FloatRegister dest)
|
||||
convertDoubleToFloat32(dest, dest);
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssemblerX86::branchTestValue(Condition cond, const Address& valaddr, const ValueOperand& value,
|
||||
Label* label)
|
||||
{
|
||||
MOZ_ASSERT(cond == Equal || cond == NotEqual);
|
||||
// Check payload before tag, since payload is more likely to differ.
|
||||
if (cond == NotEqual) {
|
||||
branchPtrImpl(NotEqual, payloadOf(valaddr), value.payloadReg(), label);
|
||||
branchPtrImpl(NotEqual, tagOf(valaddr), value.typeReg(), label);
|
||||
} else {
|
||||
Label fallthrough;
|
||||
branchPtrImpl(NotEqual, payloadOf(valaddr), value.payloadReg(), &fallthrough);
|
||||
branchPtrImpl(Equal, tagOf(valaddr), value.typeReg(), label);
|
||||
bind(&fallthrough);
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T, typename S>
|
||||
void
|
||||
MacroAssemblerX86::branchPtrImpl(Condition cond, const T& lhs, const S& rhs, Label* label)
|
||||
{
|
||||
cmpPtr(Operand(lhs), rhs);
|
||||
j(cond, label);
|
||||
}
|
||||
|
||||
} // namespace jit
|
||||
} // namespace js
|
||||
|
||||
|
@ -336,8 +336,8 @@ MacroAssemblerX86::branchPtrInNurseryRange(Condition cond, Register ptr, Registe
|
||||
const Nursery& nursery = GetJitContext()->runtime->gcNursery();
|
||||
movePtr(ImmWord(-ptrdiff_t(nursery.start())), temp);
|
||||
asMasm().addPtr(ptr, temp);
|
||||
branchPtr(cond == Assembler::Equal ? Assembler::Below : Assembler::AboveOrEqual,
|
||||
temp, Imm32(nursery.nurserySize()), label);
|
||||
asMasm().branchPtr(cond == Assembler::Equal ? Assembler::Below : Assembler::AboveOrEqual,
|
||||
temp, Imm32(nursery.nurserySize()), label);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -468,22 +468,8 @@ class MacroAssemblerX86 : public MacroAssemblerX86Shared
|
||||
|
||||
|
||||
void branchTestValue(Condition cond, const ValueOperand& value, const Value& v, Label* label);
|
||||
void branchTestValue(Condition cond, const Address& valaddr, const ValueOperand& value,
|
||||
Label* label)
|
||||
{
|
||||
MOZ_ASSERT(cond == Equal || cond == NotEqual);
|
||||
// Check payload before tag, since payload is more likely to differ.
|
||||
if (cond == NotEqual) {
|
||||
branchPtr(NotEqual, payloadOf(valaddr), value.payloadReg(), label);
|
||||
branchPtr(NotEqual, tagOf(valaddr), value.typeReg(), label);
|
||||
|
||||
} else {
|
||||
Label fallthrough;
|
||||
branchPtr(NotEqual, payloadOf(valaddr), value.payloadReg(), &fallthrough);
|
||||
branchPtr(Equal, tagOf(valaddr), value.typeReg(), label);
|
||||
bind(&fallthrough);
|
||||
}
|
||||
}
|
||||
inline void branchTestValue(Condition cond, const Address& valaddr, const ValueOperand& value,
|
||||
Label* label);
|
||||
|
||||
void testNullSet(Condition cond, const ValueOperand& value, Register dest) {
|
||||
cond = testNull(cond, value);
|
||||
@ -583,23 +569,15 @@ class MacroAssemblerX86 : public MacroAssemblerX86Shared
|
||||
j(cond, label);
|
||||
}
|
||||
|
||||
void branchPtr(Condition cond, wasm::SymbolicAddress lhs, Register ptr, Label* label) {
|
||||
cmpl(ptr, lhs);
|
||||
j(cond, label);
|
||||
}
|
||||
|
||||
template <typename T, typename S>
|
||||
void branchPtr(Condition cond, T lhs, S ptr, Label* label) {
|
||||
cmpPtr(Operand(lhs), ptr);
|
||||
j(cond, label);
|
||||
}
|
||||
|
||||
template <typename T, typename S>
|
||||
void branchPtr(Condition cond, T lhs, S ptr, RepatchLabel* label) {
|
||||
cmpPtr(Operand(lhs), ptr);
|
||||
j(cond, label);
|
||||
}
|
||||
|
||||
template <typename T, typename S>
|
||||
inline void branchPtrImpl(Condition cond, const T& lhs, const S& rhs, Label* label);
|
||||
|
||||
CodeOffsetJump jumpWithPatch(RepatchLabel* label, Label* documentation = nullptr) {
|
||||
jump(label);
|
||||
return CodeOffsetJump(size());
|
||||
@ -625,10 +603,6 @@ class MacroAssemblerX86 : public MacroAssemblerX86Shared
|
||||
cmpPtr(lhs, rhs);
|
||||
j(cond, label);
|
||||
}
|
||||
void branchPtr(Condition cond, Register lhs, Register rhs, Label* label) {
|
||||
cmpPtr(lhs, rhs);
|
||||
j(cond, label);
|
||||
}
|
||||
void branchTestPtr(Condition cond, Register lhs, Register rhs, Label* label) {
|
||||
testPtr(lhs, rhs);
|
||||
j(cond, label);
|
||||
|
Loading…
Reference in New Issue
Block a user