From a79aa14f3b9cfa0ffdc4279ebe50baf654181f00 Mon Sep 17 00:00:00 2001 From: Dragan Mladjenovic Date: Mon, 26 Mar 2018 03:05:00 +0300 Subject: [PATCH] Bug 1448809 - [MIPS] Fix build failures after final changes in Bug 1428453; r=bbouvier --- .../jit/mips-shared/CodeGenerator-mips-shared.cpp | 2 +- .../mips-shared/MacroAssembler-mips-shared-inl.h | 3 ++- .../jit/mips-shared/MacroAssembler-mips-shared.cpp | 14 +++++++++----- .../jit/mips-shared/MacroAssembler-mips-shared.h | 4 ++-- js/src/jit/mips32/MacroAssembler-mips32.cpp | 8 +++++--- js/src/jit/mips64/MacroAssembler-mips64.cpp | 6 ++++-- 6 files changed, 23 insertions(+), 14 deletions(-) diff --git a/js/src/jit/mips-shared/CodeGenerator-mips-shared.cpp b/js/src/jit/mips-shared/CodeGenerator-mips-shared.cpp index 6191a4b25047..57fc91f05b05 100644 --- a/js/src/jit/mips-shared/CodeGenerator-mips-shared.cpp +++ b/js/src/jit/mips-shared/CodeGenerator-mips-shared.cpp @@ -2389,7 +2389,7 @@ CodeGenerator::visitWasmAddOffset(LWasmAddOffset* lir) Register out = ToRegister(lir->output()); Label ok; - masm.ma_addTestCarryClear(out, base, Imm32(mir->offset()), &ok); + masm.ma_addTestCarry(Assembler::CarryClear, out, base, Imm32(mir->offset()), &ok); masm.wasmTrap(wasm::Trap::OutOfBounds, mir->bytecodeOffset()); masm.bind(&ok); } 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 54d56deb7aa9..3c1362a86758 100644 --- a/js/src/jit/mips-shared/MacroAssembler-mips-shared-inl.h +++ b/js/src/jit/mips-shared/MacroAssembler-mips-shared-inl.h @@ -637,8 +637,9 @@ MacroAssembler::branchAdd32(Condition cond, T src, Register dest, Label* overflo case Overflow: ma_addTestOverflow(dest, dest, src, overflow); break; + case CarryClear: case CarrySet: - ma_addTestCarry(dest, dest, src, overflow); + ma_addTestCarry(cond, dest, dest, src, overflow); break; default: MOZ_CRASH("NYI"); diff --git a/js/src/jit/mips-shared/MacroAssembler-mips-shared.cpp b/js/src/jit/mips-shared/MacroAssembler-mips-shared.cpp index 3209c392bc72..4b078509d768 100644 --- a/js/src/jit/mips-shared/MacroAssembler-mips-shared.cpp +++ b/js/src/jit/mips-shared/MacroAssembler-mips-shared.cpp @@ -327,19 +327,23 @@ MacroAssemblerMIPSShared::ma_addu(Register rd, Imm32 imm) } void -MacroAssemblerMIPSShared::ma_addTestCarry(Register rd, Register rs, Register rt, Label* overflow) +MacroAssemblerMIPSShared::ma_addTestCarry(Condition cond, Register rd, Register rs, Register rt, + Label* overflow) { + MOZ_ASSERT(cond == Assembler::CarrySet || cond == Assembler::CarryClear); MOZ_ASSERT_IF(rd == rs, rt != rd); as_addu(rd, rs, rt); - as_sltu(SecondScratchReg, rd, rd == rs? rt : rs); - ma_b(SecondScratchReg, SecondScratchReg, overflow, Assembler::NonZero); + as_sltu(SecondScratchReg, rd, rd == rs ? rt : rs); + ma_b(SecondScratchReg, SecondScratchReg, overflow, + cond == Assembler::CarrySet ? Assembler::NonZero : Assembler:: Zero); } void -MacroAssemblerMIPSShared::ma_addTestCarry(Register rd, Register rs, Imm32 imm, Label* overflow) +MacroAssemblerMIPSShared::ma_addTestCarry(Condition cond, Register rd, Register rs, Imm32 imm, + Label* overflow) { ma_li(ScratchRegister, imm); - ma_addTestCarry(rd, rs, ScratchRegister, overflow); + ma_addTestCarry(cond, rd, rs, ScratchRegister, overflow); } // Subtract. diff --git a/js/src/jit/mips-shared/MacroAssembler-mips-shared.h b/js/src/jit/mips-shared/MacroAssembler-mips-shared.h index b1eb26b94b81..53f8c0ea8c9d 100644 --- a/js/src/jit/mips-shared/MacroAssembler-mips-shared.h +++ b/js/src/jit/mips-shared/MacroAssembler-mips-shared.h @@ -130,8 +130,8 @@ class MacroAssemblerMIPSShared : public Assembler void ma_addu(Register rd, Register rs, Imm32 imm); void ma_addu(Register rd, Register rs); void ma_addu(Register rd, Imm32 imm); - void ma_addTestCarry(Register rd, Register rs, Register rt, Label* overflow); - void ma_addTestCarry(Register rd, Register rs, Imm32 imm, Label* overflow); + void ma_addTestCarry(Condition cond, Register rd, Register rs, Register rt, Label* overflow); + void ma_addTestCarry(Condition cond, Register rd, Register rs, Imm32 imm, Label* overflow); // subtract void ma_subu(Register rd, Register rs, Imm32 imm); diff --git a/js/src/jit/mips32/MacroAssembler-mips32.cpp b/js/src/jit/mips32/MacroAssembler-mips32.cpp index 1453a1229da8..8ffd3a45d9e1 100644 --- a/js/src/jit/mips32/MacroAssembler-mips32.cpp +++ b/js/src/jit/mips32/MacroAssembler-mips32.cpp @@ -2473,16 +2473,18 @@ MacroAssembler::storeUnboxedValue(const ConstantOrRegister& value, MIRType value void -MacroAssembler::wasmBoundsCheck(Condition cond, Register index, Register boundsCheckLimit, Label* label) +MacroAssembler::wasmBoundsCheck(Condition cond, Register index, Register boundsCheckLimit, + Label* label) { ma_b(index, boundsCheckLimit, label, cond); } void -MacroAssembler::wasmBoundsCheck(Condition cond, Register index, Address boundsCheckLimit, Label* label) +MacroAssembler::wasmBoundsCheck(Condition cond, Register index, Address boundsCheckLimit, + Label* label) { SecondScratchRegisterScope scratch2(*this); - load32(boundsCheckLimit,SecondScratchReg); + load32(boundsCheckLimit, SecondScratchReg); ma_b(index, SecondScratchReg, label, cond); } diff --git a/js/src/jit/mips64/MacroAssembler-mips64.cpp b/js/src/jit/mips64/MacroAssembler-mips64.cpp index 097b279d039e..6180f5ed7b61 100644 --- a/js/src/jit/mips64/MacroAssembler-mips64.cpp +++ b/js/src/jit/mips64/MacroAssembler-mips64.cpp @@ -2310,13 +2310,15 @@ MacroAssembler::storeUnboxedValue(const ConstantOrRegister& value, MIRType value void -MacroAssembler::wasmBoundsCheck(Condition cond, Register index, Register boundsCheckLimit, Label* label) +MacroAssembler::wasmBoundsCheck(Condition cond, Register index, Register boundsCheckLimit, + Label* label) { ma_b(index, boundsCheckLimit, label, cond); } void -MacroAssembler::wasmBoundsCheck(Condition cond, Register index, Address boundsCheckLimit, Label* label) +MacroAssembler::wasmBoundsCheck(Condition cond, Register index, Address boundsCheckLimit, + Label* label) { SecondScratchRegisterScope scratch2(*this); load32(boundsCheckLimit, SecondScratchReg);