From ba86a8bc782039f8ecde62c2ef0cb21fecd138d9 Mon Sep 17 00:00:00 2001 From: Tooru Fujisawa Date: Mon, 15 Feb 2016 23:01:48 +0900 Subject: [PATCH] Bug 1245112 - Part 3: Move MacroAssembler::branch32 into generic macro assembler. r=nbp --- js/src/jit/MacroAssembler.h | 20 ++++ js/src/jit/arm/MacroAssembler-arm-inl.h | 92 +++++++++++++++++++ js/src/jit/arm/MacroAssembler-arm.cpp | 19 ++-- js/src/jit/arm/MacroAssembler-arm.h | 62 ------------- js/src/jit/arm64/MacroAssembler-arm64-inl.h | 90 ++++++++++++++++++ js/src/jit/arm64/MacroAssembler-arm64.cpp | 12 ++- js/src/jit/arm64/MacroAssembler-arm64.h | 60 ------------ .../MacroAssembler-mips-shared-inl.h | 72 +++++++++++++++ js/src/jit/mips32/MacroAssembler-mips32.cpp | 17 ++-- js/src/jit/mips32/MacroAssembler-mips32.h | 44 --------- js/src/jit/mips64/MacroAssembler-mips64.cpp | 17 ++-- js/src/jit/mips64/MacroAssembler-mips64.h | 44 --------- js/src/jit/none/MacroAssembler-none.h | 1 - js/src/jit/x64/MacroAssembler-x64-inl.h | 31 +++++++ js/src/jit/x64/MacroAssembler-x64.cpp | 12 +-- js/src/jit/x64/MacroAssembler-x64.h | 24 ----- .../MacroAssembler-x86-shared-inl.h | 56 +++++++++++ .../x86-shared/MacroAssembler-x86-shared.h | 32 ------- js/src/jit/x86/MacroAssembler-x86-inl.h | 21 +++++ js/src/jit/x86/MacroAssembler-x86.cpp | 15 +-- js/src/jit/x86/MacroAssembler-x86.h | 13 --- 21 files changed, 435 insertions(+), 319 deletions(-) diff --git a/js/src/jit/MacroAssembler.h b/js/src/jit/MacroAssembler.h index a1848fbf73c..6fb86f2d3d2 100644 --- a/js/src/jit/MacroAssembler.h +++ b/js/src/jit/MacroAssembler.h @@ -798,6 +798,26 @@ class MacroAssembler : public MacroAssemblerSpecific // =============================================================== // Branch functions + inline void branch32(Condition cond, Register lhs, Register rhs, Label* label) PER_SHARED_ARCH; + inline void branch32(Condition cond, Register lhs, Imm32 rhs, Label* label) PER_SHARED_ARCH; + inline void branch32(Condition cond, const Address& lhs, Register rhs, Label* label) PER_SHARED_ARCH; + inline void branch32(Condition cond, const Address& lhs, Imm32 rhs, Label* label) PER_SHARED_ARCH; + + inline void branch32(Condition cond, const AbsoluteAddress& lhs, Register rhs, Label* label) + DEFINED_ON(arm, arm64, mips_shared, x86, x64); + inline void branch32(Condition cond, const AbsoluteAddress& lhs, Imm32 rhs, Label* label) + DEFINED_ON(arm, arm64, mips_shared, x86, x64); + + inline void branch32(Condition cond, const BaseIndex& lhs, Register rhs, Label* label) + DEFINED_ON(x86_shared); + inline void branch32(Condition cond, const BaseIndex& lhs, Imm32 rhs, Label* label) PER_SHARED_ARCH; + + inline void branch32(Condition cond, const Operand& lhs, Register rhs, Label* label) PER_SHARED_ARCH; + inline void branch32(Condition cond, const Operand& lhs, Imm32 rhs, Label* label) PER_SHARED_ARCH; + + inline void branch32(Condition cond, wasm::SymbolicAddress lhs, Imm32 rhs, Label* label) + DEFINED_ON(arm, arm64, mips_shared, x86, x64); + 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; diff --git a/js/src/jit/arm/MacroAssembler-arm-inl.h b/js/src/jit/arm/MacroAssembler-arm-inl.h index eb1ac684096..73cf58138b8 100644 --- a/js/src/jit/arm/MacroAssembler-arm-inl.h +++ b/js/src/jit/arm/MacroAssembler-arm-inl.h @@ -393,6 +393,98 @@ MacroAssembler::rshift64(Imm32 imm, Register64 dest) // =============================================================== // Branch functions +void +MacroAssembler::branch32(Condition cond, Register lhs, Register rhs, Label* label) +{ + ma_cmp(lhs, rhs); + ma_b(label, cond); +} + +void +MacroAssembler::branch32(Condition cond, Register lhs, Imm32 rhs, Label* label) +{ + ma_cmp(lhs, rhs); + ma_b(label, cond); +} + +void +MacroAssembler::branch32(Condition cond, const Address& lhs, Register rhs, Label* label) +{ + ScratchRegisterScope scratch(*this); + load32(lhs, scratch); + branch32(cond, scratch, rhs, label); +} + +void +MacroAssembler::branch32(Condition cond, const Address& lhs, Imm32 rhs, Label* label) +{ + // branch32 will use ScratchRegister. + AutoRegisterScope scratch(*this, secondScratchReg_); + load32(lhs, scratch); + branch32(cond, scratch, rhs, label); +} + +void +MacroAssembler::branch32(Condition cond, const AbsoluteAddress& lhs, Register rhs, Label* label) +{ + AutoRegisterScope scratch2(*this, secondScratchReg_); + loadPtr(lhs, scratch2); // ma_cmp will use the scratch register. + ma_cmp(scratch2, rhs); + ma_b(label, cond); +} + +void +MacroAssembler::branch32(Condition cond, const AbsoluteAddress& lhs, Imm32 rhs, Label* label) +{ + AutoRegisterScope scratch2(*this, secondScratchReg_); + loadPtr(lhs, scratch2); // ma_cmp will use the scratch register. + ma_cmp(scratch2, rhs); + ma_b(label, cond); +} + +void +MacroAssembler::branch32(Condition cond, const BaseIndex& lhs, Imm32 rhs, Label* label) +{ + // branch32 will use ScratchRegister. + AutoRegisterScope scratch2(*this, secondScratchReg_); + load32(lhs, scratch2); + branch32(cond, scratch2, rhs, label); +} + + +void +MacroAssembler::branch32(Condition cond, const Operand& lhs, Register rhs, Label* label) +{ + if (lhs.getTag() == Operand::OP2) { + branch32(cond, lhs.toReg(), rhs, label); + } else { + ScratchRegisterScope scratch(*this); + ma_ldr(lhs.toAddress(), scratch); + branch32(cond, scratch, rhs, label); + } +} + +void +MacroAssembler::branch32(Condition cond, const Operand& lhs, Imm32 rhs, Label* label) +{ + if (lhs.getTag() == Operand::OP2) { + branch32(cond, lhs.toReg(), rhs, label); + } else { + // branch32 will use ScratchRegister. + AutoRegisterScope scratch(*this, secondScratchReg_); + ma_ldr(lhs.toAddress(), scratch); + branch32(cond, scratch, rhs, label); + } +} + +void +MacroAssembler::branch32(Condition cond, wasm::SymbolicAddress lhs, Imm32 rhs, Label* label) +{ + ScratchRegisterScope scratch(*this); + loadPtr(lhs, scratch); + branch32(cond, scratch, rhs, label); +} + void MacroAssembler::branchPtr(Condition cond, Register lhs, Register rhs, Label* label) { diff --git a/js/src/jit/arm/MacroAssembler-arm.cpp b/js/src/jit/arm/MacroAssembler-arm.cpp index ab5110b72e0..d2da41a3cda 100644 --- a/js/src/jit/arm/MacroAssembler-arm.cpp +++ b/js/src/jit/arm/MacroAssembler-arm.cpp @@ -3589,11 +3589,13 @@ MacroAssemblerARMCompat::handleFailureWithHandlerTail(void* handler) Label bailout; ma_ldr(Address(sp, offsetof(ResumeFromException, kind)), r0); - branch32(Assembler::Equal, r0, Imm32(ResumeFromException::RESUME_ENTRY_FRAME), &entryFrame); - branch32(Assembler::Equal, r0, Imm32(ResumeFromException::RESUME_CATCH), &catch_); - branch32(Assembler::Equal, r0, Imm32(ResumeFromException::RESUME_FINALLY), &finally); - branch32(Assembler::Equal, r0, Imm32(ResumeFromException::RESUME_FORCED_RETURN), &return_); - branch32(Assembler::Equal, r0, Imm32(ResumeFromException::RESUME_BAILOUT), &bailout); + asMasm().branch32(Assembler::Equal, r0, Imm32(ResumeFromException::RESUME_ENTRY_FRAME), + &entryFrame); + asMasm().branch32(Assembler::Equal, r0, Imm32(ResumeFromException::RESUME_CATCH), &catch_); + asMasm().branch32(Assembler::Equal, r0, Imm32(ResumeFromException::RESUME_FINALLY), &finally); + asMasm().branch32(Assembler::Equal, r0, Imm32(ResumeFromException::RESUME_FORCED_RETURN), + &return_); + asMasm().branch32(Assembler::Equal, r0, Imm32(ResumeFromException::RESUME_BAILOUT), &bailout); breakpoint(); // Invalid kind. @@ -3644,7 +3646,8 @@ MacroAssemblerARMCompat::handleFailureWithHandlerTail(void* handler) Label skipProfilingInstrumentation; // Test if profiler enabled. AbsoluteAddress addressOfEnabled(GetJitContext()->runtime->spsProfiler().addressOfEnabled()); - branch32(Assembler::Equal, addressOfEnabled, Imm32(0), &skipProfilingInstrumentation); + asMasm().branch32(Assembler::Equal, addressOfEnabled, Imm32(0), + &skipProfilingInstrumentation); profilerExitFrame(); bind(&skipProfilingInstrumentation); } @@ -4119,8 +4122,8 @@ MacroAssemblerARMCompat::branchPtrInNurseryRange(Condition cond, Register ptr, R ma_mov(Imm32(startChunk), scratch2); as_rsb(scratch2, scratch2, lsr(ptr, Nursery::ChunkShift)); - branch32(cond == Assembler::Equal ? Assembler::Below : Assembler::AboveOrEqual, - scratch2, Imm32(nursery.numChunks()), label); + asMasm().branch32(cond == Assembler::Equal ? Assembler::Below : Assembler::AboveOrEqual, + scratch2, Imm32(nursery.numChunks()), label); } void diff --git a/js/src/jit/arm/MacroAssembler-arm.h b/js/src/jit/arm/MacroAssembler-arm.h index b54e478380c..88623c43c30 100644 --- a/js/src/jit/arm/MacroAssembler-arm.h +++ b/js/src/jit/arm/MacroAssembler-arm.h @@ -774,50 +774,6 @@ class MacroAssemblerARMCompat : public MacroAssemblerARM Condition c = testBoolean(cond, t); ma_b(label, c); } - void branch32(Condition cond, Register lhs, Register rhs, Label* label) { - ma_cmp(lhs, rhs); - ma_b(label, cond); - } - void branch32(Condition cond, Register lhs, Imm32 imm, Label* label) { - ma_cmp(lhs, imm); - ma_b(label, cond); - } - void branch32(Condition cond, const Operand& lhs, Register rhs, Label* label) { - if (lhs.getTag() == Operand::OP2) { - branch32(cond, lhs.toReg(), rhs, label); - } else { - ScratchRegisterScope scratch(asMasm()); - ma_ldr(lhs.toAddress(), scratch); - branch32(cond, scratch, rhs, label); - } - } - void branch32(Condition cond, const Operand& lhs, Imm32 rhs, Label* label) { - if (lhs.getTag() == Operand::OP2) { - branch32(cond, lhs.toReg(), rhs, label); - } else { - // branch32 will use ScratchRegister. - AutoRegisterScope scratch(asMasm(), secondScratchReg_); - ma_ldr(lhs.toAddress(), scratch); - branch32(cond, scratch, rhs, label); - } - } - void branch32(Condition cond, const Address& lhs, Register rhs, Label* label) { - ScratchRegisterScope scratch(asMasm()); - load32(lhs, scratch); - branch32(cond, scratch, rhs, label); - } - void branch32(Condition cond, const Address& lhs, Imm32 rhs, Label* label) { - // branch32 will use ScratchRegister. - AutoRegisterScope scratch(asMasm(), secondScratchReg_); - load32(lhs, scratch); - branch32(cond, scratch, rhs, label); - } - void branch32(Condition cond, const BaseIndex& lhs, Imm32 rhs, Label* label) { - // branch32 will use ScratchRegister. - AutoRegisterScope scratch2(asMasm(), secondScratchReg_); - load32(lhs, scratch2); - branch32(cond, scratch2, rhs, label); - } template void branchTestDouble(Condition cond, const T & t, Label* label) { @@ -942,24 +898,6 @@ class MacroAssemblerARMCompat : public MacroAssemblerARM ma_cmp(scratch2, ptr); return jumpWithPatch(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. - ma_cmp(scratch2, rhs); - ma_b(label, cond); - } - void branch32(Condition cond, AbsoluteAddress lhs, Register rhs, Label* label) { - AutoRegisterScope scratch2(asMasm(), secondScratchReg_); - loadPtr(lhs, scratch2); // ma_cmp will use the scratch register. - ma_cmp(scratch2, rhs); - ma_b(label, cond); - } - void branch32(Condition cond, wasm::SymbolicAddress addr, Imm32 imm, Label* label) { - ScratchRegisterScope scratch(asMasm()); - loadPtr(addr, scratch); - ma_cmp(scratch, imm); - ma_b(label, cond); - } void loadUnboxedValue(Address address, MIRType type, AnyRegister dest) { if (dest.isFloat()) diff --git a/js/src/jit/arm64/MacroAssembler-arm64-inl.h b/js/src/jit/arm64/MacroAssembler-arm64-inl.h index 2fcc0de7895..373aebbb447 100644 --- a/js/src/jit/arm64/MacroAssembler-arm64-inl.h +++ b/js/src/jit/arm64/MacroAssembler-arm64-inl.h @@ -438,6 +438,96 @@ MacroAssembler::rshift64(Imm32 imm, Register64 dest) // =============================================================== // Branch functions +void +MacroAssembler::branch32(Condition cond, Register lhs, Register rhs, Label* label) +{ + cmp32(lhs, rhs); + B(label, cond); +} + +void +MacroAssembler::branch32(Condition cond, Register lhs, Imm32 imm, Label* label) +{ + cmp32(lhs, imm); + B(label, cond); +} + +void +MacroAssembler::branch32(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); + load32(lhs, scratch); + branch32(cond, scratch, rhs, label); +} + +void +MacroAssembler::branch32(Condition cond, const Address& lhs, Imm32 imm, Label* label) +{ + vixl::UseScratchRegisterScope temps(this); + const Register scratch = temps.AcquireX().asUnsized(); + MOZ_ASSERT(scratch != lhs.base); + load32(lhs, scratch); + branch32(cond, scratch, imm, label); +} + +void +MacroAssembler::branch32(Condition cond, const AbsoluteAddress& lhs, Register rhs, Label* label) +{ + vixl::UseScratchRegisterScope temps(this); + const Register scratch = temps.AcquireX().asUnsized(); + movePtr(ImmPtr(lhs.addr), scratch); + branch32(cond, Address(scratch, 0), rhs, label); +} + +void +MacroAssembler::branch32(Condition cond, const AbsoluteAddress& lhs, Imm32 rhs, Label* label) +{ + vixl::UseScratchRegisterScope temps(this); + const Register scratch = temps.AcquireX().asUnsized(); + movePtr(ImmPtr(lhs.addr), scratch); + branch32(cond, Address(scratch, 0), rhs, label); +} + +void +MacroAssembler::branch32(Condition cond, const BaseIndex& lhs, Imm32 rhs, Label* label) +{ + vixl::UseScratchRegisterScope temps(this); + const ARMRegister scratch32 = temps.AcquireW(); + MOZ_ASSERT(scratch32.asUnsized() != lhs.base); + MOZ_ASSERT(scratch32.asUnsized() != lhs.index); + doBaseIndex(scratch32, lhs, vixl::LDR_w); + branch32(cond, scratch32.asUnsized(), rhs, label); +} + + +void +MacroAssembler::branch32(Condition cond, const Operand& lhs, Register rhs, Label* label) +{ + // since rhs is an operand, do the compare backwards + Cmp(ARMRegister(rhs, 32), lhs); + B(label, Assembler::InvertCmpCondition(cond)); +} + +void +MacroAssembler::branch32(Condition cond, const Operand& lhs, Imm32 rhs, Label* label) +{ + ARMRegister l = lhs.reg(); + Cmp(l, Operand(rhs.value)); + B(label, cond); +} + +void +MacroAssembler::branch32(Condition cond, wasm::SymbolicAddress lhs, Imm32 rhs, Label* label) +{ + vixl::UseScratchRegisterScope temps(this); + const Register scratch = temps.AcquireX().asUnsized(); + movePtr(lhs, scratch); + branch32(cond, Address(scratch, 0), rhs, label); +} + void MacroAssembler::branchPtr(Condition cond, Register lhs, Register rhs, Label* label) { diff --git a/js/src/jit/arm64/MacroAssembler-arm64.cpp b/js/src/jit/arm64/MacroAssembler-arm64.cpp index a42777494f9..51662f68fb7 100644 --- a/js/src/jit/arm64/MacroAssembler-arm64.cpp +++ b/js/src/jit/arm64/MacroAssembler-arm64.cpp @@ -156,11 +156,13 @@ MacroAssemblerCompat::handleFailureWithHandlerTail(void* handler) MOZ_ASSERT(GetStackPointer64().Is(x28)); // Lets the code below be a little cleaner. loadPtr(Address(r28, offsetof(ResumeFromException, kind)), r0); - branch32(Assembler::Equal, r0, Imm32(ResumeFromException::RESUME_ENTRY_FRAME), &entryFrame); - branch32(Assembler::Equal, r0, Imm32(ResumeFromException::RESUME_CATCH), &catch_); - branch32(Assembler::Equal, r0, Imm32(ResumeFromException::RESUME_FINALLY), &finally); - branch32(Assembler::Equal, r0, Imm32(ResumeFromException::RESUME_FORCED_RETURN), &return_); - branch32(Assembler::Equal, r0, Imm32(ResumeFromException::RESUME_BAILOUT), &bailout); + asMasm().branch32(Assembler::Equal, r0, Imm32(ResumeFromException::RESUME_ENTRY_FRAME), + &entryFrame); + asMasm().branch32(Assembler::Equal, r0, Imm32(ResumeFromException::RESUME_CATCH), &catch_); + asMasm().branch32(Assembler::Equal, r0, Imm32(ResumeFromException::RESUME_FINALLY), &finally); + asMasm().branch32(Assembler::Equal, r0, Imm32(ResumeFromException::RESUME_FORCED_RETURN), + &return_); + asMasm().branch32(Assembler::Equal, r0, Imm32(ResumeFromException::RESUME_BAILOUT), &bailout); breakpoint(); // Invalid kind. diff --git a/js/src/jit/arm64/MacroAssembler-arm64.h b/js/src/jit/arm64/MacroAssembler-arm64.h index 75b45543cf9..7055c52f0a8 100644 --- a/js/src/jit/arm64/MacroAssembler-arm64.h +++ b/js/src/jit/arm64/MacroAssembler-arm64.h @@ -1357,66 +1357,6 @@ class MacroAssemblerCompat : public vixl::MacroAssembler addPendingJump(loc, ImmPtr(target->raw()), Relocation::JITCODE); } - void branch32(Condition cond, const Operand& lhs, Register rhs, Label* label) { - // since rhs is an operand, do the compare backwards - Cmp(ARMRegister(rhs, 32), lhs); - B(label, Assembler::InvertCmpCondition(cond)); - } - void branch32(Condition cond, const Operand& lhs, Imm32 rhs, Label* label) { - ARMRegister l = lhs.reg(); - Cmp(l, Operand(rhs.value)); - B(label, cond); - } - void branch32(Condition cond, Register lhs, Register rhs, Label* label) { - cmp32(lhs, rhs); - B(label, cond); - } - void branch32(Condition cond, Register lhs, Imm32 imm, Label* label) { - cmp32(lhs, imm); - B(label, cond); - } - void branch32(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); - load32(lhs, scratch); - branch32(cond, scratch, rhs, label); - } - void branch32(Condition cond, const Address& lhs, Imm32 imm, Label* label) { - vixl::UseScratchRegisterScope temps(this); - const Register scratch = temps.AcquireX().asUnsized(); - MOZ_ASSERT(scratch != lhs.base); - load32(lhs, scratch); - branch32(cond, scratch, imm, label); - } - void branch32(Condition cond, AbsoluteAddress lhs, Register rhs, Label* label) { - vixl::UseScratchRegisterScope temps(this); - const Register scratch = temps.AcquireX().asUnsized(); - movePtr(ImmPtr(lhs.addr), scratch); - branch32(cond, Address(scratch, 0), rhs, label); - } - void branch32(Condition cond, AbsoluteAddress lhs, Imm32 rhs, Label* label) { - vixl::UseScratchRegisterScope temps(this); - const Register scratch = temps.AcquireX().asUnsized(); - movePtr(ImmPtr(lhs.addr), scratch); - branch32(cond, Address(scratch, 0), rhs, label); - } - void branch32(Condition cond, wasm::SymbolicAddress lhs, Imm32 rhs, Label* label) { - vixl::UseScratchRegisterScope temps(this); - const Register scratch = temps.AcquireX().asUnsized(); - movePtr(lhs, scratch); - branch32(cond, Address(scratch, 0), rhs, label); - } - void branch32(Condition cond, BaseIndex lhs, Imm32 rhs, Label* label) { - vixl::UseScratchRegisterScope temps(this); - const ARMRegister scratch32 = temps.AcquireW(); - MOZ_ASSERT(scratch32.asUnsized() != lhs.base); - MOZ_ASSERT(scratch32.asUnsized() != lhs.index); - doBaseIndex(scratch32, lhs, vixl::LDR_w); - branch32(cond, scratch32.asUnsized(), rhs, label); - } - template void branchTest32(Condition cond, Register lhs, Register rhs, L label) { MOZ_ASSERT(cond == Zero || cond == NonZero || cond == Signed || cond == NotSigned); 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 dc15f820169..a85aeaf4b9e 100644 --- a/js/src/jit/mips-shared/MacroAssembler-mips-shared-inl.h +++ b/js/src/jit/mips-shared/MacroAssembler-mips-shared-inl.h @@ -194,6 +194,78 @@ MacroAssembler::negateDouble(FloatRegister reg) // =============================================================== // Branch functions +void +MacroAssembler::branch32(Condition cond, Register lhs, Register rhs, Label* label) +{ + ma_b(lhs, rhs, label, cond); +} + +void +MacroAssembler::branch32(Condition cond, Register lhs, Imm32 imm, Label* label) +{ + ma_b(lhs, imm, label, cond); +} + +void +MacroAssembler::branch32(Condition cond, const Address& lhs, Register rhs, Label* label) +{ + load32(lhs, SecondScratchReg); + ma_b(SecondScratchReg, rhs, label, cond); +} + +void +MacroAssembler::branch32(Condition cond, const Address& lhs, Imm32 rhs, Label* label) +{ + load32(lhs, SecondScratchReg); + ma_b(SecondScratchReg, rhs, label, cond); +} + +void +MacroAssembler::branch32(Condition cond, const AbsoluteAddress& lhs, Register rhs, Label* label) +{ + load32(lhs, SecondScratchReg); + ma_b(SecondScratchReg, rhs, label, cond); +} + +void +MacroAssembler::branch32(Condition cond, const AbsoluteAddress& lhs, Imm32 rhs, Label* label) +{ + load32(lhs, SecondScratchReg); + ma_b(SecondScratchReg, rhs, label, cond); +} + +void +MacroAssembler::branch32(Condition cond, const BaseIndex& lhs, Imm32 rhs, Label* label) +{ + load32(lhs, SecondScratchReg); + ma_b(SecondScratchReg, rhs, label, cond); +} + +void +MacroAssembler::branch32(Condition cond, const Operand& lhs, Register rhs, Label* label) +{ + if (lhs.getTag() == Operand::REG) + ma_b(lhs.toReg(), rhs, label, cond); + else + branch32(cond, lhs.toAddress(), rhs, label); +} + +void +MacroAssembler::branch32(Condition cond, const Operand& lhs, Imm32 rhs, Label* label) +{ + if (lhs.getTag() == Operand::REG) + ma_b(lhs.toReg(), rhs, label, cond); + else + branch32(cond, lhs.toAddress(), rhs, label); +} + +void +MacroAssembler::branch32(Condition cond, wasm::SymbolicAddress addr, Imm32 imm, Label* label) +{ + load32(addr, SecondScratchReg); + ma_b(SecondScratchReg, imm, label, cond); +} + void MacroAssembler::branchPtr(Condition cond, Register lhs, Register rhs, Label* label) { diff --git a/js/src/jit/mips32/MacroAssembler-mips32.cpp b/js/src/jit/mips32/MacroAssembler-mips32.cpp index 9cf6bb3b4c4..56a9755e715 100644 --- a/js/src/jit/mips32/MacroAssembler-mips32.cpp +++ b/js/src/jit/mips32/MacroAssembler-mips32.cpp @@ -1088,7 +1088,7 @@ MacroAssembler::clampDoubleToUint8(FloatRegister input, Register output) Label outOfRange; branchTruncateDouble(input, output, &outOfRange); - branch32(Assembler::Above, output, Imm32(255), &outOfRange); + asMasm().branch32(Assembler::Above, output, Imm32(255), &outOfRange); { // Check if we had a tie. convertInt32ToDouble(output, ScratchDoubleReg); @@ -2178,11 +2178,13 @@ MacroAssemblerMIPSCompat::handleFailureWithHandlerTail(void* handler) // Already clobbered a0, so use it... load32(Address(StackPointer, offsetof(ResumeFromException, kind)), a0); - branch32(Assembler::Equal, a0, Imm32(ResumeFromException::RESUME_ENTRY_FRAME), &entryFrame); - branch32(Assembler::Equal, a0, Imm32(ResumeFromException::RESUME_CATCH), &catch_); - branch32(Assembler::Equal, a0, Imm32(ResumeFromException::RESUME_FINALLY), &finally); - branch32(Assembler::Equal, a0, Imm32(ResumeFromException::RESUME_FORCED_RETURN), &return_); - branch32(Assembler::Equal, a0, Imm32(ResumeFromException::RESUME_BAILOUT), &bailout); + asMasm().branch32(Assembler::Equal, a0, Imm32(ResumeFromException::RESUME_ENTRY_FRAME), + &entryFrame); + asMasm().branch32(Assembler::Equal, a0, Imm32(ResumeFromException::RESUME_CATCH), &catch_); + asMasm().branch32(Assembler::Equal, a0, Imm32(ResumeFromException::RESUME_FINALLY), &finally); + asMasm().branch32(Assembler::Equal, a0, Imm32(ResumeFromException::RESUME_FORCED_RETURN), + &return_); + asMasm().branch32(Assembler::Equal, a0, Imm32(ResumeFromException::RESUME_BAILOUT), &bailout); breakpoint(); // Invalid kind. @@ -2236,7 +2238,8 @@ MacroAssemblerMIPSCompat::handleFailureWithHandlerTail(void* handler) Label skipProfilingInstrumentation; // Test if profiler enabled. AbsoluteAddress addressOfEnabled(GetJitContext()->runtime->spsProfiler().addressOfEnabled()); - branch32(Assembler::Equal, addressOfEnabled, Imm32(0), &skipProfilingInstrumentation); + asMasm().branch32(Assembler::Equal, addressOfEnabled, Imm32(0), + &skipProfilingInstrumentation); profilerExitFrame(); bind(&skipProfilingInstrumentation); } diff --git a/js/src/jit/mips32/MacroAssembler-mips32.h b/js/src/jit/mips32/MacroAssembler-mips32.h index 610f73cff05..6703a017cf2 100644 --- a/js/src/jit/mips32/MacroAssembler-mips32.h +++ b/js/src/jit/mips32/MacroAssembler-mips32.h @@ -383,38 +383,6 @@ class MacroAssemblerMIPSCompat : public MacroAssemblerMIPS void branchTestBoolean(Condition cond, const Address& address, Label* label); void branchTestBoolean(Condition cond, const BaseIndex& src, Label* label); - void branch32(Condition cond, Register lhs, Register rhs, Label* label) { - ma_b(lhs, rhs, label, cond); - } - void branch32(Condition cond, Register lhs, Imm32 imm, Label* label) { - ma_b(lhs, imm, label, cond); - } - void branch32(Condition cond, const Operand& lhs, Register rhs, Label* label) { - if (lhs.getTag() == Operand::REG) { - ma_b(lhs.toReg(), rhs, label, cond); - } else { - branch32(cond, lhs.toAddress(), rhs, label); - } - } - void branch32(Condition cond, const Operand& lhs, Imm32 rhs, Label* label) { - if (lhs.getTag() == Operand::REG) { - ma_b(lhs.toReg(), rhs, label, cond); - } else { - branch32(cond, lhs.toAddress(), rhs, label); - } - } - void branch32(Condition cond, const Address& lhs, Register rhs, Label* label) { - load32(lhs, SecondScratchReg); - ma_b(SecondScratchReg, rhs, label, cond); - } - void branch32(Condition cond, const Address& lhs, Imm32 rhs, Label* label) { - load32(lhs, SecondScratchReg); - ma_b(SecondScratchReg, rhs, label, cond); - } - void branch32(Condition cond, const BaseIndex& lhs, Imm32 rhs, Label* label) { - load32(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); @@ -551,18 +519,6 @@ class MacroAssemblerMIPSCompat : public MacroAssemblerMIPS bind(&skipJump); return off; } - void branch32(Condition cond, AbsoluteAddress lhs, Imm32 rhs, Label* label) { - load32(lhs, SecondScratchReg); - ma_b(SecondScratchReg, rhs, label, cond); - } - void branch32(Condition cond, AbsoluteAddress lhs, Register rhs, Label* label) { - load32(lhs, SecondScratchReg); - ma_b(SecondScratchReg, rhs, label, cond); - } - void branch32(Condition cond, wasm::SymbolicAddress addr, Imm32 imm, Label* label) { - load32(addr, SecondScratchReg); - ma_b(SecondScratchReg, imm, label, cond); - } void loadUnboxedValue(Address address, MIRType type, AnyRegister dest) { if (dest.isFloat()) diff --git a/js/src/jit/mips64/MacroAssembler-mips64.cpp b/js/src/jit/mips64/MacroAssembler-mips64.cpp index 14fb5fe194c..ac244f56548 100644 --- a/js/src/jit/mips64/MacroAssembler-mips64.cpp +++ b/js/src/jit/mips64/MacroAssembler-mips64.cpp @@ -1228,7 +1228,7 @@ MacroAssembler::clampDoubleToUint8(FloatRegister input, Register output) Label outOfRange; branchTruncateDouble(input, output, &outOfRange); - branch32(Assembler::Above, output, Imm32(255), &outOfRange); + asMasm().branch32(Assembler::Above, output, Imm32(255), &outOfRange); { // Check if we had a tie. convertInt32ToDouble(output, ScratchDoubleReg); @@ -2335,11 +2335,13 @@ MacroAssemblerMIPS64Compat::handleFailureWithHandlerTail(void* handler) // Already clobbered a0, so use it... load32(Address(StackPointer, offsetof(ResumeFromException, kind)), a0); - branch32(Assembler::Equal, a0, Imm32(ResumeFromException::RESUME_ENTRY_FRAME), &entryFrame); - branch32(Assembler::Equal, a0, Imm32(ResumeFromException::RESUME_CATCH), &catch_); - branch32(Assembler::Equal, a0, Imm32(ResumeFromException::RESUME_FINALLY), &finally); - branch32(Assembler::Equal, a0, Imm32(ResumeFromException::RESUME_FORCED_RETURN), &return_); - branch32(Assembler::Equal, a0, Imm32(ResumeFromException::RESUME_BAILOUT), &bailout); + asMasm().branch32(Assembler::Equal, a0, Imm32(ResumeFromException::RESUME_ENTRY_FRAME), + &entryFrame); + asMasm().branch32(Assembler::Equal, a0, Imm32(ResumeFromException::RESUME_CATCH), &catch_); + asMasm().branch32(Assembler::Equal, a0, Imm32(ResumeFromException::RESUME_FINALLY), &finally); + asMasm().branch32(Assembler::Equal, a0, Imm32(ResumeFromException::RESUME_FORCED_RETURN), + &return_); + asMasm().branch32(Assembler::Equal, a0, Imm32(ResumeFromException::RESUME_BAILOUT), &bailout); breakpoint(); // Invalid kind. @@ -2393,7 +2395,8 @@ MacroAssemblerMIPS64Compat::handleFailureWithHandlerTail(void* handler) Label skipProfilingInstrumentation; // Test if profiler enabled. AbsoluteAddress addressOfEnabled(GetJitContext()->runtime->spsProfiler().addressOfEnabled()); - branch32(Assembler::Equal, addressOfEnabled, Imm32(0), &skipProfilingInstrumentation); + asMasm().branch32(Assembler::Equal, addressOfEnabled, Imm32(0), + &skipProfilingInstrumentation); profilerExitFrame(); bind(&skipProfilingInstrumentation); } diff --git a/js/src/jit/mips64/MacroAssembler-mips64.h b/js/src/jit/mips64/MacroAssembler-mips64.h index 88bb9e2ad2b..2d10d1c8080 100644 --- a/js/src/jit/mips64/MacroAssembler-mips64.h +++ b/js/src/jit/mips64/MacroAssembler-mips64.h @@ -424,38 +424,6 @@ class MacroAssemblerMIPS64Compat : public MacroAssemblerMIPS64 void branchTestBoolean(Condition cond, const Address& address, Label* label); void branchTestBoolean(Condition cond, const BaseIndex& src, Label* label); - void branch32(Condition cond, Register lhs, Register rhs, Label* label) { - ma_b(lhs, rhs, label, cond); - } - void branch32(Condition cond, Register lhs, Imm32 imm, Label* label) { - ma_b(lhs, imm, label, cond); - } - void branch32(Condition cond, const Operand& lhs, Register rhs, Label* label) { - if (lhs.getTag() == Operand::REG) { - ma_b(lhs.toReg(), rhs, label, cond); - } else { - branch32(cond, lhs.toAddress(), rhs, label); - } - } - void branch32(Condition cond, const Operand& lhs, Imm32 rhs, Label* label) { - if (lhs.getTag() == Operand::REG) { - ma_b(lhs.toReg(), rhs, label, cond); - } else { - branch32(cond, lhs.toAddress(), rhs, label); - } - } - void branch32(Condition cond, const Address& lhs, Register rhs, Label* label) { - load32(lhs, SecondScratchReg); - ma_b(SecondScratchReg, rhs, label, cond); - } - void branch32(Condition cond, const Address& lhs, Imm32 rhs, Label* label) { - load32(lhs, SecondScratchReg); - ma_b(SecondScratchReg, rhs, label, cond); - } - void branch32(Condition cond, const BaseIndex& lhs, Imm32 rhs, Label* label) { - load32(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); @@ -584,18 +552,6 @@ class MacroAssemblerMIPS64Compat : public MacroAssemblerMIPS64 bind(&skipJump); return off; } - void branch32(Condition cond, AbsoluteAddress lhs, Imm32 rhs, Label* label) { - load32(lhs, SecondScratchReg); - ma_b(SecondScratchReg, rhs, label, cond); - } - void branch32(Condition cond, AbsoluteAddress lhs, Register rhs, Label* label) { - load32(lhs, SecondScratchReg); - ma_b(SecondScratchReg, rhs, label, cond); - } - void branch32(Condition cond, wasm::SymbolicAddress addr, Imm32 imm, Label* label) { - load32(addr, SecondScratchReg); - ma_b(SecondScratchReg, imm, label, cond); - } template void loadUnboxedValue(const T& address, MIRType type, AnyRegister dest) { diff --git a/js/src/jit/none/MacroAssembler-none.h b/js/src/jit/none/MacroAssembler-none.h index 69baf29b8ff..fff6cc112ae 100644 --- a/js/src/jit/none/MacroAssembler-none.h +++ b/js/src/jit/none/MacroAssembler-none.h @@ -244,7 +244,6 @@ class MacroAssemblerNone : public Assembler template void cmpPtrSet(Condition, T, S, Register) { MOZ_CRASH(); } template void cmp32Set(Condition, T, S, Register) { MOZ_CRASH(); } - template void branch32(Condition, T, S, Label*) { MOZ_CRASH(); } template void branchTest32(Condition, T, S, L) { MOZ_CRASH(); } template void branchAdd32(Condition, T, S, Label*) { MOZ_CRASH(); } template void branchSub32(Condition, T, S, Label*) { MOZ_CRASH(); } diff --git a/js/src/jit/x64/MacroAssembler-x64-inl.h b/js/src/jit/x64/MacroAssembler-x64-inl.h index 1d2d879ccb0..aacce120117 100644 --- a/js/src/jit/x64/MacroAssembler-x64-inl.h +++ b/js/src/jit/x64/MacroAssembler-x64-inl.h @@ -222,6 +222,37 @@ MacroAssembler::rshift64(Imm32 imm, Register64 dest) // =============================================================== // Branch functions +void +MacroAssembler::branch32(Condition cond, const AbsoluteAddress& lhs, Register rhs, Label* label) +{ + if (X86Encoding::IsAddressImmediate(lhs.addr)) { + branch32(cond, Operand(lhs), rhs, label); + } else { + ScratchRegisterScope scratch(*this); + mov(ImmPtr(lhs.addr), scratch); + branch32(cond, Address(scratch, 0), rhs, label); + } +} +void +MacroAssembler::branch32(Condition cond, const AbsoluteAddress& lhs, Imm32 rhs, Label* label) +{ + if (X86Encoding::IsAddressImmediate(lhs.addr)) { + branch32(cond, Operand(lhs), rhs, label); + } else { + ScratchRegisterScope scratch(*this); + mov(ImmPtr(lhs.addr), scratch); + branch32(cond, Address(scratch, 0), rhs, label); + } +} + +void +MacroAssembler::branch32(Condition cond, wasm::SymbolicAddress lhs, Imm32 rhs, Label* label) +{ + ScratchRegisterScope scratch(*this); + mov(lhs, scratch); + branch32(cond, Address(scratch, 0), rhs, label); +} + void MacroAssembler::branchPtr(Condition cond, const AbsoluteAddress& lhs, Register rhs, Label* label) { diff --git a/js/src/jit/x64/MacroAssembler-x64.cpp b/js/src/jit/x64/MacroAssembler-x64.cpp index 91190a2648c..9a8313df86d 100644 --- a/js/src/jit/x64/MacroAssembler-x64.cpp +++ b/js/src/jit/x64/MacroAssembler-x64.cpp @@ -159,11 +159,11 @@ MacroAssemblerX64::handleFailureWithHandlerTail(void* handler) Label bailout; loadPtr(Address(rsp, offsetof(ResumeFromException, kind)), rax); - branch32(Assembler::Equal, rax, Imm32(ResumeFromException::RESUME_ENTRY_FRAME), &entryFrame); - branch32(Assembler::Equal, rax, Imm32(ResumeFromException::RESUME_CATCH), &catch_); - branch32(Assembler::Equal, rax, Imm32(ResumeFromException::RESUME_FINALLY), &finally); - branch32(Assembler::Equal, rax, Imm32(ResumeFromException::RESUME_FORCED_RETURN), &return_); - branch32(Assembler::Equal, rax, Imm32(ResumeFromException::RESUME_BAILOUT), &bailout); + asMasm().branch32(Assembler::Equal, rax, Imm32(ResumeFromException::RESUME_ENTRY_FRAME), &entryFrame); + asMasm().branch32(Assembler::Equal, rax, Imm32(ResumeFromException::RESUME_CATCH), &catch_); + asMasm().branch32(Assembler::Equal, rax, Imm32(ResumeFromException::RESUME_FINALLY), &finally); + asMasm().branch32(Assembler::Equal, rax, Imm32(ResumeFromException::RESUME_FORCED_RETURN), &return_); + asMasm().branch32(Assembler::Equal, rax, Imm32(ResumeFromException::RESUME_BAILOUT), &bailout); breakpoint(); // Invalid kind. @@ -210,7 +210,7 @@ MacroAssemblerX64::handleFailureWithHandlerTail(void* handler) { Label skipProfilingInstrumentation; AbsoluteAddress addressOfEnabled(GetJitContext()->runtime->spsProfiler().addressOfEnabled()); - branch32(Assembler::Equal, addressOfEnabled, Imm32(0), &skipProfilingInstrumentation); + asMasm().branch32(Assembler::Equal, addressOfEnabled, Imm32(0), &skipProfilingInstrumentation); profilerExitFrame(); bind(&skipProfilingInstrumentation); } diff --git a/js/src/jit/x64/MacroAssembler-x64.h b/js/src/jit/x64/MacroAssembler-x64.h index 03d0733e1f2..7007b4aed6b 100644 --- a/js/src/jit/x64/MacroAssembler-x64.h +++ b/js/src/jit/x64/MacroAssembler-x64.h @@ -42,7 +42,6 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared void bindOffsets(const MacroAssemblerX86Shared::UsesVector&); public: - using MacroAssemblerX86Shared::branch32; using MacroAssemblerX86Shared::branchTest32; using MacroAssemblerX86Shared::load32; using MacroAssemblerX86Shared::store32; @@ -528,29 +527,6 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared // Common interface. ///////////////////////////////////////////////////////////////// - void branch32(Condition cond, AbsoluteAddress lhs, Imm32 rhs, Label* label) { - if (X86Encoding::IsAddressImmediate(lhs.addr)) { - branch32(cond, Operand(lhs), rhs, label); - } else { - ScratchRegisterScope scratch(asMasm()); - mov(ImmPtr(lhs.addr), scratch); - branch32(cond, Address(scratch, 0), rhs, label); - } - } - void branch32(Condition cond, wasm::SymbolicAddress lhs, Imm32 rhs, Label* label) { - ScratchRegisterScope scratch(asMasm()); - mov(lhs, scratch); - branch32(cond, Address(scratch, 0), rhs, label); - } - void branch32(Condition cond, AbsoluteAddress lhs, Register rhs, Label* label) { - if (X86Encoding::IsAddressImmediate(lhs.addr)) { - branch32(cond, Operand(lhs), rhs, label); - } else { - ScratchRegisterScope scratch(asMasm()); - mov(ImmPtr(lhs.addr), scratch); - branch32(cond, Address(scratch, 0), rhs, label); - } - } void branchTest32(Condition cond, AbsoluteAddress address, Imm32 imm, Label* label) { if (X86Encoding::IsAddressImmediate(address.addr)) { test32(Operand(address), imm); 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 07b476d2807..5347de5fc5b 100644 --- a/js/src/jit/x86-shared/MacroAssembler-x86-shared-inl.h +++ b/js/src/jit/x86-shared/MacroAssembler-x86-shared-inl.h @@ -183,6 +183,62 @@ MacroAssembler::negateDouble(FloatRegister reg) // =============================================================== // Branch instructions +void +MacroAssembler::branch32(Condition cond, Register lhs, Register rhs, Label* label) +{ + cmp32(lhs, rhs); + j(cond, label); +} + +void +MacroAssembler::branch32(Condition cond, Register lhs, Imm32 rhs, Label* label) +{ + cmp32(lhs, rhs); + j(cond, label); +} + +void +MacroAssembler::branch32(Condition cond, const Address& lhs, Register rhs, Label* label) +{ + cmp32(Operand(lhs), rhs); + j(cond, label); +} + +void +MacroAssembler::branch32(Condition cond, const Address& lhs, Imm32 rhs, Label* label) +{ + cmp32(Operand(lhs), rhs); + j(cond, label); +} + +void +MacroAssembler::branch32(Condition cond, const BaseIndex& lhs, Register rhs, Label* label) +{ + cmp32(Operand(lhs), rhs); + j(cond, label); +} + +void +MacroAssembler::branch32(Condition cond, const BaseIndex& lhs, Imm32 rhs, Label* label) +{ + cmp32(Operand(lhs), rhs); + j(cond, label); +} + +void +MacroAssembler::branch32(Condition cond, const Operand& lhs, Register rhs, Label* label) +{ + cmp32(lhs, rhs); + j(cond, label); +} + +void +MacroAssembler::branch32(Condition cond, const Operand& lhs, Imm32 rhs, Label* label) +{ + cmp32(lhs, rhs); + j(cond, label); +} + void MacroAssembler::branchPtr(Condition cond, Register lhs, Register rhs, Label* label) { diff --git a/js/src/jit/x86-shared/MacroAssembler-x86-shared.h b/js/src/jit/x86-shared/MacroAssembler-x86-shared.h index ebfc6840a90..718cd0b105b 100644 --- a/js/src/jit/x86-shared/MacroAssembler-x86-shared.h +++ b/js/src/jit/x86-shared/MacroAssembler-x86-shared.h @@ -568,38 +568,6 @@ class MacroAssemblerX86Shared : public Assembler cmpw(rhs, lhs); j(cond, label); } - void branch32(Condition cond, const Operand& lhs, Register rhs, Label* label) { - cmp32(lhs, rhs); - j(cond, label); - } - void branch32(Condition cond, const Operand& lhs, Imm32 rhs, Label* label) { - cmp32(lhs, rhs); - j(cond, label); - } - void branch32(Condition cond, const Address& lhs, Register rhs, Label* label) { - cmp32(Operand(lhs), rhs); - j(cond, label); - } - void branch32(Condition cond, const Address& lhs, Imm32 imm, Label* label) { - cmp32(Operand(lhs), imm); - j(cond, label); - } - void branch32(Condition cond, const BaseIndex& lhs, Register rhs, Label* label) { - cmp32(Operand(lhs), rhs); - j(cond, label); - } - void branch32(Condition cond, const BaseIndex& lhs, Imm32 imm, Label* label) { - cmp32(Operand(lhs), imm); - j(cond, label); - } - void branch32(Condition cond, Register lhs, Imm32 imm, Label* label) { - cmp32(lhs, imm); - j(cond, label); - } - void branch32(Condition cond, Register lhs, Register rhs, Label* label) { - cmp32(lhs, rhs); - j(cond, label); - } void branchTest16(Condition cond, Register lhs, Register rhs, Label* label) { testw(rhs, lhs); j(cond, label); diff --git a/js/src/jit/x86/MacroAssembler-x86-inl.h b/js/src/jit/x86/MacroAssembler-x86-inl.h index b9f802d9c56..291df74b220 100644 --- a/js/src/jit/x86/MacroAssembler-x86-inl.h +++ b/js/src/jit/x86/MacroAssembler-x86-inl.h @@ -258,6 +258,27 @@ MacroAssembler::rshift64(Imm32 imm, Register64 dest) // =============================================================== // Branch functions +void +MacroAssembler::branch32(Condition cond, const AbsoluteAddress& lhs, Register rhs, Label* label) +{ + cmp32(Operand(lhs), rhs); + j(cond, label); +} + +void +MacroAssembler::branch32(Condition cond, const AbsoluteAddress& lhs, Imm32 rhs, Label* label) +{ + cmp32(Operand(lhs), rhs); + j(cond, label); +} + +void +MacroAssembler::branch32(Condition cond, wasm::SymbolicAddress lhs, Imm32 rhs, Label* label) +{ + cmpl(rhs, lhs); + j(cond, label); +} + void MacroAssembler::branchPtr(Condition cond, const AbsoluteAddress& lhs, Register rhs, Label* label) { diff --git a/js/src/jit/x86/MacroAssembler-x86.cpp b/js/src/jit/x86/MacroAssembler-x86.cpp index 20e642b1481..0cd7f224a82 100644 --- a/js/src/jit/x86/MacroAssembler-x86.cpp +++ b/js/src/jit/x86/MacroAssembler-x86.cpp @@ -203,11 +203,13 @@ MacroAssemblerX86::handleFailureWithHandlerTail(void* handler) Label bailout; loadPtr(Address(esp, offsetof(ResumeFromException, kind)), eax); - branch32(Assembler::Equal, eax, Imm32(ResumeFromException::RESUME_ENTRY_FRAME), &entryFrame); - branch32(Assembler::Equal, eax, Imm32(ResumeFromException::RESUME_CATCH), &catch_); - branch32(Assembler::Equal, eax, Imm32(ResumeFromException::RESUME_FINALLY), &finally); - branch32(Assembler::Equal, eax, Imm32(ResumeFromException::RESUME_FORCED_RETURN), &return_); - branch32(Assembler::Equal, eax, Imm32(ResumeFromException::RESUME_BAILOUT), &bailout); + asMasm().branch32(Assembler::Equal, eax, Imm32(ResumeFromException::RESUME_ENTRY_FRAME), + &entryFrame); + asMasm().branch32(Assembler::Equal, eax, Imm32(ResumeFromException::RESUME_CATCH), &catch_); + asMasm().branch32(Assembler::Equal, eax, Imm32(ResumeFromException::RESUME_FINALLY), &finally); + asMasm().branch32(Assembler::Equal, eax, Imm32(ResumeFromException::RESUME_FORCED_RETURN), + &return_); + asMasm().branch32(Assembler::Equal, eax, Imm32(ResumeFromException::RESUME_BAILOUT), &bailout); breakpoint(); // Invalid kind. @@ -255,7 +257,8 @@ MacroAssemblerX86::handleFailureWithHandlerTail(void* handler) Label skipProfilingInstrumentation; // Test if profiler enabled. AbsoluteAddress addressOfEnabled(GetJitContext()->runtime->spsProfiler().addressOfEnabled()); - branch32(Assembler::Equal, addressOfEnabled, Imm32(0), &skipProfilingInstrumentation); + asMasm().branch32(Assembler::Equal, addressOfEnabled, Imm32(0), + &skipProfilingInstrumentation); profilerExitFrame(); bind(&skipProfilingInstrumentation); } diff --git a/js/src/jit/x86/MacroAssembler-x86.h b/js/src/jit/x86/MacroAssembler-x86.h index 47039a12833..19f36abcd78 100644 --- a/js/src/jit/x86/MacroAssembler-x86.h +++ b/js/src/jit/x86/MacroAssembler-x86.h @@ -50,7 +50,6 @@ class MacroAssemblerX86 : public MacroAssemblerX86Shared void setupABICall(uint32_t args); public: - using MacroAssemblerX86Shared::branch32; using MacroAssemblerX86Shared::branchTest32; using MacroAssemblerX86Shared::load32; using MacroAssemblerX86Shared::store32; @@ -552,18 +551,6 @@ class MacroAssemblerX86 : public MacroAssemblerX86Shared // Common interface. ///////////////////////////////////////////////////////////////// - void branch32(Condition cond, AbsoluteAddress lhs, Imm32 rhs, Label* label) { - cmp32(Operand(lhs), rhs); - j(cond, label); - } - void branch32(Condition cond, wasm::SymbolicAddress lhs, Imm32 rhs, Label* label) { - cmpl(rhs, lhs); - j(cond, label); - } - void branch32(Condition cond, AbsoluteAddress lhs, Register rhs, Label* label) { - cmp32(Operand(lhs), rhs); - j(cond, label); - } void branchTest32(Condition cond, AbsoluteAddress address, Imm32 imm, Label* label) { test32(Operand(address), imm); j(cond, label);