diff options
Diffstat (limited to 'js/src/jit')
67 files changed, 1096 insertions, 1101 deletions
diff --git a/js/src/jit/AliasAnalysis.h b/js/src/jit/AliasAnalysis.h index 778bab4946..7370c7e693 100644 --- a/js/src/jit/AliasAnalysis.h +++ b/js/src/jit/AliasAnalysis.h @@ -21,7 +21,7 @@ class AliasAnalysis : public AliasAnalysisShared public: AliasAnalysis(MIRGenerator* mir, MIRGraph& graph); - MOZ_MUST_USE bool analyze() override; + [[nodiscard]] bool analyze() override; }; } // namespace jit diff --git a/js/src/jit/AliasAnalysisShared.h b/js/src/jit/AliasAnalysisShared.h index ba3e335eff..3c91cd449c 100644 --- a/js/src/jit/AliasAnalysisShared.h +++ b/js/src/jit/AliasAnalysisShared.h @@ -26,7 +26,7 @@ class AliasAnalysisShared graph_(graph) {} - virtual MOZ_MUST_USE bool analyze() { + [[nodiscard]] virtual bool analyze() { return true; } diff --git a/js/src/jit/AlignmentMaskAnalysis.h b/js/src/jit/AlignmentMaskAnalysis.h index 4cee7683ff..30543b6b76 100644 --- a/js/src/jit/AlignmentMaskAnalysis.h +++ b/js/src/jit/AlignmentMaskAnalysis.h @@ -22,7 +22,7 @@ class AlignmentMaskAnalysis : graph_(graph) {} - MOZ_MUST_USE bool analyze(); + [[nodiscard]] bool analyze(); }; } /* namespace jit */ diff --git a/js/src/jit/BacktrackingAllocator.h b/js/src/jit/BacktrackingAllocator.h index cbf7fca9ae..7f35ee8f4b 100644 --- a/js/src/jit/BacktrackingAllocator.h +++ b/js/src/jit/BacktrackingAllocator.h @@ -94,7 +94,7 @@ class Requirement int priority() const; - MOZ_MUST_USE bool merge(const Requirement& newRequirement) { + [[nodiscard]] bool merge(const Requirement& newRequirement) { // Merge newRequirement with any existing requirement, returning false // if the new and old requirements conflict. MOZ_ASSERT(newRequirement.kind() != Requirement::MUST_REUSE_INPUT); @@ -382,7 +382,7 @@ class SpillSet : public TempObject return new(alloc) SpillSet(alloc); } - MOZ_MUST_USE bool addSpilledBundle(LiveBundle* bundle) { + [[nodiscard]] bool addSpilledBundle(LiveBundle* bundle) { return list_.append(bundle); } size_t numSpilledBundles() const { @@ -450,9 +450,9 @@ class LiveBundle : public TempObject ranges_.removeAndIncrement(iter); } void addRange(LiveRange* range); - MOZ_MUST_USE bool addRange(TempAllocator& alloc, uint32_t vreg, + [[nodiscard]] bool addRange(TempAllocator& alloc, uint32_t vreg, CodePosition from, CodePosition to); - MOZ_MUST_USE bool addRangeAndDistributeUses(TempAllocator& alloc, LiveRange* oldRange, + [[nodiscard]] bool addRangeAndDistributeUses(TempAllocator& alloc, LiveRange* oldRange, CodePosition from, CodePosition to); LiveRange* popFirstRange(); #ifdef DEBUG @@ -576,7 +576,7 @@ class VirtualRegister return firstRange()->bundle(); } - MOZ_MUST_USE bool addInitialRange(TempAllocator& alloc, CodePosition from, CodePosition to); + [[nodiscard]] bool addInitialRange(TempAllocator& alloc, CodePosition from, CodePosition to); void addInitialUse(UsePosition* use); void setInitialDefinition(CodePosition from); }; @@ -681,7 +681,7 @@ class BacktrackingAllocator : protected RegisterAllocator callRanges(nullptr) { } - MOZ_MUST_USE bool go(); + [[nodiscard]] bool go(); private: @@ -689,10 +689,10 @@ class BacktrackingAllocator : protected RegisterAllocator typedef Vector<LiveBundle*, 4, SystemAllocPolicy> LiveBundleVector; // Liveness methods. - MOZ_MUST_USE bool init(); - MOZ_MUST_USE bool buildLivenessInfo(); + [[nodiscard]] bool init(); + [[nodiscard]] bool buildLivenessInfo(); - MOZ_MUST_USE bool addInitialFixedRange(AnyRegister reg, CodePosition from, CodePosition to); + [[nodiscard]] bool addInitialFixedRange(AnyRegister reg, CodePosition from, CodePosition to); VirtualRegister& vreg(const LDefinition* def) { return vregs[def->virtualRegister()]; @@ -703,42 +703,42 @@ class BacktrackingAllocator : protected RegisterAllocator } // Allocation methods. - MOZ_MUST_USE bool tryMergeBundles(LiveBundle* bundle0, LiveBundle* bundle1); - MOZ_MUST_USE bool tryMergeReusedRegister(VirtualRegister& def, VirtualRegister& input); - MOZ_MUST_USE bool mergeAndQueueRegisters(); - MOZ_MUST_USE bool tryAllocateFixed(LiveBundle* bundle, Requirement requirement, + [[nodiscard]] bool tryMergeBundles(LiveBundle* bundle0, LiveBundle* bundle1); + [[nodiscard]] bool tryMergeReusedRegister(VirtualRegister& def, VirtualRegister& input); + [[nodiscard]] bool mergeAndQueueRegisters(); + [[nodiscard]] bool tryAllocateFixed(LiveBundle* bundle, Requirement requirement, bool* success, bool* pfixed, LiveBundleVector& conflicting); - MOZ_MUST_USE bool tryAllocateNonFixed(LiveBundle* bundle, Requirement requirement, + [[nodiscard]] bool tryAllocateNonFixed(LiveBundle* bundle, Requirement requirement, Requirement hint, bool* success, bool* pfixed, LiveBundleVector& conflicting); - MOZ_MUST_USE bool processBundle(MIRGenerator* mir, LiveBundle* bundle); - MOZ_MUST_USE bool computeRequirement(LiveBundle* bundle, Requirement *prequirement, + [[nodiscard]] bool processBundle(MIRGenerator* mir, LiveBundle* bundle); + [[nodiscard]] bool computeRequirement(LiveBundle* bundle, Requirement *prequirement, Requirement *phint); - MOZ_MUST_USE bool tryAllocateRegister(PhysicalRegister& r, LiveBundle* bundle, bool* success, + [[nodiscard]] bool tryAllocateRegister(PhysicalRegister& r, LiveBundle* bundle, bool* success, bool* pfixed, LiveBundleVector& conflicting); - MOZ_MUST_USE bool evictBundle(LiveBundle* bundle); - MOZ_MUST_USE bool splitAndRequeueBundles(LiveBundle* bundle, + [[nodiscard]] bool evictBundle(LiveBundle* bundle); + [[nodiscard]] bool splitAndRequeueBundles(LiveBundle* bundle, const LiveBundleVector& newBundles); - MOZ_MUST_USE bool spill(LiveBundle* bundle); + [[nodiscard]] bool spill(LiveBundle* bundle); bool isReusedInput(LUse* use, LNode* ins, bool considerCopy); bool isRegisterUse(UsePosition* use, LNode* ins, bool considerCopy = false); bool isRegisterDefinition(LiveRange* range); - MOZ_MUST_USE bool pickStackSlot(SpillSet* spill); - MOZ_MUST_USE bool insertAllRanges(LiveRangeSet& set, LiveBundle* bundle); + [[nodiscard]] bool pickStackSlot(SpillSet* spill); + [[nodiscard]] bool insertAllRanges(LiveRangeSet& set, LiveBundle* bundle); // Reification methods. - MOZ_MUST_USE bool pickStackSlots(); - MOZ_MUST_USE bool resolveControlFlow(); - MOZ_MUST_USE bool reifyAllocations(); - MOZ_MUST_USE bool populateSafepoints(); - MOZ_MUST_USE bool annotateMoveGroups(); - MOZ_MUST_USE bool deadRange(LiveRange* range); + [[nodiscard]] bool pickStackSlots(); + [[nodiscard]] bool resolveControlFlow(); + [[nodiscard]] bool reifyAllocations(); + [[nodiscard]] bool populateSafepoints(); + [[nodiscard]] bool annotateMoveGroups(); + [[nodiscard]] bool deadRange(LiveRange* range); size_t findFirstNonCallSafepoint(CodePosition from); size_t findFirstSafepoint(CodePosition pos, size_t startFrom); void addLiveRegistersForRange(VirtualRegister& reg, LiveRange* range); - MOZ_MUST_USE bool addMove(LMoveGroup* moves, LiveRange* from, LiveRange* to, + [[nodiscard]] bool addMove(LMoveGroup* moves, LiveRange* from, LiveRange* to, LDefinition::Type type) { LAllocation fromAlloc = from->bundle()->allocation(); LAllocation toAlloc = to->bundle()->allocation(); @@ -746,7 +746,7 @@ class BacktrackingAllocator : protected RegisterAllocator return moves->add(fromAlloc, toAlloc, type); } - MOZ_MUST_USE bool moveInput(LInstruction* ins, LiveRange* from, LiveRange* to, + [[nodiscard]] bool moveInput(LInstruction* ins, LiveRange* from, LiveRange* to, LDefinition::Type type) { if (from->bundle()->allocation() == to->bundle()->allocation()) { return true; @@ -755,7 +755,7 @@ class BacktrackingAllocator : protected RegisterAllocator return addMove(moves, from, to, type); } - MOZ_MUST_USE bool moveAfter(LInstruction* ins, LiveRange* from, LiveRange* to, + [[nodiscard]] bool moveAfter(LInstruction* ins, LiveRange* from, LiveRange* to, LDefinition::Type type) { if (from->bundle()->allocation() == to->bundle()->allocation()) { return true; @@ -764,7 +764,7 @@ class BacktrackingAllocator : protected RegisterAllocator return addMove(moves, from, to, type); } - MOZ_MUST_USE bool moveAtExit(LBlock* block, LiveRange* from, LiveRange* to, + [[nodiscard]] bool moveAtExit(LBlock* block, LiveRange* from, LiveRange* to, LDefinition::Type type) { if (from->bundle()->allocation() == to->bundle()->allocation()) { return true; @@ -773,7 +773,7 @@ class BacktrackingAllocator : protected RegisterAllocator return addMove(moves, from, to, type); } - MOZ_MUST_USE bool moveAtEntry(LBlock* block, LiveRange* from, LiveRange* to, + [[nodiscard]] bool moveAtEntry(LBlock* block, LiveRange* from, LiveRange* to, LDefinition::Type type) { if (from->bundle()->allocation() == to->bundle()->allocation()) { return true; @@ -782,7 +782,7 @@ class BacktrackingAllocator : protected RegisterAllocator return addMove(moves, from, to, type); } - MOZ_MUST_USE bool moveAtEdge(LBlock* predecessor, LBlock* successor, LiveRange* from, + [[nodiscard]] bool moveAtEdge(LBlock* predecessor, LBlock* successor, LiveRange* from, LiveRange* to, LDefinition::Type type); // Debugging methods. @@ -801,15 +801,15 @@ class BacktrackingAllocator : protected RegisterAllocator size_t maximumSpillWeight(const LiveBundleVector& bundles); - MOZ_MUST_USE bool chooseBundleSplit(LiveBundle* bundle, bool fixed, LiveBundle* conflict); + [[nodiscard]] bool chooseBundleSplit(LiveBundle* bundle, bool fixed, LiveBundle* conflict); - MOZ_MUST_USE bool splitAt(LiveBundle* bundle, const SplitPositionVector& splitPositions); - MOZ_MUST_USE bool trySplitAcrossHotcode(LiveBundle* bundle, bool* success); - MOZ_MUST_USE bool trySplitAfterLastRegisterUse(LiveBundle* bundle, LiveBundle* conflict, + [[nodiscard]] bool splitAt(LiveBundle* bundle, const SplitPositionVector& splitPositions); + [[nodiscard]] bool trySplitAcrossHotcode(LiveBundle* bundle, bool* success); + [[nodiscard]] bool trySplitAfterLastRegisterUse(LiveBundle* bundle, LiveBundle* conflict, bool* success); - MOZ_MUST_USE bool trySplitBeforeFirstRegisterUse(LiveBundle* bundle, LiveBundle* conflict, + [[nodiscard]] bool trySplitBeforeFirstRegisterUse(LiveBundle* bundle, LiveBundle* conflict, bool* success); - MOZ_MUST_USE bool splitAcrossCalls(LiveBundle* bundle); + [[nodiscard]] bool splitAcrossCalls(LiveBundle* bundle); bool compilingWasm() { return mir->info().compilingWasm(); diff --git a/js/src/jit/Bailouts.h b/js/src/jit/Bailouts.h index d8727b917d..923c03e63e 100644 --- a/js/src/jit/Bailouts.h +++ b/js/src/jit/Bailouts.h @@ -150,7 +150,7 @@ class BailoutFrameInfo } }; -MOZ_MUST_USE bool EnsureHasEnvironmentObjects(JSContext* cx, AbstractFramePtr fp); +[[nodiscard]] bool EnsureHasEnvironmentObjects(JSContext* cx, AbstractFramePtr fp); struct BaselineBailoutInfo; diff --git a/js/src/jit/BaselineBailouts.cpp b/js/src/jit/BaselineBailouts.cpp index 4bcaadee47..7b1bdc8c3f 100644 --- a/js/src/jit/BaselineBailouts.cpp +++ b/js/src/jit/BaselineBailouts.cpp @@ -116,7 +116,7 @@ struct BaselineStackBuilder js_free(buffer_); } - MOZ_MUST_USE bool init() { + [[nodiscard]] bool init() { MOZ_ASSERT(!buffer_); MOZ_ASSERT(bufferUsed_ == 0); buffer_ = reinterpret_cast<uint8_t*>(js_calloc(bufferTotal_)); @@ -142,7 +142,7 @@ struct BaselineStackBuilder return true; } - MOZ_MUST_USE bool enlarge() { + [[nodiscard]] bool enlarge() { MOZ_ASSERT(buffer_ != nullptr); if (bufferTotal_ & mozilla::tl::MulOverflowMask<2>::value) return false; @@ -182,7 +182,7 @@ struct BaselineStackBuilder return framePushed_; } - MOZ_MUST_USE bool subtract(size_t size, const char* info = nullptr) { + [[nodiscard]] bool subtract(size_t size, const char* info = nullptr) { // enlarge the buffer if need be. while (size > bufferAvail_) { if (!enlarge()) @@ -203,7 +203,7 @@ struct BaselineStackBuilder } template <typename T> - MOZ_MUST_USE bool write(const T& t) { + [[nodiscard]] bool write(const T& t) { MOZ_ASSERT(!(uintptr_t(&t) >= uintptr_t(header_->copyStackBottom) && uintptr_t(&t) < uintptr_t(header_->copyStackTop)), "Should not reference memory that can be freed"); @@ -214,7 +214,7 @@ struct BaselineStackBuilder } template <typename T> - MOZ_MUST_USE bool writePtr(T* t, const char* info) { + [[nodiscard]] bool writePtr(T* t, const char* info) { if (!write<T*>(t)) return false; if (info) @@ -224,7 +224,7 @@ struct BaselineStackBuilder return true; } - MOZ_MUST_USE bool writeWord(size_t w, const char* info) { + [[nodiscard]] bool writeWord(size_t w, const char* info) { if (!write<size_t>(w)) return false; if (info) { @@ -241,7 +241,7 @@ struct BaselineStackBuilder return true; } - MOZ_MUST_USE bool writeValue(const Value& val, const char* info) { + [[nodiscard]] bool writeValue(const Value& val, const char* info) { if (!write<Value>(val)) return false; if (info) { @@ -253,7 +253,7 @@ struct BaselineStackBuilder return true; } - MOZ_MUST_USE bool maybeWritePadding(size_t alignment, size_t after, const char* info) { + [[nodiscard]] bool maybeWritePadding(size_t alignment, size_t after, const char* info) { MOZ_ASSERT(framePushed_ % sizeof(Value) == 0); MOZ_ASSERT(after % sizeof(Value) == 0); size_t offset = ComputeByteAlignment(after, alignment); diff --git a/js/src/jit/BaselineCacheIR.cpp b/js/src/jit/BaselineCacheIR.cpp index 5317f0e4e5..a2cb20111b 100644 --- a/js/src/jit/BaselineCacheIR.cpp +++ b/js/src/jit/BaselineCacheIR.cpp @@ -168,7 +168,7 @@ class MOZ_RAII CacheRegisterAllocator writer_(writer) {} - MOZ_MUST_USE bool init(const AllocatableGeneralRegisterSet& available) { + [[nodiscard]] bool init(const AllocatableGeneralRegisterSet& available) { availableRegs_ = available; if (!origInputLocations_.resize(writer_.numInputOperands())) return false; @@ -394,12 +394,12 @@ class MOZ_RAII BaselineCacheIRCompiler : public CacheIRCompiler stubDataOffset_(stubDataOffset) {} - MOZ_MUST_USE bool init(CacheKind kind); + [[nodiscard]] bool init(CacheKind kind); JitCode* compile(); private: -#define DEFINE_OP(op) MOZ_MUST_USE bool emit##op(); +#define DEFINE_OP(op) [[nodiscard]] bool emit##op(); CACHE_IR_OPS(DEFINE_OP) #undef DEFINE_OP diff --git a/js/src/jit/BaselineCompiler.h b/js/src/jit/BaselineCompiler.h index 30da13d9c1..de1b75d29a 100644 --- a/js/src/jit/BaselineCompiler.h +++ b/js/src/jit/BaselineCompiler.h @@ -285,43 +285,43 @@ class BaselineCompiler : public BaselineCompilerSpecific public: BaselineCompiler(JSContext* cx, TempAllocator& alloc, JSScript* script); - MOZ_MUST_USE bool init(); + [[nodiscard]] bool init(); MethodStatus compile(); private: MethodStatus emitBody(); - MOZ_MUST_USE bool emitCheckThis(ValueOperand val); + [[nodiscard]] bool emitCheckThis(ValueOperand val); void emitLoadReturnValue(ValueOperand val); void emitInitializeLocals(); - MOZ_MUST_USE bool emitPrologue(); - MOZ_MUST_USE bool emitEpilogue(); - MOZ_MUST_USE bool emitOutOfLinePostBarrierSlot(); - MOZ_MUST_USE bool emitIC(ICStub* stub, ICEntry::Kind kind); - MOZ_MUST_USE bool emitOpIC(ICStub* stub) { + [[nodiscard]] bool emitPrologue(); + [[nodiscard]] bool emitEpilogue(); + [[nodiscard]] bool emitOutOfLinePostBarrierSlot(); + [[nodiscard]] bool emitIC(ICStub* stub, ICEntry::Kind kind); + [[nodiscard]] bool emitOpIC(ICStub* stub) { return emitIC(stub, ICEntry::Kind_Op); } - MOZ_MUST_USE bool emitNonOpIC(ICStub* stub) { + [[nodiscard]] bool emitNonOpIC(ICStub* stub) { return emitIC(stub, ICEntry::Kind_NonOp); } - MOZ_MUST_USE bool emitStackCheck(bool earlyCheck=false); - MOZ_MUST_USE bool emitInterruptCheck(); - MOZ_MUST_USE bool emitWarmUpCounterIncrement(bool allowOsr=true); - MOZ_MUST_USE bool emitArgumentTypeChecks(); + [[nodiscard]] bool emitStackCheck(bool earlyCheck=false); + [[nodiscard]] bool emitInterruptCheck(); + [[nodiscard]] bool emitWarmUpCounterIncrement(bool allowOsr=true); + [[nodiscard]] bool emitArgumentTypeChecks(); void emitIsDebuggeeCheck(); - MOZ_MUST_USE bool emitDebugPrologue(); - MOZ_MUST_USE bool emitDebugTrap(); - MOZ_MUST_USE bool emitTraceLoggerEnter(); - MOZ_MUST_USE bool emitTraceLoggerExit(); - MOZ_MUST_USE bool emitTraceLoggerResume(Register script, AllocatableGeneralRegisterSet& regs); + [[nodiscard]] bool emitDebugPrologue(); + [[nodiscard]] bool emitDebugTrap(); + [[nodiscard]] bool emitTraceLoggerEnter(); + [[nodiscard]] bool emitTraceLoggerExit(); + [[nodiscard]] bool emitTraceLoggerResume(Register script, AllocatableGeneralRegisterSet& regs); void emitProfilerEnterFrame(); void emitProfilerExitFrame(); - MOZ_MUST_USE bool initEnvironmentChain(); + [[nodiscard]] bool initEnvironmentChain(); void storeValue(const StackValue* source, const Address& dest, const ValueOperand& scratch); @@ -331,35 +331,35 @@ class BaselineCompiler : public BaselineCompilerSpecific #undef EMIT_OP // JSOP_NEG, JSOP_BITNOT, JSOP_INC, JSOP_DEC - MOZ_MUST_USE bool emitUnaryArith(); + [[nodiscard]] bool emitUnaryArith(); // JSOP_BITXOR, JSOP_LSH, JSOP_ADD etc. - MOZ_MUST_USE bool emitBinaryArith(); + [[nodiscard]] bool emitBinaryArith(); // Handles JSOP_LT, JSOP_GT, and friends - MOZ_MUST_USE bool emitCompare(); + [[nodiscard]] bool emitCompare(); - MOZ_MUST_USE bool emitReturn(); + [[nodiscard]] bool emitReturn(); - MOZ_MUST_USE bool emitToBoolean(); - MOZ_MUST_USE bool emitTest(bool branchIfTrue); - MOZ_MUST_USE bool emitAndOr(bool branchIfTrue); - MOZ_MUST_USE bool emitCall(); - MOZ_MUST_USE bool emitSpreadCall(); + [[nodiscard]] bool emitToBoolean(); + [[nodiscard]] bool emitTest(bool branchIfTrue); + [[nodiscard]] bool emitAndOr(bool branchIfTrue); + [[nodiscard]] bool emitCall(); + [[nodiscard]] bool emitSpreadCall(); - MOZ_MUST_USE bool emitInitPropGetterSetter(); - MOZ_MUST_USE bool emitInitElemGetterSetter(); + [[nodiscard]] bool emitInitPropGetterSetter(); + [[nodiscard]] bool emitInitElemGetterSetter(); - MOZ_MUST_USE bool emitFormalArgAccess(uint32_t arg, bool get); + [[nodiscard]] bool emitFormalArgAccess(uint32_t arg, bool get); - MOZ_MUST_USE bool emitThrowConstAssignment(); - MOZ_MUST_USE bool emitUninitializedLexicalCheck(const ValueOperand& val); + [[nodiscard]] bool emitThrowConstAssignment(); + [[nodiscard]] bool emitUninitializedLexicalCheck(const ValueOperand& val); - MOZ_MUST_USE bool emitIsMagicValue(); + [[nodiscard]] bool emitIsMagicValue(); - MOZ_MUST_USE bool addPCMappingEntry(bool addIndexEntry); + [[nodiscard]] bool addPCMappingEntry(bool addIndexEntry); - MOZ_MUST_USE bool addYieldAndAwaitOffset(); + [[nodiscard]] bool addYieldAndAwaitOffset(); void getEnvironmentCoordinateObject(Register reg); Address getEnvironmentCoordinateAddressFromObject(Register objReg, Register reg); diff --git a/js/src/jit/BaselineDebugModeOSR.h b/js/src/jit/BaselineDebugModeOSR.h index 5ffc988f3e..1cbfc51e03 100644 --- a/js/src/jit/BaselineDebugModeOSR.h +++ b/js/src/jit/BaselineDebugModeOSR.h @@ -134,7 +134,7 @@ struct BaselineDebugModeOSRInfo void popValueInto(PCMappingSlotInfo::SlotLocation loc, Value* vp); }; -MOZ_MUST_USE bool +[[nodiscard]] bool RecompileOnStackBaselineScriptsForDebugMode(JSContext* cx, const Debugger::ExecutionObservableSet& obs, Debugger::IsObserving observing); diff --git a/js/src/jit/BaselineFrame.h b/js/src/jit/BaselineFrame.h index c54569627f..165b78ab25 100644 --- a/js/src/jit/BaselineFrame.h +++ b/js/src/jit/BaselineFrame.h @@ -102,7 +102,7 @@ class BaselineFrame // This is the old frame pointer saved in the prologue. static const uint32_t FramePointerOffset = sizeof(void*); - MOZ_MUST_USE bool initForOsr(InterpreterFrame* fp, uint32_t numStackValues); + [[nodiscard]] bool initForOsr(InterpreterFrame* fp, uint32_t numStackValues); uint32_t frameSize() const { return frameSize_; @@ -259,12 +259,12 @@ class BaselineFrame return &flags_; } - inline MOZ_MUST_USE bool pushLexicalEnvironment(JSContext* cx, Handle<LexicalScope*> scope); - inline MOZ_MUST_USE bool freshenLexicalEnvironment(JSContext* cx); - inline MOZ_MUST_USE bool recreateLexicalEnvironment(JSContext* cx); + [[nodiscard]] inline bool pushLexicalEnvironment(JSContext* cx, Handle<LexicalScope*> scope); + [[nodiscard]] inline bool freshenLexicalEnvironment(JSContext* cx); + [[nodiscard]] inline bool recreateLexicalEnvironment(JSContext* cx); - MOZ_MUST_USE bool initFunctionEnvironmentObjects(JSContext* cx); - MOZ_MUST_USE bool pushVarEnvironment(JSContext* cx, HandleScope scope); + [[nodiscard]] bool initFunctionEnvironmentObjects(JSContext* cx); + [[nodiscard]] bool pushVarEnvironment(JSContext* cx, HandleScope scope); void initArgsObjUnchecked(ArgumentsObject& argsobj) { flags_ |= HAS_ARGS_OBJ; diff --git a/js/src/jit/BaselineFrameInfo.h b/js/src/jit/BaselineFrameInfo.h index f407a9276d..6a1e47322f 100644 --- a/js/src/jit/BaselineFrameInfo.h +++ b/js/src/jit/BaselineFrameInfo.h @@ -178,7 +178,7 @@ class FrameInfo spIndex(0) { } - MOZ_MUST_USE bool init(TempAllocator& alloc); + [[nodiscard]] bool init(TempAllocator& alloc); size_t nlocals() const { return script->nfixed(); diff --git a/js/src/jit/BaselineIC.h b/js/src/jit/BaselineIC.h index bd30ec0369..183644ab3a 100644 --- a/js/src/jit/BaselineIC.h +++ b/js/src/jit/BaselineIC.h @@ -41,7 +41,7 @@ class ICWarmUpCounter_Fallback : public ICFallbackStub // Compiler for this stub kind. class Compiler : public ICStubCompiler { protected: - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); public: explicit Compiler(JSContext* cx) @@ -73,7 +73,7 @@ class ICTypeUpdate_Fallback : public ICStub // Compiler for this stub kind. class Compiler : public ICStubCompiler { protected: - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); public: explicit Compiler(JSContext* cx) @@ -97,7 +97,7 @@ class ICTypeUpdate_PrimitiveSet : public TypeCheckPrimitiveSetStub public: class Compiler : public TypeCheckPrimitiveSetStub::Compiler { protected: - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); public: Compiler(JSContext* cx, ICTypeUpdate_PrimitiveSet* existingStub, JSValueType type) @@ -141,7 +141,7 @@ class ICTypeUpdate_SingleObject : public ICStub class Compiler : public ICStubCompiler { protected: HandleObject obj_; - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); public: Compiler(JSContext* cx, HandleObject obj) @@ -176,7 +176,7 @@ class ICTypeUpdate_ObjectGroup : public ICStub class Compiler : public ICStubCompiler { protected: HandleObjectGroup group_; - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); public: Compiler(JSContext* cx, HandleObjectGroup group) @@ -206,7 +206,7 @@ class ICToBool_Fallback : public ICFallbackStub // Compiler for this stub kind. class Compiler : public ICStubCompiler { protected: - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); public: explicit Compiler(JSContext* cx) @@ -229,7 +229,7 @@ class ICToBool_Int32 : public ICStub // Compiler for this stub kind. class Compiler : public ICStubCompiler { protected: - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); public: explicit Compiler(JSContext* cx) @@ -252,7 +252,7 @@ class ICToBool_String : public ICStub // Compiler for this stub kind. class Compiler : public ICStubCompiler { protected: - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); public: explicit Compiler(JSContext* cx) @@ -275,7 +275,7 @@ class ICToBool_NullUndefined : public ICStub // Compiler for this stub kind. class Compiler : public ICStubCompiler { protected: - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); public: explicit Compiler(JSContext* cx) @@ -298,7 +298,7 @@ class ICToBool_Double : public ICStub // Compiler for this stub kind. class Compiler : public ICStubCompiler { protected: - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); public: explicit Compiler(JSContext* cx) @@ -321,7 +321,7 @@ class ICToBool_Object : public ICStub // Compiler for this stub kind. class Compiler : public ICStubCompiler { protected: - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); public: explicit Compiler(JSContext* cx) @@ -374,7 +374,7 @@ class ICGetElem_Fallback : public ICMonitoredFallbackStub // Compiler for this stub kind. class Compiler : public ICStubCompiler { protected: - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); public: explicit Compiler(JSContext* cx) @@ -699,10 +699,10 @@ class ICGetElemNativeCompiler : public ICStubCompiler HandleFunction getter_; uint32_t pcOffset_; - MOZ_MUST_USE bool emitCheckKey(MacroAssembler& masm, Label& failure); - MOZ_MUST_USE bool emitCallNative(MacroAssembler& masm, Register objReg); - MOZ_MUST_USE bool emitCallScripted(MacroAssembler& masm, Register objReg); - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool emitCheckKey(MacroAssembler& masm, Label& failure); + [[nodiscard]] bool emitCallNative(MacroAssembler& masm, Register objReg); + [[nodiscard]] bool emitCallScripted(MacroAssembler& masm, Register objReg); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); protected: virtual int32_t getKey() const { @@ -808,7 +808,7 @@ class ICGetElem_String : public ICStub // Compiler for this stub kind. class Compiler : public ICStubCompiler { protected: - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); public: explicit Compiler(JSContext* cx) @@ -845,7 +845,7 @@ class ICGetElem_Dense : public ICMonitoredStub RootedShape shape_; protected: - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); virtual int32_t getKey() const { return static_cast<int32_t>(engine_) | @@ -891,7 +891,7 @@ class ICGetElem_UnboxedArray : public ICMonitoredStub JSValueType elementType_; protected: - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); virtual int32_t getKey() const { return static_cast<int32_t>(engine_) | @@ -938,7 +938,7 @@ class ICGetElem_TypedArray : public ICStub TypedThingLayout layout_; protected: - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); virtual int32_t getKey() const { return static_cast<int32_t>(engine_) | @@ -987,7 +987,7 @@ class ICGetElem_Arguments : public ICMonitoredStub Which which_; protected: - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); virtual int32_t getKey() const { return static_cast<int32_t>(engine_) | @@ -1033,7 +1033,7 @@ class ICSetElem_Fallback : public ICFallbackStub // Compiler for this stub kind. class Compiler : public ICStubCompiler { protected: - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); public: explicit Compiler(JSContext* cx) @@ -1075,7 +1075,7 @@ class ICSetElem_DenseOrUnboxedArray : public ICUpdatedStub RootedObjectGroup group_; JSValueType unboxedType_; - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); public: virtual int32_t getKey() const { @@ -1183,7 +1183,7 @@ class ICSetElemDenseOrUnboxedArrayAddCompiler : public ICStubCompiler { size_t protoChainDepth_; JSValueType unboxedType_; - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); protected: virtual int32_t getKey() const { @@ -1248,7 +1248,7 @@ class ICSetElem_TypedArray : public ICStub bool expectOutOfBounds_; protected: - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); virtual int32_t getKey() const { return static_cast<int32_t>(engine_) | @@ -1289,7 +1289,7 @@ class ICIn_Fallback : public ICFallbackStub class Compiler : public ICStubCompiler { protected: - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); public: explicit Compiler(JSContext* cx) @@ -1373,7 +1373,7 @@ class ICInNativeCompiler : public ICStubCompiler RootedObject holder_; RootedPropertyName name_; - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); public: ICInNativeCompiler(JSContext* cx, ICStub::Kind kind, HandleObject obj, HandleObject holder, @@ -1474,7 +1474,7 @@ class ICInNativeDoesNotExistCompiler : public ICStubCompiler (static_cast<int32_t>(protoChainDepth_) << 17); } - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); public: ICInNativeDoesNotExistCompiler(JSContext* cx, HandleObject obj, HandlePropertyName name, @@ -1508,7 +1508,7 @@ class ICIn_Dense : public ICStub RootedShape shape_; protected: - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); public: Compiler(JSContext* cx, Shape* shape) @@ -1546,7 +1546,7 @@ class ICGetName_Fallback : public ICMonitoredFallbackStub class Compiler : public ICStubCompiler { protected: - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); public: explicit Compiler(JSContext* cx) @@ -1582,7 +1582,7 @@ class ICGetName_GlobalLexical : public ICMonitoredStub uint32_t slot_; protected: - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); public: Compiler(JSContext* cx, ICStub* firstMonitorStub, uint32_t slot) @@ -1639,7 +1639,7 @@ class ICGetName_Env : public ICMonitoredStub uint32_t offset_; protected: - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); protected: virtual int32_t getKey() const { @@ -1679,7 +1679,7 @@ class ICBindName_Fallback : public ICFallbackStub public: class Compiler : public ICStubCompiler { protected: - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); public: explicit Compiler(JSContext* cx) @@ -1705,7 +1705,7 @@ class ICGetIntrinsic_Fallback : public ICMonitoredFallbackStub public: class Compiler : public ICStubCompiler { protected: - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); public: explicit Compiler(JSContext* cx) @@ -1741,7 +1741,7 @@ class ICGetIntrinsic_Constant : public ICStub } class Compiler : public ICStubCompiler { - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); HandleValue value_; @@ -1790,7 +1790,7 @@ class ICSetProp_Fallback : public ICFallbackStub protected: uint32_t returnOffset_; - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); void postGenerateStubCode(MacroAssembler& masm, Handle<JitCode*> code); public: @@ -1852,7 +1852,7 @@ class ICSetProp_Native : public ICUpdatedStub (static_cast<int32_t>(obj_->is<UnboxedPlainObject>()) << 18); } - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); public: Compiler(JSContext* cx, HandleObject obj, bool isFixedSlot, uint32_t offset) @@ -1958,7 +1958,7 @@ class ICSetPropNativeAddCompiler : public ICStubCompiler (static_cast<int32_t>(protoChainDepth_) << 19); } - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); public: ICSetPropNativeAddCompiler(JSContext* cx, HandleObject obj, @@ -2024,7 +2024,7 @@ class ICSetProp_Unboxed : public ICUpdatedStub uint32_t fieldOffset_; JSValueType fieldType_; - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); virtual int32_t getKey() const { return static_cast<int32_t>(engine_) | @@ -2104,7 +2104,7 @@ class ICSetProp_TypedObject : public ICUpdatedStub TypedThingLayout layout_; Rooted<SimpleTypeDescr*> fieldDescr_; - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); virtual int32_t getKey() const { return static_cast<int32_t>(engine_) | @@ -2251,7 +2251,7 @@ class ICSetProp_CallScripted : public ICSetPropCallSetter class Compiler : public ICSetPropCallSetter::Compiler { protected: - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); public: Compiler(JSContext* cx, HandleObject obj, HandleObject holder, HandleFunction setter, @@ -2288,7 +2288,7 @@ class ICSetProp_CallNative : public ICSetPropCallSetter class Compiler : public ICSetPropCallSetter::Compiler { protected: - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); public: Compiler(JSContext* cx, HandleObject obj, HandleObject holder, HandleFunction setter, @@ -2398,7 +2398,7 @@ class ICCall_Fallback : public ICMonitoredFallbackStub bool isConstructing_; bool isSpread_; uint32_t returnOffset_; - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); void postGenerateStubCode(MacroAssembler& masm, Handle<JitCode*> code); virtual int32_t getKey() const { @@ -2491,7 +2491,7 @@ class ICCallScriptedCompiler : public ICCallStubCompiler { RootedFunction callee_; RootedObject templateObject_; uint32_t pcOffset_; - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); virtual int32_t getKey() const { return static_cast<int32_t>(engine_) | @@ -2584,7 +2584,7 @@ class ICCall_Native : public ICMonitoredStub RootedFunction callee_; RootedObject templateObject_; uint32_t pcOffset_; - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); virtual int32_t getKey() const { return static_cast<int32_t>(engine_) | @@ -2662,7 +2662,7 @@ class ICCall_ClassHook : public ICMonitoredStub Native native_; RootedObject templateObject_; uint32_t pcOffset_; - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); virtual int32_t getKey() const { return static_cast<int32_t>(engine_) | @@ -2723,7 +2723,7 @@ class ICCall_ScriptedApplyArray : public ICMonitoredStub protected: ICStub* firstMonitorStub_; uint32_t pcOffset_; - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); virtual int32_t getKey() const { return static_cast<int32_t>(engine_) | @@ -2771,7 +2771,7 @@ class ICCall_ScriptedApplyArguments : public ICMonitoredStub protected: ICStub* firstMonitorStub_; uint32_t pcOffset_; - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); virtual int32_t getKey() const { return static_cast<int32_t>(engine_) | @@ -2818,7 +2818,7 @@ class ICCall_ScriptedFunCall : public ICMonitoredStub protected: ICStub* firstMonitorStub_; uint32_t pcOffset_; - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); virtual int32_t getKey() const { return static_cast<int32_t>(engine_) | @@ -2889,7 +2889,7 @@ class ICCall_StringSplit : public ICMonitoredStub RootedString expectedSep_; RootedObject templateObject_; - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); virtual int32_t getKey() const { return static_cast<int32_t>(engine_) | @@ -2926,7 +2926,7 @@ class ICCall_IsSuspendedStarGenerator : public ICStub public: class Compiler : public ICStubCompiler { protected: - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); public: explicit Compiler(JSContext* cx) @@ -2960,7 +2960,7 @@ class ICTableSwitch : public ICStub void fixupJumpTable(JSScript* script, BaselineScript* baseline); class Compiler : public ICStubCompiler { - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); jsbytecode* pc_; @@ -2985,7 +2985,7 @@ class ICIteratorNew_Fallback : public ICFallbackStub public: class Compiler : public ICStubCompiler { protected: - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); public: explicit Compiler(JSContext* cx) @@ -3018,7 +3018,7 @@ class ICIteratorMore_Fallback : public ICFallbackStub class Compiler : public ICStubCompiler { protected: - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); public: explicit Compiler(JSContext* cx) @@ -3043,7 +3043,7 @@ class ICIteratorMore_Native : public ICStub public: class Compiler : public ICStubCompiler { protected: - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); public: explicit Compiler(JSContext* cx) @@ -3068,7 +3068,7 @@ class ICIteratorClose_Fallback : public ICFallbackStub public: class Compiler : public ICStubCompiler { protected: - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); public: explicit Compiler(JSContext* cx) @@ -3105,7 +3105,7 @@ class ICInstanceOf_Fallback : public ICFallbackStub class Compiler : public ICStubCompiler { protected: - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); public: explicit Compiler(JSContext* cx) @@ -3154,7 +3154,7 @@ class ICInstanceOf_Function : public ICStub uint32_t slot_; protected: - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); public: Compiler(JSContext* cx, Shape* shape, JSObject* prototypeObj, uint32_t slot) @@ -3185,7 +3185,7 @@ class ICTypeOf_Fallback : public ICFallbackStub public: class Compiler : public ICStubCompiler { protected: - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); public: explicit Compiler(JSContext* cx) @@ -3218,7 +3218,7 @@ class ICTypeOf_Typed : public ICFallbackStub protected: JSType type_; RootedString typeString_; - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); virtual int32_t getKey() const { return static_cast<int32_t>(engine_) | @@ -3259,7 +3259,7 @@ class ICRest_Fallback : public ICFallbackStub class Compiler : public ICStubCompiler { protected: RootedArrayObject templateObject; - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); public: Compiler(JSContext* cx, ArrayObject* templateObject) @@ -3287,7 +3287,7 @@ class ICRetSub_Fallback : public ICFallbackStub class Compiler : public ICStubCompiler { protected: - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); public: explicit Compiler(JSContext* cx) @@ -3328,7 +3328,7 @@ class ICRetSub_Resume : public ICStub uint32_t pcOffset_; uint8_t* addr_; - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); public: Compiler(JSContext* cx, uint32_t pcOffset, uint8_t* addr) diff --git a/js/src/jit/BaselineInspector.h b/js/src/jit/BaselineInspector.h index 556f28ee5b..9e027c5850 100644 --- a/js/src/jit/BaselineInspector.h +++ b/js/src/jit/BaselineInspector.h @@ -89,12 +89,12 @@ class BaselineInspector } ICStub* monomorphicStub(jsbytecode* pc); - MOZ_MUST_USE bool dimorphicStub(jsbytecode* pc, ICStub** pfirst, ICStub** psecond); + [[nodiscard]] bool dimorphicStub(jsbytecode* pc, ICStub** pfirst, ICStub** psecond); public: typedef Vector<ReceiverGuard, 4, JitAllocPolicy> ReceiverVector; typedef Vector<ObjectGroup*, 4, JitAllocPolicy> ObjectGroupVector; - MOZ_MUST_USE bool maybeInfoForPropertyOp(jsbytecode* pc, ReceiverVector& receivers, + [[nodiscard]] bool maybeInfoForPropertyOp(jsbytecode* pc, ReceiverVector& receivers, ObjectGroupVector& convertUnboxedGroups); SetElemICInspector setElemICInspector(jsbytecode* pc) { @@ -112,7 +112,7 @@ class BaselineInspector bool hasSeenDoubleResult(jsbytecode* pc); bool hasSeenNonStringIterMore(jsbytecode* pc); - MOZ_MUST_USE bool isOptimizableCallStringSplit(jsbytecode* pc, JSString** strOut, + [[nodiscard]] bool isOptimizableCallStringSplit(jsbytecode* pc, JSString** strOut, JSString** sepOut, JSObject** objOut); JSObject* getTemplateObject(jsbytecode* pc); JSObject* getTemplateObjectForNative(jsbytecode* pc, Native native); @@ -127,16 +127,16 @@ class BaselineInspector LexicalEnvironmentObject* templateNamedLambdaObject(); CallObject* templateCallObject(); - MOZ_MUST_USE bool commonGetPropFunction(jsbytecode* pc, JSObject** holder, Shape** holderShape, + [[nodiscard]] bool commonGetPropFunction(jsbytecode* pc, JSObject** holder, Shape** holderShape, JSFunction** commonGetter, Shape** globalShape, bool* isOwnProperty, ReceiverVector& receivers, ObjectGroupVector& convertUnboxedGroups); - MOZ_MUST_USE bool commonSetPropFunction(jsbytecode* pc, JSObject** holder, Shape** holderShape, + [[nodiscard]] bool commonSetPropFunction(jsbytecode* pc, JSObject** holder, Shape** holderShape, JSFunction** commonSetter, bool* isOwnProperty, ReceiverVector& receivers, ObjectGroupVector& convertUnboxedGroups); - MOZ_MUST_USE bool instanceOfData(jsbytecode* pc, Shape** shape, uint32_t* slot, + [[nodiscard]] bool instanceOfData(jsbytecode* pc, Shape** shape, uint32_t* slot, JSObject** prototypeObject); }; diff --git a/js/src/jit/BaselineJIT.h b/js/src/jit/BaselineJIT.h index dd7a92c6d9..234e60ff96 100644 --- a/js/src/jit/BaselineJIT.h +++ b/js/src/jit/BaselineJIT.h @@ -416,7 +416,7 @@ struct BaselineScript // the result may not be accurate. jsbytecode* approximatePcForNativeAddress(JSScript* script, uint8_t* nativeAddress); - MOZ_MUST_USE bool addDependentWasmImport(JSContext* cx, wasm::Instance& instance, uint32_t idx); + [[nodiscard]] bool addDependentWasmImport(JSContext* cx, wasm::Instance& instance, uint32_t idx); void removeDependentWasmImport(wasm::Instance& instance, uint32_t idx); void unlinkDependentWasmImports(FreeOp* fop); void clearDependentWasmImports(); diff --git a/js/src/jit/BitSet.h b/js/src/jit/BitSet.h index d0adeeddd4..9551736344 100644 --- a/js/src/jit/BitSet.h +++ b/js/src/jit/BitSet.h @@ -52,7 +52,7 @@ class BitSet bits_(nullptr), numBits_(numBits) {} - MOZ_MUST_USE bool init(TempAllocator& alloc); + [[nodiscard]] bool init(TempAllocator& alloc); unsigned int getNumBits() const { return numBits_; diff --git a/js/src/jit/BytecodeAnalysis.h b/js/src/jit/BytecodeAnalysis.h index 3e9251b7dc..6e3a21ea25 100644 --- a/js/src/jit/BytecodeAnalysis.h +++ b/js/src/jit/BytecodeAnalysis.h @@ -44,7 +44,7 @@ class BytecodeAnalysis public: explicit BytecodeAnalysis(TempAllocator& alloc, JSScript* script); - MOZ_MUST_USE bool init(TempAllocator& alloc, GSNCache& gsn); + [[nodiscard]] bool init(TempAllocator& alloc, GSNCache& gsn); BytecodeInfo& info(jsbytecode* pc) { MOZ_ASSERT(infos_[script_->pcToOffset(pc)].initialized); diff --git a/js/src/jit/CacheIR.h b/js/src/jit/CacheIR.h index 4bc523a972..69cc4a4577 100644 --- a/js/src/jit/CacheIR.h +++ b/js/src/jit/CacheIR.h @@ -409,18 +409,18 @@ class MOZ_RAII GetPropIRGenerator enum class PreliminaryObjectAction { None, Unlink, NotePreliminary }; PreliminaryObjectAction preliminaryObjectAction_; - MOZ_MUST_USE bool tryAttachNative(CacheIRWriter& writer, HandleObject obj, ObjOperandId objId); - MOZ_MUST_USE bool tryAttachUnboxed(CacheIRWriter& writer, HandleObject obj, ObjOperandId objId); - MOZ_MUST_USE bool tryAttachUnboxedExpando(CacheIRWriter& writer, HandleObject obj, + [[nodiscard]] bool tryAttachNative(CacheIRWriter& writer, HandleObject obj, ObjOperandId objId); + [[nodiscard]] bool tryAttachUnboxed(CacheIRWriter& writer, HandleObject obj, ObjOperandId objId); + [[nodiscard]] bool tryAttachUnboxedExpando(CacheIRWriter& writer, HandleObject obj, ObjOperandId objId); - MOZ_MUST_USE bool tryAttachTypedObject(CacheIRWriter& writer, HandleObject obj, + [[nodiscard]] bool tryAttachTypedObject(CacheIRWriter& writer, HandleObject obj, ObjOperandId objId); - MOZ_MUST_USE bool tryAttachObjectLength(CacheIRWriter& writer, HandleObject obj, + [[nodiscard]] bool tryAttachObjectLength(CacheIRWriter& writer, HandleObject obj, ObjOperandId objId); - MOZ_MUST_USE bool tryAttachModuleNamespace(CacheIRWriter& writer, HandleObject obj, + [[nodiscard]] bool tryAttachModuleNamespace(CacheIRWriter& writer, HandleObject obj, ObjOperandId objId); - MOZ_MUST_USE bool tryAttachPrimitive(CacheIRWriter& writer, ValOperandId valId); + [[nodiscard]] bool tryAttachPrimitive(CacheIRWriter& writer, ValOperandId valId); GetPropIRGenerator(const GetPropIRGenerator&) = delete; GetPropIRGenerator& operator=(const GetPropIRGenerator&) = delete; @@ -431,7 +431,7 @@ class MOZ_RAII GetPropIRGenerator bool emitted() const { return emitted_; } - MOZ_MUST_USE bool tryAttachStub(mozilla::Maybe<CacheIRWriter>& writer); + [[nodiscard]] bool tryAttachStub(mozilla::Maybe<CacheIRWriter>& writer); bool shouldUnlinkPreliminaryObjectStubs() const { return preliminaryObjectAction_ == PreliminaryObjectAction::Unlink; diff --git a/js/src/jit/CodeGenerator.h b/js/src/jit/CodeGenerator.h index b0fd03538d..bd8549842a 100644 --- a/js/src/jit/CodeGenerator.h +++ b/js/src/jit/CodeGenerator.h @@ -56,7 +56,7 @@ class OutOfLineNaNToZero; class CodeGenerator final : public CodeGeneratorSpecific { void generateArgumentsChecks(bool bailout = true); - MOZ_MUST_USE bool generateBody(); + [[nodiscard]] bool generateBody(); ConstantOrRegister toConstantOrRegister(LInstruction* lir, size_t n, MIRType type); @@ -65,11 +65,11 @@ class CodeGenerator final : public CodeGeneratorSpecific ~CodeGenerator(); public: - MOZ_MUST_USE bool generate(); - MOZ_MUST_USE bool generateWasm(wasm::SigIdDesc sigId, wasm::TrapOffset trapOffset, + [[nodiscard]] bool generate(); + [[nodiscard]] bool generateWasm(wasm::SigIdDesc sigId, wasm::TrapOffset trapOffset, wasm::FuncOffsets *offsets); - MOZ_MUST_USE bool link(JSContext* cx, CompilerConstraintList* constraints); - MOZ_MUST_USE bool linkSharedStubs(JSContext* cx); + [[nodiscard]] bool link(JSContext* cx, CompilerConstraintList* constraints); + [[nodiscard]] bool linkSharedStubs(JSContext* cx); void visitOsiPoint(LOsiPoint* lir); void visitGoto(LGoto* lir); @@ -466,7 +466,7 @@ class CodeGenerator final : public CodeGeneratorSpecific bool strict, bool needsTypeBarrier, bool guardHoles, jsbytecode* profilerLeavePc); - MOZ_MUST_USE bool generateBranchV(const ValueOperand& value, Label* ifTrue, Label* ifFalse, + [[nodiscard]] bool generateBranchV(const ValueOperand& value, Label* ifTrue, Label* ifFalse, FloatRegister fr); void emitLambdaInit(Register resultReg, Register envChainReg, diff --git a/js/src/jit/EdgeCaseAnalysis.h b/js/src/jit/EdgeCaseAnalysis.h index 86e10d83e5..bc6827a16b 100644 --- a/js/src/jit/EdgeCaseAnalysis.h +++ b/js/src/jit/EdgeCaseAnalysis.h @@ -20,7 +20,7 @@ class EdgeCaseAnalysis public: EdgeCaseAnalysis(MIRGenerator* mir, MIRGraph& graph); - MOZ_MUST_USE bool analyzeLate(); + [[nodiscard]] bool analyzeLate(); }; diff --git a/js/src/jit/EffectiveAddressAnalysis.h b/js/src/jit/EffectiveAddressAnalysis.h index a912cc34d1..f2cf933027 100644 --- a/js/src/jit/EffectiveAddressAnalysis.h +++ b/js/src/jit/EffectiveAddressAnalysis.h @@ -19,7 +19,7 @@ class EffectiveAddressAnalysis MIRGraph& graph_; template <typename AsmJSMemoryAccess> - MOZ_MUST_USE bool tryAddDisplacement(AsmJSMemoryAccess* ins, int32_t o); + [[nodiscard]] bool tryAddDisplacement(AsmJSMemoryAccess* ins, int32_t o); template <typename AsmJSMemoryAccess> void analyzeAsmJSHeapAccess(AsmJSMemoryAccess* ins); @@ -29,7 +29,7 @@ class EffectiveAddressAnalysis : mir_(mir), graph_(graph) {} - MOZ_MUST_USE bool analyze(); + [[nodiscard]] bool analyze(); }; } /* namespace jit */ diff --git a/js/src/jit/ExecutableAllocator.h b/js/src/jit/ExecutableAllocator.h index c16809c818..7932602c79 100644 --- a/js/src/jit/ExecutableAllocator.h +++ b/js/src/jit/ExecutableAllocator.h @@ -190,13 +190,13 @@ class ExecutableAllocator static void reprotectPool(JSRuntime* rt, ExecutablePool* pool, ProtectionSetting protection); public: - MOZ_MUST_USE + [[nodiscard]] static bool makeWritable(void* start, size_t size) { return ReprotectRegion(start, size, ProtectionSetting::Writable); } - MOZ_MUST_USE + [[nodiscard]] static bool makeExecutable(void* start, size_t size) { return ReprotectRegion(start, size, ProtectionSetting::Executable); diff --git a/js/src/jit/FixedList.h b/js/src/jit/FixedList.h index 23f4367dc7..9780d58c9f 100644 --- a/js/src/jit/FixedList.h +++ b/js/src/jit/FixedList.h @@ -31,7 +31,7 @@ class FixedList { } // Dynamic memory allocation requires the ability to report failure. - MOZ_MUST_USE bool init(TempAllocator& alloc, size_t length) { + [[nodiscard]] bool init(TempAllocator& alloc, size_t length) { if (length == 0) return true; @@ -59,7 +59,7 @@ class FixedList length_ -= num; } - MOZ_MUST_USE bool growBy(TempAllocator& alloc, size_t num) { + [[nodiscard]] bool growBy(TempAllocator& alloc, size_t num) { size_t newlength = length_ + num; if (newlength < length_) return false; diff --git a/js/src/jit/FlowAliasAnalysis.h b/js/src/jit/FlowAliasAnalysis.h index 91309d0d49..3779014b02 100644 --- a/js/src/jit/FlowAliasAnalysis.h +++ b/js/src/jit/FlowAliasAnalysis.h @@ -32,34 +32,34 @@ class FlowAliasAnalysis : public AliasAnalysisShared public: FlowAliasAnalysis(MIRGenerator* mir, MIRGraph& graph); - MOZ_MUST_USE bool analyze() override; + [[nodiscard]] bool analyze() override; protected: /* Process instructions. */ - MOZ_MUST_USE bool processStore(BlockStoreInfo& stores, MDefinition* store); - MOZ_MUST_USE bool processLoad(BlockStoreInfo& stores, MDefinition* load); - MOZ_MUST_USE bool processDeferredLoads(LoopInfo* info); + [[nodiscard]] bool processStore(BlockStoreInfo& stores, MDefinition* store); + [[nodiscard]] bool processLoad(BlockStoreInfo& stores, MDefinition* load); + [[nodiscard]] bool processDeferredLoads(LoopInfo* info); /* Improve dependency and helpers. */ - MOZ_MUST_USE bool improveDependency(MDefinition* load, MDefinitionVector& inputStores, - MDefinitionVector& outputStores); - MOZ_MUST_USE bool improveNonAliasedStores(MDefinition* load, MDefinitionVector& inputStores, - MDefinitionVector& outputStores, bool* improved, - bool onlyControlInstructions = false); - MOZ_MUST_USE bool improveStoresInFinishedLoops(MDefinition* load, MDefinitionVector& stores, - bool* improved); - - MOZ_MUST_USE bool improveLoopDependency(MDefinition* load, MDefinitionVector& inputStores, - MDefinitionVector& outputStores); - MOZ_MUST_USE bool deferImproveDependency(MDefinitionVector& stores); + [[nodiscard]] bool improveDependency(MDefinition* load, MDefinitionVector& inputStores, + MDefinitionVector& outputStores); + [[nodiscard]] bool improveNonAliasedStores(MDefinition* load, MDefinitionVector& inputStores, + MDefinitionVector& outputStores, bool* improved, + bool onlyControlInstructions = false); + [[nodiscard]] bool improveStoresInFinishedLoops(MDefinition* load, MDefinitionVector& stores, + bool* improved); + + [[nodiscard]] bool improveLoopDependency(MDefinition* load, MDefinitionVector& inputStores, + MDefinitionVector& outputStores); + [[nodiscard]] bool deferImproveDependency(MDefinitionVector& stores); /* Save dependency info. */ void saveLoadDependency(MDefinition* load, MDefinitionVector& dependencies); - MOZ_MUST_USE bool saveStoreDependency(MDefinition* store, BlockStoreInfo& prevStores); + [[nodiscard]] bool saveStoreDependency(MDefinition* store, BlockStoreInfo& prevStores); /* Helper functions. */ - MOZ_MUST_USE bool computeBlockStores(MBasicBlock* block); - MOZ_MUST_USE bool isLoopInvariant(MDefinition* load, MDefinition* store, bool* loopinvariant); + [[nodiscard]] bool computeBlockStores(MBasicBlock* block); + [[nodiscard]] bool isLoopInvariant(MDefinition* load, MDefinition* store, bool* loopinvariant); bool loopIsFinished(MBasicBlock* loopheader); }; diff --git a/js/src/jit/FoldLinearArithConstants.h b/js/src/jit/FoldLinearArithConstants.h index 2a493e1b9e..67a0980b6c 100644 --- a/js/src/jit/FoldLinearArithConstants.h +++ b/js/src/jit/FoldLinearArithConstants.h @@ -12,8 +12,7 @@ namespace js { namespace jit { -MOZ_MUST_USE bool -FoldLinearArithConstants(MIRGenerator* mir, MIRGraph& graph); +[[nodiscard]] bool FoldLinearArithConstants(MIRGenerator* mir, MIRGraph& graph); } /* namespace jit */ } /* namespace js */ diff --git a/js/src/jit/InstructionReordering.h b/js/src/jit/InstructionReordering.h index b43b9f55e9..baa904dfcd 100644 --- a/js/src/jit/InstructionReordering.h +++ b/js/src/jit/InstructionReordering.h @@ -11,8 +11,7 @@ namespace js { namespace jit { -MOZ_MUST_USE bool -ReorderInstructions(MIRGenerator* mir, MIRGraph& graph); +[[nodiscard]] bool ReorderInstructions(MIRGenerator* mir, MIRGraph& graph); } // namespace jit } // namespace js diff --git a/js/src/jit/Ion.h b/js/src/jit/Ion.h index 59a7823499..55709414ba 100644 --- a/js/src/jit/Ion.h +++ b/js/src/jit/Ion.h @@ -81,7 +81,7 @@ class JitContext }; // Initialize Ion statically for all JSRuntimes. -MOZ_MUST_USE bool InitializeIon(); +[[nodiscard]] bool InitializeIon(); // Get and set the current JIT context. JitContext* GetJitContext(); @@ -91,7 +91,7 @@ void SetJitContext(JitContext* ctx); bool CanIonCompileScript(JSContext* cx, JSScript* script, bool osr); -MOZ_MUST_USE bool IonCompileScriptForBaseline(JSContext* cx, BaselineFrame* frame, jsbytecode* pc); +[[nodiscard]] bool IonCompileScriptForBaseline(JSContext* cx, BaselineFrame* frame, jsbytecode* pc); MethodStatus CanEnter(JSContext* cx, RunState& state); MethodStatus CanEnterUsingFastInvoke(JSContext* cx, HandleScript script, uint32_t numActualArgs); @@ -122,8 +122,8 @@ IsErrorStatus(JitExecStatus status) struct EnterJitData; -MOZ_MUST_USE bool SetEnterJitData(JSContext* cx, EnterJitData& data, RunState& state, - MutableHandle<GCVector<Value>> vals); +[[nodiscard]] bool SetEnterJitData(JSContext* cx, EnterJitData& data, RunState& state, + MutableHandle<GCVector<Value>> vals); JitExecStatus IonCannon(JSContext* cx, RunState& state); @@ -146,7 +146,7 @@ class MIRGenerator; class LIRGraph; class CodeGenerator; -MOZ_MUST_USE bool OptimizeMIR(MIRGenerator* mir); +[[nodiscard]] bool OptimizeMIR(MIRGenerator* mir); LIRGraph* GenerateLIR(MIRGenerator* mir); CodeGenerator* GenerateCode(MIRGenerator* mir, LIRGraph* lir); CodeGenerator* CompileBackEnd(MIRGenerator* mir); diff --git a/js/src/jit/IonAnalysis.cpp b/js/src/jit/IonAnalysis.cpp index aa8f8164b5..ded3ea17ad 100644 --- a/js/src/jit/IonAnalysis.cpp +++ b/js/src/jit/IonAnalysis.cpp @@ -4465,7 +4465,7 @@ JS_FOR_EACH_TRACEKIND(TRACE_ROOTS) #undef TRACE_ROOTS } -MOZ_MUST_USE bool +[[nodiscard]] bool jit::CreateMIRRootList(IonBuilder& builder) { MOZ_ASSERT(!builder.info().isAnalysis()); diff --git a/js/src/jit/IonAnalysis.h b/js/src/jit/IonAnalysis.h index e6b7fa2aa2..6434da6a67 100644 --- a/js/src/jit/IonAnalysis.h +++ b/js/src/jit/IonAnalysis.h @@ -17,13 +17,13 @@ namespace jit { class MIRGenerator; class MIRGraph; -MOZ_MUST_USE bool +[[nodiscard]] bool PruneUnusedBranches(MIRGenerator* mir, MIRGraph& graph); -MOZ_MUST_USE bool +[[nodiscard]] bool FoldTests(MIRGraph& graph); -MOZ_MUST_USE bool +[[nodiscard]] bool SplitCriticalEdges(MIRGraph& graph); bool @@ -34,7 +34,7 @@ enum Observability { AggressiveObservability }; -MOZ_MUST_USE bool +[[nodiscard]] bool EliminatePhis(MIRGenerator* mir, MIRGraph& graph, Observability observe); size_t @@ -43,38 +43,38 @@ MarkLoopBlocks(MIRGraph& graph, MBasicBlock* header, bool* canOsr); void UnmarkLoopBlocks(MIRGraph& graph, MBasicBlock* header); -MOZ_MUST_USE bool +[[nodiscard]] bool MakeLoopsContiguous(MIRGraph& graph); -MOZ_MUST_USE bool +[[nodiscard]] bool EliminateDeadResumePointOperands(MIRGenerator* mir, MIRGraph& graph); -MOZ_MUST_USE bool +[[nodiscard]] bool EliminateDeadCode(MIRGenerator* mir, MIRGraph& graph); -MOZ_MUST_USE bool +[[nodiscard]] bool ApplyTypeInformation(MIRGenerator* mir, MIRGraph& graph); void RenumberBlocks(MIRGraph& graph); -MOZ_MUST_USE bool +[[nodiscard]] bool AccountForCFGChanges(MIRGenerator* mir, MIRGraph& graph, bool updateAliasAnalysis, bool underValueNumberer = false); -MOZ_MUST_USE bool +[[nodiscard]] bool RemoveUnmarkedBlocks(MIRGenerator* mir, MIRGraph& graph, uint32_t numMarkedBlocks); -MOZ_MUST_USE bool +[[nodiscard]] bool CreateMIRRootList(IonBuilder& builder); void ClearDominatorTree(MIRGraph& graph); -MOZ_MUST_USE bool +[[nodiscard]] bool BuildDominatorTree(MIRGraph& graph); -MOZ_MUST_USE bool +[[nodiscard]] bool BuildPhiReverseMapping(MIRGraph& graph); void @@ -86,10 +86,10 @@ AssertGraphCoherency(MIRGraph& graph); void AssertExtendedGraphCoherency(MIRGraph& graph, bool underValueNumberer = false); -MOZ_MUST_USE bool +[[nodiscard]] bool EliminateRedundantChecks(MIRGraph& graph); -MOZ_MUST_USE bool +[[nodiscard]] bool AddKeepAliveInstructions(MIRGraph& graph); class MDefinition; @@ -121,7 +121,7 @@ enum class MathSpace { SimpleLinearSum ExtractLinearSum(MDefinition* ins, MathSpace space = MathSpace::Unknown); -MOZ_MUST_USE bool +[[nodiscard]] bool ExtractLinearInequality(MTest* test, BranchDirection direction, SimpleLinearSum* plhs, MDefinition** prhs, bool* plessEqual); @@ -157,15 +157,15 @@ class LinearSum // These return false on an integer overflow, and afterwards the sum must // not be used. - MOZ_MUST_USE bool multiply(int32_t scale); - MOZ_MUST_USE bool add(const LinearSum& other, int32_t scale = 1); - MOZ_MUST_USE bool add(SimpleLinearSum other, int32_t scale = 1); - MOZ_MUST_USE bool add(MDefinition* term, int32_t scale); - MOZ_MUST_USE bool add(int32_t constant); + [[nodiscard]] bool multiply(int32_t scale); + [[nodiscard]] bool add(const LinearSum& other, int32_t scale = 1); + [[nodiscard]] bool add(SimpleLinearSum other, int32_t scale = 1); + [[nodiscard]] bool add(MDefinition* term, int32_t scale); + [[nodiscard]] bool add(int32_t constant); // Unlike the above function, on failure this leaves the sum unchanged and // it can still be used. - MOZ_MUST_USE bool divide(uint32_t scale); + [[nodiscard]] bool divide(uint32_t scale); int32_t constant() const { return constant_; } size_t numTerms() const { return terms_.length(); } @@ -191,7 +191,7 @@ ConvertLinearSum(TempAllocator& alloc, MBasicBlock* block, const LinearSum& sum, MCompare* ConvertLinearInequality(TempAllocator& alloc, MBasicBlock* block, const LinearSum& sum); -MOZ_MUST_USE bool +[[nodiscard]] bool AnalyzeNewScriptDefiniteProperties(JSContext* cx, DPAConstraintInfo& constraintInfo, HandleFunction fun, @@ -199,7 +199,7 @@ AnalyzeNewScriptDefiniteProperties(JSContext* cx, HandlePlainObject baseobj, Vector<TypeNewScript::Initializer>* initializerList); -MOZ_MUST_USE bool +[[nodiscard]] bool AnalyzeArgumentsUsage(JSContext* cx, JSScript* script); bool diff --git a/js/src/jit/IonBuilder.h b/js/src/jit/IonBuilder.h index 8f616b74eb..c5275d7b89 100644 --- a/js/src/jit/IonBuilder.h +++ b/js/src/jit/IonBuilder.h @@ -217,15 +217,15 @@ class IonBuilder // Callers of build() and buildInline() should always check whether the // call overrecursed, if false is returned. Overrecursion is not // signaled as OOM and will not in general be caught by OOM paths. - MOZ_MUST_USE bool build(); - MOZ_MUST_USE bool buildInline(IonBuilder* callerBuilder, MResumePoint* callerResumePoint, + [[nodiscard]] bool build(); + [[nodiscard]] bool buildInline(IonBuilder* callerBuilder, MResumePoint* callerResumePoint, CallInfo& callInfo); private: - MOZ_MUST_USE bool traverseBytecode(); + [[nodiscard]] bool traverseBytecode(); ControlStatus snoopControlFlow(JSOp op); - MOZ_MUST_USE bool processIterators(); - MOZ_MUST_USE bool inspectOpcode(JSOp op); + [[nodiscard]] bool processIterators(); + [[nodiscard]] bool inspectOpcode(JSOp op); uint32_t readIndex(jsbytecode* pc); JSAtom* readAtom(jsbytecode* pc); bool abort(const char* message, ...) MOZ_FORMAT_PRINTF(2, 3); @@ -233,12 +233,12 @@ class IonBuilder void spew(const char* message); JSFunction* getSingleCallTarget(TemporaryTypeSet* calleeTypes); - MOZ_MUST_USE bool getPolyCallTargets(TemporaryTypeSet* calleeTypes, bool constructing, + [[nodiscard]] bool getPolyCallTargets(TemporaryTypeSet* calleeTypes, bool constructing, ObjectVector& targets, uint32_t maxTargets); void popCfgStack(); DeferredEdge* filterDeadDeferredEdges(DeferredEdge* edge); - MOZ_MUST_USE bool processDeferredContinues(CFGState& state); + [[nodiscard]] bool processDeferredContinues(CFGState& state); ControlStatus processControlEnd(); ControlStatus processCfgStack(); ControlStatus processCfgEntry(CFGState& state); @@ -265,11 +265,11 @@ class IonBuilder ControlStatus processContinue(JSOp op); ControlStatus processBreak(JSOp op, jssrcnote* sn); ControlStatus maybeLoop(JSOp op, jssrcnote* sn); - MOZ_MUST_USE bool pushLoop(CFGState::State state, jsbytecode* stopAt, MBasicBlock* entry, + [[nodiscard]] bool pushLoop(CFGState::State state, jsbytecode* stopAt, MBasicBlock* entry, bool osr, jsbytecode* loopHead, jsbytecode* initialPc, jsbytecode* bodyStart, jsbytecode* bodyEnd, jsbytecode* exitpc, jsbytecode* continuepc); - MOZ_MUST_USE bool analyzeNewLoopTypes(MBasicBlock* entry, jsbytecode* start, jsbytecode* end); + [[nodiscard]] bool analyzeNewLoopTypes(MBasicBlock* entry, jsbytecode* start, jsbytecode* end); MBasicBlock* addBlock(MBasicBlock* block, uint32_t loopDepth); MBasicBlock* newBlock(MBasicBlock* predecessor, jsbytecode* pc); @@ -310,9 +310,9 @@ class IonBuilder // Incorporates a type/typeSet into an OSR value for a loop, after the loop // body has been processed. - MOZ_MUST_USE bool addOsrValueTypeBarrier(uint32_t slot, MInstruction** def, + [[nodiscard]] bool addOsrValueTypeBarrier(uint32_t slot, MInstruction** def, MIRType type, TemporaryTypeSet* typeSet); - MOZ_MUST_USE bool maybeAddOsrTypeBarriers(); + [[nodiscard]] bool maybeAddOsrTypeBarriers(); // Restarts processing of a loop if the type information at its header was // incomplete. @@ -328,19 +328,19 @@ class IonBuilder // Please see the Big Honkin' Comment about how resume points work in // IonBuilder.cpp, near the definition for this function. - MOZ_MUST_USE bool resume(MInstruction* ins, jsbytecode* pc, MResumePoint::Mode mode); - MOZ_MUST_USE bool resumeAt(MInstruction* ins, jsbytecode* pc); - MOZ_MUST_USE bool resumeAfter(MInstruction* ins); - MOZ_MUST_USE bool maybeInsertResume(); + [[nodiscard]] bool resume(MInstruction* ins, jsbytecode* pc, MResumePoint::Mode mode); + [[nodiscard]] bool resumeAt(MInstruction* ins, jsbytecode* pc); + [[nodiscard]] bool resumeAfter(MInstruction* ins); + [[nodiscard]] bool maybeInsertResume(); void insertRecompileCheck(); - MOZ_MUST_USE bool initParameters(); + [[nodiscard]] bool initParameters(); void initLocals(); void rewriteParameter(uint32_t slotIdx, MDefinition* param, int32_t argIndex); - MOZ_MUST_USE bool rewriteParameters(); - MOZ_MUST_USE bool initEnvironmentChain(MDefinition* callee = nullptr); - MOZ_MUST_USE bool initArgumentsObject(); + [[nodiscard]] bool rewriteParameters(); + [[nodiscard]] bool initEnvironmentChain(MDefinition* callee = nullptr); + [[nodiscard]] bool initArgumentsObject(); void pushConstant(const Value& v); MConstant* constant(const Value& v); @@ -350,27 +350,27 @@ class IonBuilder MInstruction* setInitializedLength(MDefinition* obj, JSValueType unboxedType, size_t count); // Improve the type information at tests - MOZ_MUST_USE bool improveTypesAtTest(MDefinition* ins, bool trueBranch, MTest* test); - MOZ_MUST_USE bool improveTypesAtCompare(MCompare* ins, bool trueBranch, MTest* test); - MOZ_MUST_USE bool improveTypesAtNullOrUndefinedCompare(MCompare* ins, bool trueBranch, + [[nodiscard]] bool improveTypesAtTest(MDefinition* ins, bool trueBranch, MTest* test); + [[nodiscard]] bool improveTypesAtCompare(MCompare* ins, bool trueBranch, MTest* test); + [[nodiscard]] bool improveTypesAtNullOrUndefinedCompare(MCompare* ins, bool trueBranch, MTest* test); - MOZ_MUST_USE bool improveTypesAtTypeOfCompare(MCompare* ins, bool trueBranch, MTest* test); + [[nodiscard]] bool improveTypesAtTypeOfCompare(MCompare* ins, bool trueBranch, MTest* test); // Used to detect triangular structure at test. - MOZ_MUST_USE bool detectAndOrStructure(MPhi* ins, bool* branchIsTrue); - MOZ_MUST_USE bool replaceTypeSet(MDefinition* subject, TemporaryTypeSet* type, MTest* test); + [[nodiscard]] bool detectAndOrStructure(MPhi* ins, bool* branchIsTrue); + [[nodiscard]] bool replaceTypeSet(MDefinition* subject, TemporaryTypeSet* type, MTest* test); // Add a guard which ensure that the set of type which goes through this // generated code correspond to the observed types for the bytecode. MDefinition* addTypeBarrier(MDefinition* def, TemporaryTypeSet* observed, BarrierKind kind, MTypeBarrier** pbarrier = nullptr); - MOZ_MUST_USE bool pushTypeBarrier(MDefinition* def, TemporaryTypeSet* observed, + [[nodiscard]] bool pushTypeBarrier(MDefinition* def, TemporaryTypeSet* observed, BarrierKind kind); // As pushTypeBarrier, but will compute the needBarrier boolean itself based // on observed and the JSFunction that we're planning to call. The // JSFunction must be a DOM method or getter. - MOZ_MUST_USE bool pushDOMTypeBarrier(MInstruction* ins, TemporaryTypeSet* observed, + [[nodiscard]] bool pushDOMTypeBarrier(MInstruction* ins, TemporaryTypeSet* observed, JSFunction* func); // If definiteType is not known or def already has the right type, just @@ -412,13 +412,13 @@ class IonBuilder bool invalidatedIdempotentCache(); bool hasStaticEnvironmentObject(EnvironmentCoordinate ec, JSObject** pcall); - MOZ_MUST_USE bool loadSlot(MDefinition* obj, size_t slot, size_t nfixed, MIRType rvalType, + [[nodiscard]] bool loadSlot(MDefinition* obj, size_t slot, size_t nfixed, MIRType rvalType, BarrierKind barrier, TemporaryTypeSet* types); - MOZ_MUST_USE bool loadSlot(MDefinition* obj, Shape* shape, MIRType rvalType, + [[nodiscard]] bool loadSlot(MDefinition* obj, Shape* shape, MIRType rvalType, BarrierKind barrier, TemporaryTypeSet* types); - MOZ_MUST_USE bool storeSlot(MDefinition* obj, size_t slot, size_t nfixed, MDefinition* value, + [[nodiscard]] bool storeSlot(MDefinition* obj, size_t slot, size_t nfixed, MDefinition* value, bool needsBarrier, MIRType slotType = MIRType::None); - MOZ_MUST_USE bool storeSlot(MDefinition* obj, Shape* shape, MDefinition* value, + [[nodiscard]] bool storeSlot(MDefinition* obj, Shape* shape, MDefinition* value, bool needsBarrier, MIRType slotType = MIRType::None); bool shouldAbortOnPreliminaryGroups(MDefinition *obj); @@ -426,135 +426,135 @@ class IonBuilder MDefinition* maybeUnboxForPropertyAccess(MDefinition* def); // jsop_getprop() helpers. - MOZ_MUST_USE bool checkIsDefinitelyOptimizedArguments(MDefinition* obj, bool* isOptimizedArgs); - MOZ_MUST_USE bool getPropTryInferredConstant(bool* emitted, MDefinition* obj, + [[nodiscard]] bool checkIsDefinitelyOptimizedArguments(MDefinition* obj, bool* isOptimizedArgs); + [[nodiscard]] bool getPropTryInferredConstant(bool* emitted, MDefinition* obj, PropertyName* name, TemporaryTypeSet* types); - MOZ_MUST_USE bool getPropTryArgumentsLength(bool* emitted, MDefinition* obj); - MOZ_MUST_USE bool getPropTryArgumentsCallee(bool* emitted, MDefinition* obj, + [[nodiscard]] bool getPropTryArgumentsLength(bool* emitted, MDefinition* obj); + [[nodiscard]] bool getPropTryArgumentsCallee(bool* emitted, MDefinition* obj, PropertyName* name); - MOZ_MUST_USE bool getPropTryConstant(bool* emitted, MDefinition* obj, jsid id, + [[nodiscard]] bool getPropTryConstant(bool* emitted, MDefinition* obj, jsid id, TemporaryTypeSet* types); - MOZ_MUST_USE bool getPropTryNotDefined(bool* emitted, MDefinition* obj, jsid id, + [[nodiscard]] bool getPropTryNotDefined(bool* emitted, MDefinition* obj, jsid id, TemporaryTypeSet* types); - MOZ_MUST_USE bool getPropTryDefiniteSlot(bool* emitted, MDefinition* obj, PropertyName* name, + [[nodiscard]] bool getPropTryDefiniteSlot(bool* emitted, MDefinition* obj, PropertyName* name, BarrierKind barrier, TemporaryTypeSet* types); - MOZ_MUST_USE bool getPropTryModuleNamespace(bool* emitted, MDefinition* obj, PropertyName* name, + [[nodiscard]] bool getPropTryModuleNamespace(bool* emitted, MDefinition* obj, PropertyName* name, BarrierKind barrier, TemporaryTypeSet* types); - MOZ_MUST_USE bool getPropTryUnboxed(bool* emitted, MDefinition* obj, PropertyName* name, + [[nodiscard]] bool getPropTryUnboxed(bool* emitted, MDefinition* obj, PropertyName* name, BarrierKind barrier, TemporaryTypeSet* types); - MOZ_MUST_USE bool getPropTryCommonGetter(bool* emitted, MDefinition* obj, PropertyName* name, + [[nodiscard]] bool getPropTryCommonGetter(bool* emitted, MDefinition* obj, PropertyName* name, TemporaryTypeSet* types); - MOZ_MUST_USE bool getPropTryInlineAccess(bool* emitted, MDefinition* obj, PropertyName* name, + [[nodiscard]] bool getPropTryInlineAccess(bool* emitted, MDefinition* obj, PropertyName* name, BarrierKind barrier, TemporaryTypeSet* types); - MOZ_MUST_USE bool getPropTryTypedObject(bool* emitted, MDefinition* obj, PropertyName* name); - MOZ_MUST_USE bool getPropTryScalarPropOfTypedObject(bool* emitted, MDefinition* typedObj, + [[nodiscard]] bool getPropTryTypedObject(bool* emitted, MDefinition* obj, PropertyName* name); + [[nodiscard]] bool getPropTryScalarPropOfTypedObject(bool* emitted, MDefinition* typedObj, int32_t fieldOffset, TypedObjectPrediction fieldTypeReprs); - MOZ_MUST_USE bool getPropTryReferencePropOfTypedObject(bool* emitted, MDefinition* typedObj, + [[nodiscard]] bool getPropTryReferencePropOfTypedObject(bool* emitted, MDefinition* typedObj, int32_t fieldOffset, TypedObjectPrediction fieldPrediction, PropertyName* name); - MOZ_MUST_USE bool getPropTryComplexPropOfTypedObject(bool* emitted, MDefinition* typedObj, + [[nodiscard]] bool getPropTryComplexPropOfTypedObject(bool* emitted, MDefinition* typedObj, int32_t fieldOffset, TypedObjectPrediction fieldTypeReprs, size_t fieldIndex); - MOZ_MUST_USE bool getPropTryInnerize(bool* emitted, MDefinition* obj, PropertyName* name, + [[nodiscard]] bool getPropTryInnerize(bool* emitted, MDefinition* obj, PropertyName* name, TemporaryTypeSet* types); - MOZ_MUST_USE bool getPropTryCache(bool* emitted, MDefinition* obj, PropertyName* name, + [[nodiscard]] bool getPropTryCache(bool* emitted, MDefinition* obj, PropertyName* name, BarrierKind barrier, TemporaryTypeSet* types); - MOZ_MUST_USE bool getPropTrySharedStub(bool* emitted, MDefinition* obj, + [[nodiscard]] bool getPropTrySharedStub(bool* emitted, MDefinition* obj, TemporaryTypeSet* types); // jsop_setprop() helpers. - MOZ_MUST_USE bool setPropTryCommonSetter(bool* emitted, MDefinition* obj, + [[nodiscard]] bool setPropTryCommonSetter(bool* emitted, MDefinition* obj, PropertyName* name, MDefinition* value); - MOZ_MUST_USE bool setPropTryCommonDOMSetter(bool* emitted, MDefinition* obj, + [[nodiscard]] bool setPropTryCommonDOMSetter(bool* emitted, MDefinition* obj, MDefinition* value, JSFunction* setter, TemporaryTypeSet* objTypes); - MOZ_MUST_USE bool setPropTryDefiniteSlot(bool* emitted, MDefinition* obj, + [[nodiscard]] bool setPropTryDefiniteSlot(bool* emitted, MDefinition* obj, PropertyName* name, MDefinition* value, bool barrier, TemporaryTypeSet* objTypes); - MOZ_MUST_USE bool setPropTryUnboxed(bool* emitted, MDefinition* obj, + [[nodiscard]] bool setPropTryUnboxed(bool* emitted, MDefinition* obj, PropertyName* name, MDefinition* value, bool barrier, TemporaryTypeSet* objTypes); - MOZ_MUST_USE bool setPropTryInlineAccess(bool* emitted, MDefinition* obj, + [[nodiscard]] bool setPropTryInlineAccess(bool* emitted, MDefinition* obj, PropertyName* name, MDefinition* value, bool barrier, TemporaryTypeSet* objTypes); - MOZ_MUST_USE bool setPropTryTypedObject(bool* emitted, MDefinition* obj, + [[nodiscard]] bool setPropTryTypedObject(bool* emitted, MDefinition* obj, PropertyName* name, MDefinition* value); - MOZ_MUST_USE bool setPropTryReferencePropOfTypedObject(bool* emitted, MDefinition* obj, + [[nodiscard]] bool setPropTryReferencePropOfTypedObject(bool* emitted, MDefinition* obj, int32_t fieldOffset, MDefinition* value, TypedObjectPrediction fieldPrediction, PropertyName* name); - MOZ_MUST_USE bool setPropTryScalarPropOfTypedObject(bool* emitted, + [[nodiscard]] bool setPropTryScalarPropOfTypedObject(bool* emitted, MDefinition* obj, int32_t fieldOffset, MDefinition* value, TypedObjectPrediction fieldTypeReprs); - MOZ_MUST_USE bool setPropTryCache(bool* emitted, MDefinition* obj, + [[nodiscard]] bool setPropTryCache(bool* emitted, MDefinition* obj, PropertyName* name, MDefinition* value, bool barrier, TemporaryTypeSet* objTypes); // jsop_binary_arith helpers. MBinaryArithInstruction* binaryArithInstruction(JSOp op, MDefinition* left, MDefinition* right); MIRType binaryArithNumberSpecialization(MDefinition* left, MDefinition* right); - MOZ_MUST_USE bool binaryArithTryConcat(bool* emitted, JSOp op, MDefinition* left, + [[nodiscard]] bool binaryArithTryConcat(bool* emitted, JSOp op, MDefinition* left, MDefinition* right); - MOZ_MUST_USE MBinaryArithInstruction* binaryArithEmitSpecialized(MDefinition::Opcode op, + [[nodiscard]] MBinaryArithInstruction* binaryArithEmitSpecialized(MDefinition::Opcode op, MIRType specialization, MDefinition* left, MDefinition* right); - MOZ_MUST_USE bool binaryArithTrySpecialized(bool* emitted, JSOp op, MDefinition* left, + [[nodiscard]] bool binaryArithTrySpecialized(bool* emitted, JSOp op, MDefinition* left, MDefinition* right); - MOZ_MUST_USE bool binaryArithTrySpecializedOnBaselineInspector(bool* emitted, JSOp op, + [[nodiscard]] bool binaryArithTrySpecializedOnBaselineInspector(bool* emitted, JSOp op, MDefinition* left, MDefinition* right); - MOZ_MUST_USE bool arithTrySharedStub(bool* emitted, JSOp op, MDefinition* left, + [[nodiscard]] bool arithTrySharedStub(bool* emitted, JSOp op, MDefinition* left, MDefinition* right); // jsop_bitnot helpers. - MOZ_MUST_USE bool bitnotTrySpecialized(bool* emitted, MDefinition* input); + [[nodiscard]] bool bitnotTrySpecialized(bool* emitted, MDefinition* input); // jsop_inc_or_dec helpers. MDefinition* unaryArithConvertToBinary(JSOp op, MDefinition::Opcode* defOp); - MOZ_MUST_USE bool unaryArithTrySpecialized(bool* emitted, JSOp op, MDefinition* value); - MOZ_MUST_USE bool unaryArithTrySpecializedOnBaselineInspector(bool* emitted, JSOp op, + [[nodiscard]] bool unaryArithTrySpecialized(bool* emitted, JSOp op, MDefinition* value); + [[nodiscard]] bool unaryArithTrySpecializedOnBaselineInspector(bool* emitted, JSOp op, MDefinition* value); // jsop_pow helpers. - MOZ_MUST_USE bool powTrySpecialized(bool* emitted, MDefinition* base, MDefinition* power, + [[nodiscard]] bool powTrySpecialized(bool* emitted, MDefinition* base, MDefinition* power, MIRType outputType); // jsop_compare helpers. - MOZ_MUST_USE bool compareTrySpecialized(bool* emitted, JSOp op, MDefinition* left, + [[nodiscard]] bool compareTrySpecialized(bool* emitted, JSOp op, MDefinition* left, MDefinition* right); - MOZ_MUST_USE bool compareTryBitwise(bool* emitted, JSOp op, MDefinition* left, + [[nodiscard]] bool compareTryBitwise(bool* emitted, JSOp op, MDefinition* left, MDefinition* right); - MOZ_MUST_USE bool compareTrySpecializedOnBaselineInspector(bool* emitted, JSOp op, + [[nodiscard]] bool compareTrySpecializedOnBaselineInspector(bool* emitted, JSOp op, MDefinition* left, MDefinition* right); - MOZ_MUST_USE bool compareTrySharedStub(bool* emitted, JSOp op, MDefinition* left, + [[nodiscard]] bool compareTrySharedStub(bool* emitted, JSOp op, MDefinition* left, MDefinition* right); // jsop_newarray helpers. - MOZ_MUST_USE bool newArrayTrySharedStub(bool* emitted); - MOZ_MUST_USE bool newArrayTryTemplateObject(bool* emitted, JSObject* templateObject, + [[nodiscard]] bool newArrayTrySharedStub(bool* emitted); + [[nodiscard]] bool newArrayTryTemplateObject(bool* emitted, JSObject* templateObject, uint32_t length); - MOZ_MUST_USE bool newArrayTryVM(bool* emitted, JSObject* templateObject, uint32_t length); + [[nodiscard]] bool newArrayTryVM(bool* emitted, JSObject* templateObject, uint32_t length); // jsop_newobject helpers. - MOZ_MUST_USE bool newObjectTrySharedStub(bool* emitted); - MOZ_MUST_USE bool newObjectTryTemplateObject(bool* emitted, JSObject* templateObject); - MOZ_MUST_USE bool newObjectTryVM(bool* emitted, JSObject* templateObject); + [[nodiscard]] bool newObjectTrySharedStub(bool* emitted); + [[nodiscard]] bool newObjectTryTemplateObject(bool* emitted, JSObject* templateObject); + [[nodiscard]] bool newObjectTryVM(bool* emitted, JSObject* templateObject); // jsop_in helpers. - MOZ_MUST_USE bool inTryDense(bool* emitted, MDefinition* obj, MDefinition* id); - MOZ_MUST_USE bool inTryFold(bool* emitted, MDefinition* obj, MDefinition* id); + [[nodiscard]] bool inTryDense(bool* emitted, MDefinition* obj, MDefinition* id); + [[nodiscard]] bool inTryFold(bool* emitted, MDefinition* obj, MDefinition* id); // binary data lookup helpers. TypedObjectPrediction typedObjectPrediction(MDefinition* typedObj); TypedObjectPrediction typedObjectPrediction(TemporaryTypeSet* types); - MOZ_MUST_USE bool typedObjectHasField(MDefinition* typedObj, + [[nodiscard]] bool typedObjectHasField(MDefinition* typedObj, PropertyName* name, size_t* fieldOffset, TypedObjectPrediction* fieldTypeReprs, @@ -572,87 +572,87 @@ class IonBuilder MDefinition* typeObjectForElementFromArrayStructType(MDefinition* typedObj); MDefinition* typeObjectForFieldFromStructType(MDefinition* type, size_t fieldIndex); - MOZ_MUST_USE bool storeReferenceTypedObjectValue(MDefinition* typedObj, + [[nodiscard]] bool storeReferenceTypedObjectValue(MDefinition* typedObj, const LinearSum& byteOffset, ReferenceTypeDescr::Type type, MDefinition* value, PropertyName* name); - MOZ_MUST_USE bool storeScalarTypedObjectValue(MDefinition* typedObj, + [[nodiscard]] bool storeScalarTypedObjectValue(MDefinition* typedObj, const LinearSum& byteOffset, ScalarTypeDescr::Type type, MDefinition* value); - MOZ_MUST_USE bool checkTypedObjectIndexInBounds(uint32_t elemSize, + [[nodiscard]] bool checkTypedObjectIndexInBounds(uint32_t elemSize, MDefinition* obj, MDefinition* index, TypedObjectPrediction objTypeDescrs, LinearSum* indexAsByteOffset); - MOZ_MUST_USE bool pushDerivedTypedObject(bool* emitted, + [[nodiscard]] bool pushDerivedTypedObject(bool* emitted, MDefinition* obj, const LinearSum& byteOffset, TypedObjectPrediction derivedTypeDescrs, MDefinition* derivedTypeObj); - MOZ_MUST_USE bool pushScalarLoadFromTypedObject(MDefinition* obj, + [[nodiscard]] bool pushScalarLoadFromTypedObject(MDefinition* obj, const LinearSum& byteoffset, ScalarTypeDescr::Type type); - MOZ_MUST_USE bool pushReferenceLoadFromTypedObject(MDefinition* typedObj, + [[nodiscard]] bool pushReferenceLoadFromTypedObject(MDefinition* typedObj, const LinearSum& byteOffset, ReferenceTypeDescr::Type type, PropertyName* name); JSObject* getStaticTypedArrayObject(MDefinition* obj, MDefinition* index); // jsop_setelem() helpers. - MOZ_MUST_USE bool setElemTryTypedArray(bool* emitted, MDefinition* object, + [[nodiscard]] bool setElemTryTypedArray(bool* emitted, MDefinition* object, MDefinition* index, MDefinition* value); - MOZ_MUST_USE bool setElemTryTypedObject(bool* emitted, MDefinition* obj, + [[nodiscard]] bool setElemTryTypedObject(bool* emitted, MDefinition* obj, MDefinition* index, MDefinition* value); - MOZ_MUST_USE bool setElemTryTypedStatic(bool* emitted, MDefinition* object, + [[nodiscard]] bool setElemTryTypedStatic(bool* emitted, MDefinition* object, MDefinition* index, MDefinition* value); - MOZ_MUST_USE bool setElemTryDense(bool* emitted, MDefinition* object, + [[nodiscard]] bool setElemTryDense(bool* emitted, MDefinition* object, MDefinition* index, MDefinition* value, bool writeHole); - MOZ_MUST_USE bool setElemTryArguments(bool* emitted, MDefinition* object, + [[nodiscard]] bool setElemTryArguments(bool* emitted, MDefinition* object, MDefinition* index, MDefinition* value); - MOZ_MUST_USE bool setElemTryCache(bool* emitted, MDefinition* object, + [[nodiscard]] bool setElemTryCache(bool* emitted, MDefinition* object, MDefinition* index, MDefinition* value); - MOZ_MUST_USE bool setElemTryReferenceElemOfTypedObject(bool* emitted, + [[nodiscard]] bool setElemTryReferenceElemOfTypedObject(bool* emitted, MDefinition* obj, MDefinition* index, TypedObjectPrediction objPrediction, MDefinition* value, TypedObjectPrediction elemPrediction); - MOZ_MUST_USE bool setElemTryScalarElemOfTypedObject(bool* emitted, + [[nodiscard]] bool setElemTryScalarElemOfTypedObject(bool* emitted, MDefinition* obj, MDefinition* index, TypedObjectPrediction objTypeReprs, MDefinition* value, TypedObjectPrediction elemTypeReprs, uint32_t elemSize); - MOZ_MUST_USE bool initializeArrayElement(MDefinition* obj, size_t index, MDefinition* value, + [[nodiscard]] bool initializeArrayElement(MDefinition* obj, size_t index, MDefinition* value, JSValueType unboxedType, bool addResumePointAndIncrementInitializedLength); // jsop_getelem() helpers. - MOZ_MUST_USE bool getElemTryDense(bool* emitted, MDefinition* obj, MDefinition* index); - MOZ_MUST_USE bool getElemTryGetProp(bool* emitted, MDefinition* obj, MDefinition* index); - MOZ_MUST_USE bool getElemTryTypedStatic(bool* emitted, MDefinition* obj, MDefinition* index); - MOZ_MUST_USE bool getElemTryTypedArray(bool* emitted, MDefinition* obj, MDefinition* index); - MOZ_MUST_USE bool getElemTryTypedObject(bool* emitted, MDefinition* obj, MDefinition* index); - MOZ_MUST_USE bool getElemTryString(bool* emitted, MDefinition* obj, MDefinition* index); - MOZ_MUST_USE bool getElemTryArguments(bool* emitted, MDefinition* obj, MDefinition* index); - MOZ_MUST_USE bool getElemTryArgumentsInlined(bool* emitted, MDefinition* obj, + [[nodiscard]] bool getElemTryDense(bool* emitted, MDefinition* obj, MDefinition* index); + [[nodiscard]] bool getElemTryGetProp(bool* emitted, MDefinition* obj, MDefinition* index); + [[nodiscard]] bool getElemTryTypedStatic(bool* emitted, MDefinition* obj, MDefinition* index); + [[nodiscard]] bool getElemTryTypedArray(bool* emitted, MDefinition* obj, MDefinition* index); + [[nodiscard]] bool getElemTryTypedObject(bool* emitted, MDefinition* obj, MDefinition* index); + [[nodiscard]] bool getElemTryString(bool* emitted, MDefinition* obj, MDefinition* index); + [[nodiscard]] bool getElemTryArguments(bool* emitted, MDefinition* obj, MDefinition* index); + [[nodiscard]] bool getElemTryArgumentsInlined(bool* emitted, MDefinition* obj, MDefinition* index); - MOZ_MUST_USE bool getElemTryCache(bool* emitted, MDefinition* obj, MDefinition* index); - MOZ_MUST_USE bool getElemTryScalarElemOfTypedObject(bool* emitted, + [[nodiscard]] bool getElemTryCache(bool* emitted, MDefinition* obj, MDefinition* index); + [[nodiscard]] bool getElemTryScalarElemOfTypedObject(bool* emitted, MDefinition* obj, MDefinition* index, TypedObjectPrediction objTypeReprs, TypedObjectPrediction elemTypeReprs, uint32_t elemSize); - MOZ_MUST_USE bool getElemTryReferenceElemOfTypedObject(bool* emitted, + [[nodiscard]] bool getElemTryReferenceElemOfTypedObject(bool* emitted, MDefinition* obj, MDefinition* index, TypedObjectPrediction objPrediction, TypedObjectPrediction elemPrediction); - MOZ_MUST_USE bool getElemTryComplexElemOfTypedObject(bool* emitted, + [[nodiscard]] bool getElemTryComplexElemOfTypedObject(bool* emitted, MDefinition* obj, MDefinition* index, TypedObjectPrediction objTypeReprs, @@ -683,7 +683,7 @@ class IonBuilder return length; } - MOZ_MUST_USE bool improveThisTypesForCall(); + [[nodiscard]] bool improveThisTypesForCall(); MDefinition* getCallee(); MDefinition* getAliasedVar(EnvironmentCoordinate ec); @@ -691,118 +691,118 @@ class IonBuilder MDefinition* convertToBoolean(MDefinition* input); - MOZ_MUST_USE bool tryFoldInstanceOf(MDefinition* lhs, JSObject* protoObject); - MOZ_MUST_USE bool hasOnProtoChain(TypeSet::ObjectKey* key, JSObject* protoObject, + [[nodiscard]] bool tryFoldInstanceOf(MDefinition* lhs, JSObject* protoObject); + [[nodiscard]] bool hasOnProtoChain(TypeSet::ObjectKey* key, JSObject* protoObject, bool* hasOnProto); - MOZ_MUST_USE bool jsop_add(MDefinition* left, MDefinition* right); - MOZ_MUST_USE bool jsop_bitnot(); - MOZ_MUST_USE bool jsop_bitop(JSOp op); - MOZ_MUST_USE bool jsop_binary_arith(JSOp op); - MOZ_MUST_USE bool jsop_binary_arith(JSOp op, MDefinition* left, MDefinition* right); - MOZ_MUST_USE bool jsop_pow(); - MOZ_MUST_USE bool jsop_pos(); - MOZ_MUST_USE bool jsop_neg(); - MOZ_MUST_USE bool jsop_tonumeric(); - MOZ_MUST_USE bool jsop_inc_or_dec(JSOp op); - MOZ_MUST_USE bool jsop_tostring(); - MOZ_MUST_USE bool jsop_setarg(uint32_t arg); - MOZ_MUST_USE bool jsop_defvar(uint32_t index); - MOZ_MUST_USE bool jsop_deflexical(uint32_t index); - MOZ_MUST_USE bool jsop_deffun(uint32_t index); - MOZ_MUST_USE bool jsop_notearg(); - MOZ_MUST_USE bool jsop_throwsetconst(); - MOZ_MUST_USE bool jsop_checklexical(); - MOZ_MUST_USE bool jsop_checkaliasedlexical(EnvironmentCoordinate ec); - MOZ_MUST_USE bool jsop_funcall(uint32_t argc); - MOZ_MUST_USE bool jsop_funapply(uint32_t argc); - MOZ_MUST_USE bool jsop_funapplyarguments(uint32_t argc); - MOZ_MUST_USE bool jsop_funapplyarray(uint32_t argc); - MOZ_MUST_USE bool jsop_call(uint32_t argc, bool constructing); - MOZ_MUST_USE bool jsop_call(uint32_t argc, bool constructing, bool ignoresReturnValue); - MOZ_MUST_USE bool jsop_eval(uint32_t argc); - MOZ_MUST_USE bool jsop_ifeq(JSOp op); - MOZ_MUST_USE bool jsop_try(); - MOZ_MUST_USE bool jsop_label(); - MOZ_MUST_USE bool jsop_condswitch(); - MOZ_MUST_USE bool jsop_logical(JSOp op); - MOZ_MUST_USE bool jsop_dup2(); - MOZ_MUST_USE bool jsop_loophead(jsbytecode* pc); - MOZ_MUST_USE bool jsop_compare(JSOp op); - MOZ_MUST_USE bool jsop_compare(JSOp op, MDefinition* left, MDefinition* right); - MOZ_MUST_USE bool getStaticName(JSObject* staticObject, PropertyName* name, bool* psucceeded, + [[nodiscard]] bool jsop_add(MDefinition* left, MDefinition* right); + [[nodiscard]] bool jsop_bitnot(); + [[nodiscard]] bool jsop_bitop(JSOp op); + [[nodiscard]] bool jsop_binary_arith(JSOp op); + [[nodiscard]] bool jsop_binary_arith(JSOp op, MDefinition* left, MDefinition* right); + [[nodiscard]] bool jsop_pow(); + [[nodiscard]] bool jsop_pos(); + [[nodiscard]] bool jsop_neg(); + [[nodiscard]] bool jsop_tonumeric(); + [[nodiscard]] bool jsop_inc_or_dec(JSOp op); + [[nodiscard]] bool jsop_tostring(); + [[nodiscard]] bool jsop_setarg(uint32_t arg); + [[nodiscard]] bool jsop_defvar(uint32_t index); + [[nodiscard]] bool jsop_deflexical(uint32_t index); + [[nodiscard]] bool jsop_deffun(uint32_t index); + [[nodiscard]] bool jsop_notearg(); + [[nodiscard]] bool jsop_throwsetconst(); + [[nodiscard]] bool jsop_checklexical(); + [[nodiscard]] bool jsop_checkaliasedlexical(EnvironmentCoordinate ec); + [[nodiscard]] bool jsop_funcall(uint32_t argc); + [[nodiscard]] bool jsop_funapply(uint32_t argc); + [[nodiscard]] bool jsop_funapplyarguments(uint32_t argc); + [[nodiscard]] bool jsop_funapplyarray(uint32_t argc); + [[nodiscard]] bool jsop_call(uint32_t argc, bool constructing); + [[nodiscard]] bool jsop_call(uint32_t argc, bool constructing, bool ignoresReturnValue); + [[nodiscard]] bool jsop_eval(uint32_t argc); + [[nodiscard]] bool jsop_ifeq(JSOp op); + [[nodiscard]] bool jsop_try(); + [[nodiscard]] bool jsop_label(); + [[nodiscard]] bool jsop_condswitch(); + [[nodiscard]] bool jsop_logical(JSOp op); + [[nodiscard]] bool jsop_dup2(); + [[nodiscard]] bool jsop_loophead(jsbytecode* pc); + [[nodiscard]] bool jsop_compare(JSOp op); + [[nodiscard]] bool jsop_compare(JSOp op, MDefinition* left, MDefinition* right); + [[nodiscard]] bool getStaticName(JSObject* staticObject, PropertyName* name, bool* psucceeded, MDefinition* lexicalCheck = nullptr); - MOZ_MUST_USE bool loadStaticSlot(JSObject* staticObject, BarrierKind barrier, + [[nodiscard]] bool loadStaticSlot(JSObject* staticObject, BarrierKind barrier, TemporaryTypeSet* types, uint32_t slot); - MOZ_MUST_USE bool setStaticName(JSObject* staticObject, PropertyName* name); - MOZ_MUST_USE bool jsop_getgname(PropertyName* name); - MOZ_MUST_USE bool jsop_getname(PropertyName* name); - MOZ_MUST_USE bool jsop_intrinsic(PropertyName* name); - MOZ_MUST_USE bool jsop_getimport(PropertyName* name); - MOZ_MUST_USE bool jsop_bindname(PropertyName* name); - MOZ_MUST_USE bool jsop_bindvar(); - MOZ_MUST_USE bool jsop_getelem(); - MOZ_MUST_USE bool jsop_getelem_dense(MDefinition* obj, MDefinition* index, + [[nodiscard]] bool setStaticName(JSObject* staticObject, PropertyName* name); + [[nodiscard]] bool jsop_getgname(PropertyName* name); + [[nodiscard]] bool jsop_getname(PropertyName* name); + [[nodiscard]] bool jsop_intrinsic(PropertyName* name); + [[nodiscard]] bool jsop_getimport(PropertyName* name); + [[nodiscard]] bool jsop_bindname(PropertyName* name); + [[nodiscard]] bool jsop_bindvar(); + [[nodiscard]] bool jsop_getelem(); + [[nodiscard]] bool jsop_getelem_dense(MDefinition* obj, MDefinition* index, JSValueType unboxedType); - MOZ_MUST_USE bool jsop_getelem_typed(MDefinition* obj, MDefinition* index, + [[nodiscard]] bool jsop_getelem_typed(MDefinition* obj, MDefinition* index, ScalarTypeDescr::Type arrayType); - MOZ_MUST_USE bool jsop_setelem(); - MOZ_MUST_USE bool jsop_setelem_dense(TemporaryTypeSet::DoubleConversion conversion, + [[nodiscard]] bool jsop_setelem(); + [[nodiscard]] bool jsop_setelem_dense(TemporaryTypeSet::DoubleConversion conversion, MDefinition* object, MDefinition* index, MDefinition* value, JSValueType unboxedType, bool writeHole, bool* emitted); - MOZ_MUST_USE bool jsop_setelem_typed(ScalarTypeDescr::Type arrayType, + [[nodiscard]] bool jsop_setelem_typed(ScalarTypeDescr::Type arrayType, MDefinition* object, MDefinition* index, MDefinition* value); - MOZ_MUST_USE bool jsop_length(); - MOZ_MUST_USE bool jsop_length_fastPath(); - MOZ_MUST_USE bool jsop_arguments(); - MOZ_MUST_USE bool jsop_arguments_getelem(); - MOZ_MUST_USE bool jsop_runonce(); - MOZ_MUST_USE bool jsop_rest(); - MOZ_MUST_USE bool jsop_not(); - MOZ_MUST_USE bool jsop_getprop(PropertyName* name); - MOZ_MUST_USE bool jsop_setprop(PropertyName* name); - MOZ_MUST_USE bool jsop_delprop(PropertyName* name); - MOZ_MUST_USE bool jsop_delelem(); - MOZ_MUST_USE bool jsop_newarray(uint32_t length); - MOZ_MUST_USE bool jsop_newarray(JSObject* templateObject, uint32_t length); - MOZ_MUST_USE bool jsop_newarray_copyonwrite(); - MOZ_MUST_USE bool jsop_newobject(); - MOZ_MUST_USE bool jsop_initelem(); - MOZ_MUST_USE bool jsop_initelem_array(); - MOZ_MUST_USE bool jsop_initelem_getter_setter(); - MOZ_MUST_USE bool jsop_mutateproto(); - MOZ_MUST_USE bool jsop_initprop(PropertyName* name); - MOZ_MUST_USE bool jsop_initprop_getter_setter(PropertyName* name); - MOZ_MUST_USE bool jsop_regexp(RegExpObject* reobj); - MOZ_MUST_USE bool jsop_object(JSObject* obj); - MOZ_MUST_USE bool jsop_lambda(JSFunction* fun); - MOZ_MUST_USE bool jsop_lambda_arrow(JSFunction* fun); - MOZ_MUST_USE bool jsop_setfunname(uint8_t prefixKind); - MOZ_MUST_USE bool jsop_functionthis(); - MOZ_MUST_USE bool jsop_globalthis(); - MOZ_MUST_USE bool jsop_typeof(); - MOZ_MUST_USE bool jsop_toasync(); - MOZ_MUST_USE bool jsop_toasyncgen(); - MOZ_MUST_USE bool jsop_toasynciter(); - MOZ_MUST_USE bool jsop_toid(); - MOZ_MUST_USE bool jsop_iter(uint8_t flags); - MOZ_MUST_USE bool jsop_itermore(); - MOZ_MUST_USE bool jsop_isnoiter(); - MOZ_MUST_USE bool jsop_iterend(); - MOZ_MUST_USE bool jsop_in(); - MOZ_MUST_USE bool jsop_instanceof(); - MOZ_MUST_USE bool jsop_getaliasedvar(EnvironmentCoordinate ec); - MOZ_MUST_USE bool jsop_setaliasedvar(EnvironmentCoordinate ec); - MOZ_MUST_USE bool jsop_debugger(); - MOZ_MUST_USE bool jsop_newtarget(); - MOZ_MUST_USE bool jsop_checkisobj(uint8_t kind); - MOZ_MUST_USE bool jsop_checkiscallable(uint8_t kind); - MOZ_MUST_USE bool jsop_checkobjcoercible(); - MOZ_MUST_USE bool jsop_pushcallobj(); - MOZ_MUST_USE bool jsop_importmeta(); - MOZ_MUST_USE bool jsop_dynamic_import(); + [[nodiscard]] bool jsop_length(); + [[nodiscard]] bool jsop_length_fastPath(); + [[nodiscard]] bool jsop_arguments(); + [[nodiscard]] bool jsop_arguments_getelem(); + [[nodiscard]] bool jsop_runonce(); + [[nodiscard]] bool jsop_rest(); + [[nodiscard]] bool jsop_not(); + [[nodiscard]] bool jsop_getprop(PropertyName* name); + [[nodiscard]] bool jsop_setprop(PropertyName* name); + [[nodiscard]] bool jsop_delprop(PropertyName* name); + [[nodiscard]] bool jsop_delelem(); + [[nodiscard]] bool jsop_newarray(uint32_t length); + [[nodiscard]] bool jsop_newarray(JSObject* templateObject, uint32_t length); + [[nodiscard]] bool jsop_newarray_copyonwrite(); + [[nodiscard]] bool jsop_newobject(); + [[nodiscard]] bool jsop_initelem(); + [[nodiscard]] bool jsop_initelem_array(); + [[nodiscard]] bool jsop_initelem_getter_setter(); + [[nodiscard]] bool jsop_mutateproto(); + [[nodiscard]] bool jsop_initprop(PropertyName* name); + [[nodiscard]] bool jsop_initprop_getter_setter(PropertyName* name); + [[nodiscard]] bool jsop_regexp(RegExpObject* reobj); + [[nodiscard]] bool jsop_object(JSObject* obj); + [[nodiscard]] bool jsop_lambda(JSFunction* fun); + [[nodiscard]] bool jsop_lambda_arrow(JSFunction* fun); + [[nodiscard]] bool jsop_setfunname(uint8_t prefixKind); + [[nodiscard]] bool jsop_functionthis(); + [[nodiscard]] bool jsop_globalthis(); + [[nodiscard]] bool jsop_typeof(); + [[nodiscard]] bool jsop_toasync(); + [[nodiscard]] bool jsop_toasyncgen(); + [[nodiscard]] bool jsop_toasynciter(); + [[nodiscard]] bool jsop_toid(); + [[nodiscard]] bool jsop_iter(uint8_t flags); + [[nodiscard]] bool jsop_itermore(); + [[nodiscard]] bool jsop_isnoiter(); + [[nodiscard]] bool jsop_iterend(); + [[nodiscard]] bool jsop_in(); + [[nodiscard]] bool jsop_instanceof(); + [[nodiscard]] bool jsop_getaliasedvar(EnvironmentCoordinate ec); + [[nodiscard]] bool jsop_setaliasedvar(EnvironmentCoordinate ec); + [[nodiscard]] bool jsop_debugger(); + [[nodiscard]] bool jsop_newtarget(); + [[nodiscard]] bool jsop_checkisobj(uint8_t kind); + [[nodiscard]] bool jsop_checkiscallable(uint8_t kind); + [[nodiscard]] bool jsop_checkobjcoercible(); + [[nodiscard]] bool jsop_pushcallobj(); + [[nodiscard]] bool jsop_importmeta(); + [[nodiscard]] bool jsop_dynamic_import(); /* Inlining. */ @@ -830,7 +830,7 @@ class IonBuilder // Oracles. InliningDecision canInlineTarget(JSFunction* target, CallInfo& callInfo); InliningDecision makeInliningDecision(JSObject* target, CallInfo& callInfo); - MOZ_MUST_USE bool selectInliningTargets(const ObjectVector& targets, CallInfo& callInfo, + [[nodiscard]] bool selectInliningTargets(const ObjectVector& targets, CallInfo& callInfo, BoolVector& choiceSet, uint32_t* numInlineable); // Native inlining helpers. @@ -962,13 +962,13 @@ class IonBuilder // Call functions InliningStatus inlineCallsite(const ObjectVector& targets, CallInfo& callInfo); - MOZ_MUST_USE bool inlineCalls(CallInfo& callInfo, const ObjectVector& targets, + [[nodiscard]] bool inlineCalls(CallInfo& callInfo, const ObjectVector& targets, BoolVector& choiceSet, MGetPropertyCache* maybeCache); // Inlining helpers. - MOZ_MUST_USE bool inlineGenericFallback(JSFunction* target, CallInfo& callInfo, + [[nodiscard]] bool inlineGenericFallback(JSFunction* target, CallInfo& callInfo, MBasicBlock* dispatchBlock); - MOZ_MUST_USE bool inlineObjectGroupFallback(CallInfo& callInfo, MBasicBlock* dispatchBlock, + [[nodiscard]] bool inlineObjectGroupFallback(CallInfo& callInfo, MBasicBlock* dispatchBlock, MObjectGroupDispatch* dispatch, MGetPropertyCache* cache, MBasicBlock** fallbackTarget); @@ -978,22 +978,22 @@ class IonBuilder DoCheckAtomicResult }; - MOZ_MUST_USE bool atomicsMeetsPreconditions(CallInfo& callInfo, Scalar::Type* arrayElementType, + [[nodiscard]] bool atomicsMeetsPreconditions(CallInfo& callInfo, Scalar::Type* arrayElementType, bool* requiresDynamicCheck, AtomicCheckResult checkResult=DoCheckAtomicResult); void atomicsCheckBounds(CallInfo& callInfo, MInstruction** elements, MDefinition** index); - MOZ_MUST_USE bool testNeedsArgumentCheck(JSFunction* target, CallInfo& callInfo); + [[nodiscard]] bool testNeedsArgumentCheck(JSFunction* target, CallInfo& callInfo); MCall* makeCallHelper(JSFunction* target, CallInfo& callInfo); - MOZ_MUST_USE bool makeCall(JSFunction* target, CallInfo& callInfo); + [[nodiscard]] bool makeCall(JSFunction* target, CallInfo& callInfo); MDefinition* patchInlinedReturn(CallInfo& callInfo, MBasicBlock* exit, MBasicBlock* bottom); MDefinition* patchInlinedReturns(CallInfo& callInfo, MIRGraphReturns& returns, MBasicBlock* bottom); MDefinition* specializeInlinedReturn(MDefinition* rdef, MBasicBlock* exit); - MOZ_MUST_USE bool objectsHaveCommonPrototype(TemporaryTypeSet* types, PropertyName* name, + [[nodiscard]] bool objectsHaveCommonPrototype(TemporaryTypeSet* types, PropertyName* name, bool isGetter, JSObject* foundProto, bool* guardGlobal); void freezePropertiesForCommonPrototype(TemporaryTypeSet* types, PropertyName* name, @@ -1001,12 +1001,12 @@ class IonBuilder /* * Callers must pass a non-null globalGuard if they pass a non-null globalShape. */ - MOZ_MUST_USE bool testCommonGetterSetter(TemporaryTypeSet* types, PropertyName* name, + [[nodiscard]] bool testCommonGetterSetter(TemporaryTypeSet* types, PropertyName* name, bool isGetter, JSObject* foundProto, Shape* lastProperty, JSFunction* getterOrSetter, MDefinition** guard, Shape* globalShape = nullptr, MDefinition** globalGuard = nullptr); - MOZ_MUST_USE bool testShouldDOMCall(TypeSet* inTypes, + [[nodiscard]] bool testShouldDOMCall(TypeSet* inTypes, JSFunction* func, JSJitInfo::OpType opType); MDefinition* @@ -1015,7 +1015,7 @@ class IonBuilder const BaselineInspector::ObjectGroupVector& convertUnboxedGroups, bool isOwnProperty); - MOZ_MUST_USE bool annotateGetPropertyCache(MDefinition* obj, PropertyName* name, + [[nodiscard]] bool annotateGetPropertyCache(MDefinition* obj, PropertyName* name, MGetPropertyCache* getPropCache, TemporaryTypeSet* objTypes, TemporaryTypeSet* pushedTypes); @@ -1046,8 +1046,8 @@ class IonBuilder MDefinition* elements, int32_t elementsOffset, MDefinition* scaledOffset, JSValueType unboxedType, MDefinition* value, bool preBarrier = true); - MOZ_MUST_USE bool checkPreliminaryGroups(MDefinition *obj); - MOZ_MUST_USE bool freezePropTypeSets(TemporaryTypeSet* types, + [[nodiscard]] bool checkPreliminaryGroups(MDefinition *obj); + [[nodiscard]] bool freezePropTypeSets(TemporaryTypeSet* types, JSObject* foundProto, PropertyName* name); bool canInlinePropertyOpShapes(const BaselineInspector::ReceiverVector& receivers); @@ -1057,7 +1057,7 @@ class IonBuilder // updating |current| directly. setCurrent() should only be used in cases // where the block cannot have phis whose type needs to be computed. - MOZ_MUST_USE bool setCurrentAndSpecializePhis(MBasicBlock* block) { + [[nodiscard]] bool setCurrentAndSpecializePhis(MBasicBlock* block) { if (block) { if (!block->specializePhis(alloc())) return false; @@ -1140,7 +1140,7 @@ class IonBuilder void trace(JSTracer* trc); private: - MOZ_MUST_USE bool init(); + [[nodiscard]] bool init(); JSContext* analysisContext; BaselineFrameInspector* baselineFrame_; @@ -1368,7 +1368,7 @@ class CallInfo setter_(false) { } - MOZ_MUST_USE bool init(CallInfo& callInfo) { + [[nodiscard]] bool init(CallInfo& callInfo) { MOZ_ASSERT(constructing_ == callInfo.constructing()); fun_ = callInfo.fun(); @@ -1384,7 +1384,7 @@ class CallInfo return true; } - MOZ_MUST_USE bool init(MBasicBlock* current, uint32_t argc) { + [[nodiscard]] bool init(MBasicBlock* current, uint32_t argc) { MOZ_ASSERT(args_.empty()); // Get the arguments in the right order @@ -1427,7 +1427,7 @@ class CallInfo return argc() + 2 + constructing(); } - MOZ_MUST_USE bool setArgs(const MDefinitionVector& args) { + [[nodiscard]] bool setArgs(const MDefinitionVector& args) { MOZ_ASSERT(args_.empty()); return args_.appendAll(args); } diff --git a/js/src/jit/IonCaches.h b/js/src/jit/IonCaches.h index 914965055b..13b0600e1c 100644 --- a/js/src/jit/IonCaches.h +++ b/js/src/jit/IonCaches.h @@ -302,7 +302,7 @@ class IonCache // Combine both linkStub and attachStub into one function. In addition, it // produces a spew augmented with the attachKind string. - MOZ_MUST_USE bool linkAndAttachStub(JSContext* cx, MacroAssembler& masm, StubAttacher& attacher, + [[nodiscard]] bool linkAndAttachStub(JSContext* cx, MacroAssembler& masm, StubAttacher& attacher, IonScript* ion, const char* attachKind, JS::TrackedOutcome = JS::TrackedOutcome::ICOptStub_GenericSuccess); @@ -504,76 +504,76 @@ class GetPropertyIC : public IonCache void maybeDisable(bool emitted); // Attach the proper stub, if possible - MOZ_MUST_USE bool tryAttachStub(JSContext* cx, HandleScript outerScript, IonScript* ion, - HandleObject obj, HandleValue idval, bool* emitted); + [[nodiscard]] bool tryAttachStub(JSContext* cx, HandleScript outerScript, IonScript* ion, + HandleObject obj, HandleValue idval, bool* emitted); - MOZ_MUST_USE bool tryAttachProxy(JSContext* cx, HandleScript outerScript, IonScript* ion, - HandleObject obj, HandleId id, void* returnAddr, - bool* emitted); + [[nodiscard]] bool tryAttachProxy(JSContext* cx, HandleScript outerScript, IonScript* ion, + HandleObject obj, HandleId id, void* returnAddr, + bool* emitted); - MOZ_MUST_USE bool tryAttachGenericProxy(JSContext* cx, HandleScript outerScript, IonScript* ion, - HandleObject obj, HandleId id, void* returnAddr, - bool* emitted); + [[nodiscard]] bool tryAttachGenericProxy(JSContext* cx, HandleScript outerScript, IonScript* ion, + HandleObject obj, HandleId id, void* returnAddr, + bool* emitted); - MOZ_MUST_USE bool tryAttachDOMProxyShadowed(JSContext* cx, HandleScript outerScript, - IonScript* ion, HandleObject obj, HandleId id, - void* returnAddr, bool* emitted); + [[nodiscard]] bool tryAttachDOMProxyShadowed(JSContext* cx, HandleScript outerScript, + IonScript* ion, HandleObject obj, HandleId id, + void* returnAddr, bool* emitted); - MOZ_MUST_USE bool tryAttachDOMProxyUnshadowed(JSContext* cx, HandleScript outerScript, - IonScript* ion, HandleObject obj, HandleId id, - bool resetNeeded, void* returnAddr, - bool* emitted); - - MOZ_MUST_USE bool tryAttachNative(JSContext* cx, HandleScript outerScript, IonScript* ion, - HandleObject obj, HandleId id, void* returnAddr, - bool* emitted); + [[nodiscard]] bool tryAttachDOMProxyUnshadowed(JSContext* cx, HandleScript outerScript, + IonScript* ion, HandleObject obj, HandleId id, + bool resetNeeded, void* returnAddr, + bool* emitted); - MOZ_MUST_USE bool tryAttachUnboxed(JSContext* cx, HandleScript outerScript, IonScript* ion, + [[nodiscard]] bool tryAttachNative(JSContext* cx, HandleScript outerScript, IonScript* ion, HandleObject obj, HandleId id, void* returnAddr, bool* emitted); - MOZ_MUST_USE bool tryAttachUnboxedExpando(JSContext* cx, HandleScript outerScript, - IonScript* ion, HandleObject obj, HandleId id, - void* returnAddr, bool* emitted); + [[nodiscard]] bool tryAttachUnboxed(JSContext* cx, HandleScript outerScript, IonScript* ion, + HandleObject obj, HandleId id, void* returnAddr, + bool* emitted); - MOZ_MUST_USE bool tryAttachUnboxedArrayLength(JSContext* cx, HandleScript outerScript, - IonScript* ion, HandleObject obj, HandleId id, - void* returnAddr, bool* emitted); + [[nodiscard]] bool tryAttachUnboxedExpando(JSContext* cx, HandleScript outerScript, + IonScript* ion, HandleObject obj, HandleId id, + void* returnAddr, bool* emitted); - MOZ_MUST_USE bool tryAttachTypedArrayLength(JSContext* cx, HandleScript outerScript, - IonScript* ion, HandleObject obj, HandleId id, - bool* emitted); + [[nodiscard]] bool tryAttachUnboxedArrayLength(JSContext* cx, HandleScript outerScript, + IonScript* ion, HandleObject obj, HandleId id, + void* returnAddr, bool* emitted); - MOZ_MUST_USE bool tryAttachArgumentsLength(JSContext* cx, HandleScript outerScript, - IonScript* ion, HandleObject obj, HandleId id, - bool* emitted); + [[nodiscard]] bool tryAttachTypedArrayLength(JSContext* cx, HandleScript outerScript, + IonScript* ion, HandleObject obj, HandleId id, + bool* emitted); - MOZ_MUST_USE bool tryAttachArgumentsElement(JSContext* cx, HandleScript outerScript, - IonScript* ion, HandleObject obj, HandleValue idval, + [[nodiscard]] bool tryAttachArgumentsLength(JSContext* cx, HandleScript outerScript, + IonScript* ion, HandleObject obj, HandleId id, bool* emitted); - MOZ_MUST_USE bool tryAttachDenseElement(JSContext* cx, HandleScript outerScript, IonScript* ion, - HandleObject obj, HandleValue idval, bool* emitted); + [[nodiscard]] bool tryAttachArgumentsElement(JSContext* cx, HandleScript outerScript, + IonScript* ion, HandleObject obj, HandleValue idval, + bool* emitted); + + [[nodiscard]] bool tryAttachDenseElement(JSContext* cx, HandleScript outerScript, IonScript* ion, + HandleObject obj, HandleValue idval, bool* emitted); static bool canAttachDenseElementHole(JSObject* obj, HandleValue idval, TypedOrValueRegister output); - MOZ_MUST_USE bool tryAttachDenseElementHole(JSContext* cx, HandleScript outerScript, - IonScript* ion, HandleObject obj, - HandleValue idval, bool* emitted); + [[nodiscard]] bool tryAttachDenseElementHole(JSContext* cx, HandleScript outerScript, + IonScript* ion, HandleObject obj, + HandleValue idval, bool* emitted); static bool canAttachTypedOrUnboxedArrayElement(JSObject* obj, const Value& idval, TypedOrValueRegister output); - MOZ_MUST_USE bool tryAttachTypedOrUnboxedArrayElement(JSContext* cx, HandleScript outerScript, - IonScript* ion, HandleObject obj, - HandleValue idval, bool* emitted); + [[nodiscard]] bool tryAttachTypedOrUnboxedArrayElement(JSContext* cx, HandleScript outerScript, + IonScript* ion, HandleObject obj, + HandleValue idval, bool* emitted); - MOZ_MUST_USE bool tryAttachModuleNamespace(JSContext* cx, HandleScript outerScript, - IonScript* ion, HandleObject obj, HandleId id, - void* returnAddr, bool* emitted); + [[nodiscard]] bool tryAttachModuleNamespace(JSContext* cx, HandleScript outerScript, + IonScript* ion, HandleObject obj, HandleId id, + void* returnAddr, bool* emitted); - static MOZ_MUST_USE bool update(JSContext* cx, HandleScript outerScript, size_t cacheIndex, - HandleObject obj, HandleValue id, MutableHandleValue vp); + [[nodiscard]] static bool update(JSContext* cx, HandleScript outerScript, size_t cacheIndex, + HandleObject obj, HandleValue id, MutableHandleValue vp); }; class SetPropertyIC : public IonCache @@ -673,59 +673,59 @@ class SetPropertyIC : public IonCache CanAttachCallSetter }; - MOZ_MUST_USE bool attachSetSlot(JSContext* cx, HandleScript outerScript, IonScript* ion, - HandleObject obj, HandleShape shape, bool checkTypeset); + [[nodiscard]] bool attachSetSlot(JSContext* cx, HandleScript outerScript, IonScript* ion, + HandleObject obj, HandleShape shape, bool checkTypeset); - MOZ_MUST_USE bool attachCallSetter(JSContext* cx, HandleScript outerScript, IonScript* ion, - HandleObject obj, HandleObject holder, HandleShape shape, - void* returnAddr); + [[nodiscard]] bool attachCallSetter(JSContext* cx, HandleScript outerScript, IonScript* ion, + HandleObject obj, HandleObject holder, HandleShape shape, + void* returnAddr); - MOZ_MUST_USE bool attachAddSlot(JSContext* cx, HandleScript outerScript, IonScript* ion, - HandleObject obj, HandleId id, HandleShape oldShape, - HandleObjectGroup oldGroup, bool checkTypeset); + [[nodiscard]] bool attachAddSlot(JSContext* cx, HandleScript outerScript, IonScript* ion, + HandleObject obj, HandleId id, HandleShape oldShape, + HandleObjectGroup oldGroup, bool checkTypeset); - MOZ_MUST_USE bool attachGenericProxy(JSContext* cx, HandleScript outerScript, IonScript* ion, - HandleId id, void* returnAddr); + [[nodiscard]] bool attachGenericProxy(JSContext* cx, HandleScript outerScript, IonScript* ion, + HandleId id, void* returnAddr); - MOZ_MUST_USE bool attachDOMProxyShadowed(JSContext* cx, HandleScript outerScript, - IonScript* ion, HandleObject obj, HandleId id, - void* returnAddr); + [[nodiscard]] bool attachDOMProxyShadowed(JSContext* cx, HandleScript outerScript, + IonScript* ion, HandleObject obj, HandleId id, + void* returnAddr); - MOZ_MUST_USE bool attachDOMProxyUnshadowed(JSContext* cx, HandleScript outerScript, - IonScript* ion, HandleObject obj, HandleId id, - void* returnAddr); + [[nodiscard]] bool attachDOMProxyUnshadowed(JSContext* cx, HandleScript outerScript, + IonScript* ion, HandleObject obj, HandleId id, + void* returnAddr); - static MOZ_MUST_USE bool update(JSContext* cx, HandleScript outerScript, size_t cacheIndex, - HandleObject obj, HandleValue idval, HandleValue value); + [[nodiscard]] static bool update(JSContext* cx, HandleScript outerScript, size_t cacheIndex, + HandleObject obj, HandleValue idval, HandleValue value); - MOZ_MUST_USE bool tryAttachNative(JSContext* cx, HandleScript outerScript, IonScript* ion, - HandleObject obj, HandleId id, bool* emitted, - bool* tryNativeAddSlot); + [[nodiscard]] bool tryAttachNative(JSContext* cx, HandleScript outerScript, IonScript* ion, + HandleObject obj, HandleId id, bool* emitted, + bool* tryNativeAddSlot); - MOZ_MUST_USE bool tryAttachUnboxed(JSContext* cx, HandleScript outerScript, IonScript* ion, - HandleObject obj, HandleId id, bool* emitted); + [[nodiscard]] bool tryAttachUnboxed(JSContext* cx, HandleScript outerScript, IonScript* ion, + HandleObject obj, HandleId id, bool* emitted); - MOZ_MUST_USE bool tryAttachUnboxedExpando(JSContext* cx, HandleScript outerScript, - IonScript* ion, HandleObject obj, HandleId id, - bool* emitted); + [[nodiscard]] bool tryAttachUnboxedExpando(JSContext* cx, HandleScript outerScript, + IonScript* ion, HandleObject obj, HandleId id, + bool* emitted); - MOZ_MUST_USE bool tryAttachProxy(JSContext* cx, HandleScript outerScript, IonScript* ion, - HandleObject obj, HandleId id, bool* emitted); + [[nodiscard]] bool tryAttachProxy(JSContext* cx, HandleScript outerScript, IonScript* ion, + HandleObject obj, HandleId id, bool* emitted); - MOZ_MUST_USE bool tryAttachStub(JSContext* cx, HandleScript outerScript, IonScript* ion, - HandleObject obj, HandleValue idval, HandleValue value, - MutableHandleId id, bool* emitted, bool* tryNativeAddSlot); + [[nodiscard]] bool tryAttachStub(JSContext* cx, HandleScript outerScript, IonScript* ion, + HandleObject obj, HandleValue idval, HandleValue value, + MutableHandleId id, bool* emitted, bool* tryNativeAddSlot); - MOZ_MUST_USE bool tryAttachAddSlot(JSContext* cx, HandleScript outerScript, IonScript* ion, - HandleObject obj, HandleId id, HandleObjectGroup oldGroup, - HandleShape oldShape, bool tryNativeAddSlot, bool* emitted); + [[nodiscard]] bool tryAttachAddSlot(JSContext* cx, HandleScript outerScript, IonScript* ion, + HandleObject obj, HandleId id, HandleObjectGroup oldGroup, + HandleShape oldShape, bool tryNativeAddSlot, bool* emitted); - MOZ_MUST_USE bool tryAttachDenseElement(JSContext* cx, HandleScript outerScript, IonScript* ion, - HandleObject obj, const Value& idval, bool* emitted); + [[nodiscard]] bool tryAttachDenseElement(JSContext* cx, HandleScript outerScript, IonScript* ion, + HandleObject obj, const Value& idval, bool* emitted); - MOZ_MUST_USE bool tryAttachTypedArrayElement(JSContext* cx, HandleScript outerScript, - IonScript* ion, HandleObject obj, - HandleValue idval, HandleValue val, bool* emitted); + [[nodiscard]] bool tryAttachTypedArrayElement(JSContext* cx, HandleScript outerScript, + IonScript* ion, HandleObject obj, + HandleValue idval, HandleValue val, bool* emitted); }; class BindNameIC : public IonCache @@ -755,11 +755,11 @@ class BindNameIC : public IonCache return output_; } - MOZ_MUST_USE bool attachGlobal(JSContext* cx, HandleScript outerScript, IonScript* ion, - HandleObject envChain); + [[nodiscard]] bool attachGlobal(JSContext* cx, HandleScript outerScript, IonScript* ion, + HandleObject envChain); - MOZ_MUST_USE bool attachNonGlobal(JSContext* cx, HandleScript outerScript, IonScript* ion, - HandleObject envChain, HandleObject holder); + [[nodiscard]] bool attachNonGlobal(JSContext* cx, HandleScript outerScript, IonScript* ion, + HandleObject envChain, HandleObject holder); static JSObject* update(JSContext* cx, HandleScript outerScript, size_t cacheIndex, HandleObject envChain); @@ -804,19 +804,19 @@ class NameIC : public IonCache return typeOf_; } - MOZ_MUST_USE bool attachReadSlot(JSContext* cx, HandleScript outerScript, IonScript* ion, - HandleObject envChain, HandleObject holderBase, - HandleNativeObject holder, Handle<PropertyResult> prop); + [[nodiscard]] bool attachReadSlot(JSContext* cx, HandleScript outerScript, IonScript* ion, + HandleObject envChain, HandleObject holderBase, + HandleNativeObject holder, Handle<PropertyResult> prop); - MOZ_MUST_USE bool attachCallGetter(JSContext* cx, HandleScript outerScript, IonScript* ion, - HandleObject envChain, HandleObject obj, - HandleObject holder, HandleShape shape, - void* returnAddr); + [[nodiscard]] bool attachCallGetter(JSContext* cx, HandleScript outerScript, IonScript* ion, + HandleObject envChain, HandleObject obj, + HandleObject holder, HandleShape shape, + void* returnAddr); - MOZ_MUST_USE bool attachTypeOfNoProperty(JSContext* cx, HandleScript outerScript, - IonScript* ion, HandleObject envChain); + [[nodiscard]] bool attachTypeOfNoProperty(JSContext* cx, HandleScript outerScript, + IonScript* ion, HandleObject envChain); - static MOZ_MUST_USE bool + [[nodiscard]] static bool update(JSContext* cx, HandleScript outerScript, size_t cacheIndex, HandleObject envChain, MutableHandleValue vp); }; diff --git a/js/src/jit/IonCode.h b/js/src/jit/IonCode.h index 2d9469dead..ddc0af4bb7 100644 --- a/js/src/jit/IonCode.h +++ b/js/src/jit/IonCode.h @@ -434,7 +434,7 @@ struct IonScript bool hasProfilingInstrumentation() const { return hasProfilingInstrumentation_; } - MOZ_MUST_USE bool addTraceLoggerEvent(TraceLoggerEvent& event) { + [[nodiscard]] bool addTraceLoggerEvent(TraceLoggerEvent& event) { MOZ_ASSERT(event.hasPayload()); return traceLoggerEvents_.append(Move(event)); } @@ -617,7 +617,7 @@ struct IonBlockCounts public: - MOZ_MUST_USE bool init(uint32_t id, uint32_t offset, char* description, + [[nodiscard]] bool init(uint32_t id, uint32_t offset, char* description, uint32_t numSuccessors) { id_ = id; offset_ = offset; @@ -715,7 +715,7 @@ struct IonScriptCounts } } - MOZ_MUST_USE bool init(size_t numBlocks) { + [[nodiscard]] bool init(size_t numBlocks) { blocks_ = js_pod_calloc<IonBlockCounts>(numBlocks); if (!blocks_) return false; diff --git a/js/src/jit/JitAllocPolicy.h b/js/src/jit/JitAllocPolicy.h index 2befa593f5..195a81b1ec 100644 --- a/js/src/jit/JitAllocPolicy.h +++ b/js/src/jit/JitAllocPolicy.h @@ -43,7 +43,7 @@ class TempAllocator return lifoScope_.alloc().allocInfallible(bytes); } - MOZ_MUST_USE void* allocate(size_t bytes) + [[nodiscard]] void* allocate(size_t bytes) { LifoAlloc::AutoFallibleScope fallibleAllocator(lifoAlloc()); void* p = lifoScope_.alloc().alloc(bytes); @@ -53,7 +53,7 @@ class TempAllocator } template <typename T> - MOZ_MUST_USE T* allocateArray(size_t n) + [[nodiscard]] T* allocateArray(size_t n) { LifoAlloc::AutoFallibleScope fallibleAllocator(lifoAlloc()); size_t bytes; @@ -73,7 +73,7 @@ class TempAllocator return &lifoScope_.alloc(); } - MOZ_MUST_USE bool ensureBallast() { + [[nodiscard]] bool ensureBallast() { JS_OOM_POSSIBLY_FAIL_BOOL(); return lifoScope_.alloc().ensureUnusedApproximate(BallastSize); } @@ -126,7 +126,7 @@ class JitAllocPolicy } void reportAllocOverflow() const { } - MOZ_MUST_USE bool checkSimulatedOOM() const { + [[nodiscard]] bool checkSimulatedOOM() const { return !js::oom::ShouldFailWithOOM(); } }; diff --git a/js/src/jit/JitCompartment.h b/js/src/jit/JitCompartment.h index a6cbd86719..4ef5cb4e4a 100644 --- a/js/src/jit/JitCompartment.h +++ b/js/src/jit/JitCompartment.h @@ -215,14 +215,14 @@ class JitRuntime public: explicit JitRuntime(JSRuntime* rt); ~JitRuntime(); - MOZ_MUST_USE bool initialize(JSContext* cx, js::AutoLockForExclusiveAccess& lock); + [[nodiscard]] bool initialize(JSContext* cx, js::AutoLockForExclusiveAccess& lock); uint8_t* allocateOsrTempData(size_t size); void freeOsrTempData(); static void Mark(JSTracer* trc, js::AutoLockForExclusiveAccess& lock); static void MarkJitcodeGlobalTableUnconditionally(JSTracer* trc); - static MOZ_MUST_USE bool MarkJitcodeGlobalTableIteratively(JSTracer* trc); + [[nodiscard]] static bool MarkJitcodeGlobalTableIteratively(JSTracer* trc); static void SweepJitcodeGlobalTable(JSRuntime* rt); ExecutableAllocator& execAlloc() { @@ -473,7 +473,7 @@ class JitCompartment return p->value(); return nullptr; } - MOZ_MUST_USE bool putStubCode(JSContext* cx, uint32_t key, Handle<JitCode*> stubCode) { + [[nodiscard]] bool putStubCode(JSContext* cx, uint32_t key, Handle<JitCode*> stubCode) { MOZ_ASSERT(stubCode); if (!stubCodes_->putNew(key, stubCode.get())) { ReportOutOfMemory(cx); @@ -490,7 +490,7 @@ class JitCompartment *stubInfo = nullptr; return nullptr; } - MOZ_MUST_USE bool putCacheIRStubCode(const CacheIRStubKey::Lookup& lookup, CacheIRStubKey& key, + [[nodiscard]] bool putCacheIRStubCode(const CacheIRStubKey::Lookup& lookup, CacheIRStubKey& key, JitCode* stubCode) { CacheIRStubCodeMap::AddPtr p = cacheIRStubCodes_->lookupForAdd(lookup); @@ -528,10 +528,10 @@ class JitCompartment JitCompartment(); ~JitCompartment(); - MOZ_MUST_USE bool initialize(JSContext* cx); + [[nodiscard]] bool initialize(JSContext* cx); // Initialize code stubs only used by Ion, not Baseline. - MOZ_MUST_USE bool ensureIonStubsExist(JSContext* cx); + [[nodiscard]] bool ensureIonStubsExist(JSContext* cx); void mark(JSTracer* trc, JSCompartment* compartment); void sweep(FreeOp* fop, JSCompartment* compartment); @@ -544,7 +544,7 @@ class JitCompartment return regExpMatcherStub_; } - MOZ_MUST_USE bool ensureRegExpMatcherStubExists(JSContext* cx) { + [[nodiscard]] bool ensureRegExpMatcherStubExists(JSContext* cx) { if (regExpMatcherStub_) return true; regExpMatcherStub_ = generateRegExpMatcherStub(cx); @@ -555,7 +555,7 @@ class JitCompartment return regExpSearcherStub_; } - MOZ_MUST_USE bool ensureRegExpSearcherStubExists(JSContext* cx) { + [[nodiscard]] bool ensureRegExpSearcherStubExists(JSContext* cx) { if (regExpSearcherStub_) return true; regExpSearcherStub_ = generateRegExpSearcherStub(cx); @@ -566,7 +566,7 @@ class JitCompartment return regExpTesterStub_; } - MOZ_MUST_USE bool ensureRegExpTesterStubExists(JSContext* cx) { + [[nodiscard]] bool ensureRegExpTesterStubExists(JSContext* cx) { if (regExpTesterStub_) return true; regExpTesterStub_ = generateRegExpTesterStub(cx); diff --git a/js/src/jit/JitFrameIterator.h b/js/src/jit/JitFrameIterator.h index abe2dbb231..bff72c844d 100644 --- a/js/src/jit/JitFrameIterator.h +++ b/js/src/jit/JitFrameIterator.h @@ -279,9 +279,9 @@ class JitProfilingFrameIterator inline JitFrameLayout* framePtr(); inline JSScript* frameScript(); - MOZ_MUST_USE bool tryInitWithPC(void* pc); - MOZ_MUST_USE bool tryInitWithTable(JitcodeGlobalTable* table, void* pc, JSRuntime* rt, - bool forLastCallSite); + [[nodiscard]] bool tryInitWithPC(void* pc); + [[nodiscard]] bool tryInitWithTable(JitcodeGlobalTable* table, void* pc, JSRuntime* rt, + bool forLastCallSite); void fixBaselineReturnAddress(); void moveToNextFrame(CommonFrameLayout* frame); @@ -323,7 +323,7 @@ class RInstructionResults ~RInstructionResults(); - MOZ_MUST_USE bool init(JSContext* cx, uint32_t numResults); + [[nodiscard]] bool init(JSContext* cx, uint32_t numResults); bool isInitialized() const; size_t length() const; @@ -444,7 +444,7 @@ class SnapshotIterator Value fromInstructionResult(uint32_t index) const; Value allocationValue(const RValueAllocation& a, ReadMethod rm = RM_Normal); - MOZ_MUST_USE bool allocationReadable(const RValueAllocation& a, ReadMethod rm = RM_Normal); + [[nodiscard]] bool allocationReadable(const RValueAllocation& a, ReadMethod rm = RM_Normal); void writeAllocationValuePayload(const RValueAllocation& a, const Value& v); void warnUnreadableAllocation(); @@ -481,7 +481,7 @@ class SnapshotIterator public: // Exhibits frame properties contained in the snapshot. uint32_t pcOffset() const; - inline MOZ_MUST_USE bool resumeAfter() const { + [[nodiscard]] inline bool resumeAfter() const { // Inline frames are inlined on calls, which are considered as being // resumed on the Call as baseline will push the pc once we return from // the call. @@ -514,12 +514,12 @@ class SnapshotIterator // recover instructions. This vector should be registered before the // beginning of the iteration. This function is in charge of allocating // enough space for all instructions results, and return false iff it fails. - MOZ_MUST_USE bool initInstructionResults(MaybeReadFallback& fallback); + [[nodiscard]] bool initInstructionResults(MaybeReadFallback& fallback); protected: // This function is used internally for computing the result of the recover // instructions. - MOZ_MUST_USE bool computeInstructionResults(JSContext* cx, RInstructionResults* results) const; + [[nodiscard]] bool computeInstructionResults(JSContext* cx, RInstructionResults* results) const; public: // Handle iterating over frames of the snapshots. diff --git a/js/src/jit/JitcodeMap.h b/js/src/jit/JitcodeMap.h index 0f096a9e69..df690abe35 100644 --- a/js/src/jit/JitcodeMap.h +++ b/js/src/jit/JitcodeMap.h @@ -319,8 +319,8 @@ class JitcodeGlobalEntry void* canonicalNativeAddrFor(JSRuntime*rt, void* ptr) const; - MOZ_MUST_USE bool callStackAtAddr(JSRuntime* rt, void* ptr, BytecodeLocationVector& results, - uint32_t* depth) const; + [[nodiscard]] bool callStackAtAddr(JSRuntime* rt, void* ptr, BytecodeLocationVector& results, + uint32_t* depth) const; uint32_t callStackAtAddr(JSRuntime* rt, void* ptr, const char** results, uint32_t maxResults) const; @@ -416,8 +416,8 @@ class JitcodeGlobalEntry void* canonicalNativeAddrFor(JSRuntime* rt, void* ptr) const; - MOZ_MUST_USE bool callStackAtAddr(JSRuntime* rt, void* ptr, BytecodeLocationVector& results, - uint32_t* depth) const; + [[nodiscard]] bool callStackAtAddr(JSRuntime* rt, void* ptr, BytecodeLocationVector& results, + uint32_t* depth) const; uint32_t callStackAtAddr(JSRuntime* rt, void* ptr, const char** results, uint32_t maxResults) const; @@ -455,8 +455,8 @@ class JitcodeGlobalEntry void* canonicalNativeAddrFor(JSRuntime* rt, void* ptr) const; - MOZ_MUST_USE bool callStackAtAddr(JSRuntime* rt, void* ptr, BytecodeLocationVector& results, - uint32_t* depth) const; + [[nodiscard]] bool callStackAtAddr(JSRuntime* rt, void* ptr, BytecodeLocationVector& results, + uint32_t* depth) const; uint32_t callStackAtAddr(JSRuntime* rt, void* ptr, const char** results, uint32_t maxResults) const; @@ -494,8 +494,8 @@ class JitcodeGlobalEntry return nullptr; } - MOZ_MUST_USE bool callStackAtAddr(JSRuntime* rt, void* ptr, BytecodeLocationVector& results, - uint32_t* depth) const + [[nodiscard]] bool callStackAtAddr(JSRuntime* rt, void* ptr, BytecodeLocationVector& results, + uint32_t* depth) const { return true; } @@ -758,8 +758,8 @@ class JitcodeGlobalEntry // outermost appended last. // // Returns false on memory failure. - MOZ_MUST_USE bool callStackAtAddr(JSRuntime* rt, void* ptr, BytecodeLocationVector& results, - uint32_t* depth) const + [[nodiscard]] bool callStackAtAddr(JSRuntime* rt, void* ptr, BytecodeLocationVector& results, + uint32_t* depth) const { switch (kind()) { case Ion: @@ -1041,16 +1041,16 @@ class JitcodeGlobalTable const JitcodeGlobalEntry& lookupForSamplerInfallible(void* ptr, JSRuntime* rt, uint32_t sampleBufferGen); - MOZ_MUST_USE bool addEntry(const JitcodeGlobalEntry::IonEntry& entry, JSRuntime* rt) { + [[nodiscard]] bool addEntry(const JitcodeGlobalEntry::IonEntry& entry, JSRuntime* rt) { return addEntry(JitcodeGlobalEntry(entry), rt); } - MOZ_MUST_USE bool addEntry(const JitcodeGlobalEntry::BaselineEntry& entry, JSRuntime* rt) { + [[nodiscard]] bool addEntry(const JitcodeGlobalEntry::BaselineEntry& entry, JSRuntime* rt) { return addEntry(JitcodeGlobalEntry(entry), rt); } - MOZ_MUST_USE bool addEntry(const JitcodeGlobalEntry::IonCacheEntry& entry, JSRuntime* rt) { + [[nodiscard]] bool addEntry(const JitcodeGlobalEntry::IonCacheEntry& entry, JSRuntime* rt) { return addEntry(JitcodeGlobalEntry(entry), rt); } - MOZ_MUST_USE bool addEntry(const JitcodeGlobalEntry::DummyEntry& entry, JSRuntime* rt) { + [[nodiscard]] bool addEntry(const JitcodeGlobalEntry::DummyEntry& entry, JSRuntime* rt) { return addEntry(JitcodeGlobalEntry(entry), rt); } @@ -1059,11 +1059,11 @@ class JitcodeGlobalTable void setAllEntriesAsExpired(JSRuntime* rt); void markUnconditionally(JSTracer* trc); - MOZ_MUST_USE bool markIteratively(JSTracer* trc); + [[nodiscard]] bool markIteratively(JSTracer* trc); void sweep(JSRuntime* rt); private: - MOZ_MUST_USE bool addEntry(const JitcodeGlobalEntry& entry, JSRuntime* rt); + [[nodiscard]] bool addEntry(const JitcodeGlobalEntry& entry, JSRuntime* rt); JitcodeGlobalEntry* lookupInternal(void* ptr); @@ -1229,9 +1229,9 @@ class JitcodeRegionEntry const CodeGeneratorShared::NativeToBytecode* end); // Write a run, starting at the given NativeToBytecode entry, into the given buffer writer. - static MOZ_MUST_USE bool WriteRun(CompactBufferWriter& writer, JSScript** scriptList, - uint32_t scriptListSize, uint32_t runLength, - const CodeGeneratorShared::NativeToBytecode* entry); + [[nodiscard]] static bool WriteRun(CompactBufferWriter& writer, JSScript** scriptList, + uint32_t scriptListSize, uint32_t runLength, + const CodeGeneratorShared::NativeToBytecode* entry); // Delta Run entry formats are encoded little-endian: // @@ -1438,8 +1438,8 @@ class JitcodeIonTable regionOffsets_[i] = 0; } - MOZ_MUST_USE bool makeIonEntry(JSContext* cx, JitCode* code, uint32_t numScripts, - JSScript** scripts, JitcodeGlobalEntry::IonEntry& out); + [[nodiscard]] bool makeIonEntry(JSContext* cx, JitCode* code, uint32_t numScripts, + JSScript** scripts, JitcodeGlobalEntry::IonEntry& out); uint32_t numRegions() const { return numRegions_; @@ -1478,11 +1478,11 @@ class JitcodeIonTable return payloadEnd() - regionOffset(0); } - static MOZ_MUST_USE bool WriteIonTable(CompactBufferWriter& writer, - JSScript** scriptList, uint32_t scriptListSize, - const CodeGeneratorShared::NativeToBytecode* start, - const CodeGeneratorShared::NativeToBytecode* end, - uint32_t* tableOffsetOut, uint32_t* numRegionsOut); + [[nodiscard]] static bool WriteIonTable(CompactBufferWriter& writer, + JSScript** scriptList, uint32_t scriptListSize, + const CodeGeneratorShared::NativeToBytecode* start, + const CodeGeneratorShared::NativeToBytecode* end, + uint32_t* tableOffsetOut, uint32_t* numRegionsOut); }; diff --git a/js/src/jit/LICM.h b/js/src/jit/LICM.h index 3c8117bd19..64569450fd 100644 --- a/js/src/jit/LICM.h +++ b/js/src/jit/LICM.h @@ -16,7 +16,7 @@ namespace jit { class MIRGenerator; class MIRGraph; -MOZ_MUST_USE bool LICM(MIRGenerator* mir, MIRGraph& graph); +[[nodiscard]] bool LICM(MIRGenerator* mir, MIRGraph& graph); } // namespace jit } // namespace js diff --git a/js/src/jit/LIR.h b/js/src/jit/LIR.h index bee3b3ebea..ce911ae958 100644 --- a/js/src/jit/LIR.h +++ b/js/src/jit/LIR.h @@ -965,7 +965,7 @@ class LBlock public: explicit LBlock(MBasicBlock* block); - MOZ_MUST_USE bool init(TempAllocator& alloc); + [[nodiscard]] bool init(TempAllocator& alloc); void add(LInstruction* ins) { ins->setBlock(this); @@ -1156,7 +1156,7 @@ class LVariadicInstruction : public details::LInstructionFixedDefsTempsHelper<De FixedList<LAllocation> operands_; public: - MOZ_MUST_USE bool init(TempAllocator& alloc, size_t length) { + [[nodiscard]] bool init(TempAllocator& alloc, size_t length) { return operands_.init(alloc, length); } size_t numOperands() const final override { @@ -1193,13 +1193,13 @@ class LRecoverInfo : public TempObject RecoverOffset recoverOffset_; explicit LRecoverInfo(TempAllocator& alloc); - MOZ_MUST_USE bool init(MResumePoint* mir); + [[nodiscard]] bool init(MResumePoint* mir); // Fill the instruction vector such as all instructions needed for the // recovery are pushed before the current instruction. - MOZ_MUST_USE bool appendOperands(MNode* ins); - MOZ_MUST_USE bool appendDefinition(MDefinition* def); - MOZ_MUST_USE bool appendResumePoint(MResumePoint* rp); + [[nodiscard]] bool appendOperands(MNode* ins); + [[nodiscard]] bool appendDefinition(MDefinition* def); + [[nodiscard]] bool appendResumePoint(MResumePoint* rp); public: static LRecoverInfo* New(MIRGenerator* gen, MResumePoint* mir); @@ -1291,7 +1291,7 @@ class LSnapshot : public TempObject BailoutKind bailoutKind_; LSnapshot(LRecoverInfo* recover, BailoutKind kind); - MOZ_MUST_USE bool init(MIRGenerator* gen); + [[nodiscard]] bool init(MIRGenerator* gen); public: static LSnapshot* New(MIRGenerator* gen, LRecoverInfo* recover, BailoutKind kind); @@ -1480,7 +1480,7 @@ class LSafepoint : public TempObject LiveGeneralRegisterSet gcRegs() const { return gcRegs_; } - MOZ_MUST_USE bool addGcSlot(bool stack, uint32_t slot) { + [[nodiscard]] bool addGcSlot(bool stack, uint32_t slot) { bool result = gcSlots_.append(SlotEntry(stack, slot)); if (result) assertInvariants(); @@ -1500,13 +1500,13 @@ class LSafepoint : public TempObject slotsOrElementsRegs_.addUnchecked(reg); assertInvariants(); } - MOZ_MUST_USE bool addSlotsOrElementsSlot(bool stack, uint32_t slot) { + [[nodiscard]] bool addSlotsOrElementsSlot(bool stack, uint32_t slot) { bool result = slotsOrElementsSlots_.append(SlotEntry(stack, slot)); if (result) assertInvariants(); return result; } - MOZ_MUST_USE bool addSlotsOrElementsPointer(LAllocation alloc) { + [[nodiscard]] bool addSlotsOrElementsPointer(LAllocation alloc) { if (alloc.isMemory()) return addSlotsOrElementsSlot(alloc.isStackSlot(), alloc.memorySlot()); MOZ_ASSERT(alloc.isRegister()); @@ -1525,7 +1525,7 @@ class LSafepoint : public TempObject return false; } - MOZ_MUST_USE bool addGcPointer(LAllocation alloc) { + [[nodiscard]] bool addGcPointer(LAllocation alloc) { if (alloc.isMemory()) return addGcSlot(alloc.isStackSlot(), alloc.memorySlot()); if (alloc.isRegister()) @@ -1545,7 +1545,7 @@ class LSafepoint : public TempObject return false; } - MOZ_MUST_USE bool addValueSlot(bool stack, uint32_t slot) { + [[nodiscard]] bool addValueSlot(bool stack, uint32_t slot) { bool result = valueSlots_.append(SlotEntry(stack, slot)); if (result) assertInvariants(); @@ -1565,14 +1565,14 @@ class LSafepoint : public TempObject #ifdef JS_NUNBOX32 - MOZ_MUST_USE bool addNunboxParts(uint32_t typeVreg, LAllocation type, LAllocation payload) { + [[nodiscard]] bool addNunboxParts(uint32_t typeVreg, LAllocation type, LAllocation payload) { bool result = nunboxParts_.append(NunboxEntry(typeVreg, type, payload)); if (result) assertInvariants(); return result; } - MOZ_MUST_USE bool addNunboxType(uint32_t typeVreg, LAllocation type) { + [[nodiscard]] bool addNunboxType(uint32_t typeVreg, LAllocation type) { for (size_t i = 0; i < nunboxParts_.length(); i++) { if (nunboxParts_[i].type == type) return true; @@ -1590,7 +1590,7 @@ class LSafepoint : public TempObject return result; } - MOZ_MUST_USE bool addNunboxPayload(uint32_t payloadVreg, LAllocation payload) { + [[nodiscard]] bool addNunboxPayload(uint32_t payloadVreg, LAllocation payload) { for (size_t i = 0; i < nunboxParts_.length(); i++) { if (nunboxParts_[i].payload == payload) return true; @@ -1646,7 +1646,7 @@ class LSafepoint : public TempObject return valueRegs_; } - MOZ_MUST_USE bool addBoxedValue(LAllocation alloc) { + [[nodiscard]] bool addBoxedValue(LAllocation alloc) { if (alloc.isRegister()) { Register reg = alloc.toRegister().gpr(); if (!valueRegs().has(reg)) @@ -1788,7 +1788,7 @@ class LIRGraph public: explicit LIRGraph(MIRGraph* mir); - MOZ_MUST_USE bool init() { + [[nodiscard]] bool init() { return constantPoolMap_.init() && blocks_.init(mir_.alloc(), mir_.numBlocks()); } MIRGraph& mir() const { @@ -1803,7 +1803,7 @@ class LIRGraph uint32_t numBlockIds() const { return mir_.numBlockIds(); } - MOZ_MUST_USE bool initBlock(MBasicBlock* mir) { + [[nodiscard]] bool initBlock(MBasicBlock* mir) { auto* block = &blocks_[mir->id()]; auto* lir = new (block) LBlock(mir); return lir->init(mir_.alloc()); @@ -1855,7 +1855,7 @@ class LIRGraph uint32_t totalSlotCount() const { return paddedLocalSlotCount() + argumentsSize(); } - MOZ_MUST_USE bool addConstantToPool(const Value& v, uint32_t* index); + [[nodiscard]] bool addConstantToPool(const Value& v, uint32_t* index); size_t numConstants() const { return constantPool_.length(); } diff --git a/js/src/jit/LoopUnroller.h b/js/src/jit/LoopUnroller.h index 096bdd2e42..4c1923c522 100644 --- a/js/src/jit/LoopUnroller.h +++ b/js/src/jit/LoopUnroller.h @@ -11,8 +11,7 @@ namespace js { namespace jit { -MOZ_MUST_USE bool -UnrollLoops(MIRGraph& graph, const LoopIterationBoundVector& bounds); +[[nodiscard]] bool UnrollLoops(MIRGraph& graph, const LoopIterationBoundVector& bounds); } // namespace jit } // namespace js diff --git a/js/src/jit/Lowering.h b/js/src/jit/Lowering.h index 8c380dcdef..e2b053643d 100644 --- a/js/src/jit/Lowering.h +++ b/js/src/jit/Lowering.h @@ -45,7 +45,7 @@ class LIRGenerator : public LIRGeneratorSpecific maxargslots_(0) { } - MOZ_MUST_USE bool generate(); + [[nodiscard]] bool generate(); private: LBoxAllocation useBoxFixedAtStart(MDefinition* mir, Register reg1, Register reg2) { @@ -60,11 +60,11 @@ class LIRGenerator : public LIRGeneratorSpecific void lowerBinaryV(JSOp op, MBinaryInstruction* ins); void definePhis(); - MOZ_MUST_USE bool lowerCallArguments(MCall* call); + [[nodiscard]] bool lowerCallArguments(MCall* call); public: - MOZ_MUST_USE bool visitInstruction(MInstruction* ins); - MOZ_MUST_USE bool visitBlock(MBasicBlock* block); + [[nodiscard]] bool visitInstruction(MInstruction* ins); + [[nodiscard]] bool visitBlock(MBasicBlock* block); // Visitor hooks are explicit, to give CPU-specific versions a chance to // intercept without a bunch of explicit gunk in the .cpp. diff --git a/js/src/jit/MIR.h b/js/src/jit/MIR.h index 62f49c8bad..f21454fd76 100644 --- a/js/src/jit/MIR.h +++ b/js/src/jit/MIR.h @@ -292,7 +292,7 @@ class MNode : public TempObject inline MDefinition* toDefinition(); inline MResumePoint* toResumePoint(); - virtual MOZ_MUST_USE bool writeRecoverData(CompactBufferWriter& writer) const; + [[nodiscard]] virtual bool writeRecoverData(CompactBufferWriter& writer) const; virtual void dump(GenericPrinter& out) const = 0; virtual void dump() const = 0; @@ -393,7 +393,7 @@ class StoreDependency : public TempObject : all_(alloc) { } - MOZ_MUST_USE bool init(MDefinitionVector& all) { + [[nodiscard]] bool init(MDefinitionVector& all) { if (!all_.appendAll(all)) return false; return true; @@ -800,7 +800,7 @@ class MDefinition : public MNode // Replace the current instruction by an optimized-out constant in all uses // of the current instruction. Note, that optimized-out constant should not // be observed, and thus they should not flow in any computation. - MOZ_MUST_USE bool optimizeOutAllUses(TempAllocator& alloc); + [[nodiscard]] bool optimizeOutAllUses(TempAllocator& alloc); // Replace the current instruction by a dominating instruction |dom| in all // instruction, but keep the current instruction for resume point and @@ -810,7 +810,7 @@ class MDefinition : public MNode // Mark this instruction as having replaced all uses of ins, as during GVN, // returning false if the replacement should not be performed. For use when // GVN eliminates instructions which are not equivalent to one another. - virtual MOZ_MUST_USE bool updateForReplacement(MDefinition* ins) { + [[nodiscard]] virtual bool updateForReplacement(MDefinition* ins) { return true; } @@ -1027,17 +1027,17 @@ class MRootList : public TempObject void trace(JSTracer* trc); template <typename T> - MOZ_MUST_USE bool append(T ptr) { + [[nodiscard]] bool append(T ptr) { if (ptr) return roots_[JS::MapTypeToRootKind<T>::kind]->append(ptr); return true; } template <typename T> - MOZ_MUST_USE bool append(const CompilerGCPointer<T>& ptr) { + [[nodiscard]] bool append(const CompilerGCPointer<T>& ptr) { return append(static_cast<T>(ptr)); } - MOZ_MUST_USE bool append(const ReceiverGuard& guard) { + [[nodiscard]] bool append(const ReceiverGuard& guard) { return append(guard.group) && append(guard.shape); } }; @@ -1362,7 +1362,7 @@ class MVariadicT : public T FixedList<MUse> operands_; protected: - MOZ_MUST_USE bool init(TempAllocator& alloc, size_t length) { + [[nodiscard]] bool init(TempAllocator& alloc, size_t length) { return operands_.init(alloc, length); } void initOperand(size_t index, MDefinition* operand) { @@ -1533,7 +1533,7 @@ class MConstant : public MNullaryInstruction // Try to convert this constant to boolean, similar to js::ToBoolean. // Returns false if the type is MIRType::Magic*. - bool MOZ_MUST_USE valueToBoolean(bool* res) const; + [[nodiscard]] bool valueToBoolean(bool* res) const; // Like valueToBoolean, but returns the result directly instead of using // an outparam. Should not be used if this constant might be a magic value. @@ -1552,7 +1552,7 @@ class MConstant : public MNullaryInstruction return AliasSet::None(); } - MOZ_MUST_USE bool updateForReplacement(MDefinition* def) override { + [[nodiscard]] bool updateForReplacement(MDefinition* def) override { MConstant* c = def->toConstant(); // During constant folding, we don't want to replace a float32 // value by a double value. @@ -1803,7 +1803,7 @@ class MTableSwitch final return successors_.length(); } - MOZ_MUST_USE bool addSuccessor(MBasicBlock* successor, size_t* index) { + [[nodiscard]] bool addSuccessor(MBasicBlock* successor, size_t* index) { MOZ_ASSERT(successors_.length() < (size_t)(high_ - low_ + 2)); MOZ_ASSERT(!successors_.empty()); *index = successors_.length(); @@ -1848,14 +1848,14 @@ class MTableSwitch final return high() - low() + 1; } - MOZ_MUST_USE bool addDefault(MBasicBlock* block, size_t* index = nullptr) { + [[nodiscard]] bool addDefault(MBasicBlock* block, size_t* index = nullptr) { MOZ_ASSERT(successors_.empty()); if (index) *index = 0; return successors_.append(block); } - MOZ_MUST_USE bool addCase(size_t successorIndex) { + [[nodiscard]] bool addCase(size_t successorIndex) { return cases_.append(successorIndex); } @@ -1864,7 +1864,7 @@ class MTableSwitch final return blocks_[i]; } - MOZ_MUST_USE bool addBlock(MBasicBlock* block) { + [[nodiscard]] bool addBlock(MBasicBlock* block) { return blocks_.append(block); } @@ -2116,7 +2116,7 @@ MakeSingletonTypeSet(CompilerConstraintList* constraints, JSObject* obj); TemporaryTypeSet* MakeSingletonTypeSet(CompilerConstraintList* constraints, ObjectGroup* obj); -MOZ_MUST_USE bool +[[nodiscard]] bool MergeTypes(TempAllocator& alloc, MIRType* ptype, TemporaryTypeSet** ptypeSet, MIRType newType, TemporaryTypeSet* newTypeSet); @@ -2197,7 +2197,7 @@ class MNewArray return AliasSet::None(); } - MOZ_MUST_USE bool writeRecoverData(CompactBufferWriter& writer) const override; + [[nodiscard]] bool writeRecoverData(CompactBufferWriter& writer) const override; bool canRecoverOnBailout() const override { // The template object can safely be used in the recover instruction // because it can never be mutated by any other function execution. @@ -2313,7 +2313,7 @@ class MNewTypedArray return AliasSet::None(); } - MOZ_MUST_USE bool writeRecoverData(CompactBufferWriter& writer) const override; + [[nodiscard]] bool writeRecoverData(CompactBufferWriter& writer) const override; bool canRecoverOnBailout() const override { return true; } @@ -2428,7 +2428,7 @@ class MNewObject return vmCall_; } - MOZ_MUST_USE bool writeRecoverData(CompactBufferWriter& writer) const override; + [[nodiscard]] bool writeRecoverData(CompactBufferWriter& writer) const override; bool canRecoverOnBailout() const override { // The template object can safely be used in the recover instruction // because it can never be mutated by any other function execution. @@ -2542,7 +2542,7 @@ class MNewDerivedTypedObject return AliasSet::None(); } - MOZ_MUST_USE bool writeRecoverData(CompactBufferWriter& writer) const override; + [[nodiscard]] bool writeRecoverData(CompactBufferWriter& writer) const override; bool canRecoverOnBailout() const override { return true; } @@ -2557,7 +2557,7 @@ struct OperandIndexMap : public TempObject // have any large number of properties. FixedList<uint8_t> map; - MOZ_MUST_USE bool init(TempAllocator& alloc, JSObject* templateObject); + [[nodiscard]] bool init(TempAllocator& alloc, JSObject* templateObject); }; // Represent the content of all slots of an object. This instruction is not @@ -2578,7 +2578,7 @@ class MObjectState MObjectState(JSObject *templateObject, OperandIndexMap* operandIndex); explicit MObjectState(MObjectState* state); - MOZ_MUST_USE bool init(TempAllocator& alloc, MDefinition* obj); + [[nodiscard]] bool init(TempAllocator& alloc, MDefinition* obj); void initSlot(uint32_t slot, MDefinition* def) { initOperand(slot + 1, def); @@ -2597,7 +2597,7 @@ class MObjectState // As we might do read of uninitialized properties, we have to copy the // initial values from the template object. - MOZ_MUST_USE bool initFromTemplateObject(TempAllocator& alloc, MDefinition* undefinedVal); + [[nodiscard]] bool initFromTemplateObject(TempAllocator& alloc, MDefinition* undefinedVal); size_t numFixedSlots() const { return numFixedSlots_; @@ -2647,7 +2647,7 @@ class MObjectState replaceOperand(operandIndex_->map[offset], def); } - MOZ_MUST_USE bool writeRecoverData(CompactBufferWriter& writer) const override; + [[nodiscard]] bool writeRecoverData(CompactBufferWriter& writer) const override; bool canRecoverOnBailout() const override { return true; } @@ -2664,7 +2664,7 @@ class MArrayState explicit MArrayState(MDefinition* arr); - MOZ_MUST_USE bool init(TempAllocator& alloc, MDefinition* obj, MDefinition* len); + [[nodiscard]] bool init(TempAllocator& alloc, MDefinition* obj, MDefinition* len); void initElement(uint32_t index, MDefinition* def) { initOperand(index + 2, def); @@ -2694,7 +2694,7 @@ class MArrayState replaceOperand(index + 2, def); } - MOZ_MUST_USE bool writeRecoverData(CompactBufferWriter& writer) const override; + [[nodiscard]] bool writeRecoverData(CompactBufferWriter& writer) const override; bool canRecoverOnBailout() const override { return true; } @@ -3181,7 +3181,7 @@ class MAssertRecoveredOnBailout // Needed to assert that float32 instructions are correctly recovered. bool canConsumeFloat32(MUse* use) const override { return true; } - MOZ_MUST_USE bool writeRecoverData(CompactBufferWriter& writer) const override; + [[nodiscard]] bool writeRecoverData(CompactBufferWriter& writer) const override; bool canRecoverOnBailout() const override { return true; } @@ -3381,8 +3381,8 @@ class MCompare INSTRUCTION_HEADER(Compare) TRIVIAL_NEW_WRAPPERS - MOZ_MUST_USE bool tryFold(bool* result); - MOZ_MUST_USE bool evaluateConstantOperands(TempAllocator& alloc, bool* result); + [[nodiscard]] bool tryFold(bool* result); + [[nodiscard]] bool evaluateConstantOperands(TempAllocator& alloc, bool* result); MDefinition* foldsTo(TempAllocator& alloc) override; void filtersUndefinedOrNull(bool trueBranch, MDefinition** subject, bool* filtersUndefined, bool* filtersNull); @@ -3458,8 +3458,8 @@ class MCompare ALLOW_CLONE(MCompare) protected: - MOZ_MUST_USE bool tryFoldEqualOperands(bool* result); - MOZ_MUST_USE bool tryFoldTypeOf(bool* result); + [[nodiscard]] bool tryFoldEqualOperands(bool* result); + [[nodiscard]] bool tryFoldTypeOf(bool* result); bool congruentTo(const MDefinition* ins) const override { if (!binaryCongruentTo(ins)) @@ -3769,7 +3769,7 @@ class MCreateThisWithTemplate return AliasSet::None(); } - MOZ_MUST_USE bool writeRecoverData(CompactBufferWriter& writer) const override; + [[nodiscard]] bool writeRecoverData(CompactBufferWriter& writer) const override; bool canRecoverOnBailout() const override; }; @@ -4036,7 +4036,7 @@ class MToDouble implicitTruncate_ = Max(implicitTruncate_, kind); } - MOZ_MUST_USE bool writeRecoverData(CompactBufferWriter& writer) const override; + [[nodiscard]] bool writeRecoverData(CompactBufferWriter& writer) const override; bool canRecoverOnBailout() const override { if (input()->type() == MIRType::Value) { return false; @@ -4103,7 +4103,7 @@ class MToFloat32 bool canConsumeFloat32(MUse* use) const override { return true; } bool canProduceFloat32() const override { return true; } - MOZ_MUST_USE bool writeRecoverData(CompactBufferWriter& writer) const override; + [[nodiscard]] bool writeRecoverData(CompactBufferWriter& writer) const override; bool canRecoverOnBailout() const override { return true; } @@ -4479,7 +4479,7 @@ class MTruncateToInt32 } #endif - MOZ_MUST_USE bool writeRecoverData(CompactBufferWriter& writer) const override; + [[nodiscard]] bool writeRecoverData(CompactBufferWriter& writer) const override; bool canRecoverOnBailout() const override { return input()->type() < MIRType::Symbol; } @@ -4589,7 +4589,7 @@ class MBitNot } void computeRange(TempAllocator& alloc) override; - MOZ_MUST_USE bool writeRecoverData(CompactBufferWriter& writer) const override; + [[nodiscard]] bool writeRecoverData(CompactBufferWriter& writer) const override; bool canRecoverOnBailout() const override { return specialization_ != MIRType::None; } @@ -4647,7 +4647,7 @@ class MTypeOf return congruentIfOperandsEqual(ins); } - MOZ_MUST_USE bool writeRecoverData(CompactBufferWriter& writer) const override; + [[nodiscard]] bool writeRecoverData(CompactBufferWriter& writer) const override; bool canRecoverOnBailout() const override { return true; } @@ -4784,7 +4784,7 @@ class MBitAnd : public MBinaryBitwiseInstruction } void computeRange(TempAllocator& alloc) override; - MOZ_MUST_USE bool writeRecoverData(CompactBufferWriter& writer) const override; + [[nodiscard]] bool writeRecoverData(CompactBufferWriter& writer) const override; bool canRecoverOnBailout() const override { return specialization_ != MIRType::None; } @@ -4816,7 +4816,7 @@ class MBitOr : public MBinaryBitwiseInstruction return this; } void computeRange(TempAllocator& alloc) override; - MOZ_MUST_USE bool writeRecoverData(CompactBufferWriter& writer) const override; + [[nodiscard]] bool writeRecoverData(CompactBufferWriter& writer) const override; bool canRecoverOnBailout() const override { return specialization_ != MIRType::None; } @@ -4849,7 +4849,7 @@ class MBitXor : public MBinaryBitwiseInstruction } void computeRange(TempAllocator& alloc) override; - MOZ_MUST_USE bool writeRecoverData(CompactBufferWriter& writer) const override; + [[nodiscard]] bool writeRecoverData(CompactBufferWriter& writer) const override; bool canRecoverOnBailout() const override { return specialization_ < MIRType::Object; } @@ -4896,7 +4896,7 @@ class MLsh : public MShiftInstruction } void computeRange(TempAllocator& alloc) override; - MOZ_MUST_USE bool writeRecoverData(CompactBufferWriter& writer) const override; + [[nodiscard]] bool writeRecoverData(CompactBufferWriter& writer) const override; bool canRecoverOnBailout() const override { return specialization_ != MIRType::None; } @@ -4922,7 +4922,7 @@ class MRsh : public MShiftInstruction } void computeRange(TempAllocator& alloc) override; - MOZ_MUST_USE bool writeRecoverData(CompactBufferWriter& writer) const override; + [[nodiscard]] bool writeRecoverData(CompactBufferWriter& writer) const override; bool canRecoverOnBailout() const override { return specialization_ < MIRType::Object; } @@ -4965,7 +4965,7 @@ class MUrsh : public MShiftInstruction void computeRange(TempAllocator& alloc) override; void collectRangeInfoPreTrunc() override; - MOZ_MUST_USE bool writeRecoverData(CompactBufferWriter& writer) const override; + [[nodiscard]] bool writeRecoverData(CompactBufferWriter& writer) const override; bool canRecoverOnBailout() const override { return specialization_ < MIRType::Object; } @@ -5009,7 +5009,7 @@ class MSignExtendInt32 return AliasSet::None(); } - MOZ_MUST_USE bool writeRecoverData(CompactBufferWriter& writer) const override; + [[nodiscard]] bool writeRecoverData(CompactBufferWriter& writer) const override; bool canRecoverOnBailout() const override { return true; } @@ -5175,7 +5175,7 @@ class MMinMax } MDefinition* foldsTo(TempAllocator& alloc) override; void computeRange(TempAllocator& alloc) override; - MOZ_MUST_USE bool writeRecoverData(CompactBufferWriter& writer) const override; + [[nodiscard]] bool writeRecoverData(CompactBufferWriter& writer) const override; bool canRecoverOnBailout() const override { return true; } @@ -5225,7 +5225,7 @@ class MAbs bool isFloat32Commutative() const override { return true; } void trySpecializeFloat32(TempAllocator& alloc) override; - MOZ_MUST_USE bool writeRecoverData(CompactBufferWriter& writer) const override; + [[nodiscard]] bool writeRecoverData(CompactBufferWriter& writer) const override; bool canRecoverOnBailout() const override { return true; } @@ -5371,7 +5371,7 @@ class MSqrt bool isFloat32Commutative() const override { return true; } void trySpecializeFloat32(TempAllocator& alloc) override; - MOZ_MUST_USE bool writeRecoverData(CompactBufferWriter& writer) const override; + [[nodiscard]] bool writeRecoverData(CompactBufferWriter& writer) const override; bool canRecoverOnBailout() const override { return true; } @@ -5433,7 +5433,7 @@ class MAtan2 return true; } - MOZ_MUST_USE bool writeRecoverData(CompactBufferWriter& writer) const override; + [[nodiscard]] bool writeRecoverData(CompactBufferWriter& writer) const override; bool canRecoverOnBailout() const override { return true; } @@ -5468,7 +5468,7 @@ class MHypot return true; } - MOZ_MUST_USE bool writeRecoverData(CompactBufferWriter& writer) const override; + [[nodiscard]] bool writeRecoverData(CompactBufferWriter& writer) const override; bool canRecoverOnBailout() const override { return true; } @@ -5516,7 +5516,7 @@ class MPow bool possiblyCalls() const override { return true; } - MOZ_MUST_USE bool writeRecoverData(CompactBufferWriter& writer) const override; + [[nodiscard]] bool writeRecoverData(CompactBufferWriter& writer) const override; bool canRecoverOnBailout() const override { // Temporarily disable recovery to relieve fuzzer pressure. See bug 1188586. return false; @@ -5566,7 +5566,7 @@ class MPowHalf return AliasSet::None(); } void collectRangeInfoPreTrunc() override; - MOZ_MUST_USE bool writeRecoverData(CompactBufferWriter& writer) const override; + [[nodiscard]] bool writeRecoverData(CompactBufferWriter& writer) const override; bool canRecoverOnBailout() const override { return true; } @@ -5596,7 +5596,7 @@ class MRandom : public MNullaryInstruction void computeRange(TempAllocator& alloc) override; - MOZ_MUST_USE bool writeRecoverData(CompactBufferWriter& writer) const override; + [[nodiscard]] bool writeRecoverData(CompactBufferWriter& writer) const override; bool canRecoverOnBailout() const override { #ifdef JS_MORE_DETERMINISTIC @@ -5691,7 +5691,7 @@ class MMathFunction } void trySpecializeFloat32(TempAllocator& alloc) override; void computeRange(TempAllocator& alloc) override; - MOZ_MUST_USE bool writeRecoverData(CompactBufferWriter& writer) const override; + [[nodiscard]] bool writeRecoverData(CompactBufferWriter& writer) const override; bool canRecoverOnBailout() const override { if (input()->type() == MIRType::SinCosDouble) return false; @@ -5743,7 +5743,7 @@ class MAdd : public MBinaryArithInstruction void truncate() override; TruncateKind operandTruncateKind(size_t index) const override; - MOZ_MUST_USE bool writeRecoverData(CompactBufferWriter& writer) const override; + [[nodiscard]] bool writeRecoverData(CompactBufferWriter& writer) const override; bool canRecoverOnBailout() const override { return specialization_ < MIRType::Object; } @@ -5785,7 +5785,7 @@ class MSub : public MBinaryArithInstruction void truncate() override; TruncateKind operandTruncateKind(size_t index) const override; - MOZ_MUST_USE bool writeRecoverData(CompactBufferWriter& writer) const override; + [[nodiscard]] bool writeRecoverData(CompactBufferWriter& writer) const override; bool canRecoverOnBailout() const override { return specialization_ < MIRType::Object; } @@ -5880,7 +5880,7 @@ class MMul : public MBinaryArithInstruction canBeNegativeZero_ = negativeZero; } - MOZ_MUST_USE bool updateForReplacement(MDefinition* ins) override; + [[nodiscard]] bool updateForReplacement(MDefinition* ins) override; bool fallible() const { return canBeNegativeZero_ || canOverflow(); @@ -5899,7 +5899,7 @@ class MMul : public MBinaryArithInstruction Mode mode() const { return mode_; } - MOZ_MUST_USE bool writeRecoverData(CompactBufferWriter& writer) const override; + [[nodiscard]] bool writeRecoverData(CompactBufferWriter& writer) const override; bool canRecoverOnBailout() const override { return specialization_ < MIRType::Object; } @@ -6033,7 +6033,7 @@ class MDiv : public MBinaryArithInstruction void collectRangeInfoPreTrunc() override; TruncateKind operandTruncateKind(size_t index) const override; - MOZ_MUST_USE bool writeRecoverData(CompactBufferWriter& writer) const override; + [[nodiscard]] bool writeRecoverData(CompactBufferWriter& writer) const override; bool canRecoverOnBailout() const override { return specialization_ < MIRType::Object; } @@ -6129,7 +6129,7 @@ class MMod : public MBinaryArithInstruction return trapOffset_; } - MOZ_MUST_USE bool writeRecoverData(CompactBufferWriter& writer) const override; + [[nodiscard]] bool writeRecoverData(CompactBufferWriter& writer) const override; bool canRecoverOnBailout() const override { return specialization_ < MIRType::Object; } @@ -6176,7 +6176,7 @@ class MConcat return AliasSet::None(); } - MOZ_MUST_USE bool writeRecoverData(CompactBufferWriter& writer) const override; + [[nodiscard]] bool writeRecoverData(CompactBufferWriter& writer) const override; bool canRecoverOnBailout() const override { return true; } @@ -6210,7 +6210,7 @@ class MCharCodeAt void computeRange(TempAllocator& alloc) override; - MOZ_MUST_USE bool writeRecoverData(CompactBufferWriter& writer) const override; + [[nodiscard]] bool writeRecoverData(CompactBufferWriter& writer) const override; bool canRecoverOnBailout() const override { return true; } @@ -6240,7 +6240,7 @@ class MFromCharCode return congruentIfOperandsEqual(ins); } - MOZ_MUST_USE bool writeRecoverData(CompactBufferWriter& writer) const override; + [[nodiscard]] bool writeRecoverData(CompactBufferWriter& writer) const override; bool canRecoverOnBailout() const override { return true; } @@ -6340,7 +6340,7 @@ class MStringSplit // it as store instruction, see also MNewArray. return AliasSet::None(); } - MOZ_MUST_USE bool writeRecoverData(CompactBufferWriter& writer) const override; + [[nodiscard]] bool writeRecoverData(CompactBufferWriter& writer) const override; bool canRecoverOnBailout() const override { return true; } @@ -6510,12 +6510,12 @@ class MPhi final // Add types for this phi which speculate about new inputs that may come in // via a loop backedge. - MOZ_MUST_USE bool addBackedgeType(TempAllocator& alloc, MIRType type, + [[nodiscard]] bool addBackedgeType(TempAllocator& alloc, MIRType type, TemporaryTypeSet* typeSet); // Initializes the operands vector to the given capacity, // permitting use of addInput() instead of addInputSlow(). - MOZ_MUST_USE bool reserveLength(size_t length) { + [[nodiscard]] bool reserveLength(size_t length) { return inputs_.reserve(length); } @@ -6526,7 +6526,7 @@ class MPhi final // Appends a new input to the input vector. May perform reallocation. // Prefer reserveLength() and addInput() instead, where possible. - MOZ_MUST_USE bool addInputSlow(MDefinition* ins) { + [[nodiscard]] bool addInputSlow(MDefinition* ins) { return inputs_.emplaceBack(ins, this); } @@ -7064,7 +7064,7 @@ class MRegExpMatcher TRIVIAL_NEW_WRAPPERS NAMED_OPERANDS((0, regexp), (1, string), (2, lastIndex)) - MOZ_MUST_USE bool writeRecoverData(CompactBufferWriter& writer) const override; + [[nodiscard]] bool writeRecoverData(CompactBufferWriter& writer) const override; bool canRecoverOnBailout() const override { return true; @@ -7099,7 +7099,7 @@ class MRegExpSearcher TRIVIAL_NEW_WRAPPERS NAMED_OPERANDS((0, regexp), (1, string), (2, lastIndex)) - MOZ_MUST_USE bool writeRecoverData(CompactBufferWriter& writer) const override; + [[nodiscard]] bool writeRecoverData(CompactBufferWriter& writer) const override; bool canRecoverOnBailout() const override { return true; @@ -7138,7 +7138,7 @@ class MRegExpTester return true; } - MOZ_MUST_USE bool writeRecoverData(CompactBufferWriter& writer) const override; + [[nodiscard]] bool writeRecoverData(CompactBufferWriter& writer) const override; bool canRecoverOnBailout() const override { return true; } @@ -7251,7 +7251,7 @@ class MStringReplace return AliasSet::None(); } - MOZ_MUST_USE bool writeRecoverData(CompactBufferWriter& writer) const override; + [[nodiscard]] bool writeRecoverData(CompactBufferWriter& writer) const override; bool canRecoverOnBailout() const override { if (isFlatReplacement_) { MOZ_ASSERT(!pattern()->isRegExp()); @@ -7392,7 +7392,7 @@ class MLambda const LambdaFunctionInfo& info() const { return info_; } - MOZ_MUST_USE bool writeRecoverData(CompactBufferWriter& writer) const override; + [[nodiscard]] bool writeRecoverData(CompactBufferWriter& writer) const override; bool canRecoverOnBailout() const override { return true; } @@ -8112,7 +8112,7 @@ class MNot bool congruentTo(const MDefinition* ins) const override { return congruentIfOperandsEqual(ins); } - MOZ_MUST_USE bool writeRecoverData(CompactBufferWriter& writer) const override; + [[nodiscard]] bool writeRecoverData(CompactBufferWriter& writer) const override; bool canRecoverOnBailout() const override { return true; } @@ -9582,7 +9582,7 @@ class InlinePropertyTable : public TempObject return pc_; } - MOZ_MUST_USE bool addEntry(TempAllocator& alloc, ObjectGroup* group, JSFunction* func) { + [[nodiscard]] bool addEntry(TempAllocator& alloc, ObjectGroup* group, JSFunction* func) { return entries_.append(new(alloc) Entry(group, func)); } @@ -9703,7 +9703,7 @@ class MGetPropertyCache } void setBlock(MBasicBlock* block) override; - MOZ_MUST_USE bool updateForReplacement(MDefinition* ins) override; + [[nodiscard]] bool updateForReplacement(MDefinition* ins) override; bool allowDoubleResult() const; @@ -9761,7 +9761,7 @@ class MGetPropertyPolymorphic return congruentIfOperandsEqual(ins); } - MOZ_MUST_USE bool addReceiver(const ReceiverGuard& receiver, Shape* shape) { + [[nodiscard]] bool addReceiver(const ReceiverGuard& receiver, Shape* shape) { PolymorphicEntry entry; entry.receiver = receiver; entry.shape = shape; @@ -9826,7 +9826,7 @@ class MSetPropertyPolymorphic return new(alloc) MSetPropertyPolymorphic(alloc, obj, value, name); } - MOZ_MUST_USE bool addReceiver(const ReceiverGuard& receiver, Shape* shape) { + [[nodiscard]] bool addReceiver(const ReceiverGuard& receiver, Shape* shape) { PolymorphicEntry entry; entry.receiver = receiver; entry.shape = shape; @@ -9952,7 +9952,7 @@ class MDispatchInstruction } public: - MOZ_MUST_USE bool addCase(JSFunction* func, ObjectGroup* funcGroup, MBasicBlock* block) { + [[nodiscard]] bool addCase(JSFunction* func, ObjectGroup* funcGroup, MBasicBlock* block) { return map_.append(Entry(func, funcGroup, block)); } uint32_t numCases() const { @@ -10162,7 +10162,7 @@ class MGuardReceiverPolymorphic return new(alloc) MGuardReceiverPolymorphic(alloc, obj); } - MOZ_MUST_USE bool addReceiver(const ReceiverGuard& receiver) { + [[nodiscard]] bool addReceiver(const ReceiverGuard& receiver) { return receivers_.append(receiver); } size_t numReceivers() const { @@ -10896,7 +10896,7 @@ class MGetDOMProperty return info_; } - MOZ_MUST_USE bool init(TempAllocator& alloc, MDefinition* obj, MDefinition* guard, + [[nodiscard]] bool init(TempAllocator& alloc, MDefinition* obj, MDefinition* guard, MDefinition* globalGuard) { MOZ_ASSERT(obj); // guard can be null. @@ -11049,7 +11049,7 @@ class MStringLength void computeRange(TempAllocator& alloc) override; - MOZ_MUST_USE bool writeRecoverData(CompactBufferWriter& writer) const override; + [[nodiscard]] bool writeRecoverData(CompactBufferWriter& writer) const override; bool canRecoverOnBailout() const override { return true; } @@ -11090,7 +11090,7 @@ class MFloor return congruentIfOperandsEqual(ins); } void computeRange(TempAllocator& alloc) override; - MOZ_MUST_USE bool writeRecoverData(CompactBufferWriter& writer) const override; + [[nodiscard]] bool writeRecoverData(CompactBufferWriter& writer) const override; bool canRecoverOnBailout() const override { return true; } @@ -11131,7 +11131,7 @@ class MCeil return congruentIfOperandsEqual(ins); } void computeRange(TempAllocator& alloc) override; - MOZ_MUST_USE bool writeRecoverData(CompactBufferWriter& writer) const override; + [[nodiscard]] bool writeRecoverData(CompactBufferWriter& writer) const override; bool canRecoverOnBailout() const override { return true; } @@ -11173,7 +11173,7 @@ class MRound return congruentIfOperandsEqual(ins); } - MOZ_MUST_USE bool writeRecoverData(CompactBufferWriter& writer) const override; + [[nodiscard]] bool writeRecoverData(CompactBufferWriter& writer) const override; bool canRecoverOnBailout() const override { return true; } @@ -11397,7 +11397,7 @@ class MArgumentsLength : public MNullaryInstruction void computeRange(TempAllocator& alloc) override; - MOZ_MUST_USE bool writeRecoverData(CompactBufferWriter& writer) const override; + [[nodiscard]] bool writeRecoverData(CompactBufferWriter& writer) const override; bool canRecoverOnBailout() const override { return true; @@ -11910,7 +11910,7 @@ class MResumePoint final : protected: // Initializes operands_ to an empty array of a fixed length. // The array may then be filled in by inherit(). - MOZ_MUST_USE bool init(TempAllocator& alloc); + [[nodiscard]] bool init(TempAllocator& alloc); void clearOperand(size_t index) { // FixedList doesn't initialize its elements, so do an unchecked init. @@ -12000,7 +12000,7 @@ class MResumePoint final : } } - MOZ_MUST_USE bool writeRecoverData(CompactBufferWriter& writer) const override; + [[nodiscard]] bool writeRecoverData(CompactBufferWriter& writer) const override; // Register a store instruction on the current resume point. This // instruction would be recovered when we are bailing out. The |cache| @@ -12292,7 +12292,7 @@ class MAtomicIsLockFree return congruentIfOperandsEqual(ins); } - MOZ_MUST_USE bool writeRecoverData(CompactBufferWriter& writer) const override; + [[nodiscard]] bool writeRecoverData(CompactBufferWriter& writer) const override; bool canRecoverOnBailout() const override { return true; } diff --git a/js/src/jit/MIRGenerator.h b/js/src/jit/MIRGenerator.h index 53e1155be9..3f1ee61f38 100644 --- a/js/src/jit/MIRGenerator.h +++ b/js/src/jit/MIRGenerator.h @@ -48,7 +48,7 @@ class MIRGenerator MIRGraph& graph() { return *graph_; } - MOZ_MUST_USE bool ensureBallast() { + [[nodiscard]] bool ensureBallast() { return alloc().ensureBallast(); } const JitRuntime* jitRuntime() const { @@ -78,7 +78,7 @@ class MIRGenerator return error_; } - MOZ_MUST_USE bool instrumentedProfiling() { + [[nodiscard]] bool instrumentedProfiling() { if (!instrumentedProfilingIsCached_) { instrumentedProfiling_ = GetJitContext()->runtime->spsProfiler().enabled(); instrumentedProfilingIsCached_ = true; diff --git a/js/src/jit/MIRGraph.h b/js/src/jit/MIRGraph.h index d68be8039c..a404adc3e9 100644 --- a/js/src/jit/MIRGraph.h +++ b/js/src/jit/MIRGraph.h @@ -46,11 +46,11 @@ class MBasicBlock : public TempObject, public InlineListNode<MBasicBlock> private: MBasicBlock(MIRGraph& graph, const CompileInfo& info, BytecodeSite* site, Kind kind); - MOZ_MUST_USE bool init(); + [[nodiscard]] bool init(); void copySlots(MBasicBlock* from); - MOZ_MUST_USE bool inherit(TempAllocator& alloc, BytecodeAnalysis* analysis, MBasicBlock* pred, + [[nodiscard]] bool inherit(TempAllocator& alloc, BytecodeAnalysis* analysis, MBasicBlock* pred, uint32_t popped, unsigned stackPhiCount = 0); - MOZ_MUST_USE bool inheritResumePoint(MBasicBlock* pred); + [[nodiscard]] bool inheritResumePoint(MBasicBlock* pred); void assertUsesAreNotWithin(MUseIterator use, MUseIterator end); // This block cannot be reached by any means. @@ -154,8 +154,8 @@ class MBasicBlock : public TempObject, public InlineListNode<MBasicBlock> MDefinition* argumentsObject(); // Increase the number of slots available - MOZ_MUST_USE bool increaseSlots(size_t num); - MOZ_MUST_USE bool ensureHasSlots(size_t num); + [[nodiscard]] bool increaseSlots(size_t num); + [[nodiscard]] bool ensureHasSlots(size_t num); // Initializes a slot value; must not be called for normal stack // operations, as it will not create new SSA names for copies. @@ -166,7 +166,7 @@ class MBasicBlock : public TempObject, public InlineListNode<MBasicBlock> // In an OSR block, set all MOsrValues to use the MResumePoint attached to // the MStart. - MOZ_MUST_USE bool linkOsrValues(MStart* start); + [[nodiscard]] bool linkOsrValues(MStart* start); // Sets the instruction associated with various slot types. The // instruction must lie at the top of the stack. @@ -220,17 +220,17 @@ class MBasicBlock : public TempObject, public InlineListNode<MBasicBlock> // Adds a predecessor. Every predecessor must have the same exit stack // depth as the entry state to this block. Adding a predecessor // automatically creates phi nodes and rewrites uses as needed. - MOZ_MUST_USE bool addPredecessor(TempAllocator& alloc, MBasicBlock* pred); - MOZ_MUST_USE bool addPredecessorPopN(TempAllocator& alloc, MBasicBlock* pred, uint32_t popped); + [[nodiscard]] bool addPredecessor(TempAllocator& alloc, MBasicBlock* pred); + [[nodiscard]] bool addPredecessorPopN(TempAllocator& alloc, MBasicBlock* pred, uint32_t popped); // Add a predecessor which won't introduce any new phis to this block. // This may be called after the contents of this block have been built. void addPredecessorSameInputsAs(MBasicBlock* pred, MBasicBlock* existingPred); // Stranger utilities used for inlining. - MOZ_MUST_USE bool addPredecessorWithoutPhis(MBasicBlock* pred); + [[nodiscard]] bool addPredecessorWithoutPhis(MBasicBlock* pred); void inheritSlots(MBasicBlock* parent); - MOZ_MUST_USE bool initEntrySlots(TempAllocator& alloc); + [[nodiscard]] bool initEntrySlots(TempAllocator& alloc); // Replaces an edge for a given block with a new block. This is // used for critical edge splitting. @@ -255,8 +255,8 @@ class MBasicBlock : public TempObject, public InlineListNode<MBasicBlock> // Sets a back edge. This places phi nodes and rewrites instructions within // the current loop as necessary. If the backedge introduces new types for // phis at the loop header, returns a disabling abort. - MOZ_MUST_USE AbortReason setBackedge(TempAllocator& alloc, MBasicBlock* block); - MOZ_MUST_USE bool setBackedgeWasm(MBasicBlock* block); + [[nodiscard]] AbortReason setBackedge(TempAllocator& alloc, MBasicBlock* block); + [[nodiscard]] bool setBackedgeWasm(MBasicBlock* block); // Resets a LOOP_HEADER block to a NORMAL block. This is needed when // optimizations remove the backedge. @@ -271,11 +271,11 @@ class MBasicBlock : public TempObject, public InlineListNode<MBasicBlock> void inheritPhis(MBasicBlock* header); // Propagates backedge slots into phis operands of the loop header. - MOZ_MUST_USE bool inheritPhisFromBackedge(TempAllocator& alloc, MBasicBlock* backedge, + [[nodiscard]] bool inheritPhisFromBackedge(TempAllocator& alloc, MBasicBlock* backedge, bool* hadTypeChange); // Compute the types for phis in this block according to their inputs. - MOZ_MUST_USE bool specializePhis(TempAllocator& alloc); + [[nodiscard]] bool specializePhis(TempAllocator& alloc); void insertBefore(MInstruction* at, MInstruction* ins); void insertAfter(MInstruction* at, MInstruction* ins); @@ -683,7 +683,7 @@ class MBasicBlock : public TempObject, public InlineListNode<MBasicBlock> #endif public: explicit BackupPoint(MBasicBlock* current); - MOZ_MUST_USE bool init(TempAllocator& alloc); + [[nodiscard]] bool init(TempAllocator& alloc); MBasicBlock* restore(); }; @@ -804,7 +804,7 @@ class MIRGraph return returnAccumulator_; } - MOZ_MUST_USE bool addReturn(MBasicBlock* returnBlock) { + [[nodiscard]] bool addReturn(MBasicBlock* returnBlock) { if (!returnAccumulator_) return true; diff --git a/js/src/jit/MacroAssembler.h b/js/src/jit/MacroAssembler.h index f681456396..d9c0532c34 100644 --- a/js/src/jit/MacroAssembler.h +++ b/js/src/jit/MacroAssembler.h @@ -1886,10 +1886,10 @@ class MacroAssembler : public MacroAssemblerSpecific void convertValueToFloatingPoint(ValueOperand value, FloatRegister output, Label* fail, MIRType outputType); - MOZ_MUST_USE bool convertValueToFloatingPoint(JSContext* cx, const Value& v, + [[nodiscard]] bool convertValueToFloatingPoint(JSContext* cx, const Value& v, FloatRegister output, Label* fail, MIRType outputType); - MOZ_MUST_USE bool convertConstantOrRegisterToFloatingPoint(JSContext* cx, + [[nodiscard]] bool convertConstantOrRegisterToFloatingPoint(JSContext* cx, const ConstantOrRegister& src, FloatRegister output, Label* fail, MIRType outputType); @@ -1903,11 +1903,11 @@ class MacroAssembler : public MacroAssemblerSpecific void convertValueToDouble(ValueOperand value, FloatRegister output, Label* fail) { convertValueToFloatingPoint(value, output, fail, MIRType::Double); } - MOZ_MUST_USE bool convertValueToDouble(JSContext* cx, const Value& v, FloatRegister output, + [[nodiscard]] bool convertValueToDouble(JSContext* cx, const Value& v, FloatRegister output, Label* fail) { return convertValueToFloatingPoint(cx, v, output, fail, MIRType::Double); } - MOZ_MUST_USE bool convertConstantOrRegisterToDouble(JSContext* cx, + [[nodiscard]] bool convertConstantOrRegisterToDouble(JSContext* cx, const ConstantOrRegister& src, FloatRegister output, Label* fail) { @@ -1920,11 +1920,11 @@ class MacroAssembler : public MacroAssemblerSpecific void convertValueToFloat(ValueOperand value, FloatRegister output, Label* fail) { convertValueToFloatingPoint(value, output, fail, MIRType::Float32); } - MOZ_MUST_USE bool convertValueToFloat(JSContext* cx, const Value& v, FloatRegister output, + [[nodiscard]] bool convertValueToFloat(JSContext* cx, const Value& v, FloatRegister output, Label* fail) { return convertValueToFloatingPoint(cx, v, output, fail, MIRType::Float32); } - MOZ_MUST_USE bool convertConstantOrRegisterToFloat(JSContext* cx, + [[nodiscard]] bool convertConstantOrRegisterToFloat(JSContext* cx, const ConstantOrRegister& src, FloatRegister output, Label* fail) { @@ -1969,9 +1969,9 @@ class MacroAssembler : public MacroAssemblerSpecific convertValueToInt(value, nullptr, nullptr, nullptr, nullptr, InvalidReg, temp, output, fail, behavior); } - MOZ_MUST_USE bool convertValueToInt(JSContext* cx, const Value& v, Register output, Label* fail, + [[nodiscard]] bool convertValueToInt(JSContext* cx, const Value& v, Register output, Label* fail, IntConversionBehavior behavior); - MOZ_MUST_USE bool convertConstantOrRegisterToInt(JSContext* cx, + [[nodiscard]] bool convertConstantOrRegisterToInt(JSContext* cx, const ConstantOrRegister& src, FloatRegister temp, Register output, Label* fail, IntConversionBehavior behavior); @@ -1998,14 +1998,14 @@ class MacroAssembler : public MacroAssemblerSpecific : IntConversion_Normal, conversion); } - MOZ_MUST_USE bool convertValueToInt32(JSContext* cx, const Value& v, Register output, + [[nodiscard]] bool convertValueToInt32(JSContext* cx, const Value& v, Register output, Label* fail, bool negativeZeroCheck) { return convertValueToInt(cx, v, output, fail, negativeZeroCheck ? IntConversion_NegativeZeroCheck : IntConversion_Normal); } - MOZ_MUST_USE bool convertConstantOrRegisterToInt32(JSContext* cx, + [[nodiscard]] bool convertConstantOrRegisterToInt32(JSContext* cx, const ConstantOrRegister& src, FloatRegister temp, Register output, Label* fail, bool negativeZeroCheck) @@ -2042,11 +2042,11 @@ class MacroAssembler : public MacroAssemblerSpecific convertValueToInt(value, input, nullptr, nullptr, nullptr, InvalidReg, temp, output, fail, IntConversion_Truncate); } - MOZ_MUST_USE bool truncateValueToInt32(JSContext* cx, const Value& v, Register output, + [[nodiscard]] bool truncateValueToInt32(JSContext* cx, const Value& v, Register output, Label* fail) { return convertValueToInt(cx, v, output, fail, IntConversion_Truncate); } - MOZ_MUST_USE bool truncateConstantOrRegisterToInt32(JSContext* cx, + [[nodiscard]] bool truncateConstantOrRegisterToInt32(JSContext* cx, const ConstantOrRegister& src, FloatRegister temp, Register output, Label* fail) @@ -2076,11 +2076,11 @@ class MacroAssembler : public MacroAssemblerSpecific convertValueToInt(value, input, nullptr, nullptr, nullptr, InvalidReg, temp, output, fail, IntConversion_ClampToUint8); } - MOZ_MUST_USE bool clampValueToUint8(JSContext* cx, const Value& v, Register output, + [[nodiscard]] bool clampValueToUint8(JSContext* cx, const Value& v, Register output, Label* fail) { return convertValueToInt(cx, v, output, fail, IntConversion_ClampToUint8); } - MOZ_MUST_USE bool clampConstantOrRegisterToUint8(JSContext* cx, + [[nodiscard]] bool clampConstantOrRegisterToUint8(JSContext* cx, const ConstantOrRegister& src, FloatRegister temp, Register output, Label* fail) @@ -2114,7 +2114,7 @@ class MacroAssembler : public MacroAssemblerSpecific void restoreFrameAlignmentForICArguments(AfterICSaveLive& aic) PER_ARCH; AfterICSaveLive icSaveLive(LiveRegisterSet& liveRegs); - MOZ_MUST_USE bool icBuildOOLFakeExitFrame(void* fakeReturnAddr, AfterICSaveLive& aic); + [[nodiscard]] bool icBuildOOLFakeExitFrame(void* fakeReturnAddr, AfterICSaveLive& aic); void icRestoreLive(LiveRegisterSet& liveRegs, AfterICSaveLive& aic); // Align the stack pointer based on the number of arguments which are pushed diff --git a/js/src/jit/MoveResolver.h b/js/src/jit/MoveResolver.h index f52d6bc99a..40809b77c6 100644 --- a/js/src/jit/MoveResolver.h +++ b/js/src/jit/MoveResolver.h @@ -299,7 +299,7 @@ class MoveResolver PendingMove* findBlockingMove(const PendingMove* last); PendingMove* findCycledMove(PendingMoveIterator* stack, PendingMoveIterator end, const PendingMove* first); - MOZ_MUST_USE bool addOrderedMove(const MoveOp& move); + [[nodiscard]] bool addOrderedMove(const MoveOp& move); void reorderMove(size_t from, size_t to); // Internal reset function. Does not clear lists. @@ -319,8 +319,8 @@ class MoveResolver // // After calling addMove() for each parallel move, resolve() performs the // cycle resolution algorithm. Calling addMove() again resets the resolver. - MOZ_MUST_USE bool addMove(const MoveOperand& from, const MoveOperand& to, MoveOp::Type type); - MOZ_MUST_USE bool resolve(); + [[nodiscard]] bool addMove(const MoveOperand& from, const MoveOperand& to, MoveOp::Type type); + [[nodiscard]] bool resolve(); void sortMemoryToMemoryMoves(); size_t numMoves() const { diff --git a/js/src/jit/OptimizationTracking.h b/js/src/jit/OptimizationTracking.h index 1854fc1652..d2d6909369 100644 --- a/js/src/jit/OptimizationTracking.h +++ b/js/src/jit/OptimizationTracking.h @@ -74,8 +74,8 @@ class OptimizationTypeInfo types_(alloc) { } - MOZ_MUST_USE bool trackTypeSet(TemporaryTypeSet* typeSet); - MOZ_MUST_USE bool trackType(TypeSet::Type type); + [[nodiscard]] bool trackTypeSet(TemporaryTypeSet* typeSet); + [[nodiscard]] bool trackType(TypeSet::Type type); JS::TrackedTypeSite site() const { return site_; } MIRType mirType() const { return mirType_; } @@ -86,8 +86,8 @@ class OptimizationTypeInfo HashNumber hash() const; - MOZ_MUST_USE bool writeCompact(JSContext* cx, CompactBufferWriter& writer, - UniqueTrackedTypes& uniqueTypes) const; + [[nodiscard]] bool writeCompact(JSContext* cx, CompactBufferWriter& writer, + UniqueTrackedTypes& uniqueTypes) const; }; typedef Vector<OptimizationTypeInfo, 1, JitAllocPolicy> TempOptimizationTypeInfoVector; @@ -113,9 +113,9 @@ class TrackedOptimizations : public TempObject currentAttempt_ = UINT32_MAX; } - MOZ_MUST_USE bool trackTypeInfo(OptimizationTypeInfo&& ty); + [[nodiscard]] bool trackTypeInfo(OptimizationTypeInfo&& ty); - MOZ_MUST_USE bool trackAttempt(JS::TrackedStrategy strategy); + [[nodiscard]] bool trackAttempt(JS::TrackedStrategy strategy); void amendAttempt(uint32_t index); void trackOutcome(JS::TrackedOutcome outcome); void trackSuccess(); @@ -173,10 +173,10 @@ class UniqueTrackedOptimizations sorted_(cx) { } - MOZ_MUST_USE bool init() { return map_.init(); } - MOZ_MUST_USE bool add(const TrackedOptimizations* optimizations); + [[nodiscard]] bool init() { return map_.init(); } + [[nodiscard]] bool add(const TrackedOptimizations* optimizations); - MOZ_MUST_USE bool sortByFrequency(JSContext* cx); + [[nodiscard]] bool sortByFrequency(JSContext* cx); bool sorted() const { return !sorted_.empty(); } uint32_t count() const { MOZ_ASSERT(sorted()); return sorted_.length(); } const SortedVector& sortedVector() const { MOZ_ASSERT(sorted()); return sorted_; } @@ -406,10 +406,10 @@ class IonTrackedOptimizationsRegion uint8_t* index); static void WriteDelta(CompactBufferWriter& writer, uint32_t startDelta, uint32_t length, uint8_t index); - static MOZ_MUST_USE bool WriteRun(CompactBufferWriter& writer, - const NativeToTrackedOptimizations* start, - const NativeToTrackedOptimizations* end, - const UniqueTrackedOptimizations& unique); + [[nodiscard]] static bool WriteRun(CompactBufferWriter& writer, + const NativeToTrackedOptimizations* start, + const NativeToTrackedOptimizations* end, + const UniqueTrackedOptimizations& unique); }; class IonTrackedOptimizationsAttempts @@ -559,7 +559,7 @@ typedef IonTrackedOptimizationsOffsetsTable<IonTrackedOptimizationsAttempts> typedef IonTrackedOptimizationsOffsetsTable<IonTrackedOptimizationsTypeInfo> IonTrackedOptimizationsTypesTable; -MOZ_MUST_USE bool +[[nodiscard]] bool WriteIonTrackedOptimizationsTable(JSContext* cx, CompactBufferWriter& writer, const NativeToTrackedOptimizations* start, const NativeToTrackedOptimizations* end, diff --git a/js/src/jit/PcScriptCache.h b/js/src/jit/PcScriptCache.h index 03f8f311b4..c3060f3ea4 100644 --- a/js/src/jit/PcScriptCache.h +++ b/js/src/jit/PcScriptCache.h @@ -40,8 +40,8 @@ struct PcScriptCache } // Get a value from the cache. May perform lazy allocation. - MOZ_MUST_USE bool get(JSRuntime* rt, uint32_t hash, uint8_t* addr, - JSScript** scriptRes, jsbytecode** pcRes) + [[nodiscard]] bool get(JSRuntime* rt, uint32_t hash, uint8_t* addr, + JSScript** scriptRes, jsbytecode** pcRes) { // If a GC occurred, lazily clear the cache now. if (gcNumber != rt->gc.gcNumber()) { diff --git a/js/src/jit/PerfSpewer.h b/js/src/jit/PerfSpewer.h index 465058574b..046e17838f 100644 --- a/js/src/jit/PerfSpewer.h +++ b/js/src/jit/PerfSpewer.h @@ -65,9 +65,9 @@ class PerfSpewer BasicBlocksVector basicBlocks_; public: - virtual MOZ_MUST_USE bool startBasicBlock(MBasicBlock* blk, MacroAssembler& masm); - virtual MOZ_MUST_USE bool endBasicBlock(MacroAssembler& masm); - MOZ_MUST_USE bool noteEndInlineCode(MacroAssembler& masm); + [[nodiscard]] virtual bool startBasicBlock(MBasicBlock* blk, MacroAssembler& masm); + [[nodiscard]] virtual bool endBasicBlock(MacroAssembler& masm); + [[nodiscard]] bool noteEndInlineCode(MacroAssembler& masm); void writeProfile(JSScript* script, JitCode* code, MacroAssembler& masm); }; @@ -79,8 +79,8 @@ void writePerfSpewerJitCodeProfile(JitCode* code, const char* msg); class WasmPerfSpewer : public PerfSpewer { public: - MOZ_MUST_USE bool startBasicBlock(MBasicBlock* blk, MacroAssembler& masm) { return true; } - MOZ_MUST_USE bool endBasicBlock(MacroAssembler& masm) { return true; } + [[nodiscard]] bool startBasicBlock(MBasicBlock* blk, MacroAssembler& masm) { return true; } + [[nodiscard]] bool endBasicBlock(MacroAssembler& masm) { return true; } }; void writePerfSpewerWasmFunctionMap(uintptr_t base, uintptr_t size, const char* filename, diff --git a/js/src/jit/ProcessExecutableMemory.cpp b/js/src/jit/ProcessExecutableMemory.cpp index 7c40d93c71..a49ac22e77 100644 --- a/js/src/jit/ProcessExecutableMemory.cpp +++ b/js/src/jit/ProcessExecutableMemory.cpp @@ -441,7 +441,7 @@ class ProcessExecutableMemory pages_() {} - MOZ_MUST_USE bool init() { + [[nodiscard]] bool init() { pages_.init(); MOZ_RELEASE_ASSERT(!initialized()); diff --git a/js/src/jit/ProcessExecutableMemory.h b/js/src/jit/ProcessExecutableMemory.h index 45c9c23b8c..efc47247fa 100644 --- a/js/src/jit/ProcessExecutableMemory.h +++ b/js/src/jit/ProcessExecutableMemory.h @@ -22,11 +22,11 @@ enum class ProtectionSetting { Executable, }; -extern MOZ_MUST_USE bool ReprotectRegion(void* start, size_t size, ProtectionSetting protection); +[[nodiscard]] extern bool ReprotectRegion(void* start, size_t size, ProtectionSetting protection); // Functions called at process start-up/shutdown to initialize/release the // executable memory region. -extern MOZ_MUST_USE bool InitProcessExecutableMemory(); +[[nodiscard]] extern bool InitProcessExecutableMemory(); extern void ReleaseProcessExecutableMemory(); // Allocate/deallocate executable pages. diff --git a/js/src/jit/RangeAnalysis.h b/js/src/jit/RangeAnalysis.h index 16fe93e000..879a20c940 100644 --- a/js/src/jit/RangeAnalysis.h +++ b/js/src/jit/RangeAnalysis.h @@ -103,24 +103,24 @@ class RangeAnalysis public: RangeAnalysis(MIRGenerator* mir, MIRGraph& graph) : mir(mir), graph_(graph) {} - MOZ_MUST_USE bool addBetaNodes(); - MOZ_MUST_USE bool analyze(); - MOZ_MUST_USE bool addRangeAssertions(); - MOZ_MUST_USE bool removeBetaNodes(); - MOZ_MUST_USE bool prepareForUCE(bool* shouldRemoveDeadCode); - MOZ_MUST_USE bool tryRemovingGuards(); - MOZ_MUST_USE bool truncate(); - MOZ_MUST_USE bool removeUnnecessaryBitops(); + [[nodiscard]] bool addBetaNodes(); + [[nodiscard]] bool analyze(); + [[nodiscard]] bool addRangeAssertions(); + [[nodiscard]] bool removeBetaNodes(); + [[nodiscard]] bool prepareForUCE(bool* shouldRemoveDeadCode); + [[nodiscard]] bool tryRemovingGuards(); + [[nodiscard]] bool truncate(); + [[nodiscard]] bool removeUnnecessaryBitops(); // Any iteration bounds discovered for loops in the graph. LoopIterationBoundVector loopIterationBounds; private: - MOZ_MUST_USE bool analyzeLoop(MBasicBlock* header); + [[nodiscard]] bool analyzeLoop(MBasicBlock* header); LoopIterationBound* analyzeLoopIterationCount(MBasicBlock* header, MTest* test, BranchDirection direction); void analyzeLoopPhi(MBasicBlock* header, LoopIterationBound* loopBound, MPhi* phi); - MOZ_MUST_USE bool tryHoistBoundsCheck(MBasicBlock* header, MBoundsCheck* ins); + [[nodiscard]] bool tryHoistBoundsCheck(MBasicBlock* header, MBoundsCheck* ins); }; class Range : public TempObject { @@ -455,7 +455,7 @@ class Range : public TempObject { void dump(GenericPrinter& out) const; void dump() const; - MOZ_MUST_USE bool update(const Range* other); + [[nodiscard]] bool update(const Range* other); // Unlike the other operations, unionWith is an in-place // modification. This is to avoid a bunch of useless extra @@ -485,7 +485,7 @@ class Range : public TempObject { static Range* sign(TempAllocator& alloc, const Range* op); static Range* NaNToZero(TempAllocator& alloc, const Range* op); - static MOZ_MUST_USE bool negativeZeroMul(const Range* lhs, const Range* rhs); + [[nodiscard]] static bool negativeZeroMul(const Range* lhs, const Range* rhs); bool isUnknownInt32() const { return isInt32() && lower() == INT32_MIN && upper() == INT32_MAX; diff --git a/js/src/jit/Recover.h b/js/src/jit/Recover.h index ee330d78e5..dc4e9bed50 100644 --- a/js/src/jit/Recover.h +++ b/js/src/jit/Recover.h @@ -143,7 +143,7 @@ class MOZ_NON_PARAM RInstruction // Function used to recover the value computed by this instruction. This // function reads its arguments from the allocations listed on the snapshot // iterator and stores its returned value on the snapshot iterator too. - virtual MOZ_MUST_USE bool recover(JSContext* cx, SnapshotIterator& iter) const = 0; + [[nodiscard]] virtual bool recover(JSContext* cx, SnapshotIterator& iter) const = 0; // Decode an RInstruction on top of the reserved storage space, based on the // tag written by the writeRecoverData function of the corresponding MIR @@ -195,7 +195,7 @@ class RResumePoint final : public RInstruction uint32_t numOperands() const override { return numOperands_; } - MOZ_MUST_USE bool recover(JSContext* cx, SnapshotIterator& iter) const override; + [[nodiscard]] bool recover(JSContext* cx, SnapshotIterator& iter) const override; }; class RBitNot final : public RInstruction @@ -203,7 +203,7 @@ class RBitNot final : public RInstruction public: RINSTRUCTION_HEADER_NUM_OP_(BitNot, 1) - MOZ_MUST_USE bool recover(JSContext* cx, SnapshotIterator& iter) const override; + [[nodiscard]] bool recover(JSContext* cx, SnapshotIterator& iter) const override; }; class RBitAnd final : public RInstruction @@ -211,7 +211,7 @@ class RBitAnd final : public RInstruction public: RINSTRUCTION_HEADER_NUM_OP_(BitAnd, 2) - MOZ_MUST_USE bool recover(JSContext* cx, SnapshotIterator& iter) const override; + [[nodiscard]] bool recover(JSContext* cx, SnapshotIterator& iter) const override; }; class RBitOr final : public RInstruction @@ -219,7 +219,7 @@ class RBitOr final : public RInstruction public: RINSTRUCTION_HEADER_NUM_OP_(BitOr, 2) - MOZ_MUST_USE bool recover(JSContext* cx, SnapshotIterator& iter) const override; + [[nodiscard]] bool recover(JSContext* cx, SnapshotIterator& iter) const override; }; class RBitXor final : public RInstruction @@ -227,7 +227,7 @@ class RBitXor final : public RInstruction public: RINSTRUCTION_HEADER_NUM_OP_(BitXor, 2) - MOZ_MUST_USE bool recover(JSContext* cx, SnapshotIterator& iter) const override; + [[nodiscard]] bool recover(JSContext* cx, SnapshotIterator& iter) const override; }; class RLsh final : public RInstruction @@ -235,7 +235,7 @@ class RLsh final : public RInstruction public: RINSTRUCTION_HEADER_NUM_OP_(Lsh, 2) - MOZ_MUST_USE bool recover(JSContext* cx, SnapshotIterator& iter) const override; + [[nodiscard]] bool recover(JSContext* cx, SnapshotIterator& iter) const override; }; class RRsh final : public RInstruction @@ -243,7 +243,7 @@ class RRsh final : public RInstruction public: RINSTRUCTION_HEADER_NUM_OP_(Rsh, 2) - MOZ_MUST_USE bool recover(JSContext* cx, SnapshotIterator& iter) const override; + [[nodiscard]] bool recover(JSContext* cx, SnapshotIterator& iter) const override; }; class RUrsh final : public RInstruction @@ -251,7 +251,7 @@ class RUrsh final : public RInstruction public: RINSTRUCTION_HEADER_NUM_OP_(Ursh, 2) - MOZ_MUST_USE bool recover(JSContext* cx, SnapshotIterator& iter) const override; + [[nodiscard]] bool recover(JSContext* cx, SnapshotIterator& iter) const override; }; class RSignExtendInt32 final : public RInstruction @@ -262,7 +262,7 @@ class RSignExtendInt32 final : public RInstruction public: RINSTRUCTION_HEADER_NUM_OP_(SignExtendInt32, 1) - MOZ_MUST_USE bool recover(JSContext* cx, SnapshotIterator& iter) const override; + [[nodiscard]] bool recover(JSContext* cx, SnapshotIterator& iter) const override; }; class RAdd final : public RInstruction @@ -273,7 +273,7 @@ class RAdd final : public RInstruction public: RINSTRUCTION_HEADER_NUM_OP_(Add, 2) - MOZ_MUST_USE bool recover(JSContext* cx, SnapshotIterator& iter) const override; + [[nodiscard]] bool recover(JSContext* cx, SnapshotIterator& iter) const override; }; class RSub final : public RInstruction @@ -284,7 +284,7 @@ class RSub final : public RInstruction public: RINSTRUCTION_HEADER_NUM_OP_(Sub, 2) - MOZ_MUST_USE bool recover(JSContext* cx, SnapshotIterator& iter) const override; + [[nodiscard]] bool recover(JSContext* cx, SnapshotIterator& iter) const override; }; class RMul final : public RInstruction @@ -296,7 +296,7 @@ class RMul final : public RInstruction public: RINSTRUCTION_HEADER_NUM_OP_(Mul, 2) - MOZ_MUST_USE bool recover(JSContext* cx, SnapshotIterator& iter) const override; + [[nodiscard]] bool recover(JSContext* cx, SnapshotIterator& iter) const override; }; class RDiv final : public RInstruction @@ -307,7 +307,7 @@ class RDiv final : public RInstruction public: RINSTRUCTION_HEADER_NUM_OP_(Div, 2) - MOZ_MUST_USE bool recover(JSContext* cx, SnapshotIterator& iter) const override; + [[nodiscard]] bool recover(JSContext* cx, SnapshotIterator& iter) const override; }; class RMod final : public RInstruction @@ -315,7 +315,7 @@ class RMod final : public RInstruction public: RINSTRUCTION_HEADER_NUM_OP_(Mod, 2) - MOZ_MUST_USE bool recover(JSContext* cx, SnapshotIterator& iter) const override; + [[nodiscard]] bool recover(JSContext* cx, SnapshotIterator& iter) const override; }; class RNot final : public RInstruction @@ -323,7 +323,7 @@ class RNot final : public RInstruction public: RINSTRUCTION_HEADER_NUM_OP_(Not, 1) - MOZ_MUST_USE bool recover(JSContext* cx, SnapshotIterator& iter) const override; + [[nodiscard]] bool recover(JSContext* cx, SnapshotIterator& iter) const override; }; class RConcat final : public RInstruction @@ -331,7 +331,7 @@ class RConcat final : public RInstruction public: RINSTRUCTION_HEADER_NUM_OP_(Concat, 2) - MOZ_MUST_USE bool recover(JSContext* cx, SnapshotIterator& iter) const override; + [[nodiscard]] bool recover(JSContext* cx, SnapshotIterator& iter) const override; }; class RStringLength final : public RInstruction @@ -339,7 +339,7 @@ class RStringLength final : public RInstruction public: RINSTRUCTION_HEADER_NUM_OP_(StringLength, 1) - MOZ_MUST_USE bool recover(JSContext* cx, SnapshotIterator& iter) const override; + [[nodiscard]] bool recover(JSContext* cx, SnapshotIterator& iter) const override; }; class RArgumentsLength final : public RInstruction @@ -347,7 +347,7 @@ class RArgumentsLength final : public RInstruction public: RINSTRUCTION_HEADER_NUM_OP_(ArgumentsLength, 0) - MOZ_MUST_USE bool recover(JSContext* cx, SnapshotIterator& iter) const override; + [[nodiscard]] bool recover(JSContext* cx, SnapshotIterator& iter) const override; }; @@ -356,7 +356,7 @@ class RFloor final : public RInstruction public: RINSTRUCTION_HEADER_NUM_OP_(Floor, 1) - MOZ_MUST_USE bool recover(JSContext* cx, SnapshotIterator& iter) const override; + [[nodiscard]] bool recover(JSContext* cx, SnapshotIterator& iter) const override; }; class RCeil final : public RInstruction @@ -364,7 +364,7 @@ class RCeil final : public RInstruction public: RINSTRUCTION_HEADER_NUM_OP_(Ceil, 1) - MOZ_MUST_USE bool recover(JSContext* cx, SnapshotIterator& iter) const override; + [[nodiscard]] bool recover(JSContext* cx, SnapshotIterator& iter) const override; }; class RRound final : public RInstruction @@ -372,7 +372,7 @@ class RRound final : public RInstruction public: RINSTRUCTION_HEADER_NUM_OP_(Round, 1) - MOZ_MUST_USE bool recover(JSContext* cx, SnapshotIterator& iter) const override; + [[nodiscard]] bool recover(JSContext* cx, SnapshotIterator& iter) const override; }; class RCharCodeAt final : public RInstruction @@ -380,7 +380,7 @@ class RCharCodeAt final : public RInstruction public: RINSTRUCTION_HEADER_NUM_OP_(CharCodeAt, 2) - MOZ_MUST_USE bool recover(JSContext* cx, SnapshotIterator& iter) const override; + [[nodiscard]] bool recover(JSContext* cx, SnapshotIterator& iter) const override; }; class RFromCharCode final : public RInstruction @@ -388,7 +388,7 @@ class RFromCharCode final : public RInstruction public: RINSTRUCTION_HEADER_NUM_OP_(FromCharCode, 1) - MOZ_MUST_USE bool recover(JSContext* cx, SnapshotIterator& iter) const override; + [[nodiscard]] bool recover(JSContext* cx, SnapshotIterator& iter) const override; }; class RPow final : public RInstruction @@ -396,7 +396,7 @@ class RPow final : public RInstruction public: RINSTRUCTION_HEADER_NUM_OP_(Pow, 2) - MOZ_MUST_USE bool recover(JSContext* cx, SnapshotIterator& iter) const override; + [[nodiscard]] bool recover(JSContext* cx, SnapshotIterator& iter) const override; }; class RPowHalf final : public RInstruction @@ -404,7 +404,7 @@ class RPowHalf final : public RInstruction public: RINSTRUCTION_HEADER_NUM_OP_(PowHalf, 1) - MOZ_MUST_USE bool recover(JSContext* cx, SnapshotIterator& iter) const override; + [[nodiscard]] bool recover(JSContext* cx, SnapshotIterator& iter) const override; }; class RMinMax final : public RInstruction @@ -415,7 +415,7 @@ class RMinMax final : public RInstruction public: RINSTRUCTION_HEADER_NUM_OP_(MinMax, 2) - MOZ_MUST_USE bool recover(JSContext* cx, SnapshotIterator& iter) const override; + [[nodiscard]] bool recover(JSContext* cx, SnapshotIterator& iter) const override; }; class RAbs final : public RInstruction @@ -423,7 +423,7 @@ class RAbs final : public RInstruction public: RINSTRUCTION_HEADER_NUM_OP_(Abs, 1) - MOZ_MUST_USE bool recover(JSContext* cx, SnapshotIterator& iter) const override; + [[nodiscard]] bool recover(JSContext* cx, SnapshotIterator& iter) const override; }; class RSqrt final : public RInstruction @@ -434,7 +434,7 @@ class RSqrt final : public RInstruction public: RINSTRUCTION_HEADER_NUM_OP_(Sqrt, 1) - MOZ_MUST_USE bool recover(JSContext* cx, SnapshotIterator& iter) const override; + [[nodiscard]] bool recover(JSContext* cx, SnapshotIterator& iter) const override; }; class RAtan2 final : public RInstruction @@ -442,7 +442,7 @@ class RAtan2 final : public RInstruction public: RINSTRUCTION_HEADER_NUM_OP_(Atan2, 2) - MOZ_MUST_USE bool recover(JSContext* cx, SnapshotIterator& iter) const override; + [[nodiscard]] bool recover(JSContext* cx, SnapshotIterator& iter) const override; }; class RHypot final : public RInstruction @@ -457,7 +457,7 @@ class RHypot final : public RInstruction return numOperands_; } - MOZ_MUST_USE bool recover(JSContext* cx, SnapshotIterator& iter) const override; + [[nodiscard]] bool recover(JSContext* cx, SnapshotIterator& iter) const override; }; class RMathFunction final : public RInstruction @@ -468,14 +468,14 @@ class RMathFunction final : public RInstruction public: RINSTRUCTION_HEADER_NUM_OP_(MathFunction, 1) - MOZ_MUST_USE bool recover(JSContext* cx, SnapshotIterator& iter) const override; + [[nodiscard]] bool recover(JSContext* cx, SnapshotIterator& iter) const override; }; class RRandom final : public RInstruction { RINSTRUCTION_HEADER_NUM_OP_(Random, 0) public: - MOZ_MUST_USE bool recover(JSContext* cx, SnapshotIterator& iter) const override; + [[nodiscard]] bool recover(JSContext* cx, SnapshotIterator& iter) const override; }; class RStringSplit final : public RInstruction @@ -483,7 +483,7 @@ class RStringSplit final : public RInstruction public: RINSTRUCTION_HEADER_NUM_OP_(StringSplit, 3) - MOZ_MUST_USE bool recover(JSContext* cx, SnapshotIterator& iter) const override; + [[nodiscard]] bool recover(JSContext* cx, SnapshotIterator& iter) const override; }; class RNaNToZero final : public RInstruction @@ -499,7 +499,7 @@ class RRegExpMatcher final : public RInstruction public: RINSTRUCTION_HEADER_NUM_OP_(RegExpMatcher, 3) - MOZ_MUST_USE bool recover(JSContext* cx, SnapshotIterator& iter) const override; + [[nodiscard]] bool recover(JSContext* cx, SnapshotIterator& iter) const override; }; class RRegExpSearcher final : public RInstruction @@ -507,7 +507,7 @@ class RRegExpSearcher final : public RInstruction public: RINSTRUCTION_HEADER_NUM_OP_(RegExpSearcher, 3) - MOZ_MUST_USE bool recover(JSContext* cx, SnapshotIterator& iter) const override; + [[nodiscard]] bool recover(JSContext* cx, SnapshotIterator& iter) const override; }; class RRegExpTester final : public RInstruction @@ -515,7 +515,7 @@ class RRegExpTester final : public RInstruction public: RINSTRUCTION_HEADER_NUM_OP_(RegExpTester, 3) - MOZ_MUST_USE bool recover(JSContext* cx, SnapshotIterator& iter) const override; + [[nodiscard]] bool recover(JSContext* cx, SnapshotIterator& iter) const override; }; class RStringReplace final : public RInstruction @@ -526,7 +526,7 @@ class RStringReplace final : public RInstruction public: RINSTRUCTION_HEADER_NUM_OP_(StringReplace, 3) - MOZ_MUST_USE bool recover(JSContext* cx, SnapshotIterator& iter) const override; + [[nodiscard]] bool recover(JSContext* cx, SnapshotIterator& iter) const override; }; class RTypeOf final : public RInstruction @@ -534,7 +534,7 @@ class RTypeOf final : public RInstruction public: RINSTRUCTION_HEADER_NUM_OP_(TypeOf, 1) - MOZ_MUST_USE bool recover(JSContext* cx, SnapshotIterator& iter) const override; + [[nodiscard]] bool recover(JSContext* cx, SnapshotIterator& iter) const override; }; class RToDouble final : public RInstruction @@ -542,7 +542,7 @@ class RToDouble final : public RInstruction public: RINSTRUCTION_HEADER_NUM_OP_(ToDouble, 1) - MOZ_MUST_USE bool recover(JSContext* cx, SnapshotIterator& iter) const override; + [[nodiscard]] bool recover(JSContext* cx, SnapshotIterator& iter) const override; }; class RToFloat32 final : public RInstruction @@ -550,7 +550,7 @@ class RToFloat32 final : public RInstruction public: RINSTRUCTION_HEADER_NUM_OP_(ToFloat32, 1) - MOZ_MUST_USE bool recover(JSContext* cx, SnapshotIterator& iter) const override; + [[nodiscard]] bool recover(JSContext* cx, SnapshotIterator& iter) const override; }; class RTruncateToInt32 final : public RInstruction @@ -558,7 +558,7 @@ class RTruncateToInt32 final : public RInstruction public: RINSTRUCTION_HEADER_NUM_OP_(TruncateToInt32, 1) - MOZ_MUST_USE bool recover(JSContext* cx, SnapshotIterator& iter) const override; + [[nodiscard]] bool recover(JSContext* cx, SnapshotIterator& iter) const override; }; class RNewObject final : public RInstruction @@ -569,7 +569,7 @@ class RNewObject final : public RInstruction public: RINSTRUCTION_HEADER_NUM_OP_(NewObject, 1) - MOZ_MUST_USE bool recover(JSContext* cx, SnapshotIterator& iter) const override; + [[nodiscard]] bool recover(JSContext* cx, SnapshotIterator& iter) const override; }; class RNewTypedArray final : public RInstruction @@ -577,7 +577,7 @@ class RNewTypedArray final : public RInstruction public: RINSTRUCTION_HEADER_NUM_OP_(NewTypedArray, 1) - MOZ_MUST_USE bool recover(JSContext* cx, SnapshotIterator& iter) const override; + [[nodiscard]] bool recover(JSContext* cx, SnapshotIterator& iter) const override; }; class RNewArray final : public RInstruction @@ -588,7 +588,7 @@ class RNewArray final : public RInstruction public: RINSTRUCTION_HEADER_NUM_OP_(NewArray, 1) - MOZ_MUST_USE bool recover(JSContext* cx, SnapshotIterator& iter) const override; + [[nodiscard]] bool recover(JSContext* cx, SnapshotIterator& iter) const override; }; class RNewDerivedTypedObject final : public RInstruction @@ -596,7 +596,7 @@ class RNewDerivedTypedObject final : public RInstruction public: RINSTRUCTION_HEADER_NUM_OP_(NewDerivedTypedObject, 3) - MOZ_MUST_USE bool recover(JSContext* cx, SnapshotIterator& iter) const override; + [[nodiscard]] bool recover(JSContext* cx, SnapshotIterator& iter) const override; }; class RCreateThisWithTemplate final : public RInstruction @@ -604,7 +604,7 @@ class RCreateThisWithTemplate final : public RInstruction public: RINSTRUCTION_HEADER_NUM_OP_(CreateThisWithTemplate, 1) - MOZ_MUST_USE bool recover(JSContext* cx, SnapshotIterator& iter) const override; + [[nodiscard]] bool recover(JSContext* cx, SnapshotIterator& iter) const override; }; class RLambda final : public RInstruction @@ -612,7 +612,7 @@ class RLambda final : public RInstruction public: RINSTRUCTION_HEADER_NUM_OP_(Lambda, 2) - MOZ_MUST_USE bool recover(JSContext* cx, SnapshotIterator& iter) const override; + [[nodiscard]] bool recover(JSContext* cx, SnapshotIterator& iter) const override; }; class RObjectState final : public RInstruction @@ -631,7 +631,7 @@ class RObjectState final : public RInstruction return numSlots() + 1; } - MOZ_MUST_USE bool recover(JSContext* cx, SnapshotIterator& iter) const override; + [[nodiscard]] bool recover(JSContext* cx, SnapshotIterator& iter) const override; }; class RArrayState final : public RInstruction @@ -651,7 +651,7 @@ class RArrayState final : public RInstruction return numElements() + 2; } - MOZ_MUST_USE bool recover(JSContext* cx, SnapshotIterator& iter) const override; + [[nodiscard]] bool recover(JSContext* cx, SnapshotIterator& iter) const override; }; class RAtomicIsLockFree final : public RInstruction @@ -659,7 +659,7 @@ class RAtomicIsLockFree final : public RInstruction public: RINSTRUCTION_HEADER_NUM_OP_(AtomicIsLockFree, 1) - MOZ_MUST_USE bool recover(JSContext* cx, SnapshotIterator& iter) const override; + [[nodiscard]] bool recover(JSContext* cx, SnapshotIterator& iter) const override; }; class RAssertRecoveredOnBailout final : public RInstruction @@ -667,7 +667,7 @@ class RAssertRecoveredOnBailout final : public RInstruction public: RINSTRUCTION_HEADER_NUM_OP_(AssertRecoveredOnBailout, 1) - MOZ_MUST_USE bool recover(JSContext* cx, SnapshotIterator& iter) const override; + [[nodiscard]] bool recover(JSContext* cx, SnapshotIterator& iter) const override; }; #undef RINSTRUCTION_HEADER_ diff --git a/js/src/jit/RegisterAllocator.h b/js/src/jit/RegisterAllocator.h index 97333fbdca..39ead5df27 100644 --- a/js/src/jit/RegisterAllocator.h +++ b/js/src/jit/RegisterAllocator.h @@ -36,13 +36,13 @@ struct AllocationIntegrityState // Record all virtual registers in the graph. This must be called before // register allocation, to pick up the original LUses. - MOZ_MUST_USE bool record(); + [[nodiscard]] bool record(); // Perform the liveness analysis on the graph, and assert on an invalid // allocation. This must be called after register allocation, to pick up // all assigned physical values. If populateSafepoints is specified, // safepoints will be filled in with liveness information. - MOZ_MUST_USE bool check(bool populateSafepoints); + [[nodiscard]] bool check(bool populateSafepoints); private: @@ -121,11 +121,11 @@ struct AllocationIntegrityState typedef HashSet<IntegrityItem, IntegrityItem, SystemAllocPolicy> IntegrityItemSet; IntegrityItemSet seen; - MOZ_MUST_USE bool checkIntegrity(LBlock* block, LInstruction* ins, uint32_t vreg, + [[nodiscard]] bool checkIntegrity(LBlock* block, LInstruction* ins, uint32_t vreg, LAllocation alloc, bool populateSafepoints); - MOZ_MUST_USE bool checkSafepointAllocation(LInstruction* ins, uint32_t vreg, LAllocation alloc, + [[nodiscard]] bool checkSafepointAllocation(LInstruction* ins, uint32_t vreg, LAllocation alloc, bool populateSafepoints); - MOZ_MUST_USE bool addPredecessor(LBlock* block, uint32_t vreg, LAllocation alloc); + [[nodiscard]] bool addPredecessor(LBlock* block, uint32_t vreg, LAllocation alloc); void dump(); }; @@ -232,7 +232,7 @@ class InstructionDataMap : insData_() { } - MOZ_MUST_USE bool init(MIRGenerator* gen, uint32_t numInstructions) { + [[nodiscard]] bool init(MIRGenerator* gen, uint32_t numInstructions) { if (!insData_.init(gen->alloc(), numInstructions)) return false; memset(&insData_[0], 0, sizeof(LNode*) * numInstructions); @@ -296,7 +296,7 @@ class RegisterAllocator } } - MOZ_MUST_USE bool init(); + [[nodiscard]] bool init(); TempAllocator& alloc() const { return mir->alloc(); diff --git a/js/src/jit/RematerializedFrame.h b/js/src/jit/RematerializedFrame.h index fa3a9ef49f..694b3d02cd 100644 --- a/js/src/jit/RematerializedFrame.h +++ b/js/src/jit/RematerializedFrame.h @@ -72,10 +72,10 @@ class RematerializedFrame // Rematerialize all remaining frames pointed to by |iter| into |frames| // in older-to-younger order, e.g., frames[0] is the oldest frame. - static MOZ_MUST_USE bool RematerializeInlineFrames(JSContext* cx, uint8_t* top, - InlineFrameIterator& iter, - MaybeReadFallback& fallback, - GCVector<RematerializedFrame*>& frames); + [[nodiscard]] static bool RematerializeInlineFrames(JSContext* cx, uint8_t* top, + InlineFrameIterator& iter, + MaybeReadFallback& fallback, + GCVector<RematerializedFrame*>& frames); // Free a vector of RematerializedFrames; takes care to call the // destructor. Also clears the vector. @@ -137,8 +137,8 @@ class RematerializedFrame envChain_ = &envChain_->as<SpecificEnvironment>().enclosingEnvironment(); } - MOZ_MUST_USE bool initFunctionEnvironmentObjects(JSContext* cx); - MOZ_MUST_USE bool pushVarEnvironment(JSContext* cx, HandleScope scope); + [[nodiscard]] bool initFunctionEnvironmentObjects(JSContext* cx); + [[nodiscard]] bool pushVarEnvironment(JSContext* cx, HandleScope scope); bool hasInitialEnvironment() const { return hasInitialEnv_; diff --git a/js/src/jit/Safepoints.h b/js/src/jit/Safepoints.h index 1626d924c8..4c5858851c 100644 --- a/js/src/jit/Safepoints.h +++ b/js/src/jit/Safepoints.h @@ -28,7 +28,7 @@ class SafepointWriter public: explicit SafepointWriter(uint32_t slotCount, uint32_t argumentCount); - MOZ_MUST_USE bool init(TempAllocator& alloc); + [[nodiscard]] bool init(TempAllocator& alloc); private: // A safepoint entry is written in the order these functions appear. @@ -83,7 +83,7 @@ class SafepointReader void advanceFromGcSlots(); void advanceFromValueSlots(); void advanceFromNunboxSlots(); - MOZ_MUST_USE bool getSlotFromBitmap(SafepointSlotEntry* entry); + [[nodiscard]] bool getSlotFromBitmap(SafepointSlotEntry* entry); public: SafepointReader(IonScript* script, const SafepointIndex* si); @@ -111,17 +111,17 @@ class SafepointReader uint32_t osiReturnPointOffset() const; // Returns true if a slot was read, false if there are no more slots. - MOZ_MUST_USE bool getGcSlot(SafepointSlotEntry* entry); + [[nodiscard]] bool getGcSlot(SafepointSlotEntry* entry); // Returns true if a slot was read, false if there are no more value slots. - MOZ_MUST_USE bool getValueSlot(SafepointSlotEntry* entry); + [[nodiscard]] bool getValueSlot(SafepointSlotEntry* entry); // Returns true if a nunbox slot was read, false if there are no more // nunbox slots. - MOZ_MUST_USE bool getNunboxSlot(LAllocation* type, LAllocation* payload); + [[nodiscard]] bool getNunboxSlot(LAllocation* type, LAllocation* payload); // Returns true if a slot was read, false if there are no more slots. - MOZ_MUST_USE bool getSlotsOrElementsSlot(SafepointSlotEntry* entry); + [[nodiscard]] bool getSlotsOrElementsSlot(SafepointSlotEntry* entry); }; } // namespace jit diff --git a/js/src/jit/ScalarReplacement.h b/js/src/jit/ScalarReplacement.h index 18e0f02624..cc885642eb 100644 --- a/js/src/jit/ScalarReplacement.h +++ b/js/src/jit/ScalarReplacement.h @@ -15,8 +15,7 @@ namespace jit { class MIRGenerator; class MIRGraph; -MOZ_MUST_USE bool -ScalarReplacement(MIRGenerator* mir, MIRGraph& graph); +[[nodiscard]] bool ScalarReplacement(MIRGenerator* mir, MIRGraph& graph); } // namespace jit } // namespace js diff --git a/js/src/jit/SharedIC.h b/js/src/jit/SharedIC.h index d259ebf0bc..dcc615a608 100644 --- a/js/src/jit/SharedIC.h +++ b/js/src/jit/SharedIC.h @@ -939,10 +939,10 @@ class ICUpdatedStub : public ICStub {} public: - MOZ_MUST_USE bool initUpdatingChain(JSContext* cx, ICStubSpace* space); + [[nodiscard]] bool initUpdatingChain(JSContext* cx, ICStubSpace* space); - MOZ_MUST_USE bool addUpdateStubForValue(JSContext* cx, HandleScript script, HandleObject obj, - HandleId id, HandleValue val); + [[nodiscard]] bool addUpdateStubForValue(JSContext* cx, HandleScript script, HandleObject obj, + HandleId id, HandleValue val); void addOptimizedUpdateStub(ICStub* stub) { if (firstUpdateStub_->isTypeUpdate_Fallback()) { @@ -1015,7 +1015,7 @@ class ICStubCompiler (static_cast<int32_t>(kind) << 1); } - virtual MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm) = 0; + [[nodiscard]] virtual bool generateStubCode(MacroAssembler& masm) = 0; virtual void postGenerateStubCode(MacroAssembler& masm, Handle<JitCode*> genCode) {} JitCode* getStubCode(); @@ -1032,14 +1032,14 @@ class ICStubCompiler void pushStubPayload(MacroAssembler& masm, Register scratch); // Emits a tail call to a VMFunction wrapper. - MOZ_MUST_USE bool tailCallVM(const VMFunction& fun, MacroAssembler& masm); + [[nodiscard]] bool tailCallVM(const VMFunction& fun, MacroAssembler& masm); // Emits a normal (non-tail) call to a VMFunction wrapper. - MOZ_MUST_USE bool callVM(const VMFunction& fun, MacroAssembler& masm); + [[nodiscard]] bool callVM(const VMFunction& fun, MacroAssembler& masm); // Emits a call to a type-update IC, assuming that the value to be // checked is already in R0. - MOZ_MUST_USE bool callTypeUpdateIC(MacroAssembler& masm, uint32_t objectOffset); + [[nodiscard]] bool callTypeUpdateIC(MacroAssembler& masm, uint32_t objectOffset); // A stub frame is used when a stub wants to call into the VM without // performing a tail call. This is required for the return address @@ -1180,9 +1180,9 @@ class ICMonitoredFallbackStub : public ICFallbackStub fallbackMonitorStub_(nullptr) {} public: - MOZ_MUST_USE bool initMonitoringChain(JSContext* cx, ICStubSpace* space, + [[nodiscard]] bool initMonitoringChain(JSContext* cx, ICStubSpace* space, ICStubCompiler::Engine engine); - MOZ_MUST_USE bool addMonitorStubForValue(JSContext* cx, SharedStubInfo* info, HandleValue val); + [[nodiscard]] bool addMonitorStubForValue(JSContext* cx, SharedStubInfo* info, HandleValue val); inline ICTypeMonitor_Fallback* fallbackMonitorStub() const { return fallbackMonitorStub_; @@ -1442,7 +1442,7 @@ class ICTypeMonitor_Fallback : public ICStub // Create a new monitor stub for the type of the given value, and // add it to this chain. - MOZ_MUST_USE bool addMonitorStubForValue(JSContext* cx, SharedStubInfo* info, HandleValue val); + [[nodiscard]] bool addMonitorStubForValue(JSContext* cx, SharedStubInfo* info, HandleValue val); void resetMonitorStubChain(Zone* zone); @@ -1452,7 +1452,7 @@ class ICTypeMonitor_Fallback : public ICStub uint32_t argumentIndex_; protected: - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); public: Compiler(JSContext* cx, Engine engine, ICMonitoredFallbackStub* mainFallbackStub) @@ -1485,7 +1485,7 @@ class ICTypeMonitor_PrimitiveSet : public TypeCheckPrimitiveSetStub public: class Compiler : public TypeCheckPrimitiveSetStub::Compiler { protected: - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); public: Compiler(JSContext* cx, Engine engine, ICTypeMonitor_PrimitiveSet* existingStub, @@ -1529,7 +1529,7 @@ class ICTypeMonitor_SingleObject : public ICStub class Compiler : public ICStubCompiler { protected: HandleObject obj_; - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); public: Compiler(JSContext* cx, HandleObject obj) @@ -1563,7 +1563,7 @@ class ICTypeMonitor_ObjectGroup : public ICStub class Compiler : public ICStubCompiler { protected: HandleObjectGroup group_; - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); public: Compiler(JSContext* cx, HandleObjectGroup group) @@ -1615,7 +1615,7 @@ class ICBinaryArith_Fallback : public ICFallbackStub // Compiler for this stub kind. class Compiler : public ICStubCompiler { protected: - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); public: explicit Compiler(JSContext* cx, Engine engine) @@ -1648,7 +1648,7 @@ class ICBinaryArith_Int32 : public ICStub JSOp op_; bool allowDouble_; - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); // Stub keys shift-stubs need to encode the kind, the JSOp and if we allow doubles. virtual int32_t getKey() const { @@ -1680,7 +1680,7 @@ class ICBinaryArith_StringConcat : public ICStub public: class Compiler : public ICStubCompiler { protected: - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); public: explicit Compiler(JSContext* cx, Engine engine) @@ -1711,7 +1711,7 @@ class ICBinaryArith_StringObjectConcat : public ICStub class Compiler : public ICStubCompiler { protected: bool lhsIsString_; - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); virtual int32_t getKey() const { return static_cast<int32_t>(engine_) | @@ -1743,7 +1743,7 @@ class ICBinaryArith_Double : public ICStub public: class Compiler : public ICMultiStubCompiler { protected: - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); public: Compiler(JSContext* cx, JSOp op, Engine engine) @@ -1785,7 +1785,7 @@ class ICBinaryArith_BooleanWithInt32 : public ICStub JSOp op_; bool lhsIsBool_; bool rhsIsBool_; - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); virtual int32_t getKey() const { return static_cast<int32_t>(engine_) | @@ -1830,7 +1830,7 @@ class ICBinaryArith_DoubleWithInt32 : public ICStub class Compiler : public ICMultiStubCompiler { protected: bool lhsIsDouble_; - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); virtual int32_t getKey() const { return static_cast<int32_t>(engine_) | @@ -1881,7 +1881,7 @@ class ICUnaryArith_Fallback : public ICFallbackStub // Compiler for this stub kind. class Compiler : public ICStubCompiler { protected: - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); public: explicit Compiler(JSContext* cx, Engine engine) @@ -1905,7 +1905,7 @@ class ICUnaryArith_Int32 : public ICStub public: class Compiler : public ICMultiStubCompiler { protected: - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); public: Compiler(JSContext* cx, JSOp op, Engine engine) @@ -1929,7 +1929,7 @@ class ICUnaryArith_Double : public ICStub public: class Compiler : public ICMultiStubCompiler { protected: - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); public: Compiler(JSContext* cx, JSOp op, Engine engine) @@ -1973,7 +1973,7 @@ class ICCompare_Fallback : public ICFallbackStub // Compiler for this stub kind. class Compiler : public ICStubCompiler { protected: - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); public: explicit Compiler(JSContext* cx, Engine engine) @@ -1996,7 +1996,7 @@ class ICCompare_Int32 : public ICStub // Compiler for this stub kind. class Compiler : public ICMultiStubCompiler { protected: - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); public: Compiler(JSContext* cx, JSOp op, Engine engine) @@ -2019,7 +2019,7 @@ class ICCompare_Double : public ICStub public: class Compiler : public ICMultiStubCompiler { protected: - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); public: Compiler(JSContext* cx, JSOp op, Engine engine) @@ -2049,7 +2049,7 @@ class ICCompare_NumberWithUndefined : public ICStub class Compiler : public ICMultiStubCompiler { protected: - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); bool lhsIsUndefined; @@ -2084,7 +2084,7 @@ class ICCompare_String : public ICStub public: class Compiler : public ICMultiStubCompiler { protected: - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); public: Compiler(JSContext* cx, JSOp op, Engine engine) @@ -2108,7 +2108,7 @@ class ICCompare_Boolean : public ICStub public: class Compiler : public ICMultiStubCompiler { protected: - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); public: Compiler(JSContext* cx, JSOp op, Engine engine) @@ -2132,7 +2132,7 @@ class ICCompare_Object : public ICStub public: class Compiler : public ICMultiStubCompiler { protected: - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); public: Compiler(JSContext* cx, JSOp op, Engine engine) @@ -2156,7 +2156,7 @@ class ICCompare_ObjectWithUndefined : public ICStub public: class Compiler : public ICMultiStubCompiler { protected: - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); bool lhsIsUndefined; bool compareWithNull; @@ -2202,7 +2202,7 @@ class ICCompare_Int32WithBoolean : public ICStub protected: JSOp op_; bool lhsIsInt32_; - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); virtual int32_t getKey() const { return static_cast<int32_t>(engine_) | @@ -2249,7 +2249,7 @@ IsPreliminaryObject(JSObject* obj); void StripPreliminaryObjectStubs(JSContext* cx, ICFallbackStub* stub); -MOZ_MUST_USE bool +[[nodiscard]] bool EffectlesslyLookupProperty(JSContext* cx, HandleObject obj, HandleId name, MutableHandleObject holder, MutableHandle<PropertyResult> prop, bool* checkDOMProxy=nullptr, @@ -2268,17 +2268,17 @@ IsCacheableGetPropReadSlot(JSObject* obj, JSObject* holder, Shape* shape, bool i void GetFixedOrDynamicSlotOffset(Shape* shape, bool* isFixed, uint32_t* offset); -MOZ_MUST_USE bool +[[nodiscard]] bool IsCacheableGetPropCall(JSContext* cx, JSObject* obj, JSObject* holder, Shape* shape, bool* isScripted, bool* isTemporarilyUnoptimizable, bool isDOMProxy=false); -MOZ_MUST_USE bool +[[nodiscard]] bool UpdateExistingGetPropCallStubs(ICFallbackStub* fallbackStub, ICStub::Kind kind, HandleNativeObject holder, HandleObject receiver, HandleFunction getter); -MOZ_MUST_USE bool +[[nodiscard]] bool CheckHasNoSuchProperty(JSContext* cx, JSObject* obj, PropertyName* name, JSObject** lastProto = nullptr, size_t* protoChainDepthOut = nullptr); @@ -2287,7 +2287,7 @@ GuardReceiverObject(MacroAssembler& masm, ReceiverGuard guard, Register object, Register scratch, size_t receiverGuardOffset, Label* failure); -MOZ_MUST_USE bool +[[nodiscard]] bool GetProtoShapes(JSObject* obj, size_t protoChainDepth, MutableHandle<ShapeVector> shapes); void @@ -2302,7 +2302,7 @@ CheckDOMProxyExpandoDoesNotShadow(JSContext* cx, MacroAssembler& masm, Register void CheckForTypedObjectWithDetachedStorage(JSContext* cx, MacroAssembler& masm, Label* failure); -MOZ_MUST_USE bool +[[nodiscard]] bool DoCallNativeGetter(JSContext* cx, HandleFunction callee, HandleObject obj, MutableHandleValue result); @@ -2344,7 +2344,7 @@ class ICGetProp_Fallback : public ICMonitoredFallbackStub protected: uint32_t returnOffset_; - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); void postGenerateStubCode(MacroAssembler& masm, Handle<JitCode*> code); public: @@ -2376,7 +2376,7 @@ class ICGetProp_Generic : public ICMonitoredStub class Compiler : public ICStubCompiler { protected: - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); ICStub* firstMonitorStub_; public: explicit Compiler(JSContext* cx, Engine engine, ICStub* firstMonitorStub) @@ -2401,7 +2401,7 @@ class ICGetProp_StringLength : public ICStub public: class Compiler : public ICStubCompiler { - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); public: explicit Compiler(JSContext* cx, Engine engine) @@ -2515,7 +2515,7 @@ class ICGetPropNativeCompiler : public ICStubCompiler uint32_t offset_; bool inputDefinitelyObject_; - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); protected: virtual int32_t getKey() const { @@ -2695,7 +2695,7 @@ class ICGetProp_CallScripted : public ICGetPropCallGetter class Compiler : public ICGetPropCallGetter::Compiler { protected: - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); public: Compiler(JSContext* cx, ICStub* firstMonitorStub, HandleObject obj, @@ -2770,7 +2770,7 @@ class ICGetPropCallNativeCompiler : public ICGetPropCallGetter::Compiler { bool inputDefinitelyObject_; protected: - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); virtual int32_t getKey() const { int32_t baseKey = ICGetPropCallGetter::Compiler::getKey(); @@ -2883,9 +2883,9 @@ class ICGetPropCallDOMProxyNativeCompiler : public ICStubCompiler { RootedFunction getter_; uint32_t pcOffset_; - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm, Address* internalStructAddr, + [[nodiscard]] bool generateStubCode(MacroAssembler& masm, Address* internalStructAddr, Address* generationAddr); - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); public: ICGetPropCallDOMProxyNativeCompiler(JSContext* cx, ICStub::Kind kind, @@ -2941,7 +2941,7 @@ class ICGetProp_DOMProxyShadowed : public ICMonitoredStub RootedPropertyName name_; uint32_t pcOffset_; - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); public: Compiler(JSContext* cx, Engine engine, ICStub* firstMonitorStub, Handle<ProxyObject*> proxy, @@ -2973,7 +2973,7 @@ class ICGetProp_ArgumentsLength : public ICStub protected: Which which_; - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); virtual int32_t getKey() const { return static_cast<int32_t>(engine_) | @@ -3004,7 +3004,7 @@ class ICGetProp_ArgumentsCallee : public ICMonitoredStub class Compiler : public ICStubCompiler { protected: ICStub* firstMonitorStub_; - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); public: Compiler(JSContext* cx, Engine engine, ICStub* firstMonitorStub) @@ -3039,7 +3039,7 @@ class ICNewArray_Fallback : public ICFallbackStub public: class Compiler : public ICStubCompiler { RootedObjectGroup templateGroup; - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); public: Compiler(JSContext* cx, ObjectGroup* templateGroup, Engine engine) @@ -3085,7 +3085,7 @@ class ICNewObject_Fallback : public ICFallbackStub public: class Compiler : public ICStubCompiler { - MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); + [[nodiscard]] bool generateStubCode(MacroAssembler& masm); public: explicit Compiler(JSContext* cx, Engine engine) diff --git a/js/src/jit/Sink.h b/js/src/jit/Sink.h index 154300f43c..d2a9e8c646 100644 --- a/js/src/jit/Sink.h +++ b/js/src/jit/Sink.h @@ -15,8 +15,7 @@ namespace jit { class MIRGenerator; class MIRGraph; -MOZ_MUST_USE bool -Sink(MIRGenerator* mir, MIRGraph& graph); +[[nodiscard]] bool Sink(MIRGenerator* mir, MIRGraph& graph); } // namespace jit } // namespace js diff --git a/js/src/jit/Snapshots.h b/js/src/jit/Snapshots.h index d9a4962946..290dbd68cd 100644 --- a/js/src/jit/Snapshots.h +++ b/js/src/jit/Snapshots.h @@ -384,14 +384,14 @@ class SnapshotWriter SnapshotOffset lastStart_; public: - MOZ_MUST_USE bool init(); + [[nodiscard]] bool init(); SnapshotOffset startSnapshot(RecoverOffset recoverOffset, BailoutKind kind); #ifdef TRACK_SNAPSHOTS void trackSnapshot(uint32_t pcOpcode, uint32_t mirOpcode, uint32_t mirId, uint32_t lirOpcode, uint32_t lirId); #endif - MOZ_MUST_USE bool add(const RValueAllocation& slot); + [[nodiscard]] bool add(const RValueAllocation& slot); uint32_t allocWritten() const { return allocWritten_; diff --git a/js/src/jit/StupidAllocator.h b/js/src/jit/StupidAllocator.h index aae2cb96bd..96c17e03f3 100644 --- a/js/src/jit/StupidAllocator.h +++ b/js/src/jit/StupidAllocator.h @@ -56,10 +56,10 @@ class StupidAllocator : public RegisterAllocator { } - MOZ_MUST_USE bool go(); + [[nodiscard]] bool go(); private: - MOZ_MUST_USE bool init(); + [[nodiscard]] bool init(); void syncForBlockEnd(LBlock* block, LInstruction* ins); void allocateForInstruction(LInstruction* ins); diff --git a/js/src/jit/TypePolicy.h b/js/src/jit/TypePolicy.h index 0b9d2b37ef..8ab241ab00 100644 --- a/js/src/jit/TypePolicy.h +++ b/js/src/jit/TypePolicy.h @@ -29,7 +29,7 @@ class TypePolicy // * If untyped, optionally ask the input to try and specialize its value. // * Replace the operand with a conversion instruction. // * Insert an unconditional deoptimization (no conversion possible). - virtual MOZ_MUST_USE bool adjustInputs(TempAllocator& alloc, MInstruction* def) = 0; + [[nodiscard]] virtual bool adjustInputs(TempAllocator& alloc, MInstruction* def) = 0; }; struct TypeSpecializationData @@ -79,8 +79,8 @@ class BoxInputsPolicy final : public TypePolicy { public: SPECIALIZATION_DATA_; - static MOZ_MUST_USE bool staticAdjustInputs(TempAllocator& alloc, MInstruction* def); - virtual MOZ_MUST_USE bool adjustInputs(TempAllocator& alloc, MInstruction* def) override { + [[nodiscard]] static bool staticAdjustInputs(TempAllocator& alloc, MInstruction* def); + [[nodiscard]] virtual bool adjustInputs(TempAllocator& alloc, MInstruction* def) override { return staticAdjustInputs(alloc, def); } }; @@ -89,28 +89,28 @@ class ArithPolicy final : public TypePolicy { public: SPECIALIZATION_DATA_; - virtual MOZ_MUST_USE bool adjustInputs(TempAllocator& alloc, MInstruction* def) override; + [[nodiscard]] virtual bool adjustInputs(TempAllocator& alloc, MInstruction* def) override; }; class AllDoublePolicy final : public TypePolicy { public: EMPTY_DATA_; - MOZ_MUST_USE bool adjustInputs(TempAllocator& alloc, MInstruction* def); + [[nodiscard]] bool adjustInputs(TempAllocator& alloc, MInstruction* def); }; class BitwisePolicy final : public TypePolicy { public: SPECIALIZATION_DATA_; - virtual MOZ_MUST_USE bool adjustInputs(TempAllocator& alloc, MInstruction* def) override; + [[nodiscard]] virtual bool adjustInputs(TempAllocator& alloc, MInstruction* def) override; }; class ComparePolicy final : public TypePolicy { public: EMPTY_DATA_; - virtual MOZ_MUST_USE bool adjustInputs(TempAllocator& alloc, MInstruction* def) override; + [[nodiscard]] virtual bool adjustInputs(TempAllocator& alloc, MInstruction* def) override; }; // Policy for MTest instructions. @@ -118,21 +118,21 @@ class TestPolicy final : public TypePolicy { public: EMPTY_DATA_; - virtual MOZ_MUST_USE bool adjustInputs(TempAllocator& alloc, MInstruction* ins) override; + [[nodiscard]] virtual bool adjustInputs(TempAllocator& alloc, MInstruction* ins) override; }; class TypeBarrierPolicy final : public TypePolicy { public: EMPTY_DATA_; - virtual MOZ_MUST_USE bool adjustInputs(TempAllocator& alloc, MInstruction* ins) override; + [[nodiscard]] virtual bool adjustInputs(TempAllocator& alloc, MInstruction* ins) override; }; class CallPolicy final : public TypePolicy { public: EMPTY_DATA_; - virtual MOZ_MUST_USE bool adjustInputs(TempAllocator& alloc, MInstruction* def) override; + [[nodiscard]] virtual bool adjustInputs(TempAllocator& alloc, MInstruction* def) override; }; // Policy for MPow. First operand Double; second Double or Int32. @@ -140,7 +140,7 @@ class PowPolicy final : public TypePolicy { public: SPECIALIZATION_DATA_; - virtual MOZ_MUST_USE bool adjustInputs(TempAllocator& alloc, MInstruction* ins) override; + [[nodiscard]] virtual bool adjustInputs(TempAllocator& alloc, MInstruction* ins) override; }; // Expect a string for operand Op. If the input is a Value, it is unboxed. @@ -149,8 +149,8 @@ class StringPolicy final : public TypePolicy { public: EMPTY_DATA_; - static MOZ_MUST_USE bool staticAdjustInputs(TempAllocator& alloc, MInstruction* def); - virtual MOZ_MUST_USE bool adjustInputs(TempAllocator& alloc, MInstruction* def) override { + [[nodiscard]] static bool staticAdjustInputs(TempAllocator& alloc, MInstruction* def); + [[nodiscard]] virtual bool adjustInputs(TempAllocator& alloc, MInstruction* def) override { return staticAdjustInputs(alloc, def); } }; @@ -161,8 +161,8 @@ class ConvertToStringPolicy final : public TypePolicy { public: EMPTY_DATA_; - static MOZ_MUST_USE bool staticAdjustInputs(TempAllocator& alloc, MInstruction* def); - virtual MOZ_MUST_USE bool adjustInputs(TempAllocator& alloc, MInstruction* def) override { + [[nodiscard]] static bool staticAdjustInputs(TempAllocator& alloc, MInstruction* def); + [[nodiscard]] virtual bool adjustInputs(TempAllocator& alloc, MInstruction* def) override { return staticAdjustInputs(alloc, def); } }; @@ -173,8 +173,8 @@ class BooleanPolicy final : private TypePolicy { public: EMPTY_DATA_; - static MOZ_MUST_USE bool staticAdjustInputs(TempAllocator& alloc, MInstruction* def); - virtual MOZ_MUST_USE bool adjustInputs(TempAllocator& alloc, MInstruction* def) override { + [[nodiscard]] static bool staticAdjustInputs(TempAllocator& alloc, MInstruction* def); + [[nodiscard]] virtual bool adjustInputs(TempAllocator& alloc, MInstruction* def) override { return staticAdjustInputs(alloc, def); } }; @@ -185,8 +185,8 @@ class IntPolicy final : private TypePolicy { public: EMPTY_DATA_; - static MOZ_MUST_USE bool staticAdjustInputs(TempAllocator& alloc, MInstruction* def); - virtual MOZ_MUST_USE bool adjustInputs(TempAllocator& alloc, MInstruction* def) override { + [[nodiscard]] static bool staticAdjustInputs(TempAllocator& alloc, MInstruction* def); + [[nodiscard]] virtual bool adjustInputs(TempAllocator& alloc, MInstruction* def) override { return staticAdjustInputs(alloc, def); } }; @@ -197,8 +197,8 @@ class ConvertToInt32Policy final : public TypePolicy { public: EMPTY_DATA_; - static MOZ_MUST_USE bool staticAdjustInputs(TempAllocator& alloc, MInstruction* def); - virtual MOZ_MUST_USE bool adjustInputs(TempAllocator& alloc, MInstruction* def) override { + [[nodiscard]] static bool staticAdjustInputs(TempAllocator& alloc, MInstruction* def); + [[nodiscard]] virtual bool adjustInputs(TempAllocator& alloc, MInstruction* def) override { return staticAdjustInputs(alloc, def); } }; @@ -209,8 +209,8 @@ class TruncateToInt32Policy final : public TypePolicy { public: EMPTY_DATA_; - static MOZ_MUST_USE bool staticAdjustInputs(TempAllocator& alloc, MInstruction* def); - virtual MOZ_MUST_USE bool adjustInputs(TempAllocator& alloc, MInstruction* def) override { + [[nodiscard]] static bool staticAdjustInputs(TempAllocator& alloc, MInstruction* def); + [[nodiscard]] virtual bool adjustInputs(TempAllocator& alloc, MInstruction* def) override { return staticAdjustInputs(alloc, def); } }; @@ -221,8 +221,8 @@ class DoublePolicy final : public TypePolicy { public: EMPTY_DATA_; - static MOZ_MUST_USE bool staticAdjustInputs(TempAllocator& alloc, MInstruction* def); - virtual MOZ_MUST_USE bool adjustInputs(TempAllocator& alloc, MInstruction* def) override { + [[nodiscard]] static bool staticAdjustInputs(TempAllocator& alloc, MInstruction* def); + [[nodiscard]] virtual bool adjustInputs(TempAllocator& alloc, MInstruction* def) override { return staticAdjustInputs(alloc, def); } }; @@ -233,8 +233,8 @@ class Float32Policy final : public TypePolicy { public: EMPTY_DATA_; - static MOZ_MUST_USE bool staticAdjustInputs(TempAllocator& alloc, MInstruction* def); - virtual MOZ_MUST_USE bool adjustInputs(TempAllocator& alloc, MInstruction* def) override { + [[nodiscard]] static bool staticAdjustInputs(TempAllocator& alloc, MInstruction* def); + [[nodiscard]] virtual bool adjustInputs(TempAllocator& alloc, MInstruction* def) override { return staticAdjustInputs(alloc, def); } }; @@ -246,7 +246,7 @@ class FloatingPointPolicy final : public TypePolicy { public: SPECIALIZATION_DATA_; - virtual MOZ_MUST_USE bool adjustInputs(TempAllocator& alloc, MInstruction* def) override; + [[nodiscard]] virtual bool adjustInputs(TempAllocator& alloc, MInstruction* def) override; }; template <unsigned Op> @@ -254,8 +254,8 @@ class NoFloatPolicy final : public TypePolicy { public: EMPTY_DATA_; - static MOZ_MUST_USE bool staticAdjustInputs(TempAllocator& alloc, MInstruction* def); - virtual MOZ_MUST_USE bool adjustInputs(TempAllocator& alloc, MInstruction* def) override { + [[nodiscard]] static bool staticAdjustInputs(TempAllocator& alloc, MInstruction* def); + [[nodiscard]] virtual bool adjustInputs(TempAllocator& alloc, MInstruction* def) override { return staticAdjustInputs(alloc, def); } }; @@ -267,7 +267,7 @@ class NoFloatPolicyAfter final : public TypePolicy { public: EMPTY_DATA_; - virtual MOZ_MUST_USE bool adjustInputs(TempAllocator& alloc, MInstruction* ins) override; + [[nodiscard]] virtual bool adjustInputs(TempAllocator& alloc, MInstruction* ins) override; }; // Box objects or strings as an input to a ToDouble instruction. @@ -275,8 +275,8 @@ class ToDoublePolicy final : public TypePolicy { public: EMPTY_DATA_; - static MOZ_MUST_USE bool staticAdjustInputs(TempAllocator& alloc, MInstruction* def); - virtual MOZ_MUST_USE bool adjustInputs(TempAllocator& alloc, MInstruction* def) override { + [[nodiscard]] static bool staticAdjustInputs(TempAllocator& alloc, MInstruction* def); + [[nodiscard]] virtual bool adjustInputs(TempAllocator& alloc, MInstruction* def) override { return staticAdjustInputs(alloc, def); } }; @@ -286,8 +286,8 @@ class ToInt32Policy final : public TypePolicy { public: EMPTY_DATA_; - static MOZ_MUST_USE bool staticAdjustInputs(TempAllocator& alloc, MInstruction* def); - virtual MOZ_MUST_USE bool adjustInputs(TempAllocator& alloc, MInstruction* def) override { + [[nodiscard]] static bool staticAdjustInputs(TempAllocator& alloc, MInstruction* def); + [[nodiscard]] virtual bool adjustInputs(TempAllocator& alloc, MInstruction* def) override { return staticAdjustInputs(alloc, def); } }; @@ -297,8 +297,8 @@ class ToStringPolicy final : public TypePolicy { public: EMPTY_DATA_; - static MOZ_MUST_USE bool staticAdjustInputs(TempAllocator& alloc, MInstruction* def); - virtual MOZ_MUST_USE bool adjustInputs(TempAllocator& alloc, MInstruction* def) override { + [[nodiscard]] static bool staticAdjustInputs(TempAllocator& alloc, MInstruction* def); + [[nodiscard]] virtual bool adjustInputs(TempAllocator& alloc, MInstruction* def) override { return staticAdjustInputs(alloc, def); } }; @@ -308,8 +308,8 @@ class ObjectPolicy final : public TypePolicy { public: EMPTY_DATA_; - static MOZ_MUST_USE bool staticAdjustInputs(TempAllocator& alloc, MInstruction* ins); - virtual MOZ_MUST_USE bool adjustInputs(TempAllocator& alloc, MInstruction* ins) override { + [[nodiscard]] static bool staticAdjustInputs(TempAllocator& alloc, MInstruction* ins); + [[nodiscard]] virtual bool adjustInputs(TempAllocator& alloc, MInstruction* ins) override { return staticAdjustInputs(alloc, ins); } }; @@ -323,8 +323,8 @@ class BoxPolicy final : public TypePolicy { public: EMPTY_DATA_; - static MOZ_MUST_USE bool staticAdjustInputs(TempAllocator& alloc, MInstruction* ins); - virtual MOZ_MUST_USE bool adjustInputs(TempAllocator& alloc, MInstruction* ins) override { + [[nodiscard]] static bool staticAdjustInputs(TempAllocator& alloc, MInstruction* ins); + [[nodiscard]] virtual bool adjustInputs(TempAllocator& alloc, MInstruction* ins) override { return staticAdjustInputs(alloc, ins); } }; @@ -335,8 +335,8 @@ class BoxExceptPolicy final : public TypePolicy { public: EMPTY_DATA_; - static MOZ_MUST_USE bool staticAdjustInputs(TempAllocator& alloc, MInstruction* ins); - MOZ_MUST_USE bool adjustInputs(TempAllocator& alloc, MInstruction* ins) { + [[nodiscard]] static bool staticAdjustInputs(TempAllocator& alloc, MInstruction* ins); + [[nodiscard]] bool adjustInputs(TempAllocator& alloc, MInstruction* ins) { return staticAdjustInputs(alloc, ins); } }; @@ -347,8 +347,8 @@ class CacheIdPolicy final : public TypePolicy { public: EMPTY_DATA_; - static MOZ_MUST_USE bool staticAdjustInputs(TempAllocator& alloc, MInstruction* ins); - MOZ_MUST_USE bool adjustInputs(TempAllocator& alloc, MInstruction* ins) { + [[nodiscard]] static bool staticAdjustInputs(TempAllocator& alloc, MInstruction* ins); + [[nodiscard]] bool adjustInputs(TempAllocator& alloc, MInstruction* ins) { return staticAdjustInputs(alloc, ins); } }; @@ -359,10 +359,10 @@ class MixPolicy final : public TypePolicy { public: EMPTY_DATA_; - static MOZ_MUST_USE bool staticAdjustInputs(TempAllocator& alloc, MInstruction* ins) { + [[nodiscard]] static bool staticAdjustInputs(TempAllocator& alloc, MInstruction* ins) { return Lhs::staticAdjustInputs(alloc, ins) && Rhs::staticAdjustInputs(alloc, ins); } - virtual MOZ_MUST_USE bool adjustInputs(TempAllocator& alloc, MInstruction* ins) override { + [[nodiscard]] virtual bool adjustInputs(TempAllocator& alloc, MInstruction* ins) override { return staticAdjustInputs(alloc, ins); } }; @@ -373,12 +373,12 @@ class Mix3Policy final : public TypePolicy { public: EMPTY_DATA_; - static MOZ_MUST_USE bool staticAdjustInputs(TempAllocator& alloc, MInstruction* ins) { + [[nodiscard]] static bool staticAdjustInputs(TempAllocator& alloc, MInstruction* ins) { return Policy1::staticAdjustInputs(alloc, ins) && Policy2::staticAdjustInputs(alloc, ins) && Policy3::staticAdjustInputs(alloc, ins); } - virtual MOZ_MUST_USE bool adjustInputs(TempAllocator& alloc, MInstruction* ins) override { + [[nodiscard]] virtual bool adjustInputs(TempAllocator& alloc, MInstruction* ins) override { return staticAdjustInputs(alloc, ins); } }; @@ -389,13 +389,13 @@ class Mix4Policy : public TypePolicy { public: EMPTY_DATA_; - static MOZ_MUST_USE bool staticAdjustInputs(TempAllocator& alloc, MInstruction* ins) { + [[nodiscard]] static bool staticAdjustInputs(TempAllocator& alloc, MInstruction* ins) { return Policy1::staticAdjustInputs(alloc, ins) && Policy2::staticAdjustInputs(alloc, ins) && Policy3::staticAdjustInputs(alloc, ins) && Policy4::staticAdjustInputs(alloc, ins); } - virtual MOZ_MUST_USE bool adjustInputs(TempAllocator& alloc, MInstruction* ins) override { + [[nodiscard]] virtual bool adjustInputs(TempAllocator& alloc, MInstruction* ins) override { return staticAdjustInputs(alloc, ins); } }; @@ -404,7 +404,7 @@ class CallSetElementPolicy final : public TypePolicy { public: EMPTY_DATA_; - virtual MOZ_MUST_USE bool adjustInputs(TempAllocator& alloc, MInstruction* def) override; + [[nodiscard]] virtual bool adjustInputs(TempAllocator& alloc, MInstruction* def) override; }; // First operand will be boxed to a Value (except for an object) @@ -413,7 +413,7 @@ class InstanceOfPolicy final : public TypePolicy { public: EMPTY_DATA_; - virtual MOZ_MUST_USE bool adjustInputs(TempAllocator& alloc, MInstruction* def) override; + [[nodiscard]] virtual bool adjustInputs(TempAllocator& alloc, MInstruction* def) override; }; class StoreTypedArrayHolePolicy; @@ -422,37 +422,37 @@ class StoreTypedArrayElementStaticPolicy; class StoreUnboxedScalarPolicy : public TypePolicy { private: - static MOZ_MUST_USE bool adjustValueInput(TempAllocator& alloc, MInstruction* ins, - Scalar::Type arrayType, MDefinition* value, - int valueOperand); + [[nodiscard]] static bool adjustValueInput(TempAllocator& alloc, MInstruction* ins, + Scalar::Type arrayType, MDefinition* value, + int valueOperand); friend class StoreTypedArrayHolePolicy; friend class StoreTypedArrayElementStaticPolicy; public: EMPTY_DATA_; - virtual MOZ_MUST_USE bool adjustInputs(TempAllocator& alloc, MInstruction* ins) override; + [[nodiscard]] virtual bool adjustInputs(TempAllocator& alloc, MInstruction* ins) override; }; class StoreTypedArrayHolePolicy final : public StoreUnboxedScalarPolicy { public: EMPTY_DATA_; - virtual MOZ_MUST_USE bool adjustInputs(TempAllocator& alloc, MInstruction* ins) override; + [[nodiscard]] virtual bool adjustInputs(TempAllocator& alloc, MInstruction* ins) override; }; class StoreTypedArrayElementStaticPolicy final : public StoreUnboxedScalarPolicy { public: EMPTY_DATA_; - virtual MOZ_MUST_USE bool adjustInputs(TempAllocator& alloc, MInstruction* ins) override; + [[nodiscard]] virtual bool adjustInputs(TempAllocator& alloc, MInstruction* ins) override; }; class StoreUnboxedObjectOrNullPolicy final : public TypePolicy { public: EMPTY_DATA_; - virtual MOZ_MUST_USE bool adjustInputs(TempAllocator& alloc, MInstruction* def) override; + [[nodiscard]] virtual bool adjustInputs(TempAllocator& alloc, MInstruction* def) override; }; // Accepts integers and doubles. Everything else is boxed. @@ -460,14 +460,14 @@ class ClampPolicy final : public TypePolicy { public: EMPTY_DATA_; - virtual MOZ_MUST_USE bool adjustInputs(TempAllocator& alloc, MInstruction* ins) override; + [[nodiscard]] virtual bool adjustInputs(TempAllocator& alloc, MInstruction* ins) override; }; class FilterTypeSetPolicy final : public TypePolicy { public: EMPTY_DATA_; - virtual MOZ_MUST_USE bool adjustInputs(TempAllocator& alloc, MInstruction* ins) override; + [[nodiscard]] virtual bool adjustInputs(TempAllocator& alloc, MInstruction* ins) override; }; #undef SPECIALIZATION_DATA_ diff --git a/js/src/jit/VMFunctions.h b/js/src/jit/VMFunctions.h index b134c5df05..8a2e9b92d2 100644 --- a/js/src/jit/VMFunctions.h +++ b/js/src/jit/VMFunctions.h @@ -582,10 +582,10 @@ class AutoDetectInvalidation } }; -MOZ_MUST_USE bool +[[nodiscard]] bool InvokeFunction(JSContext* cx, HandleObject obj0, bool constructing, bool ignoresReturnValue, uint32_t argc, Value* argv, MutableHandleValue rval); -MOZ_MUST_USE bool +[[nodiscard]] bool InvokeFunctionShuffleNewTarget(JSContext* cx, HandleObject obj, uint32_t numActualArgs, uint32_t numFormalArgs, Value* argv, MutableHandleValue rval); @@ -594,15 +594,15 @@ bool CheckOverRecursedWithExtra(JSContext* cx, BaselineFrame* frame, uint32_t extra, uint32_t earlyCheck); JSObject* BindVar(JSContext* cx, HandleObject scopeChain); -MOZ_MUST_USE bool +[[nodiscard]] bool DefVar(JSContext* cx, HandlePropertyName dn, unsigned attrs, HandleObject scopeChain); -MOZ_MUST_USE bool +[[nodiscard]] bool DefLexical(JSContext* cx, HandlePropertyName dn, unsigned attrs, HandleObject scopeChain); -MOZ_MUST_USE bool +[[nodiscard]] bool DefGlobalLexical(JSContext* cx, HandlePropertyName dn, unsigned attrs); -MOZ_MUST_USE bool +[[nodiscard]] bool MutatePrototype(JSContext* cx, HandlePlainObject obj, HandleValue value); -MOZ_MUST_USE bool +[[nodiscard]] bool InitProp(JSContext* cx, HandleObject obj, HandlePropertyName name, HandleValue value, jsbytecode* pc); @@ -620,21 +620,21 @@ bool GreaterThanOrEqual(JSContext* cx, MutableHandleValue lhs, MutableHandleValu template<bool Equal> bool StringsEqual(JSContext* cx, HandleString left, HandleString right, bool* res); -MOZ_MUST_USE bool ArrayPopDense(JSContext* cx, HandleObject obj, MutableHandleValue rval); -MOZ_MUST_USE bool ArrayPushDense(JSContext* cx, HandleObject obj, HandleValue v, uint32_t* length); -MOZ_MUST_USE bool ArrayShiftDense(JSContext* cx, HandleObject obj, MutableHandleValue rval); +[[nodiscard]] bool ArrayPopDense(JSContext* cx, HandleObject obj, MutableHandleValue rval); +[[nodiscard]] bool ArrayPushDense(JSContext* cx, HandleObject obj, HandleValue v, uint32_t* length); +[[nodiscard]] bool ArrayShiftDense(JSContext* cx, HandleObject obj, MutableHandleValue rval); JSString* ArrayJoin(JSContext* cx, HandleObject array, HandleString sep); -MOZ_MUST_USE bool +[[nodiscard]] bool CharCodeAt(JSContext* cx, HandleString str, int32_t index, uint32_t* code); JSFlatString* StringFromCharCode(JSContext* cx, int32_t code); JSString* StringFromCodePoint(JSContext* cx, int32_t codePoint); -MOZ_MUST_USE bool +[[nodiscard]] bool SetProperty(JSContext* cx, HandleObject obj, HandlePropertyName name, HandleValue value, bool strict, jsbytecode* pc); -MOZ_MUST_USE bool +[[nodiscard]] bool InterruptCheck(JSContext* cx); void* MallocWrapper(JSRuntime* rt, size_t nbytes); @@ -645,10 +645,10 @@ JSObject* NewStringObject(JSContext* cx, HandleString str); bool OperatorIn(JSContext* cx, HandleValue key, HandleObject obj, bool* out); bool OperatorInI(JSContext* cx, uint32_t index, HandleObject obj, bool* out); -MOZ_MUST_USE bool +[[nodiscard]] bool GetIntrinsicValue(JSContext* cx, HandlePropertyName name, MutableHandleValue rval); -MOZ_MUST_USE bool +[[nodiscard]] bool CreateThis(JSContext* cx, HandleObject callee, HandleObject newTarget, MutableHandleValue rval); void GetDynamicName(JSContext* cx, JSObject* scopeChain, JSString* str, Value* vp); @@ -659,92 +659,92 @@ void PostGlobalWriteBarrier(JSRuntime* rt, JSObject* obj); uint32_t GetIndexFromString(JSString* str); -MOZ_MUST_USE bool +[[nodiscard]] bool DebugPrologue(JSContext* cx, BaselineFrame* frame, jsbytecode* pc, bool* mustReturn); -MOZ_MUST_USE bool +[[nodiscard]] bool DebugEpilogue(JSContext* cx, BaselineFrame* frame, jsbytecode* pc, bool ok); -MOZ_MUST_USE bool +[[nodiscard]] bool DebugEpilogueOnBaselineReturn(JSContext* cx, BaselineFrame* frame, jsbytecode* pc); void FrameIsDebuggeeCheck(BaselineFrame* frame); JSObject* CreateGenerator(JSContext* cx, BaselineFrame* frame); -MOZ_MUST_USE bool +[[nodiscard]] bool NormalSuspend(JSContext* cx, HandleObject obj, BaselineFrame* frame, jsbytecode* pc, uint32_t stackDepth); -MOZ_MUST_USE bool +[[nodiscard]] bool FinalSuspend(JSContext* cx, HandleObject obj, BaselineFrame* frame, jsbytecode* pc); -MOZ_MUST_USE bool +[[nodiscard]] bool InterpretResume(JSContext* cx, HandleObject obj, HandleValue val, HandlePropertyName kind, MutableHandleValue rval); -MOZ_MUST_USE bool +[[nodiscard]] bool DebugAfterYield(JSContext* cx, BaselineFrame* frame); -MOZ_MUST_USE bool +[[nodiscard]] bool GeneratorThrowOrClose(JSContext* cx, BaselineFrame* frame, Handle<GeneratorObject*> genObj, HandleValue arg, uint32_t resumeKind); -MOZ_MUST_USE bool +[[nodiscard]] bool GlobalNameConflictsCheckFromIon(JSContext* cx, HandleScript script); -MOZ_MUST_USE bool +[[nodiscard]] bool CheckGlobalOrEvalDeclarationConflicts(JSContext* cx, BaselineFrame* frame); -MOZ_MUST_USE bool +[[nodiscard]] bool InitFunctionEnvironmentObjects(JSContext* cx, BaselineFrame* frame); -MOZ_MUST_USE bool +[[nodiscard]] bool NewArgumentsObject(JSContext* cx, BaselineFrame* frame, MutableHandleValue res); JSObject* InitRestParameter(JSContext* cx, uint32_t length, Value* rest, HandleObject templateObj, HandleObject res); -MOZ_MUST_USE bool +[[nodiscard]] bool HandleDebugTrap(JSContext* cx, BaselineFrame* frame, uint8_t* retAddr, bool* mustReturn); -MOZ_MUST_USE bool +[[nodiscard]] bool OnDebuggerStatement(JSContext* cx, BaselineFrame* frame, jsbytecode* pc, bool* mustReturn); -MOZ_MUST_USE bool +[[nodiscard]] bool GlobalHasLiveOnDebuggerStatement(JSContext* cx); -MOZ_MUST_USE bool +[[nodiscard]] bool EnterWith(JSContext* cx, BaselineFrame* frame, HandleValue val, Handle<WithScope*> templ); -MOZ_MUST_USE bool +[[nodiscard]] bool LeaveWith(JSContext* cx, BaselineFrame* frame); -MOZ_MUST_USE bool +[[nodiscard]] bool PushLexicalEnv(JSContext* cx, BaselineFrame* frame, Handle<LexicalScope*> scope); -MOZ_MUST_USE bool +[[nodiscard]] bool PopLexicalEnv(JSContext* cx, BaselineFrame* frame); -MOZ_MUST_USE bool +[[nodiscard]] bool DebugLeaveThenPopLexicalEnv(JSContext* cx, BaselineFrame* frame, jsbytecode* pc); -MOZ_MUST_USE bool +[[nodiscard]] bool FreshenLexicalEnv(JSContext* cx, BaselineFrame* frame); -MOZ_MUST_USE bool +[[nodiscard]] bool DebugLeaveThenFreshenLexicalEnv(JSContext* cx, BaselineFrame* frame, jsbytecode* pc); -MOZ_MUST_USE bool +[[nodiscard]] bool RecreateLexicalEnv(JSContext* cx, BaselineFrame* frame); -MOZ_MUST_USE bool +[[nodiscard]] bool DebugLeaveThenRecreateLexicalEnv(JSContext* cx, BaselineFrame* frame, jsbytecode* pc); -MOZ_MUST_USE bool +[[nodiscard]] bool DebugLeaveLexicalEnv(JSContext* cx, BaselineFrame* frame, jsbytecode* pc); -MOZ_MUST_USE bool +[[nodiscard]] bool PushVarEnv(JSContext* cx, BaselineFrame* frame, HandleScope scope); -MOZ_MUST_USE bool +[[nodiscard]] bool PopVarEnv(JSContext* cx, BaselineFrame* frame); -MOZ_MUST_USE bool +[[nodiscard]] bool InitBaselineFrameForOsr(BaselineFrame* frame, InterpreterFrame* interpFrame, uint32_t numStackValues); JSObject* CreateDerivedTypedObj(JSContext* cx, HandleObject descr, HandleObject owner, int32_t offset); -MOZ_MUST_USE bool +[[nodiscard]] bool Recompile(JSContext* cx); -MOZ_MUST_USE bool +[[nodiscard]] bool ForcedRecompile(JSContext* cx); JSString* StringReplace(JSContext* cx, HandleString string, HandleString pattern, HandleString repl); -MOZ_MUST_USE bool SetDenseOrUnboxedArrayElement(JSContext* cx, HandleObject obj, int32_t index, +[[nodiscard]] bool SetDenseOrUnboxedArrayElement(JSContext* cx, HandleObject obj, int32_t index, HandleValue value, bool strict); void AssertValidObjectPtr(JSContext* cx, JSObject* obj); @@ -782,25 +782,25 @@ IonMarkFunction(MIRType type) bool ObjectIsCallable(JSObject* obj); bool ObjectIsConstructor(JSObject* obj); -MOZ_MUST_USE bool +[[nodiscard]] bool ThrowRuntimeLexicalError(JSContext* cx, unsigned errorNumber); -MOZ_MUST_USE bool +[[nodiscard]] bool ThrowReadOnlyError(JSContext* cx, int32_t index); -MOZ_MUST_USE bool +[[nodiscard]] bool BaselineThrowUninitializedThis(JSContext* cx, BaselineFrame* frame); -MOZ_MUST_USE bool +[[nodiscard]] bool ThrowBadDerivedReturn(JSContext* cx, HandleValue v); -MOZ_MUST_USE bool +[[nodiscard]] bool ThrowObjectCoercible(JSContext* cx, HandleValue v); -MOZ_MUST_USE bool +[[nodiscard]] bool BaselineGetFunctionThis(JSContext* cx, BaselineFrame* frame, MutableHandleValue res); -MOZ_MUST_USE bool +[[nodiscard]] bool CheckIsCallable(JSContext* cx, HandleValue v, CheckIsCallableKind kind); extern const VMFunction ToNumberInfo; diff --git a/js/src/jit/ValueNumbering.h b/js/src/jit/ValueNumbering.h index df3540fa4b..dd2cb733c8 100644 --- a/js/src/jit/ValueNumbering.h +++ b/js/src/jit/ValueNumbering.h @@ -40,14 +40,14 @@ class ValueNumberer public: explicit VisibleValues(TempAllocator& alloc); - MOZ_MUST_USE bool init(); + [[nodiscard]] bool init(); typedef ValueSet::Ptr Ptr; typedef ValueSet::AddPtr AddPtr; Ptr findLeader(const MDefinition* def) const; AddPtr findLeaderForAdd(MDefinition* def); - MOZ_MUST_USE bool add(AddPtr p, MDefinition* def); + [[nodiscard]] bool add(AddPtr p, MDefinition* def); void overwrite(AddPtr p, MDefinition* def); void forget(const MDefinition* def); void clear(); @@ -77,37 +77,37 @@ class ValueNumberer SetUseRemoved }; - MOZ_MUST_USE bool handleUseReleased(MDefinition* def, UseRemovedOption useRemovedOption); - MOZ_MUST_USE bool discardDefsRecursively(MDefinition* def); - MOZ_MUST_USE bool releaseResumePointOperands(MResumePoint* resume); - MOZ_MUST_USE bool releaseAndRemovePhiOperands(MPhi* phi); - MOZ_MUST_USE bool releaseOperands(MDefinition* def); - MOZ_MUST_USE bool discardDef(MDefinition* def); - MOZ_MUST_USE bool processDeadDefs(); + [[nodiscard]] bool handleUseReleased(MDefinition* def, UseRemovedOption useRemovedOption); + [[nodiscard]] bool discardDefsRecursively(MDefinition* def); + [[nodiscard]] bool releaseResumePointOperands(MResumePoint* resume); + [[nodiscard]] bool releaseAndRemovePhiOperands(MPhi* phi); + [[nodiscard]] bool releaseOperands(MDefinition* def); + [[nodiscard]] bool discardDef(MDefinition* def); + [[nodiscard]] bool processDeadDefs(); - MOZ_MUST_USE bool fixupOSROnlyLoop(MBasicBlock* block, MBasicBlock* backedge); - MOZ_MUST_USE bool removePredecessorAndDoDCE(MBasicBlock* block, MBasicBlock* pred, + [[nodiscard]] bool fixupOSROnlyLoop(MBasicBlock* block, MBasicBlock* backedge); + [[nodiscard]] bool removePredecessorAndDoDCE(MBasicBlock* block, MBasicBlock* pred, size_t predIndex); - MOZ_MUST_USE bool removePredecessorAndCleanUp(MBasicBlock* block, MBasicBlock* pred); + [[nodiscard]] bool removePredecessorAndCleanUp(MBasicBlock* block, MBasicBlock* pred); MDefinition* simplified(MDefinition* def) const; MDefinition* leader(MDefinition* def); bool hasLeader(const MPhi* phi, const MBasicBlock* phiBlock) const; bool loopHasOptimizablePhi(MBasicBlock* header) const; - MOZ_MUST_USE bool visitDefinition(MDefinition* def); - MOZ_MUST_USE bool visitControlInstruction(MBasicBlock* block, const MBasicBlock* root); - MOZ_MUST_USE bool visitUnreachableBlock(MBasicBlock* block); - MOZ_MUST_USE bool visitBlock(MBasicBlock* block, const MBasicBlock* root); - MOZ_MUST_USE bool visitDominatorTree(MBasicBlock* root); - MOZ_MUST_USE bool visitGraph(); + [[nodiscard]] bool visitDefinition(MDefinition* def); + [[nodiscard]] bool visitControlInstruction(MBasicBlock* block, const MBasicBlock* root); + [[nodiscard]] bool visitUnreachableBlock(MBasicBlock* block); + [[nodiscard]] bool visitBlock(MBasicBlock* block, const MBasicBlock* root); + [[nodiscard]] bool visitDominatorTree(MBasicBlock* root); + [[nodiscard]] bool visitGraph(); - MOZ_MUST_USE bool insertOSRFixups(); - MOZ_MUST_USE bool cleanupOSRFixups(); + [[nodiscard]] bool insertOSRFixups(); + [[nodiscard]] bool cleanupOSRFixups(); public: ValueNumberer(MIRGenerator* mir, MIRGraph& graph); - MOZ_MUST_USE bool init(); + [[nodiscard]] bool init(); enum UpdateAliasAnalysisFlag { DontUpdateAliasAnalysis, @@ -117,7 +117,7 @@ class ValueNumberer // Optimize the graph, performing expression simplification and // canonicalization, eliminating statically fully-redundant expressions, // deleting dead instructions, and removing unreachable blocks. - MOZ_MUST_USE bool run(UpdateAliasAnalysisFlag updateAliasAnalysis); + [[nodiscard]] bool run(UpdateAliasAnalysisFlag updateAliasAnalysis); }; } // namespace jit diff --git a/js/src/jit/shared/CodeGenerator-shared.cpp b/js/src/jit/shared/CodeGenerator-shared.cpp index cdacf9ead5..ccda378a3a 100644 --- a/js/src/jit/shared/CodeGenerator-shared.cpp +++ b/js/src/jit/shared/CodeGenerator-shared.cpp @@ -1640,7 +1640,7 @@ CodeGeneratorShared::jumpToBlock(MBasicBlock* mir, Assembler::Condition cond) } #endif -MOZ_MUST_USE bool +[[nodiscard]] bool CodeGeneratorShared::addCacheLocations(const CacheLocationList& locs, size_t* numLocs, size_t* curIndex) { diff --git a/js/src/jit/shared/CodeGenerator-shared.h b/js/src/jit/shared/CodeGenerator-shared.h index 0cc10b567d..7f14e8cd58 100644 --- a/js/src/jit/shared/CodeGenerator-shared.h +++ b/js/src/jit/shared/CodeGenerator-shared.h @@ -270,8 +270,7 @@ class CodeGeneratorShared : public LElementVisitor }; protected: - MOZ_MUST_USE - bool allocateData(size_t size, size_t* offset) { + [[nodiscard]] bool allocateData(size_t size, size_t* offset) { MOZ_ASSERT(size % sizeof(void*) == 0); *offset = runtimeData_.length(); masm.propagateOOM(runtimeData_.appendN(0, size)); diff --git a/js/src/jit/x64/BaseAssembler-x64.h b/js/src/jit/x64/BaseAssembler-x64.h index f66cecf35d..2b42bc12d2 100644 --- a/js/src/jit/x64/BaseAssembler-x64.h +++ b/js/src/jit/x64/BaseAssembler-x64.h @@ -700,7 +700,7 @@ class BaseAssemblerX64 : public BaseAssembler m_formatter.oneByteOp64(OP_MOVSXD_GvEv, offset, base, index, scale, dst); } - MOZ_MUST_USE JmpSrc + [[nodiscard]] JmpSrc movl_ripr(RegisterID dst) { m_formatter.oneByteRipOp(OP_MOV_GvEv, 0, (RegisterID)dst); @@ -709,7 +709,7 @@ class BaseAssemblerX64 : public BaseAssembler return label; } - MOZ_MUST_USE JmpSrc + [[nodiscard]] JmpSrc movl_rrip(RegisterID src) { m_formatter.oneByteRipOp(OP_MOV_EvGv, 0, (RegisterID)src); @@ -718,7 +718,7 @@ class BaseAssemblerX64 : public BaseAssembler return label; } - MOZ_MUST_USE JmpSrc + [[nodiscard]] JmpSrc movq_ripr(RegisterID dst) { m_formatter.oneByteRipOp64(OP_MOV_GvEv, 0, dst); @@ -727,7 +727,7 @@ class BaseAssemblerX64 : public BaseAssembler return label; } - MOZ_MUST_USE JmpSrc + [[nodiscard]] JmpSrc movq_rrip(RegisterID src) { m_formatter.oneByteRipOp64(OP_MOV_EvGv, 0, (RegisterID)src); @@ -742,7 +742,7 @@ class BaseAssemblerX64 : public BaseAssembler m_formatter.oneByteOp64(OP_LEA, offset, base, dst); } - MOZ_MUST_USE JmpSrc + [[nodiscard]] JmpSrc leaq_rip(RegisterID dst) { m_formatter.oneByteRipOp64(OP_LEA, 0, dst); @@ -806,44 +806,44 @@ class BaseAssemblerX64 : public BaseAssembler twoByteOpInt64Simd("vmovq", VEX_PD, OP2_MOVD_VdEd, src, invalid_xmm, dst); } - MOZ_MUST_USE JmpSrc + [[nodiscard]] JmpSrc vmovsd_ripr(XMMRegisterID dst) { return twoByteRipOpSimd("vmovsd", VEX_SD, OP2_MOVSD_VsdWsd, invalid_xmm, dst); } - MOZ_MUST_USE JmpSrc + [[nodiscard]] JmpSrc vmovss_ripr(XMMRegisterID dst) { return twoByteRipOpSimd("vmovss", VEX_SS, OP2_MOVSD_VsdWsd, invalid_xmm, dst); } - MOZ_MUST_USE JmpSrc + [[nodiscard]] JmpSrc vmovsd_rrip(XMMRegisterID src) { return twoByteRipOpSimd("vmovsd", VEX_SD, OP2_MOVSD_WsdVsd, invalid_xmm, src); } - MOZ_MUST_USE JmpSrc + [[nodiscard]] JmpSrc vmovss_rrip(XMMRegisterID src) { return twoByteRipOpSimd("vmovss", VEX_SS, OP2_MOVSD_WsdVsd, invalid_xmm, src); } - MOZ_MUST_USE JmpSrc + [[nodiscard]] JmpSrc vmovdqa_rrip(XMMRegisterID src) { return twoByteRipOpSimd("vmovdqa", VEX_PD, OP2_MOVDQ_WdqVdq, invalid_xmm, src); } - MOZ_MUST_USE JmpSrc + [[nodiscard]] JmpSrc vmovaps_rrip(XMMRegisterID src) { return twoByteRipOpSimd("vmovdqa", VEX_PS, OP2_MOVAPS_WsdVsd, invalid_xmm, src); } - MOZ_MUST_USE JmpSrc + [[nodiscard]] JmpSrc vmovaps_ripr(XMMRegisterID dst) { return twoByteRipOpSimd("vmovaps", VEX_PS, OP2_MOVAPS_VsdWsd, invalid_xmm, dst); } - MOZ_MUST_USE JmpSrc + [[nodiscard]] JmpSrc vmovdqa_ripr(XMMRegisterID dst) { return twoByteRipOpSimd("vmovdqa", VEX_PD, OP2_MOVDQ_VdqWdq, invalid_xmm, dst); @@ -851,7 +851,7 @@ class BaseAssemblerX64 : public BaseAssembler private: - MOZ_MUST_USE JmpSrc + [[nodiscard]] JmpSrc twoByteRipOpSimd(const char* name, VexOperandType ty, TwoByteOpcodeID opcode, XMMRegisterID src0, XMMRegisterID dst) { diff --git a/js/src/jit/x86-shared/AssemblerBuffer-x86-shared.h b/js/src/jit/x86-shared/AssemblerBuffer-x86-shared.h index 8a5caa58dd..66815c2131 100644 --- a/js/src/jit/x86-shared/AssemblerBuffer-x86-shared.h +++ b/js/src/jit/x86-shared/AssemblerBuffer-x86-shared.h @@ -2,6 +2,7 @@ * * ***** BEGIN LICENSE BLOCK ***** * Copyright (C) 2008 Apple Inc. All rights reserved. + * Copyright (C) 2023 Moonchild Productions. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -112,7 +113,7 @@ namespace jit { MOZ_ALWAYS_INLINE void putInt(int value) { sizedAppend<4>(value); } MOZ_ALWAYS_INLINE void putInt64(int64_t value) { sizedAppend<8>(value); } - MOZ_MUST_USE bool append(const unsigned char* values, size_t size) + [[nodiscard]] bool append(const unsigned char* values, size_t size) { if (MOZ_UNLIKELY(!m_buffer.append(values, size))) { oomDetected(); diff --git a/js/src/jit/x86-shared/BaseAssembler-x86-shared.h b/js/src/jit/x86-shared/BaseAssembler-x86-shared.h index 31a8d1f65c..ad479cd4e0 100644 --- a/js/src/jit/x86-shared/BaseAssembler-x86-shared.h +++ b/js/src/jit/x86-shared/BaseAssembler-x86-shared.h @@ -80,7 +80,7 @@ public: spew("; %s", msg); } - MOZ_MUST_USE JmpSrc + [[nodiscard]] JmpSrc twoByteNop() { spew("nop (2 byte)"); @@ -1782,7 +1782,7 @@ public: } } - MOZ_MUST_USE JmpSrc + [[nodiscard]] JmpSrc cmpl_im_disp32(int32_t rhs, int32_t offset, RegisterID base) { spew("cmpl $0x%x, " MEM_o32b, rhs, ADDR_o32b(offset, base)); @@ -1799,7 +1799,7 @@ public: return r; } - MOZ_MUST_USE JmpSrc + [[nodiscard]] JmpSrc cmpl_im_disp32(int32_t rhs, const void* addr) { spew("cmpl $0x%x, %p", rhs, addr); @@ -2514,7 +2514,7 @@ public: // Flow control: - MOZ_MUST_USE JmpSrc + [[nodiscard]] JmpSrc call() { m_formatter.oneByteOp(OP_CALL_rel32); @@ -2538,7 +2538,7 @@ public: // Comparison of EAX against a 32-bit immediate. The immediate is patched // in as if it were a jump target. The intention is to toggle the first // byte of the instruction between a CMP and a JMP to produce a pseudo-NOP. - MOZ_MUST_USE JmpSrc + [[nodiscard]] JmpSrc cmp_eax() { m_formatter.oneByteOp(OP_CMP_EAXIv); @@ -2563,7 +2563,7 @@ public: m_formatter.immediate32(diff - 5); } } - MOZ_MUST_USE JmpSrc + [[nodiscard]] JmpSrc jmp() { m_formatter.oneByteOp(OP_JMP_rel32); @@ -2606,7 +2606,7 @@ public: } } - MOZ_MUST_USE JmpSrc + [[nodiscard]] JmpSrc jCC(Condition cond) { m_formatter.twoByteOp(jccRel32(cond)); @@ -3829,7 +3829,7 @@ threeByteOpImmSimd("vblendps", VEX_PD, OP3_BLENDPS_VpsWpsIb, ESCAPE_3A, imm, off { memcpy(buffer, m_formatter.buffer(), size()); } - MOZ_MUST_USE bool appendBuffer(const BaseAssembler& other) + [[nodiscard]] bool appendBuffer(const BaseAssembler& other) { return m_formatter.append(other.m_formatter.buffer(), other.size()); } @@ -5048,7 +5048,7 @@ threeByteOpImmSimd("vblendps", VEX_PD, OP3_BLENDPS_VpsWpsIb, ESCAPE_3A, imm, off m_buffer.putInt64Unchecked(imm); } - MOZ_ALWAYS_INLINE MOZ_MUST_USE JmpSrc + [[nodiscard]] MOZ_ALWAYS_INLINE JmpSrc immediateRel32() { m_buffer.putIntUnchecked(0); @@ -5107,7 +5107,7 @@ threeByteOpImmSimd("vblendps", VEX_PD, OP3_BLENDPS_VpsWpsIb, ESCAPE_3A, imm, off bool isAligned(int alignment) const { return m_buffer.isAligned(alignment); } unsigned char* data() { return m_buffer.data(); } - MOZ_MUST_USE bool append(const unsigned char* values, size_t size) + [[nodiscard]] bool append(const unsigned char* values, size_t size) { return m_buffer.append(values, size); } |