commit 6ad9983264efd83c11086e83c26ec9c68f9f1ebd
parent a176d53b5cfb10610b600d34cbe36a2cee8f961a
Author: André Bargull <andre.bargull@gmail.com>
Date: Fri, 17 Oct 2025 11:25:41 +0000
Bug 1992993 - Part 3: Avoid inline function not defined warnings. r=spidermonkey-reviewers,iain
`branchTestPtr` and `branchTest32` are defined in (platform-specific) MacroAssembler-inl.h
headers, so they can't be called from `CodeGenerator-xxx.h`. Use `template` functions, so
the compiler doesn't try to perform the lookups too early.
Differential Revision: https://phabricator.services.mozilla.com/D267791
Diffstat:
5 files changed, 13 insertions(+), 27 deletions(-)
diff --git a/js/src/jit/loong64/CodeGenerator-loong64.h b/js/src/jit/loong64/CodeGenerator-loong64.h
@@ -61,20 +61,11 @@ class CodeGeneratorLOONG64 : public CodeGeneratorShared {
masm.branchPtr(c, lhs, rhs, &bail);
bailoutFrom(&bail, snapshot);
}
- void bailoutTestPtr(Assembler::Condition c, Register lhs, Register rhs,
+ template <typename T1, typename T2>
+ void bailoutTestPtr(Assembler::Condition c, T1 lhs, T2 rhs,
LSnapshot* snapshot) {
- // TODO(loong64) Didn't use branchTestPtr due to '-Wundefined-inline'.
- MOZ_ASSERT(c == Assembler::Zero || c == Assembler::NonZero ||
- c == Assembler::Signed || c == Assembler::NotSigned);
Label bail;
- if (lhs == rhs) {
- masm.ma_b(lhs, rhs, &bail, c);
- } else {
- UseScratchRegisterScope temps(masm);
- Register scratch = temps.Acquire();
- masm.as_and(scratch, lhs, rhs);
- masm.ma_b(scratch, scratch, &bail, c);
- }
+ masm.branchTestPtr(c, lhs, rhs, &bail);
bailoutFrom(&bail, snapshot);
}
void bailoutIfFalseBool(Register reg, LSnapshot* snapshot) {
diff --git a/js/src/jit/mips-shared/CodeGenerator-mips-shared.h b/js/src/jit/mips-shared/CodeGenerator-mips-shared.h
@@ -57,13 +57,15 @@ class CodeGeneratorMIPSShared : public CodeGeneratorShared {
masm.branchPtr(c, lhs, rhs, &bail);
bailoutFrom(&bail, snapshot);
}
- void bailoutTestPtr(Assembler::Condition c, Register lhs, Register rhs,
+ template <typename T1, typename T2>
+ void bailoutTestPtr(Assembler::Condition c, T1 lhs, T2 rhs,
LSnapshot* snapshot) {
Label bail;
masm.branchTestPtr(c, lhs, rhs, &bail);
bailoutFrom(&bail, snapshot);
}
- void bailoutIfFalseBool(Register reg, LSnapshot* snapshot) {
+ template <typename T>
+ void bailoutIfFalseBool(T reg, LSnapshot* snapshot) {
Label bail;
masm.branchTest32(Assembler::Zero, reg, Imm32(0xFF), &bail);
bailoutFrom(&bail, snapshot);
diff --git a/js/src/jit/mips64/Lowering-mips64.cpp b/js/src/jit/mips64/Lowering-mips64.cpp
@@ -33,6 +33,8 @@ LBoxAllocation LIRGeneratorMIPS64::useBoxFixed(MDefinition* mir, Register reg1,
return LBoxAllocation(LUse(reg1, mir->virtualRegister(), useAtStart));
}
+LDefinition LIRGeneratorMIPS64::tempToUnbox() { return temp(); }
+
void LIRGeneratorMIPS64::lowerDivI64(MDiv* div) {
if (div->isUnsigned()) {
lowerUDivI64(div);
diff --git a/js/src/jit/mips64/Lowering-mips64.h b/js/src/jit/mips64/Lowering-mips64.h
@@ -24,7 +24,7 @@ class LIRGeneratorMIPS64 : public LIRGeneratorMIPSShared {
LBoxAllocation useBoxFixed(MDefinition* mir, Register reg1, Register reg2,
bool useAtStart = false);
- inline LDefinition tempToUnbox() { return temp(); }
+ LDefinition tempToUnbox();
void lowerUntypedPhiInput(MPhi* phi, uint32_t inputPosition, LBlock* block,
size_t lirIndex);
diff --git a/js/src/jit/riscv64/CodeGenerator-riscv64.h b/js/src/jit/riscv64/CodeGenerator-riscv64.h
@@ -62,20 +62,11 @@ class CodeGeneratorRiscv64 : public CodeGeneratorShared {
masm.branchPtr(c, lhs, rhs, &bail);
bailoutFrom(&bail, snapshot);
}
- void bailoutTestPtr(Assembler::Condition c, Register lhs, Register rhs,
+ template <typename T1, typename T2>
+ void bailoutTestPtr(Assembler::Condition c, T1 lhs, T2 rhs,
LSnapshot* snapshot) {
- // TODO(riscv64) Didn't use branchTestPtr due to '-Wundefined-inline'.
- MOZ_ASSERT(c == Assembler::Zero || c == Assembler::NonZero ||
- c == Assembler::Signed || c == Assembler::NotSigned);
Label bail;
- if (lhs == rhs) {
- masm.ma_b(lhs, rhs, &bail, c);
- } else {
- UseScratchRegisterScope temps(&masm);
- Register scratch = temps.Acquire();
- masm.and_(scratch, lhs, rhs);
- masm.ma_b(scratch, scratch, &bail, c);
- }
+ masm.branchTestPtr(c, lhs, rhs, &bail);
bailoutFrom(&bail, snapshot);
}
void bailoutIfFalseBool(Register reg, LSnapshot* snapshot) {