diff --git a/js/src/jit/MacroAssembler.h b/js/src/jit/MacroAssembler.h index 4297d499341c..c07e42890447 100644 --- a/js/src/jit/MacroAssembler.h +++ b/js/src/jit/MacroAssembler.h @@ -1037,6 +1037,8 @@ class MacroAssembler : public MacroAssemblerSpecific 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 BaseIndex& 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) @@ -1654,6 +1656,8 @@ class MacroAssembler : public MacroAssemblerSpecific if (type == MIRType::Value) branchTestGCThing(Assembler::NotEqual, address, &done); + else if (type == MIRType::Object || type == MIRType::String) + branchPtr(Assembler::Equal, address, ImmWord(0), &done); Push(PreBarrierReg); computeEffectiveAddress(address, PreBarrierReg); diff --git a/js/src/jit/VMFunctions.cpp b/js/src/jit/VMFunctions.cpp index fd16e4ba2a65..6bbf16bd830e 100644 --- a/js/src/jit/VMFunctions.cpp +++ b/js/src/jit/VMFunctions.cpp @@ -1433,15 +1433,15 @@ MarkValueFromIon(JSRuntime* rt, Value* vp) void MarkStringFromIon(JSRuntime* rt, JSString** stringp) { - if (*stringp) - TraceManuallyBarrieredEdge(&rt->gc.marker, stringp, "write barrier"); + MOZ_ASSERT(*stringp); + TraceManuallyBarrieredEdge(&rt->gc.marker, stringp, "write barrier"); } void MarkObjectFromIon(JSRuntime* rt, JSObject** objp) { - if (*objp) - TraceManuallyBarrieredEdge(&rt->gc.marker, objp, "write barrier"); + MOZ_ASSERT(*objp); + TraceManuallyBarrieredEdge(&rt->gc.marker, objp, "write barrier"); } void diff --git a/js/src/jit/arm/MacroAssembler-arm-inl.h b/js/src/jit/arm/MacroAssembler-arm-inl.h index 5a17342d9125..e77dc17b6253 100644 --- a/js/src/jit/arm/MacroAssembler-arm-inl.h +++ b/js/src/jit/arm/MacroAssembler-arm-inl.h @@ -1457,6 +1457,12 @@ MacroAssembler::branchPtr(Condition cond, wasm::SymbolicAddress lhs, Register rh branchPtr(cond, scratch2, rhs, label); } +void +MacroAssembler::branchPtr(Condition cond, const BaseIndex& lhs, ImmWord rhs, Label* label) +{ + branch32(cond, lhs, Imm32(rhs.value), label); +} + template inline CodeOffsetJump MacroAssembler::branchPtrWithPatch(Condition cond, Register lhs, T rhs, RepatchLabel* label) diff --git a/js/src/jit/arm64/MacroAssembler-arm64-inl.h b/js/src/jit/arm64/MacroAssembler-arm64-inl.h index 77a6c38ed76e..908fd60d92fa 100644 --- a/js/src/jit/arm64/MacroAssembler-arm64-inl.h +++ b/js/src/jit/arm64/MacroAssembler-arm64-inl.h @@ -1032,6 +1032,17 @@ MacroAssembler::branchPtr(Condition cond, wasm::SymbolicAddress lhs, Register rh branchPtr(cond, scratch, rhs, label); } +void +MacroAssembler::branchPtr(Condition cond, const BaseIndex& lhs, ImmWord rhs, Label* label) +{ + vixl::UseScratchRegisterScope temps(this); + const Register scratch = temps.AcquireX().asUnsized(); + MOZ_ASSERT(scratch != lhs.base); + MOZ_ASSERT(scratch != lhs.index); + loadPtr(lhs, scratch); + branchPtr(cond, scratch, rhs, label); +} + template CodeOffsetJump MacroAssembler::branchPtrWithPatch(Condition cond, Register lhs, T rhs, RepatchLabel* label) diff --git a/js/src/jit/mips-shared/MacroAssembler-mips-shared-inl.h b/js/src/jit/mips-shared/MacroAssembler-mips-shared-inl.h index f2eb0c9b2802..b7c9936904e2 100644 --- a/js/src/jit/mips-shared/MacroAssembler-mips-shared-inl.h +++ b/js/src/jit/mips-shared/MacroAssembler-mips-shared-inl.h @@ -571,6 +571,13 @@ MacroAssembler::branchPtr(Condition cond, wasm::SymbolicAddress lhs, Register rh branchPtr(cond, SecondScratchReg, rhs, label); } +void +MacroAssembler::branchPtr(Condition cond, const BaseIndex& lhs, ImmWord rhs, Label* label) +{ + loadPtr(lhs, SecondScratchReg); + branchPtr(cond, SecondScratchReg, rhs, label); +} + template CodeOffsetJump MacroAssembler::branchPtrWithPatch(Condition cond, Register lhs, T rhs, RepatchLabel* label) diff --git a/js/src/jit/x64/Assembler-x64.h b/js/src/jit/x64/Assembler-x64.h index cf6c5afbc460..61cfe768fc5b 100644 --- a/js/src/jit/x64/Assembler-x64.h +++ b/js/src/jit/x64/Assembler-x64.h @@ -871,6 +871,9 @@ class Assembler : public AssemblerX86Shared case Operand::MEM_REG_DISP: masm.cmpq_im(rhs.value, lhs.disp(), lhs.base()); break; + case Operand::MEM_SCALE: + masm.cmpq_im(rhs.value, lhs.disp(), lhs.base(), lhs.index(), lhs.scale()); + break; case Operand::MEM_ADDRESS32: masm.cmpq_im(rhs.value, lhs.address()); break; diff --git a/js/src/jit/x86-shared/MacroAssembler-x86-shared-inl.h b/js/src/jit/x86-shared/MacroAssembler-x86-shared-inl.h index 33bfd46db85a..b5719b054896 100644 --- a/js/src/jit/x86-shared/MacroAssembler-x86-shared-inl.h +++ b/js/src/jit/x86-shared/MacroAssembler-x86-shared-inl.h @@ -582,6 +582,12 @@ MacroAssembler::branchPtr(Condition cond, const Address& lhs, ImmWord rhs, Label branchPtrImpl(cond, lhs, rhs, label); } +void +MacroAssembler::branchPtr(Condition cond, const BaseIndex& lhs, ImmWord rhs, Label* label) +{ + branchPtrImpl(cond, lhs, rhs, label); +} + template void MacroAssembler::branchPtrImpl(Condition cond, const T& lhs, const S& rhs, L label)