diff --git a/lib/Backend/BackwardPass.cpp b/lib/Backend/BackwardPass.cpp index 6b4c9f9a0b3..44676b6658e 100644 --- a/lib/Backend/BackwardPass.cpp +++ b/lib/Backend/BackwardPass.cpp @@ -486,6 +486,7 @@ BackwardPass::MergeSuccBlocksInfo(BasicBlock * block) BVSparse * typesNeedingKnownObjectLayout = nullptr; BVSparse * slotDeadStoreCandidates = nullptr; BVSparse * byteCodeUpwardExposedUsed = nullptr; + BVSparse * auxSlotPtrUpwardExposedUses = nullptr; BVSparse * couldRemoveNegZeroBailoutForDef = nullptr; BVSparse * liveFixedFields = nullptr; #if DBG @@ -505,6 +506,11 @@ BackwardPass::MergeSuccBlocksInfo(BasicBlock * block) #endif } + if ((this->tag == Js::DeadStorePhase) && !PHASE_OFF(Js::ReuseAuxSlotPtrPhase, this->func)) + { + auxSlotPtrUpwardExposedUses = JitAnew(this->tempAlloc, BVSparse, this->tempAlloc); + } + #if DBG if (!IsCollectionPass() && this->DoMarkTempObjectVerify()) { @@ -1124,6 +1130,29 @@ BackwardPass::MergeSuccBlocksInfo(BasicBlock * block) NEXT_DEAD_SUCCESSOR_BLOCK; } + if (auxSlotPtrUpwardExposedUses) + { + FOREACH_SUCCESSOR_BLOCK(blockSucc, block) + { + Assert(blockSucc->auxSlotPtrUpwardExposedUses || blockSucc->isLoopHeader); + if (blockSucc->auxSlotPtrUpwardExposedUses) + { + auxSlotPtrUpwardExposedUses->Or(blockSucc->auxSlotPtrUpwardExposedUses); + } + } + NEXT_SUCCESSOR_BLOCK; + + FOREACH_DEAD_SUCCESSOR_BLOCK(deadBlockSucc, block) + { + Assert(deadBlockSucc->auxSlotPtrUpwardExposedUses || deadBlockSucc->isLoopHeader); + if (deadBlockSucc->auxSlotPtrUpwardExposedUses) + { + auxSlotPtrUpwardExposedUses->Or(deadBlockSucc->auxSlotPtrUpwardExposedUses); + } + } + NEXT_DEAD_SUCCESSOR_BLOCK; + } + if (block->isLoopHeader) { this->DeleteBlockData(block); @@ -1187,6 +1216,7 @@ BackwardPass::MergeSuccBlocksInfo(BasicBlock * block) block->upwardExposedFields = upwardExposedFields; block->typesNeedingKnownObjectLayout = typesNeedingKnownObjectLayout; block->byteCodeUpwardExposedUsed = byteCodeUpwardExposedUsed; + block->auxSlotPtrUpwardExposedUses = auxSlotPtrUpwardExposedUses; #if DBG block->byteCodeRestoreSyms = byteCodeRestoreSyms; block->excludeByteCodeUpwardExposedTracking = excludeByteCodeUpwardExposedTracking; @@ -4267,6 +4297,7 @@ BackwardPass::DumpBlockData(BasicBlock * block, IR::Instr* instr) { block->typesNeedingKnownObjectLayout, _u("Needs Known Object Layout") }, { block->upwardExposedFields, _u("Exposed Fields") }, { block->byteCodeUpwardExposedUsed, _u("Byte Code Use") }, + { block->auxSlotPtrUpwardExposedUses, _u("Aux Slot Use")}, { byteCodeRegisterUpwardExposed, _u("Byte Code Reg Use") }, { !this->IsCollectionPass() && !block->isDead && this->DoDeadStoreSlots() ? block->slotDeadStoreCandidates : nullptr, _u("Slot deadStore candidates") }, }; @@ -5603,12 +5634,12 @@ BackwardPass::TrackObjTypeSpecProperties(IR::PropertySymOpnd *opnd, BasicBlock * { // This is an upward-exposed use of the aux slot pointer. Assert(auxSlotPtrSym); - auxSlotPtrUpwardExposed = this->currentBlock->upwardExposedUses->TestAndSet(auxSlotPtrSym->m_id); + auxSlotPtrUpwardExposed = this->currentBlock->auxSlotPtrUpwardExposedUses->TestAndSet(auxSlotPtrSym->m_id); } else if (auxSlotPtrSym != nullptr) { // The aux slot pointer is not upward-exposed at this point. - auxSlotPtrUpwardExposed = this->currentBlock->upwardExposedUses->TestAndClear(auxSlotPtrSym->m_id); + auxSlotPtrUpwardExposed = this->currentBlock->auxSlotPtrUpwardExposedUses->TestAndClear(auxSlotPtrSym->m_id); } if (!this->IsPrePass() && auxSlotPtrUpwardExposed) { diff --git a/lib/Backend/FlowGraph.h b/lib/Backend/FlowGraph.h index f05fc566f17..8b3c62f51f9 100644 --- a/lib/Backend/FlowGraph.h +++ b/lib/Backend/FlowGraph.h @@ -391,6 +391,7 @@ class BasicBlock BVSparse * upwardExposedFields; BVSparse * typesNeedingKnownObjectLayout; BVSparse * slotDeadStoreCandidates; + BVSparse * auxSlotPtrUpwardExposedUses; TempNumberTracker * tempNumberTracker; TempObjectTracker * tempObjectTracker; #if DBG @@ -437,6 +438,7 @@ class BasicBlock upwardExposedFields(nullptr), typesNeedingKnownObjectLayout(nullptr), slotDeadStoreCandidates(nullptr), + auxSlotPtrUpwardExposedUses(nullptr), tempNumberTracker(nullptr), tempObjectTracker(nullptr), #if DBG