diff --git a/js/src/assembler/assembler/X86Assembler.h b/js/src/assembler/assembler/X86Assembler.h index 0ccef86ab4d..9786852a82b 100644 --- a/js/src/assembler/assembler/X86Assembler.h +++ b/js/src/assembler/assembler/X86Assembler.h @@ -942,6 +942,13 @@ public: m_formatter.oneByteOp64(OP_SUB_EvGv, src, dst); } + void subq_rm(RegisterID src, int offset, RegisterID base) + { + spew("subq %s, %s0x%x(%s)", + nameIReg(8,src), PRETTY_PRINT_OFFSET(offset), nameIReg(8,base)); + m_formatter.oneByteOp64(OP_SUB_EvGv, src, base, offset); + } + void subq_mr(int offset, RegisterID base, RegisterID dst) { spew("subq %s0x%x(%s), %s", diff --git a/js/src/jit/shared/Assembler-x86-shared.h b/js/src/jit/shared/Assembler-x86-shared.h index 1868c255573..5c1ace6fcf8 100644 --- a/js/src/jit/shared/Assembler-x86-shared.h +++ b/js/src/jit/shared/Assembler-x86-shared.h @@ -948,6 +948,18 @@ class AssemblerX86Shared MOZ_ASSUME_UNREACHABLE("unexpected operand kind"); } } + void subl(const Register &src, const Operand &dest) { + switch (dest.kind()) { + case Operand::REG: + masm.subl_rr(src.code(), dest.reg()); + break; + case Operand::MEM_REG_DISP: + masm.subl_rm(src.code(), dest.disp(), dest.base()); + break; + default: + MOZ_ASSUME_UNREACHABLE("unexpected operand kind"); + } + } void orl(const Register ®, const Register &dest) { masm.orl_rr(reg.code(), dest.code()); } diff --git a/js/src/jit/x64/Assembler-x64.h b/js/src/jit/x64/Assembler-x64.h index 6ea67251571..d77de0b1476 100644 --- a/js/src/jit/x64/Assembler-x64.h +++ b/js/src/jit/x64/Assembler-x64.h @@ -449,6 +449,18 @@ class Assembler : public AssemblerX86Shared MOZ_ASSUME_UNREACHABLE("unexpected operand kind"); } } + void subq(const Register &src, const Operand &dest) { + switch (dest.kind()) { + case Operand::REG: + masm.subq_rr(src.code(), dest.reg()); + break; + case Operand::MEM_REG_DISP: + masm.subq_rm(src.code(), dest.disp(), dest.base()); + break; + default: + MOZ_ASSUME_UNREACHABLE("unexpected operand kind"); + } + } void shlq(Imm32 imm, const Register &dest) { masm.shlq_i8r(imm.value, dest.code()); } diff --git a/js/src/jit/x64/MacroAssembler-x64.h b/js/src/jit/x64/MacroAssembler-x64.h index fa273cbdc0c..024e55d4225 100644 --- a/js/src/jit/x64/MacroAssembler-x64.h +++ b/js/src/jit/x64/MacroAssembler-x64.h @@ -554,6 +554,9 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared void subPtr(const Address &addr, const Register &dest) { subq(Operand(addr), dest); } + void subPtr(const Register &src, const Address &dest) { + subq(src, Operand(dest)); + } void branch32(Condition cond, const AbsoluteAddress &lhs, Imm32 rhs, Label *label) { if (JSC::X86Assembler::isAddressImmediate(lhs.addr)) { diff --git a/js/src/jit/x86/MacroAssembler-x86.h b/js/src/jit/x86/MacroAssembler-x86.h index 8d81b9f57a2..a9134ca4545 100644 --- a/js/src/jit/x86/MacroAssembler-x86.h +++ b/js/src/jit/x86/MacroAssembler-x86.h @@ -561,6 +561,9 @@ class MacroAssemblerX86 : public MacroAssemblerX86Shared void subPtr(const Address &addr, const Register &dest) { subl(Operand(addr), dest); } + void subPtr(const Register &src, const Address &dest) { + subl(src, Operand(dest)); + } void branch32(Condition cond, const AbsoluteAddress &lhs, Imm32 rhs, Label *label) { cmpl(Operand(lhs), rhs);