Loading js/src/jit/IonAnalysis.cpp +32 −23 Original line number Diff line number Diff line Loading @@ -29,8 +29,9 @@ using MPhiUseIteratorStack = // Look for Phi uses with a depth-first search. If any uses are found the stack // of MPhi instructions is returned in the |worklist| argument. static bool DepthFirstSearchUse(MIRGenerator* mir, MPhiUseIteratorStack& worklist, MPhi* phi) { [[nodiscard]] static bool DepthFirstSearchUse(MIRGenerator* mir, MPhiUseIteratorStack& worklist, MPhi* phi) { // Push a Phi and the next use to iterate over in the worklist. auto push = [&worklist](MPhi* phi, MUseIterator use) -> bool { phi->setInWorklist(); Loading Loading @@ -131,8 +132,8 @@ static bool DepthFirstSearchUse(MIRGenerator* mir, return true; } static bool FlagPhiInputsAsImplicitlyUsed(MIRGenerator* mir, MBasicBlock* block, MBasicBlock* succ, [[nodiscard]] static bool FlagPhiInputsAsImplicitlyUsed( MIRGenerator* mir, MBasicBlock* block, MBasicBlock* succ, MPhiUseIteratorStack& worklist) { // When removing an edge between 2 blocks, we might remove the ability of // later phases to figure out that the uses of a Phi should be considered as Loading Loading @@ -265,7 +266,7 @@ static MInstructionIterator FindFirstInstructionAfterBail(MBasicBlock* block) { // Given an iterator pointing to the first removed instruction, mark // the operands of each removed instruction as having implicit uses. static bool FlagOperandsAsImplicitlyUsedAfter( [[nodiscard]] static bool FlagOperandsAsImplicitlyUsedAfter( MIRGenerator* mir, MBasicBlock* block, MInstructionIterator firstRemoved) { MOZ_ASSERT(firstRemoved->block() == block); Loading Loading @@ -312,7 +313,7 @@ static bool FlagOperandsAsImplicitlyUsedAfter( return true; } static bool FlagEntryResumePointOperands(MIRGenerator* mir, [[nodiscard]] static bool FlagEntryResumePointOperands(MIRGenerator* mir, MBasicBlock* block) { // Flag observable operands of the entry resume point as having implicit uses. MResumePoint* rp = block->entryResumePoint(); Loading @@ -334,7 +335,7 @@ static bool FlagEntryResumePointOperands(MIRGenerator* mir, return true; } static bool FlagAllOperandsAsImplicitlyUsed(MIRGenerator* mir, [[nodiscard]] static bool FlagAllOperandsAsImplicitlyUsed(MIRGenerator* mir, MBasicBlock* block) { return FlagEntryResumePointOperands(mir, block) && FlagOperandsAsImplicitlyUsedAfter(mir, block, block->begin()); Loading Loading @@ -420,12 +421,16 @@ bool jit::PruneUnusedBranches(MIRGenerator* mir, MIRGraph& graph) { if (!block->isMarked()) { // If we are removing the block entirely, mark the operands of every // instruction as being implicitly used. FlagAllOperandsAsImplicitlyUsed(mir, block); if (!FlagAllOperandsAsImplicitlyUsed(mir, block)) { return false; } } else if (block->alwaysBails()) { // If we are only trimming instructions after a bail, only mark operands // of removed instructions. MInstructionIterator firstRemoved = FindFirstInstructionAfterBail(block); FlagOperandsAsImplicitlyUsedAfter(mir, block, firstRemoved); if (!FlagOperandsAsImplicitlyUsedAfter(mir, block, firstRemoved)) { return false; } } } Loading Loading @@ -503,7 +508,8 @@ bool jit::PruneUnusedBranches(MIRGenerator* mir, MIRGraph& graph) { return true; } static bool SplitCriticalEdgesForBlock(MIRGraph& graph, MBasicBlock* block) { [[nodiscard]] static bool SplitCriticalEdgesForBlock(MIRGraph& graph, MBasicBlock* block) { if (block->numSuccessors() < 2) { return true; } Loading Loading @@ -767,8 +773,8 @@ static bool IsDiamondPattern(MBasicBlock* initialBlock) { return true; } static bool MaybeFoldDiamondConditionBlock(MIRGraph& graph, MBasicBlock* initialBlock) { [[nodiscard]] static bool MaybeFoldDiamondConditionBlock( MIRGraph& graph, MBasicBlock* initialBlock) { MOZ_ASSERT(IsDiamondPattern(initialBlock)); // Optimize the MIR graph to improve the code generated for conditional Loading Loading @@ -936,8 +942,8 @@ static bool IsTrianglePattern(MBasicBlock* initialBlock) { return false; } static bool MaybeFoldTriangleConditionBlock(MIRGraph& graph, MBasicBlock* initialBlock) { [[nodiscard]] static bool MaybeFoldTriangleConditionBlock( MIRGraph& graph, MBasicBlock* initialBlock) { MOZ_ASSERT(IsTrianglePattern(initialBlock)); // Optimize the MIR graph to improve the code generated for boolean Loading Loading @@ -1089,7 +1095,7 @@ static bool MaybeFoldTriangleConditionBlock(MIRGraph& graph, return true; } static bool MaybeFoldConditionBlock(MIRGraph& graph, [[nodiscard]] static bool MaybeFoldConditionBlock(MIRGraph& graph, MBasicBlock* initialBlock) { if (IsDiamondPattern(initialBlock)) { return MaybeFoldDiamondConditionBlock(graph, initialBlock); Loading @@ -1100,7 +1106,8 @@ static bool MaybeFoldConditionBlock(MIRGraph& graph, return true; } static bool MaybeFoldTestBlock(MIRGraph& graph, MBasicBlock* initialBlock) { [[nodiscard]] static bool MaybeFoldTestBlock(MIRGraph& graph, MBasicBlock* initialBlock) { // Handle test expressions on more than two inputs. For example // |if ((x > 10) && (y > 20) && (z > 30)) { ... }|, which results in the below // pattern. Loading Loading @@ -2752,7 +2759,9 @@ bool jit::RemoveUnmarkedBlocks(MIRGenerator* mir, MIRGraph& graph, continue; } FlagAllOperandsAsImplicitlyUsed(mir, block); if (!FlagAllOperandsAsImplicitlyUsed(mir, block)) { return false; } } // Find unmarked blocks and remove them. Loading Loading @@ -4003,8 +4012,8 @@ bool jit::EliminateRedundantShapeGuards(MIRGraph& graph) { return true; } static bool TryEliminateGCBarriersForAllocation(TempAllocator& alloc, MInstruction* allocation) { [[nodiscard]] static bool TryEliminateGCBarriersForAllocation( TempAllocator& alloc, MInstruction* allocation) { MOZ_ASSERT(allocation->type() == MIRType::Object); JitSpew(JitSpew_RedundantGCBarriers, "Analyzing allocation %s", Loading Loading
js/src/jit/IonAnalysis.cpp +32 −23 Original line number Diff line number Diff line Loading @@ -29,8 +29,9 @@ using MPhiUseIteratorStack = // Look for Phi uses with a depth-first search. If any uses are found the stack // of MPhi instructions is returned in the |worklist| argument. static bool DepthFirstSearchUse(MIRGenerator* mir, MPhiUseIteratorStack& worklist, MPhi* phi) { [[nodiscard]] static bool DepthFirstSearchUse(MIRGenerator* mir, MPhiUseIteratorStack& worklist, MPhi* phi) { // Push a Phi and the next use to iterate over in the worklist. auto push = [&worklist](MPhi* phi, MUseIterator use) -> bool { phi->setInWorklist(); Loading Loading @@ -131,8 +132,8 @@ static bool DepthFirstSearchUse(MIRGenerator* mir, return true; } static bool FlagPhiInputsAsImplicitlyUsed(MIRGenerator* mir, MBasicBlock* block, MBasicBlock* succ, [[nodiscard]] static bool FlagPhiInputsAsImplicitlyUsed( MIRGenerator* mir, MBasicBlock* block, MBasicBlock* succ, MPhiUseIteratorStack& worklist) { // When removing an edge between 2 blocks, we might remove the ability of // later phases to figure out that the uses of a Phi should be considered as Loading Loading @@ -265,7 +266,7 @@ static MInstructionIterator FindFirstInstructionAfterBail(MBasicBlock* block) { // Given an iterator pointing to the first removed instruction, mark // the operands of each removed instruction as having implicit uses. static bool FlagOperandsAsImplicitlyUsedAfter( [[nodiscard]] static bool FlagOperandsAsImplicitlyUsedAfter( MIRGenerator* mir, MBasicBlock* block, MInstructionIterator firstRemoved) { MOZ_ASSERT(firstRemoved->block() == block); Loading Loading @@ -312,7 +313,7 @@ static bool FlagOperandsAsImplicitlyUsedAfter( return true; } static bool FlagEntryResumePointOperands(MIRGenerator* mir, [[nodiscard]] static bool FlagEntryResumePointOperands(MIRGenerator* mir, MBasicBlock* block) { // Flag observable operands of the entry resume point as having implicit uses. MResumePoint* rp = block->entryResumePoint(); Loading @@ -334,7 +335,7 @@ static bool FlagEntryResumePointOperands(MIRGenerator* mir, return true; } static bool FlagAllOperandsAsImplicitlyUsed(MIRGenerator* mir, [[nodiscard]] static bool FlagAllOperandsAsImplicitlyUsed(MIRGenerator* mir, MBasicBlock* block) { return FlagEntryResumePointOperands(mir, block) && FlagOperandsAsImplicitlyUsedAfter(mir, block, block->begin()); Loading Loading @@ -420,12 +421,16 @@ bool jit::PruneUnusedBranches(MIRGenerator* mir, MIRGraph& graph) { if (!block->isMarked()) { // If we are removing the block entirely, mark the operands of every // instruction as being implicitly used. FlagAllOperandsAsImplicitlyUsed(mir, block); if (!FlagAllOperandsAsImplicitlyUsed(mir, block)) { return false; } } else if (block->alwaysBails()) { // If we are only trimming instructions after a bail, only mark operands // of removed instructions. MInstructionIterator firstRemoved = FindFirstInstructionAfterBail(block); FlagOperandsAsImplicitlyUsedAfter(mir, block, firstRemoved); if (!FlagOperandsAsImplicitlyUsedAfter(mir, block, firstRemoved)) { return false; } } } Loading Loading @@ -503,7 +508,8 @@ bool jit::PruneUnusedBranches(MIRGenerator* mir, MIRGraph& graph) { return true; } static bool SplitCriticalEdgesForBlock(MIRGraph& graph, MBasicBlock* block) { [[nodiscard]] static bool SplitCriticalEdgesForBlock(MIRGraph& graph, MBasicBlock* block) { if (block->numSuccessors() < 2) { return true; } Loading Loading @@ -767,8 +773,8 @@ static bool IsDiamondPattern(MBasicBlock* initialBlock) { return true; } static bool MaybeFoldDiamondConditionBlock(MIRGraph& graph, MBasicBlock* initialBlock) { [[nodiscard]] static bool MaybeFoldDiamondConditionBlock( MIRGraph& graph, MBasicBlock* initialBlock) { MOZ_ASSERT(IsDiamondPattern(initialBlock)); // Optimize the MIR graph to improve the code generated for conditional Loading Loading @@ -936,8 +942,8 @@ static bool IsTrianglePattern(MBasicBlock* initialBlock) { return false; } static bool MaybeFoldTriangleConditionBlock(MIRGraph& graph, MBasicBlock* initialBlock) { [[nodiscard]] static bool MaybeFoldTriangleConditionBlock( MIRGraph& graph, MBasicBlock* initialBlock) { MOZ_ASSERT(IsTrianglePattern(initialBlock)); // Optimize the MIR graph to improve the code generated for boolean Loading Loading @@ -1089,7 +1095,7 @@ static bool MaybeFoldTriangleConditionBlock(MIRGraph& graph, return true; } static bool MaybeFoldConditionBlock(MIRGraph& graph, [[nodiscard]] static bool MaybeFoldConditionBlock(MIRGraph& graph, MBasicBlock* initialBlock) { if (IsDiamondPattern(initialBlock)) { return MaybeFoldDiamondConditionBlock(graph, initialBlock); Loading @@ -1100,7 +1106,8 @@ static bool MaybeFoldConditionBlock(MIRGraph& graph, return true; } static bool MaybeFoldTestBlock(MIRGraph& graph, MBasicBlock* initialBlock) { [[nodiscard]] static bool MaybeFoldTestBlock(MIRGraph& graph, MBasicBlock* initialBlock) { // Handle test expressions on more than two inputs. For example // |if ((x > 10) && (y > 20) && (z > 30)) { ... }|, which results in the below // pattern. Loading Loading @@ -2752,7 +2759,9 @@ bool jit::RemoveUnmarkedBlocks(MIRGenerator* mir, MIRGraph& graph, continue; } FlagAllOperandsAsImplicitlyUsed(mir, block); if (!FlagAllOperandsAsImplicitlyUsed(mir, block)) { return false; } } // Find unmarked blocks and remove them. Loading Loading @@ -4003,8 +4012,8 @@ bool jit::EliminateRedundantShapeGuards(MIRGraph& graph) { return true; } static bool TryEliminateGCBarriersForAllocation(TempAllocator& alloc, MInstruction* allocation) { [[nodiscard]] static bool TryEliminateGCBarriersForAllocation( TempAllocator& alloc, MInstruction* allocation) { MOZ_ASSERT(allocation->type() == MIRType::Object); JitSpew(JitSpew_RedundantGCBarriers, "Analyzing allocation %s", Loading