haikuwebkit/Source/WTF/wtf/Dominators.h

762 lines
30 KiB
C
Raw Permalink Normal View History

Dominators should be factored out of the DFG https://bugs.webkit.org/show_bug.cgi?id=150764 Reviewed by Geoffrey Garen. Source/JavaScriptCore: Factored DFGDominators.h/DFGDominators.cpp into WTF. To do this, I made two changes to the DFG: 1) DFG now has a CFG abstraction called DFG::CFG. The cool thing about this is that in the future if we wanted to support inverted dominators, we could do it by just creating a DFG::BackwardCFG. 2) Got rid of DFG::Analysis. From now on, an Analysis being invalidated is expressed by the DFG::Graph having a null pointer for that analysis. When we "run" the analysis, we just instantiate it. This makes it much more natural to integrate WTF::Dominators into the DFG. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * dfg/DFGAnalysis.h: Removed. * dfg/DFGCFG.h: Added. (JSC::DFG::CFG::CFG): (JSC::DFG::CFG::root): (JSC::DFG::CFG::newMap<T>): (JSC::DFG::CFG::successors): (JSC::DFG::CFG::predecessors): (JSC::DFG::CFG::index): (JSC::DFG::CFG::node): (JSC::DFG::CFG::numNodes): (JSC::DFG::CFG::dump): * dfg/DFGCSEPhase.cpp: * dfg/DFGDisassembler.cpp: (JSC::DFG::Disassembler::createDumpList): * dfg/DFGDominators.cpp: Removed. * dfg/DFGDominators.h: (JSC::DFG::Dominators::Dominators): (JSC::DFG::Dominators::strictlyDominates): Deleted. (JSC::DFG::Dominators::dominates): Deleted. (JSC::DFG::Dominators::immediateDominatorOf): Deleted. (JSC::DFG::Dominators::forAllStrictDominatorsOf): Deleted. (JSC::DFG::Dominators::forAllDominatorsOf): Deleted. (JSC::DFG::Dominators::forAllBlocksStrictlyDominatedBy): Deleted. (JSC::DFG::Dominators::forAllBlocksDominatedBy): Deleted. (JSC::DFG::Dominators::forAllBlocksInDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInIteratedDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInPrunedIteratedDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInDominanceFrontierOfImpl): Deleted. (JSC::DFG::Dominators::forAllBlocksInIteratedDominanceFrontierOfImpl): Deleted. (JSC::DFG::Dominators::BlockData::BlockData): Deleted. * dfg/DFGEdgeDominates.h: (JSC::DFG::EdgeDominates::operator()): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::Graph): (JSC::DFG::Graph::dumpBlockHeader): (JSC::DFG::Graph::invalidateCFG): (JSC::DFG::Graph::substituteGetLocal): (JSC::DFG::Graph::handleAssertionFailure): (JSC::DFG::Graph::ensureDominators): (JSC::DFG::Graph::ensurePrePostNumbering): (JSC::DFG::Graph::ensureNaturalLoops): (JSC::DFG::Graph::valueProfileFor): * dfg/DFGGraph.h: (JSC::DFG::Graph::hasDebuggerEnabled): * dfg/DFGLICMPhase.cpp: (JSC::DFG::LICMPhase::run): (JSC::DFG::LICMPhase::attemptHoist): * dfg/DFGLoopPreHeaderCreationPhase.cpp: (JSC::DFG::createPreHeader): (JSC::DFG::LoopPreHeaderCreationPhase::run): * dfg/DFGNaturalLoops.cpp: (JSC::DFG::NaturalLoop::dump): (JSC::DFG::NaturalLoops::NaturalLoops): (JSC::DFG::NaturalLoops::~NaturalLoops): (JSC::DFG::NaturalLoops::loopsOf): (JSC::DFG::NaturalLoops::computeDependencies): Deleted. (JSC::DFG::NaturalLoops::compute): Deleted. * dfg/DFGNaturalLoops.h: (JSC::DFG::NaturalLoops::numLoops): * dfg/DFGNode.h: (JSC::DFG::Node::SuccessorsIterable::end): (JSC::DFG::Node::SuccessorsIterable::size): (JSC::DFG::Node::SuccessorsIterable::at): (JSC::DFG::Node::SuccessorsIterable::operator[]): * dfg/DFGOSREntrypointCreationPhase.cpp: (JSC::DFG::OSREntrypointCreationPhase::run): * dfg/DFGObjectAllocationSinkingPhase.cpp: * dfg/DFGPlan.cpp: (JSC::DFG::Plan::compileInThreadImpl): * dfg/DFGPrePostNumbering.cpp: (JSC::DFG::PrePostNumbering::PrePostNumbering): (JSC::DFG::PrePostNumbering::~PrePostNumbering): (JSC::DFG::PrePostNumbering::compute): Deleted. * dfg/DFGPrePostNumbering.h: (JSC::DFG::PrePostNumbering::preNumber): (JSC::DFG::PrePostNumbering::postNumber): * dfg/DFGPutStackSinkingPhase.cpp: * dfg/DFGSSACalculator.cpp: (JSC::DFG::SSACalculator::nonLocalReachingDef): (JSC::DFG::SSACalculator::reachingDefAtTail): * dfg/DFGSSACalculator.h: (JSC::DFG::SSACalculator::computePhis): * dfg/DFGSSAConversionPhase.cpp: (JSC::DFG::SSAConversionPhase::run): * ftl/FTLLink.cpp: (JSC::FTL::link): * ftl/FTLLowerDFGToLLVM.cpp: (JSC::FTL::DFG::LowerDFGToLLVM::lower): (JSC::FTL::DFG::LowerDFGToLLVM::safelyInvalidateAfterTermination): (JSC::FTL::DFG::LowerDFGToLLVM::isValid): Source/WTF: This takes what used to be DFGDominators.h/DFGDominators.cpp and turns it into a generic algorithm that can take any abstract graph. The idea is that you create Dominators<CFG> and pass it a CFG object, which defines the types of graph nodes and methods for getting successors, predecessors, etc. The DFG now defines a class called CFG, which is a wrapper for DFG::Graph that conforms to the thing that wtf/Dominators.h expects. When doing things to graphs, it's common to refer to the things in the graph as "nodes". Because I intend to reuse the CFG abstraction with many graph algorithms, that abstraction uses the term "node" to refer to a DFG basic block. But in Dominators, the method and variable names still use "block". This is because although Dominators are applicable to any kind of directed graph, it's super unlikely that we will ever use them for anything but compilers. Indeed, the only reason why I'm factoring them out of the DFG is so that I can use them with B3 and Air. This has the nice side effect that a user of WTF::Dominators<JSC::DFG::CFG> will see familiar terminology like "blocksStrictlyDominatedBy(...)" instead of "nodesStrictlyDominatedBy(...)", which would be super confusing. Overall, wtf/Dominators.h is a combination of what used to be in DFGDominators.h, DFGDominators.cpp, DFGNaiveDominators.h, and DFGNaiveDominators.cpp. I only changed code when I had to in order to make it generic. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/Dominators.h: Added. (WTF::Dominators::Dominators): (WTF::Dominators::compute): (WTF::Dominators::strictlyDominates): (WTF::Dominators::dominates): (WTF::Dominators::immediateDominatorOf): (WTF::Dominators::forAllStrictDominatorsOf): (WTF::Dominators::forAllDominatorsOf): (WTF::Dominators::forAllBlocksStrictlyDominatedBy): (WTF::Dominators::forAllBlocksDominatedBy): (WTF::Dominators::strictDominatorsOf): (WTF::Dominators::dominatorsOf): (WTF::Dominators::blocksStrictlyDominatedBy): (WTF::Dominators::blocksDominatedBy): (WTF::Dominators::forAllBlocksInDominanceFrontierOf): (WTF::Dominators::dominanceFrontierOf): (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOf): (WTF::Dominators::forAllBlocksInPrunedIteratedDominanceFrontierOf): (WTF::Dominators::iteratedDominanceFrontierOf): (WTF::Dominators::dump): (WTF::Dominators::LengauerTarjan::LengauerTarjan): (WTF::Dominators::LengauerTarjan::compute): (WTF::Dominators::LengauerTarjan::immediateDominator): (WTF::Dominators::LengauerTarjan::computeDepthFirstPreNumbering): (WTF::Dominators::LengauerTarjan::computeSemiDominatorsAndImplicitImmediateDominators): (WTF::Dominators::LengauerTarjan::computeExplicitImmediateDominators): (WTF::Dominators::LengauerTarjan::link): (WTF::Dominators::LengauerTarjan::eval): (WTF::Dominators::LengauerTarjan::compress): (WTF::Dominators::LengauerTarjan::BlockData::BlockData): (WTF::Dominators::NaiveDominators::NaiveDominators): (WTF::Dominators::NaiveDominators::dominates): (WTF::Dominators::NaiveDominators::dump): (WTF::Dominators::NaiveDominators::pruneDominators): (WTF::Dominators::ValidationContext::ValidationContext): (WTF::Dominators::ValidationContext::reportError): (WTF::Dominators::ValidationContext::handleErrors): (WTF::Dominators::naiveDominates): (WTF::Dominators::forAllBlocksInDominanceFrontierOfImpl): (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOfImpl): (WTF::Dominators::BlockData::BlockData): Canonical link: https://commits.webkit.org/168962@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@191870 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-11-02 00:48:03 +00:00
/*
Support compiling catch in the DFG https://bugs.webkit.org/show_bug.cgi?id=174590 <rdar://problem/34047845> Reviewed by Filip Pizlo. JSTests: * microbenchmarks/delta-blue-try-catch.js: Added. (exception): (value): (OrderedCollection): (OrderedCollection.prototype.add): (OrderedCollection.prototype.at): (OrderedCollection.prototype.size): (OrderedCollection.prototype.removeFirst): (OrderedCollection.prototype.remove): (Strength): (Strength.stronger): (Strength.weaker): (Strength.weakestOf): (Strength.strongest): (Strength.prototype.nextWeaker): (Constraint): (Constraint.prototype.addConstraint): (Constraint.prototype.satisfy): (Constraint.prototype.destroyConstraint): (Constraint.prototype.isInput): (UnaryConstraint): (UnaryConstraint.prototype.addToGraph): (UnaryConstraint.prototype.chooseMethod): (UnaryConstraint.prototype.isSatisfied): (UnaryConstraint.prototype.markInputs): (UnaryConstraint.prototype.output): (UnaryConstraint.prototype.recalculate): (UnaryConstraint.prototype.markUnsatisfied): (UnaryConstraint.prototype.inputsKnown): (UnaryConstraint.prototype.removeFromGraph): (StayConstraint): (StayConstraint.prototype.execute): (EditConstraint.prototype.isInput): (EditConstraint.prototype.execute): (BinaryConstraint): (BinaryConstraint.prototype.chooseMethod): (BinaryConstraint.prototype.addToGraph): (BinaryConstraint.prototype.isSatisfied): (BinaryConstraint.prototype.markInputs): (BinaryConstraint.prototype.input): (BinaryConstraint.prototype.output): (BinaryConstraint.prototype.recalculate): (BinaryConstraint.prototype.markUnsatisfied): (BinaryConstraint.prototype.inputsKnown): (BinaryConstraint.prototype.removeFromGraph): (ScaleConstraint): (ScaleConstraint.prototype.addToGraph): (ScaleConstraint.prototype.removeFromGraph): (ScaleConstraint.prototype.markInputs): (ScaleConstraint.prototype.execute): (ScaleConstraint.prototype.recalculate): (EqualityConstraint): (EqualityConstraint.prototype.execute): (Variable): (Variable.prototype.addConstraint): (Variable.prototype.removeConstraint): (Planner): (Planner.prototype.incrementalAdd): (Planner.prototype.incrementalRemove): (Planner.prototype.newMark): (Planner.prototype.makePlan): (Planner.prototype.extractPlanFromConstraints): (Planner.prototype.addPropagate): (Planner.prototype.removePropagateFrom): (Planner.prototype.addConstraintsConsumingTo): (Plan): (Plan.prototype.addConstraint): (Plan.prototype.size): (Plan.prototype.constraintAt): (Plan.prototype.execute): (chainTest): (projectionTest): (change): (deltaBlue): * microbenchmarks/fake-iterators-that-throw-when-finished.js: Added. (assert): (Numbers): (Numbers.prototype.next): (return.Transpose): (return.Transpose.prototype.next): (transpose): (verifyEven): (verifyString): (foo): (runIterators): * microbenchmarks/try-catch-word-count.js: Added. (let.assert): (EOF): (let.texts): (let.o.apply): (foo): (bar): (f): (run): (test1): (test2): (test3): (fn): (A): (B): (A.prototype.getValue): (B.prototype.getParentValue): (strlen): (sum.0): (test): (result.test.o): (set add.set add): (set forEach): (stringHash): (set if): (testFunction): (set delete.set has.set add): * stress/catch-set-argument-speculation-failure.js: Added. (o): (e): (e2): (escape): (baz): (noInline.run): (noInline): * stress/osr-enter-to-catch-with-set-local-type-check-failure.js: Added. (foo): (e): (baz): (bar): Source/JavaScriptCore: This patch implements OSR entry into op_catch in the DFG. We will support OSR entry into the FTL in a followup: https://bugs.webkit.org/show_bug.cgi?id=175396 To implement catch in the DFG, this patch introduces the concept of multiple entrypoints into CPS/LoadStore DFG IR. A lot of this patch is stringing this concept through the DFG. Many phases used to assume that Graph::block(0) is the only root, and this patch contains many straight forward changes generalizing the code to handle more than one entrypoint. A main building block of this is moving to two CFG types: SSACFG and CPSCFG. SSACFG is the same CFG we used to have. CPSCFG is a new type that introduces a fake root that has an outgoing edge to all the entrypoints. This allows our existing graph algorithms to Just Work over CPSCFG. For example, there is now the concept of SSADominators vs CPSDominators, and SSANaturalLoops vs CPSNaturalLoops. The way we compile the catch entrypoint is by bootstrapping the state of the program by loading all live bytecode locals from a buffer. The OSR entry code will store all live values into that buffer before jumping to the entrypoint. The OSR entry code is also responsible for performing type proofs of the arguments before doing an OSR entry. If there is a type mismatch, it's not legal to OSR enter into the DFG compilation. Currently, each catch entrypoint knows the argument type proofs it must perform to enter into the DFG. Currently, all entrypoints' arguments flush format are unified via ArgumentPosition, but this is just an implementation detail. The code is written more generally to assume that each entrypoint may perform its own distinct proof. op_catch now performs value profiling for all live bytecode locals in the LLInt and baseline JIT. This information is then fed into the DFG via the ExtractCatchLocal node in the prediction propagation phase. This patch also changes how we generate op_catch in bytecode. All op_catches are now split out at the end of the program in bytecode. This ensures that no op_catch is inside a try block. This is needed to ensure correctness in the DFGLiveCatchVariablePreservationPhase. That phase only inserts flushes before SetLocals inside a try block. If an op_catch were in a try block, this would cause the phase to insert a Flush before one of the state bootstrapping SetLocals, which would generate invalid IR. Moving op_catch to be generated on its own at the end of a bytecode stream seemed like the most elegant solution since it better represents that we treat op_catch as an entrypoint. This is true both in the DFG and in the baseline and LLInt: we don't reach an op_catch via normal control flow. Because op_catch cannot throw, this will not break any previous semantics of op_catch. Logically, it'd be valid to split try blocks around any non-throwing bytecode operation. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * bytecode/BytecodeDumper.cpp: (JSC::BytecodeDumper<Block>::dumpBytecode): * bytecode/BytecodeList.json: * bytecode/BytecodeUseDef.h: (JSC::computeUsesForBytecodeOffset): * bytecode/CodeBlock.cpp: (JSC::CodeBlock::finishCreation): (JSC::CodeBlock::ensureCatchLivenessIsComputedForBytecodeOffset): (JSC::CodeBlock::updateAllPredictionsAndCountLiveness): (JSC::CodeBlock::validate): * bytecode/CodeBlock.h: * bytecode/ValueProfile.h: (JSC::ValueProfile::ValueProfile): (JSC::ValueProfileAndOperandBuffer::ValueProfileAndOperandBuffer): (JSC::ValueProfileAndOperandBuffer::~ValueProfileAndOperandBuffer): (JSC::ValueProfileAndOperandBuffer::forEach): * bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::generate): (JSC::BytecodeGenerator::BytecodeGenerator): (JSC::BytecodeGenerator::emitCatch): (JSC::BytecodeGenerator::emitEnumeration): * bytecompiler/BytecodeGenerator.h: * bytecompiler/NodesCodegen.cpp: (JSC::TryNode::emitBytecode): * dfg/DFGAbstractInterpreterInlines.h: (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects): * dfg/DFGBackwardsCFG.h: (JSC::DFG::BackwardsCFG::BackwardsCFG): * dfg/DFGBasicBlock.cpp: (JSC::DFG::BasicBlock::BasicBlock): * dfg/DFGBasicBlock.h: (JSC::DFG::BasicBlock::findTerminal const): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::setDirect): (JSC::DFG::ByteCodeParser::flush): (JSC::DFG::ByteCodeParser::DelayedSetLocal::DelayedSetLocal): (JSC::DFG::ByteCodeParser::DelayedSetLocal::execute): (JSC::DFG::ByteCodeParser::parseBlock): (JSC::DFG::ByteCodeParser::parseCodeBlock): (JSC::DFG::ByteCodeParser::parse): * dfg/DFGCFG.h: (JSC::DFG::CFG::root): (JSC::DFG::CFG::roots): (JSC::DFG::CPSCFG::CPSCFG): (JSC::DFG::selectCFG): * dfg/DFGCPSRethreadingPhase.cpp: (JSC::DFG::CPSRethreadingPhase::specialCaseArguments): * dfg/DFGCSEPhase.cpp: * dfg/DFGClobberize.h: (JSC::DFG::clobberize): * dfg/DFGControlEquivalenceAnalysis.h: (JSC::DFG::ControlEquivalenceAnalysis::ControlEquivalenceAnalysis): * dfg/DFGDCEPhase.cpp: (JSC::DFG::DCEPhase::run): * dfg/DFGDisassembler.cpp: (JSC::DFG::Disassembler::createDumpList): * dfg/DFGDoesGC.cpp: (JSC::DFG::doesGC): * dfg/DFGDominators.h: (JSC::DFG::Dominators::Dominators): (JSC::DFG::ensureDominatorsForCFG): * dfg/DFGEdgeDominates.h: (JSC::DFG::EdgeDominates::EdgeDominates): (JSC::DFG::EdgeDominates::operator()): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): (JSC::DFG::FixupPhase::fixupChecksInBlock): * dfg/DFGFlushFormat.h: * dfg/DFGGraph.cpp: (JSC::DFG::Graph::Graph): (JSC::DFG::unboxLoopNode): (JSC::DFG::Graph::dumpBlockHeader): (JSC::DFG::Graph::dump): (JSC::DFG::Graph::determineReachability): (JSC::DFG::Graph::invalidateCFG): (JSC::DFG::Graph::blocksInPreOrder): (JSC::DFG::Graph::blocksInPostOrder): (JSC::DFG::Graph::ensureCPSDominators): (JSC::DFG::Graph::ensureSSADominators): (JSC::DFG::Graph::ensureCPSNaturalLoops): (JSC::DFG::Graph::ensureSSANaturalLoops): (JSC::DFG::Graph::ensureBackwardsCFG): (JSC::DFG::Graph::ensureBackwardsDominators): (JSC::DFG::Graph::ensureControlEquivalenceAnalysis): (JSC::DFG::Graph::methodOfGettingAValueProfileFor): (JSC::DFG::Graph::clearCPSCFGData): (JSC::DFG::Graph::ensureDominators): Deleted. (JSC::DFG::Graph::ensurePrePostNumbering): Deleted. (JSC::DFG::Graph::ensureNaturalLoops): Deleted. * dfg/DFGGraph.h: (JSC::DFG::Graph::willCatchExceptionInMachineFrame): (JSC::DFG::Graph::isEntrypoint const): * dfg/DFGInPlaceAbstractState.cpp: (JSC::DFG::InPlaceAbstractState::initialize): (JSC::DFG::InPlaceAbstractState::mergeToSuccessors): * dfg/DFGJITCode.cpp: (JSC::DFG::JITCode::shrinkToFit): * dfg/DFGJITCode.h: (JSC::DFG::JITCode::catchOSREntryDataForBytecodeIndex): (JSC::DFG::JITCode::finalizeCatchOSREntrypoints): (JSC::DFG::JITCode::appendCatchEntrypoint): * dfg/DFGJITCompiler.cpp: (JSC::DFG::JITCompiler::compile): (JSC::DFG::JITCompiler::compileFunction): (JSC::DFG::JITCompiler::noticeCatchEntrypoint): (JSC::DFG::JITCompiler::noticeOSREntry): (JSC::DFG::JITCompiler::makeCatchOSREntryBuffer): * dfg/DFGJITCompiler.h: * dfg/DFGLICMPhase.cpp: (JSC::DFG::LICMPhase::run): (JSC::DFG::LICMPhase::attemptHoist): * dfg/DFGLiveCatchVariablePreservationPhase.cpp: (JSC::DFG::LiveCatchVariablePreservationPhase::run): (JSC::DFG::LiveCatchVariablePreservationPhase::isValidFlushLocation): (JSC::DFG::LiveCatchVariablePreservationPhase::handleBlockForTryCatch): (JSC::DFG::LiveCatchVariablePreservationPhase::newVariableAccessData): (JSC::DFG::LiveCatchVariablePreservationPhase::willCatchException): Deleted. (JSC::DFG::LiveCatchVariablePreservationPhase::handleBlock): Deleted. * dfg/DFGLoopPreHeaderCreationPhase.cpp: (JSC::DFG::createPreHeader): (JSC::DFG::LoopPreHeaderCreationPhase::run): * dfg/DFGMaximalFlushInsertionPhase.cpp: (JSC::DFG::MaximalFlushInsertionPhase::run): (JSC::DFG::MaximalFlushInsertionPhase::treatRegularBlock): (JSC::DFG::MaximalFlushInsertionPhase::treatRootBlock): * dfg/DFGMayExit.cpp: * dfg/DFGNaturalLoops.h: (JSC::DFG::NaturalLoops::NaturalLoops): * dfg/DFGNode.h: (JSC::DFG::Node::isSwitch const): (JSC::DFG::Node::successor): (JSC::DFG::Node::catchOSREntryIndex const): (JSC::DFG::Node::catchLocalPrediction): (JSC::DFG::Node::isSwitch): Deleted. * dfg/DFGNodeType.h: * dfg/DFGOSREntry.cpp: (JSC::DFG::prepareCatchOSREntry): * dfg/DFGOSREntry.h: * dfg/DFGOSREntrypointCreationPhase.cpp: (JSC::DFG::OSREntrypointCreationPhase::run): * dfg/DFGOSRExitCompilerCommon.cpp: (JSC::DFG::handleExitCounts): * dfg/DFGObjectAllocationSinkingPhase.cpp: * dfg/DFGPlan.cpp: (JSC::DFG::Plan::compileInThreadImpl): * dfg/DFGPrePostNumbering.cpp: (JSC::DFG::PrePostNumbering::PrePostNumbering): Deleted. (JSC::DFG::PrePostNumbering::~PrePostNumbering): Deleted. (WTF::printInternal): Deleted. * dfg/DFGPrePostNumbering.h: (): Deleted. (JSC::DFG::PrePostNumbering::preNumber const): Deleted. (JSC::DFG::PrePostNumbering::postNumber const): Deleted. (JSC::DFG::PrePostNumbering::isStrictAncestorOf const): Deleted. (JSC::DFG::PrePostNumbering::isAncestorOf const): Deleted. (JSC::DFG::PrePostNumbering::isStrictDescendantOf const): Deleted. (JSC::DFG::PrePostNumbering::isDescendantOf const): Deleted. (JSC::DFG::PrePostNumbering::edgeKind const): Deleted. * dfg/DFGPredictionInjectionPhase.cpp: (JSC::DFG::PredictionInjectionPhase::run): * dfg/DFGPredictionPropagationPhase.cpp: * dfg/DFGPutStackSinkingPhase.cpp: * dfg/DFGSSACalculator.cpp: (JSC::DFG::SSACalculator::nonLocalReachingDef): (JSC::DFG::SSACalculator::reachingDefAtTail): * dfg/DFGSSACalculator.h: (JSC::DFG::SSACalculator::computePhis): * dfg/DFGSSAConversionPhase.cpp: (JSC::DFG::SSAConversionPhase::run): (JSC::DFG::performSSAConversion): * dfg/DFGSafeToExecute.h: (JSC::DFG::safeToExecute): * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::compileCurrentBlock): (JSC::DFG::SpeculativeJIT::checkArgumentTypes): (JSC::DFG::SpeculativeJIT::createOSREntries): (JSC::DFG::SpeculativeJIT::linkOSREntries): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGStaticExecutionCountEstimationPhase.cpp: (JSC::DFG::StaticExecutionCountEstimationPhase::run): * dfg/DFGStrengthReductionPhase.cpp: (JSC::DFG::StrengthReductionPhase::handleNode): * dfg/DFGTierUpCheckInjectionPhase.cpp: (JSC::DFG::TierUpCheckInjectionPhase::run): (JSC::DFG::TierUpCheckInjectionPhase::buildNaturalLoopToLoopHintMap): * dfg/DFGTypeCheckHoistingPhase.cpp: (JSC::DFG::TypeCheckHoistingPhase::run): * dfg/DFGValidate.cpp: * ftl/FTLLink.cpp: (JSC::FTL::link): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::lower): (JSC::FTL::DFG::LowerDFGToB3::safelyInvalidateAfterTermination): (JSC::FTL::DFG::LowerDFGToB3::isValid): * jit/JIT.h: * jit/JITInlines.h: (JSC::JIT::callOperation): * jit/JITOpcodes.cpp: (JSC::JIT::emit_op_catch): * jit/JITOpcodes32_64.cpp: (JSC::JIT::emit_op_catch): * jit/JITOperations.cpp: * jit/JITOperations.h: * llint/LLIntSlowPaths.cpp: (JSC::LLInt::LLINT_SLOW_PATH_DECL): * llint/LLIntSlowPaths.h: * llint/LowLevelInterpreter32_64.asm: * llint/LowLevelInterpreter64.asm: Source/WTF: This patch generalizes the BackwardsGraph fake root into a more generalizable class called SingleRootGraph. SingleRootGraph exposes the general graph interface used in Dominators and NaturalLoops. SingleRootGraph takes as input a graph with the normal graph interface, but also allows the input graph to contain more than one root. SingleRootGraph then exposes a single root, which it creates, that has an outgoing edge to all the roots in the original graph. * WTF.xcodeproj/project.pbxproj: * wtf/BackwardsGraph.h: (WTF::BackwardsGraph::dump const): (WTF::BackwardsGraph::rootName): Deleted. (WTF::BackwardsGraph::Node::Node): Deleted. (WTF::BackwardsGraph::Node::root): Deleted. (WTF::BackwardsGraph::Node::operator== const): Deleted. (WTF::BackwardsGraph::Node::operator!= const): Deleted. (WTF::BackwardsGraph::Node::operator bool const): Deleted. (WTF::BackwardsGraph::Node::isRoot const): Deleted. (WTF::BackwardsGraph::Node::node const): Deleted. (): Deleted. (WTF::BackwardsGraph::Set::Set): Deleted. (WTF::BackwardsGraph::Set::add): Deleted. (WTF::BackwardsGraph::Set::remove): Deleted. (WTF::BackwardsGraph::Set::contains): Deleted. (WTF::BackwardsGraph::Set::dump const): Deleted. (WTF::BackwardsGraph::Map::Map): Deleted. (WTF::BackwardsGraph::Map::clear): Deleted. (WTF::BackwardsGraph::Map::size const): Deleted. (WTF::BackwardsGraph::Map::operator[]): Deleted. (WTF::BackwardsGraph::Map::operator[] const): Deleted. * wtf/Dominators.h: (WTF::Dominators::Dominators): (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOf): (WTF::Dominators::forAllBlocksInPrunedIteratedDominanceFrontierOf): (WTF::Dominators::iteratedDominanceFrontierOf const): (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOfImpl const): * wtf/SingleRootGraph.h: Added. (WTF::SingleRootGraphNode::rootName): (WTF::SingleRootGraphNode::SingleRootGraphNode): (WTF::SingleRootGraphNode::root): (WTF::SingleRootGraphNode::operator== const): (WTF::SingleRootGraphNode::operator!= const): (WTF::SingleRootGraphNode::operator bool const): (WTF::SingleRootGraphNode::isRoot const): (WTF::SingleRootGraphNode::node const): (WTF::SingleRootGraphSet::add): (WTF::SingleRootGraphSet::remove): (WTF::SingleRootGraphSet::contains): (WTF::SingleRootGraphSet::dump const): (WTF::SingleRootMap::SingleRootMap): (WTF::SingleRootMap::clear): (WTF::SingleRootMap::size const): (WTF::SingleRootMap::operator[]): (WTF::SingleRootMap::operator[] const): (WTF::SingleRootGraph::SingleRootGraph): (WTF::SingleRootGraph::root const): (WTF::SingleRootGraph::newMap): (WTF::SingleRootGraph::successors const): (WTF::SingleRootGraph::predecessors const): (WTF::SingleRootGraph::index const): (WTF::SingleRootGraph::node const): (WTF::SingleRootGraph::numNodes const): (WTF::SingleRootGraph::dump const): (WTF::SingleRootGraph::assertIsConsistent const): Canonical link: https://commits.webkit.org/192644@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@221196 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-08-25 18:26:15 +00:00
* Copyright (C) 2011-2017 Apple Inc. All rights reserved.
Dominators should be factored out of the DFG https://bugs.webkit.org/show_bug.cgi?id=150764 Reviewed by Geoffrey Garen. Source/JavaScriptCore: Factored DFGDominators.h/DFGDominators.cpp into WTF. To do this, I made two changes to the DFG: 1) DFG now has a CFG abstraction called DFG::CFG. The cool thing about this is that in the future if we wanted to support inverted dominators, we could do it by just creating a DFG::BackwardCFG. 2) Got rid of DFG::Analysis. From now on, an Analysis being invalidated is expressed by the DFG::Graph having a null pointer for that analysis. When we "run" the analysis, we just instantiate it. This makes it much more natural to integrate WTF::Dominators into the DFG. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * dfg/DFGAnalysis.h: Removed. * dfg/DFGCFG.h: Added. (JSC::DFG::CFG::CFG): (JSC::DFG::CFG::root): (JSC::DFG::CFG::newMap<T>): (JSC::DFG::CFG::successors): (JSC::DFG::CFG::predecessors): (JSC::DFG::CFG::index): (JSC::DFG::CFG::node): (JSC::DFG::CFG::numNodes): (JSC::DFG::CFG::dump): * dfg/DFGCSEPhase.cpp: * dfg/DFGDisassembler.cpp: (JSC::DFG::Disassembler::createDumpList): * dfg/DFGDominators.cpp: Removed. * dfg/DFGDominators.h: (JSC::DFG::Dominators::Dominators): (JSC::DFG::Dominators::strictlyDominates): Deleted. (JSC::DFG::Dominators::dominates): Deleted. (JSC::DFG::Dominators::immediateDominatorOf): Deleted. (JSC::DFG::Dominators::forAllStrictDominatorsOf): Deleted. (JSC::DFG::Dominators::forAllDominatorsOf): Deleted. (JSC::DFG::Dominators::forAllBlocksStrictlyDominatedBy): Deleted. (JSC::DFG::Dominators::forAllBlocksDominatedBy): Deleted. (JSC::DFG::Dominators::forAllBlocksInDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInIteratedDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInPrunedIteratedDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInDominanceFrontierOfImpl): Deleted. (JSC::DFG::Dominators::forAllBlocksInIteratedDominanceFrontierOfImpl): Deleted. (JSC::DFG::Dominators::BlockData::BlockData): Deleted. * dfg/DFGEdgeDominates.h: (JSC::DFG::EdgeDominates::operator()): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::Graph): (JSC::DFG::Graph::dumpBlockHeader): (JSC::DFG::Graph::invalidateCFG): (JSC::DFG::Graph::substituteGetLocal): (JSC::DFG::Graph::handleAssertionFailure): (JSC::DFG::Graph::ensureDominators): (JSC::DFG::Graph::ensurePrePostNumbering): (JSC::DFG::Graph::ensureNaturalLoops): (JSC::DFG::Graph::valueProfileFor): * dfg/DFGGraph.h: (JSC::DFG::Graph::hasDebuggerEnabled): * dfg/DFGLICMPhase.cpp: (JSC::DFG::LICMPhase::run): (JSC::DFG::LICMPhase::attemptHoist): * dfg/DFGLoopPreHeaderCreationPhase.cpp: (JSC::DFG::createPreHeader): (JSC::DFG::LoopPreHeaderCreationPhase::run): * dfg/DFGNaturalLoops.cpp: (JSC::DFG::NaturalLoop::dump): (JSC::DFG::NaturalLoops::NaturalLoops): (JSC::DFG::NaturalLoops::~NaturalLoops): (JSC::DFG::NaturalLoops::loopsOf): (JSC::DFG::NaturalLoops::computeDependencies): Deleted. (JSC::DFG::NaturalLoops::compute): Deleted. * dfg/DFGNaturalLoops.h: (JSC::DFG::NaturalLoops::numLoops): * dfg/DFGNode.h: (JSC::DFG::Node::SuccessorsIterable::end): (JSC::DFG::Node::SuccessorsIterable::size): (JSC::DFG::Node::SuccessorsIterable::at): (JSC::DFG::Node::SuccessorsIterable::operator[]): * dfg/DFGOSREntrypointCreationPhase.cpp: (JSC::DFG::OSREntrypointCreationPhase::run): * dfg/DFGObjectAllocationSinkingPhase.cpp: * dfg/DFGPlan.cpp: (JSC::DFG::Plan::compileInThreadImpl): * dfg/DFGPrePostNumbering.cpp: (JSC::DFG::PrePostNumbering::PrePostNumbering): (JSC::DFG::PrePostNumbering::~PrePostNumbering): (JSC::DFG::PrePostNumbering::compute): Deleted. * dfg/DFGPrePostNumbering.h: (JSC::DFG::PrePostNumbering::preNumber): (JSC::DFG::PrePostNumbering::postNumber): * dfg/DFGPutStackSinkingPhase.cpp: * dfg/DFGSSACalculator.cpp: (JSC::DFG::SSACalculator::nonLocalReachingDef): (JSC::DFG::SSACalculator::reachingDefAtTail): * dfg/DFGSSACalculator.h: (JSC::DFG::SSACalculator::computePhis): * dfg/DFGSSAConversionPhase.cpp: (JSC::DFG::SSAConversionPhase::run): * ftl/FTLLink.cpp: (JSC::FTL::link): * ftl/FTLLowerDFGToLLVM.cpp: (JSC::FTL::DFG::LowerDFGToLLVM::lower): (JSC::FTL::DFG::LowerDFGToLLVM::safelyInvalidateAfterTermination): (JSC::FTL::DFG::LowerDFGToLLVM::isValid): Source/WTF: This takes what used to be DFGDominators.h/DFGDominators.cpp and turns it into a generic algorithm that can take any abstract graph. The idea is that you create Dominators<CFG> and pass it a CFG object, which defines the types of graph nodes and methods for getting successors, predecessors, etc. The DFG now defines a class called CFG, which is a wrapper for DFG::Graph that conforms to the thing that wtf/Dominators.h expects. When doing things to graphs, it's common to refer to the things in the graph as "nodes". Because I intend to reuse the CFG abstraction with many graph algorithms, that abstraction uses the term "node" to refer to a DFG basic block. But in Dominators, the method and variable names still use "block". This is because although Dominators are applicable to any kind of directed graph, it's super unlikely that we will ever use them for anything but compilers. Indeed, the only reason why I'm factoring them out of the DFG is so that I can use them with B3 and Air. This has the nice side effect that a user of WTF::Dominators<JSC::DFG::CFG> will see familiar terminology like "blocksStrictlyDominatedBy(...)" instead of "nodesStrictlyDominatedBy(...)", which would be super confusing. Overall, wtf/Dominators.h is a combination of what used to be in DFGDominators.h, DFGDominators.cpp, DFGNaiveDominators.h, and DFGNaiveDominators.cpp. I only changed code when I had to in order to make it generic. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/Dominators.h: Added. (WTF::Dominators::Dominators): (WTF::Dominators::compute): (WTF::Dominators::strictlyDominates): (WTF::Dominators::dominates): (WTF::Dominators::immediateDominatorOf): (WTF::Dominators::forAllStrictDominatorsOf): (WTF::Dominators::forAllDominatorsOf): (WTF::Dominators::forAllBlocksStrictlyDominatedBy): (WTF::Dominators::forAllBlocksDominatedBy): (WTF::Dominators::strictDominatorsOf): (WTF::Dominators::dominatorsOf): (WTF::Dominators::blocksStrictlyDominatedBy): (WTF::Dominators::blocksDominatedBy): (WTF::Dominators::forAllBlocksInDominanceFrontierOf): (WTF::Dominators::dominanceFrontierOf): (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOf): (WTF::Dominators::forAllBlocksInPrunedIteratedDominanceFrontierOf): (WTF::Dominators::iteratedDominanceFrontierOf): (WTF::Dominators::dump): (WTF::Dominators::LengauerTarjan::LengauerTarjan): (WTF::Dominators::LengauerTarjan::compute): (WTF::Dominators::LengauerTarjan::immediateDominator): (WTF::Dominators::LengauerTarjan::computeDepthFirstPreNumbering): (WTF::Dominators::LengauerTarjan::computeSemiDominatorsAndImplicitImmediateDominators): (WTF::Dominators::LengauerTarjan::computeExplicitImmediateDominators): (WTF::Dominators::LengauerTarjan::link): (WTF::Dominators::LengauerTarjan::eval): (WTF::Dominators::LengauerTarjan::compress): (WTF::Dominators::LengauerTarjan::BlockData::BlockData): (WTF::Dominators::NaiveDominators::NaiveDominators): (WTF::Dominators::NaiveDominators::dominates): (WTF::Dominators::NaiveDominators::dump): (WTF::Dominators::NaiveDominators::pruneDominators): (WTF::Dominators::ValidationContext::ValidationContext): (WTF::Dominators::ValidationContext::reportError): (WTF::Dominators::ValidationContext::handleErrors): (WTF::Dominators::naiveDominates): (WTF::Dominators::forAllBlocksInDominanceFrontierOfImpl): (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOfImpl): (WTF::Dominators::BlockData::BlockData): Canonical link: https://commits.webkit.org/168962@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@191870 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-11-02 00:48:03 +00:00
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
Use pragma once in WTF https://bugs.webkit.org/show_bug.cgi?id=190527 Reviewed by Chris Dumez. Source/WTF: We also need to consistently include wtf headers from within wtf so we can build wtf without symbol redefinition errors from including the copy in Source and the copy in the build directory. * wtf/ASCIICType.h: * wtf/Assertions.cpp: * wtf/Assertions.h: * wtf/Atomics.h: * wtf/AutomaticThread.cpp: * wtf/AutomaticThread.h: * wtf/BackwardsGraph.h: * wtf/Bag.h: * wtf/BagToHashMap.h: * wtf/BitVector.cpp: * wtf/BitVector.h: * wtf/Bitmap.h: * wtf/BloomFilter.h: * wtf/Box.h: * wtf/BubbleSort.h: * wtf/BumpPointerAllocator.h: * wtf/ByteOrder.h: * wtf/CPUTime.cpp: * wtf/CallbackAggregator.h: * wtf/CheckedArithmetic.h: * wtf/CheckedBoolean.h: * wtf/ClockType.cpp: * wtf/ClockType.h: * wtf/CommaPrinter.h: * wtf/CompilationThread.cpp: * wtf/CompilationThread.h: * wtf/Compiler.h: * wtf/ConcurrentPtrHashSet.cpp: * wtf/ConcurrentVector.h: * wtf/Condition.h: * wtf/CountingLock.cpp: * wtf/CrossThreadTaskHandler.cpp: * wtf/CryptographicUtilities.cpp: * wtf/CryptographicUtilities.h: * wtf/CryptographicallyRandomNumber.cpp: * wtf/CryptographicallyRandomNumber.h: * wtf/CurrentTime.cpp: * wtf/DataLog.cpp: * wtf/DataLog.h: * wtf/DateMath.cpp: * wtf/DateMath.h: * wtf/DecimalNumber.cpp: * wtf/DecimalNumber.h: * wtf/Deque.h: * wtf/DisallowCType.h: * wtf/Dominators.h: * wtf/DoublyLinkedList.h: * wtf/FastBitVector.cpp: * wtf/FastMalloc.cpp: * wtf/FastMalloc.h: * wtf/FeatureDefines.h: * wtf/FilePrintStream.cpp: * wtf/FilePrintStream.h: * wtf/FlipBytes.h: * wtf/FunctionDispatcher.cpp: * wtf/FunctionDispatcher.h: * wtf/GetPtr.h: * wtf/Gigacage.cpp: * wtf/GlobalVersion.cpp: * wtf/GraphNodeWorklist.h: * wtf/GregorianDateTime.cpp: * wtf/GregorianDateTime.h: * wtf/HashFunctions.h: * wtf/HashMap.h: * wtf/HashMethod.h: * wtf/HashSet.h: * wtf/HashTable.cpp: * wtf/HashTraits.h: * wtf/Indenter.h: * wtf/IndexSparseSet.h: * wtf/InlineASM.h: * wtf/Insertion.h: * wtf/IteratorAdaptors.h: * wtf/IteratorRange.h: * wtf/JSONValues.cpp: * wtf/JSValueMalloc.cpp: * wtf/LEBDecoder.h: * wtf/Language.cpp: * wtf/ListDump.h: * wtf/Lock.cpp: * wtf/Lock.h: * wtf/LockAlgorithm.h: * wtf/LockedPrintStream.cpp: * wtf/Locker.h: * wtf/MD5.cpp: * wtf/MD5.h: * wtf/MainThread.cpp: * wtf/MainThread.h: * wtf/MallocPtr.h: * wtf/MathExtras.h: * wtf/MediaTime.cpp: * wtf/MediaTime.h: * wtf/MemoryPressureHandler.cpp: * wtf/MessageQueue.h: * wtf/MetaAllocator.cpp: * wtf/MetaAllocator.h: * wtf/MetaAllocatorHandle.h: * wtf/MonotonicTime.cpp: * wtf/MonotonicTime.h: * wtf/NakedPtr.h: * wtf/NoLock.h: * wtf/NoTailCalls.h: * wtf/Noncopyable.h: * wtf/NumberOfCores.cpp: * wtf/NumberOfCores.h: * wtf/OSAllocator.h: * wtf/OSAllocatorPosix.cpp: * wtf/OSRandomSource.cpp: * wtf/OSRandomSource.h: * wtf/ObjcRuntimeExtras.h: * wtf/OrderMaker.h: * wtf/PackedIntVector.h: * wtf/PageAllocation.h: * wtf/PageBlock.cpp: * wtf/PageBlock.h: * wtf/PageReservation.h: * wtf/ParallelHelperPool.cpp: * wtf/ParallelHelperPool.h: * wtf/ParallelJobs.h: * wtf/ParallelJobsLibdispatch.h: * wtf/ParallelVectorIterator.h: * wtf/ParkingLot.cpp: * wtf/ParkingLot.h: * wtf/Platform.h: * wtf/PointerComparison.h: * wtf/Poisoned.cpp: * wtf/PrintStream.cpp: * wtf/PrintStream.h: * wtf/ProcessID.h: * wtf/ProcessPrivilege.cpp: * wtf/RAMSize.cpp: * wtf/RAMSize.h: * wtf/RandomDevice.cpp: * wtf/RandomNumber.cpp: * wtf/RandomNumber.h: * wtf/RandomNumberSeed.h: * wtf/RangeSet.h: * wtf/RawPointer.h: * wtf/ReadWriteLock.cpp: * wtf/RedBlackTree.h: * wtf/Ref.h: * wtf/RefCountedArray.h: * wtf/RefCountedLeakCounter.cpp: * wtf/RefCountedLeakCounter.h: * wtf/RefCounter.h: * wtf/RefPtr.h: * wtf/RetainPtr.h: * wtf/RunLoop.cpp: * wtf/RunLoop.h: * wtf/RunLoopTimer.h: * wtf/RunLoopTimerCF.cpp: * wtf/SHA1.cpp: * wtf/SHA1.h: * wtf/SaturatedArithmetic.h: (saturatedSubtraction): * wtf/SchedulePair.h: * wtf/SchedulePairCF.cpp: * wtf/SchedulePairMac.mm: * wtf/ScopedLambda.h: * wtf/Seconds.cpp: * wtf/Seconds.h: * wtf/SegmentedVector.h: * wtf/SentinelLinkedList.h: * wtf/SharedTask.h: * wtf/SimpleStats.h: * wtf/SingleRootGraph.h: * wtf/SinglyLinkedList.h: * wtf/SixCharacterHash.cpp: * wtf/SixCharacterHash.h: * wtf/SmallPtrSet.h: * wtf/Spectrum.h: * wtf/StackBounds.cpp: * wtf/StackBounds.h: * wtf/StackStats.cpp: * wtf/StackStats.h: * wtf/StackTrace.cpp: * wtf/StdLibExtras.h: * wtf/StreamBuffer.h: * wtf/StringHashDumpContext.h: * wtf/StringPrintStream.cpp: * wtf/StringPrintStream.h: * wtf/ThreadGroup.cpp: * wtf/ThreadMessage.cpp: * wtf/ThreadSpecific.h: * wtf/Threading.cpp: * wtf/Threading.h: * wtf/ThreadingPrimitives.h: * wtf/ThreadingPthreads.cpp: * wtf/TimeWithDynamicClockType.cpp: * wtf/TimeWithDynamicClockType.h: * wtf/TimingScope.cpp: * wtf/TinyLRUCache.h: * wtf/TinyPtrSet.h: * wtf/TriState.h: * wtf/TypeCasts.h: * wtf/UUID.cpp: * wtf/UnionFind.h: * wtf/VMTags.h: * wtf/ValueCheck.h: * wtf/Vector.h: * wtf/VectorTraits.h: * wtf/WallTime.cpp: * wtf/WallTime.h: * wtf/WeakPtr.h: * wtf/WeakRandom.h: * wtf/WordLock.cpp: * wtf/WordLock.h: * wtf/WorkQueue.cpp: * wtf/WorkQueue.h: * wtf/WorkerPool.cpp: * wtf/cf/LanguageCF.cpp: * wtf/cf/RunLoopCF.cpp: * wtf/cocoa/Entitlements.mm: * wtf/cocoa/MachSendRight.cpp: * wtf/cocoa/MainThreadCocoa.mm: * wtf/cocoa/MemoryFootprintCocoa.cpp: * wtf/cocoa/WorkQueueCocoa.cpp: * wtf/dtoa.cpp: * wtf/dtoa.h: * wtf/ios/WebCoreThread.cpp: * wtf/ios/WebCoreThread.h: * wtf/mac/AppKitCompatibilityDeclarations.h: * wtf/mac/DeprecatedSymbolsUsedBySafari.mm: * wtf/mbmalloc.cpp: * wtf/persistence/PersistentCoders.cpp: * wtf/persistence/PersistentDecoder.cpp: * wtf/persistence/PersistentEncoder.cpp: * wtf/spi/cf/CFBundleSPI.h: * wtf/spi/darwin/CommonCryptoSPI.h: * wtf/text/ASCIIFastPath.h: * wtf/text/ASCIILiteral.cpp: * wtf/text/AtomicString.cpp: * wtf/text/AtomicString.h: * wtf/text/AtomicStringHash.h: * wtf/text/AtomicStringImpl.cpp: * wtf/text/AtomicStringImpl.h: * wtf/text/AtomicStringTable.cpp: * wtf/text/AtomicStringTable.h: * wtf/text/Base64.cpp: * wtf/text/CString.cpp: * wtf/text/CString.h: * wtf/text/ConversionMode.h: * wtf/text/ExternalStringImpl.cpp: * wtf/text/IntegerToStringConversion.h: * wtf/text/LChar.h: * wtf/text/LineEnding.cpp: * wtf/text/StringBuffer.h: * wtf/text/StringBuilder.cpp: * wtf/text/StringBuilder.h: * wtf/text/StringBuilderJSON.cpp: * wtf/text/StringCommon.h: * wtf/text/StringConcatenate.h: * wtf/text/StringHash.h: * wtf/text/StringImpl.cpp: * wtf/text/StringImpl.h: * wtf/text/StringOperators.h: * wtf/text/StringView.cpp: * wtf/text/StringView.h: * wtf/text/SymbolImpl.cpp: * wtf/text/SymbolRegistry.cpp: * wtf/text/SymbolRegistry.h: * wtf/text/TextBreakIterator.cpp: * wtf/text/TextBreakIterator.h: * wtf/text/TextBreakIteratorInternalICU.h: * wtf/text/TextPosition.h: * wtf/text/TextStream.cpp: * wtf/text/UniquedStringImpl.h: * wtf/text/WTFString.cpp: * wtf/text/WTFString.h: * wtf/text/cocoa/StringCocoa.mm: * wtf/text/cocoa/StringViewCocoa.mm: * wtf/text/cocoa/TextBreakIteratorInternalICUCocoa.cpp: * wtf/text/icu/UTextProvider.cpp: * wtf/text/icu/UTextProvider.h: * wtf/text/icu/UTextProviderLatin1.cpp: * wtf/text/icu/UTextProviderLatin1.h: * wtf/text/icu/UTextProviderUTF16.cpp: * wtf/text/icu/UTextProviderUTF16.h: * wtf/threads/BinarySemaphore.cpp: * wtf/threads/BinarySemaphore.h: * wtf/threads/Signals.cpp: * wtf/unicode/CharacterNames.h: * wtf/unicode/Collator.h: * wtf/unicode/CollatorDefault.cpp: * wtf/unicode/UTF8.cpp: * wtf/unicode/UTF8.h: Tools: Put WorkQueue in namespace DRT so it does not conflict with WTF::WorkQueue. * DumpRenderTree/TestRunner.cpp: (TestRunner::queueLoadHTMLString): (TestRunner::queueLoadAlternateHTMLString): (TestRunner::queueBackNavigation): (TestRunner::queueForwardNavigation): (TestRunner::queueLoadingScript): (TestRunner::queueNonLoadingScript): (TestRunner::queueReload): * DumpRenderTree/WorkQueue.cpp: (WorkQueue::singleton): Deleted. (WorkQueue::WorkQueue): Deleted. (WorkQueue::queue): Deleted. (WorkQueue::dequeue): Deleted. (WorkQueue::count): Deleted. (WorkQueue::clear): Deleted. (WorkQueue::processWork): Deleted. * DumpRenderTree/WorkQueue.h: (WorkQueue::setFrozen): Deleted. * DumpRenderTree/WorkQueueItem.h: * DumpRenderTree/mac/DumpRenderTree.mm: (runTest): * DumpRenderTree/mac/FrameLoadDelegate.mm: (-[FrameLoadDelegate processWork:]): (-[FrameLoadDelegate webView:locationChangeDone:forDataSource:]): * DumpRenderTree/mac/TestRunnerMac.mm: (TestRunner::notifyDone): (TestRunner::forceImmediateCompletion): (TestRunner::queueLoad): * DumpRenderTree/win/DumpRenderTree.cpp: (runTest): * DumpRenderTree/win/FrameLoadDelegate.cpp: (FrameLoadDelegate::processWork): (FrameLoadDelegate::locationChangeDone): * DumpRenderTree/win/TestRunnerWin.cpp: (TestRunner::notifyDone): (TestRunner::forceImmediateCompletion): (TestRunner::queueLoad): Canonical link: https://commits.webkit.org/205473@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@237099 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-10-15 14:24:49 +00:00
#pragma once
Dominators should be factored out of the DFG https://bugs.webkit.org/show_bug.cgi?id=150764 Reviewed by Geoffrey Garen. Source/JavaScriptCore: Factored DFGDominators.h/DFGDominators.cpp into WTF. To do this, I made two changes to the DFG: 1) DFG now has a CFG abstraction called DFG::CFG. The cool thing about this is that in the future if we wanted to support inverted dominators, we could do it by just creating a DFG::BackwardCFG. 2) Got rid of DFG::Analysis. From now on, an Analysis being invalidated is expressed by the DFG::Graph having a null pointer for that analysis. When we "run" the analysis, we just instantiate it. This makes it much more natural to integrate WTF::Dominators into the DFG. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * dfg/DFGAnalysis.h: Removed. * dfg/DFGCFG.h: Added. (JSC::DFG::CFG::CFG): (JSC::DFG::CFG::root): (JSC::DFG::CFG::newMap<T>): (JSC::DFG::CFG::successors): (JSC::DFG::CFG::predecessors): (JSC::DFG::CFG::index): (JSC::DFG::CFG::node): (JSC::DFG::CFG::numNodes): (JSC::DFG::CFG::dump): * dfg/DFGCSEPhase.cpp: * dfg/DFGDisassembler.cpp: (JSC::DFG::Disassembler::createDumpList): * dfg/DFGDominators.cpp: Removed. * dfg/DFGDominators.h: (JSC::DFG::Dominators::Dominators): (JSC::DFG::Dominators::strictlyDominates): Deleted. (JSC::DFG::Dominators::dominates): Deleted. (JSC::DFG::Dominators::immediateDominatorOf): Deleted. (JSC::DFG::Dominators::forAllStrictDominatorsOf): Deleted. (JSC::DFG::Dominators::forAllDominatorsOf): Deleted. (JSC::DFG::Dominators::forAllBlocksStrictlyDominatedBy): Deleted. (JSC::DFG::Dominators::forAllBlocksDominatedBy): Deleted. (JSC::DFG::Dominators::forAllBlocksInDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInIteratedDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInPrunedIteratedDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInDominanceFrontierOfImpl): Deleted. (JSC::DFG::Dominators::forAllBlocksInIteratedDominanceFrontierOfImpl): Deleted. (JSC::DFG::Dominators::BlockData::BlockData): Deleted. * dfg/DFGEdgeDominates.h: (JSC::DFG::EdgeDominates::operator()): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::Graph): (JSC::DFG::Graph::dumpBlockHeader): (JSC::DFG::Graph::invalidateCFG): (JSC::DFG::Graph::substituteGetLocal): (JSC::DFG::Graph::handleAssertionFailure): (JSC::DFG::Graph::ensureDominators): (JSC::DFG::Graph::ensurePrePostNumbering): (JSC::DFG::Graph::ensureNaturalLoops): (JSC::DFG::Graph::valueProfileFor): * dfg/DFGGraph.h: (JSC::DFG::Graph::hasDebuggerEnabled): * dfg/DFGLICMPhase.cpp: (JSC::DFG::LICMPhase::run): (JSC::DFG::LICMPhase::attemptHoist): * dfg/DFGLoopPreHeaderCreationPhase.cpp: (JSC::DFG::createPreHeader): (JSC::DFG::LoopPreHeaderCreationPhase::run): * dfg/DFGNaturalLoops.cpp: (JSC::DFG::NaturalLoop::dump): (JSC::DFG::NaturalLoops::NaturalLoops): (JSC::DFG::NaturalLoops::~NaturalLoops): (JSC::DFG::NaturalLoops::loopsOf): (JSC::DFG::NaturalLoops::computeDependencies): Deleted. (JSC::DFG::NaturalLoops::compute): Deleted. * dfg/DFGNaturalLoops.h: (JSC::DFG::NaturalLoops::numLoops): * dfg/DFGNode.h: (JSC::DFG::Node::SuccessorsIterable::end): (JSC::DFG::Node::SuccessorsIterable::size): (JSC::DFG::Node::SuccessorsIterable::at): (JSC::DFG::Node::SuccessorsIterable::operator[]): * dfg/DFGOSREntrypointCreationPhase.cpp: (JSC::DFG::OSREntrypointCreationPhase::run): * dfg/DFGObjectAllocationSinkingPhase.cpp: * dfg/DFGPlan.cpp: (JSC::DFG::Plan::compileInThreadImpl): * dfg/DFGPrePostNumbering.cpp: (JSC::DFG::PrePostNumbering::PrePostNumbering): (JSC::DFG::PrePostNumbering::~PrePostNumbering): (JSC::DFG::PrePostNumbering::compute): Deleted. * dfg/DFGPrePostNumbering.h: (JSC::DFG::PrePostNumbering::preNumber): (JSC::DFG::PrePostNumbering::postNumber): * dfg/DFGPutStackSinkingPhase.cpp: * dfg/DFGSSACalculator.cpp: (JSC::DFG::SSACalculator::nonLocalReachingDef): (JSC::DFG::SSACalculator::reachingDefAtTail): * dfg/DFGSSACalculator.h: (JSC::DFG::SSACalculator::computePhis): * dfg/DFGSSAConversionPhase.cpp: (JSC::DFG::SSAConversionPhase::run): * ftl/FTLLink.cpp: (JSC::FTL::link): * ftl/FTLLowerDFGToLLVM.cpp: (JSC::FTL::DFG::LowerDFGToLLVM::lower): (JSC::FTL::DFG::LowerDFGToLLVM::safelyInvalidateAfterTermination): (JSC::FTL::DFG::LowerDFGToLLVM::isValid): Source/WTF: This takes what used to be DFGDominators.h/DFGDominators.cpp and turns it into a generic algorithm that can take any abstract graph. The idea is that you create Dominators<CFG> and pass it a CFG object, which defines the types of graph nodes and methods for getting successors, predecessors, etc. The DFG now defines a class called CFG, which is a wrapper for DFG::Graph that conforms to the thing that wtf/Dominators.h expects. When doing things to graphs, it's common to refer to the things in the graph as "nodes". Because I intend to reuse the CFG abstraction with many graph algorithms, that abstraction uses the term "node" to refer to a DFG basic block. But in Dominators, the method and variable names still use "block". This is because although Dominators are applicable to any kind of directed graph, it's super unlikely that we will ever use them for anything but compilers. Indeed, the only reason why I'm factoring them out of the DFG is so that I can use them with B3 and Air. This has the nice side effect that a user of WTF::Dominators<JSC::DFG::CFG> will see familiar terminology like "blocksStrictlyDominatedBy(...)" instead of "nodesStrictlyDominatedBy(...)", which would be super confusing. Overall, wtf/Dominators.h is a combination of what used to be in DFGDominators.h, DFGDominators.cpp, DFGNaiveDominators.h, and DFGNaiveDominators.cpp. I only changed code when I had to in order to make it generic. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/Dominators.h: Added. (WTF::Dominators::Dominators): (WTF::Dominators::compute): (WTF::Dominators::strictlyDominates): (WTF::Dominators::dominates): (WTF::Dominators::immediateDominatorOf): (WTF::Dominators::forAllStrictDominatorsOf): (WTF::Dominators::forAllDominatorsOf): (WTF::Dominators::forAllBlocksStrictlyDominatedBy): (WTF::Dominators::forAllBlocksDominatedBy): (WTF::Dominators::strictDominatorsOf): (WTF::Dominators::dominatorsOf): (WTF::Dominators::blocksStrictlyDominatedBy): (WTF::Dominators::blocksDominatedBy): (WTF::Dominators::forAllBlocksInDominanceFrontierOf): (WTF::Dominators::dominanceFrontierOf): (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOf): (WTF::Dominators::forAllBlocksInPrunedIteratedDominanceFrontierOf): (WTF::Dominators::iteratedDominanceFrontierOf): (WTF::Dominators::dump): (WTF::Dominators::LengauerTarjan::LengauerTarjan): (WTF::Dominators::LengauerTarjan::compute): (WTF::Dominators::LengauerTarjan::immediateDominator): (WTF::Dominators::LengauerTarjan::computeDepthFirstPreNumbering): (WTF::Dominators::LengauerTarjan::computeSemiDominatorsAndImplicitImmediateDominators): (WTF::Dominators::LengauerTarjan::computeExplicitImmediateDominators): (WTF::Dominators::LengauerTarjan::link): (WTF::Dominators::LengauerTarjan::eval): (WTF::Dominators::LengauerTarjan::compress): (WTF::Dominators::LengauerTarjan::BlockData::BlockData): (WTF::Dominators::NaiveDominators::NaiveDominators): (WTF::Dominators::NaiveDominators::dominates): (WTF::Dominators::NaiveDominators::dump): (WTF::Dominators::NaiveDominators::pruneDominators): (WTF::Dominators::ValidationContext::ValidationContext): (WTF::Dominators::ValidationContext::reportError): (WTF::Dominators::ValidationContext::handleErrors): (WTF::Dominators::naiveDominates): (WTF::Dominators::forAllBlocksInDominanceFrontierOfImpl): (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOfImpl): (WTF::Dominators::BlockData::BlockData): Canonical link: https://commits.webkit.org/168962@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@191870 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-11-02 00:48:03 +00:00
B3 should do LICM https://bugs.webkit.org/show_bug.cgi?id=174750 Reviewed by Keith Miller and Saam Barati. Source/JavaScriptCore: Added a LICM phase to B3. This phase is called hoistLoopInvariantValues, to conform to the B3 naming convention for phases (it has to be an imperative). The phase uses NaturalLoops and BackwardsDominators, so this adds those analyses to B3. BackwardsDominators was already available in templatized form. This change templatizes DFG::NaturalLoops so that we can just use it. The LICM phase itself is really simple. We are decently precise with our handling of everything except the relationship between control dependence and side exits. Also added a bunch of tests. This isn't super important. It's perf-neutral on JS benchmarks. FTL already does LICM on DFG SSA IR, and probably all current WebAssembly content has had LICM done to it. That being said, this is a cheap phase so it doesn't hurt to have it. I wrote it because I thought I needed it for bug 174727. It turns out that there's a better way to handle the problem I had, so I ended up not needed it - but by then I had already written it. I think it's good to have it because LICM is one of those core compiler phases; every compiler has it eventually. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * b3/B3BackwardsCFG.h: Added. (JSC::B3::BackwardsCFG::BackwardsCFG): * b3/B3BackwardsDominators.h: Added. (JSC::B3::BackwardsDominators::BackwardsDominators): * b3/B3BasicBlock.cpp: (JSC::B3::BasicBlock::appendNonTerminal): * b3/B3Effects.h: * b3/B3EnsureLoopPreHeaders.cpp: Added. (JSC::B3::ensureLoopPreHeaders): * b3/B3EnsureLoopPreHeaders.h: Added. * b3/B3Generate.cpp: (JSC::B3::generateToAir): * b3/B3HoistLoopInvariantValues.cpp: Added. (JSC::B3::hoistLoopInvariantValues): * b3/B3HoistLoopInvariantValues.h: Added. * b3/B3NaturalLoops.h: Added. (JSC::B3::NaturalLoops::NaturalLoops): * b3/B3Procedure.cpp: (JSC::B3::Procedure::invalidateCFG): (JSC::B3::Procedure::naturalLoops): (JSC::B3::Procedure::backwardsCFG): (JSC::B3::Procedure::backwardsDominators): * b3/B3Procedure.h: * b3/testb3.cpp: (JSC::B3::generateLoop): (JSC::B3::makeArrayForLoops): (JSC::B3::generateLoopNotBackwardsDominant): (JSC::B3::oneFunction): (JSC::B3::noOpFunction): (JSC::B3::testLICMPure): (JSC::B3::testLICMPureSideExits): (JSC::B3::testLICMPureWritesPinned): (JSC::B3::testLICMPureWrites): (JSC::B3::testLICMReadsLocalState): (JSC::B3::testLICMReadsPinned): (JSC::B3::testLICMReads): (JSC::B3::testLICMPureNotBackwardsDominant): (JSC::B3::testLICMPureFoiledByChild): (JSC::B3::testLICMPureNotBackwardsDominantFoiledByChild): (JSC::B3::testLICMExitsSideways): (JSC::B3::testLICMWritesLocalState): (JSC::B3::testLICMWrites): (JSC::B3::testLICMFence): (JSC::B3::testLICMWritesPinned): (JSC::B3::testLICMControlDependent): (JSC::B3::testLICMControlDependentNotBackwardsDominant): (JSC::B3::testLICMControlDependentSideExits): (JSC::B3::testLICMReadsPinnedWritesPinned): (JSC::B3::testLICMReadsWritesDifferentHeaps): (JSC::B3::testLICMReadsWritesOverlappingHeaps): (JSC::B3::testLICMDefaultCall): (JSC::B3::run): * dfg/DFGBasicBlock.h: * dfg/DFGCFG.h: * dfg/DFGNaturalLoops.cpp: Removed. * dfg/DFGNaturalLoops.h: (JSC::DFG::NaturalLoops::NaturalLoops): (JSC::DFG::NaturalLoop::NaturalLoop): Deleted. (JSC::DFG::NaturalLoop::header): Deleted. (JSC::DFG::NaturalLoop::size): Deleted. (JSC::DFG::NaturalLoop::at): Deleted. (JSC::DFG::NaturalLoop::operator[]): Deleted. (JSC::DFG::NaturalLoop::contains): Deleted. (JSC::DFG::NaturalLoop::index): Deleted. (JSC::DFG::NaturalLoop::isOuterMostLoop): Deleted. (JSC::DFG::NaturalLoop::addBlock): Deleted. (JSC::DFG::NaturalLoops::numLoops): Deleted. (JSC::DFG::NaturalLoops::loop): Deleted. (JSC::DFG::NaturalLoops::headerOf): Deleted. (JSC::DFG::NaturalLoops::innerMostLoopOf): Deleted. (JSC::DFG::NaturalLoops::innerMostOuterLoop): Deleted. (JSC::DFG::NaturalLoops::belongsTo): Deleted. (JSC::DFG::NaturalLoops::loopDepth): Deleted. Source/WTF: Moved DFG::NaturalLoops to WTF. The new templatized NaturalLoops<> uses the same Graph abstraction as Dominators<>. This allows us to add a B3::NaturalLoops for free. Also made small tweaks to RangeSet, which the LICM uses. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/Dominators.h: * wtf/NaturalLoops.h: Added. (WTF::NaturalLoop::NaturalLoop): (WTF::NaturalLoop::graph): (WTF::NaturalLoop::header): (WTF::NaturalLoop::size): (WTF::NaturalLoop::at): (WTF::NaturalLoop::operator[]): (WTF::NaturalLoop::contains): (WTF::NaturalLoop::index): (WTF::NaturalLoop::isOuterMostLoop): (WTF::NaturalLoop::dump): (WTF::NaturalLoop::addBlock): (WTF::NaturalLoops::NaturalLoops): (WTF::NaturalLoops::graph): (WTF::NaturalLoops::numLoops): (WTF::NaturalLoops::loop): (WTF::NaturalLoops::headerOf): (WTF::NaturalLoops::innerMostLoopOf): (WTF::NaturalLoops::innerMostOuterLoop): (WTF::NaturalLoops::belongsTo): (WTF::NaturalLoops::loopDepth): (WTF::NaturalLoops::loopsOf): (WTF::NaturalLoops::dump): * wtf/RangeSet.h: (WTF::RangeSet::begin): (WTF::RangeSet::end): (WTF::RangeSet::addAll): Canonical link: https://commits.webkit.org/191658@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@219898 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-07-26 01:58:36 +00:00
#include <wtf/CommaPrinter.h>
FTL B3 should be able to flag the tag constants as being super important so that B3 can hoist them and Air can force them into registers https://bugs.webkit.org/show_bug.cgi?id=151955 Reviewed by Geoffrey Garen. Source/JavaScriptCore: Taught B3 about the concept of "fast constants". A client of B3 can now tell B3 which constants are super important. B3 will not spill the constant in that case and will ensure that the constant is materialized only once: statically once, and dynamically once per procedure execution. The hoistFastConstants() algorithm in B3MoveConstants.cpp achieves this by first picking the lowest common dominator of all uses of each fast constant, and then picking the materialization point by finding the lowest dominator of that dominator that is tied for lowest block frequency. In practice, the second step ensures that this is the lowest point in the program that is not in a loop (i.e. executes no more than once dynamically per procedure invocation). Taught Air about the concept of "fast tmps". B3 tells Air that a tmp is fast if it is used to hold the materialization of a fast constant. IRC will use the lowest possible spill score for fast tmps. In practice, this ensures that fast constants are never spilled. Added a small snippet of code to FTL::LowerDFGToLLVM that makes both of the tag constants into fast constants. My hope is that this very brute-force heuristic is good enough that we don't have to think about constants for a while. Based on my experience with how LLVM's constant hoisting works out, the heuristic in this patch is going to be tough to beat. LLVM's constant hoisting does good things when it hoists the tags, and usually causes nothing but problems when it hoists anything else. This is because there is no way a low-level compiler to really understand how a constant materialization impacts some operation's contribution to the overall execution time of a procedure. But, in the FTL we know that constant materializations for type checks are a bummer because we are super comfortable placing type checks on the hottest of paths. So those are the last paths where extra instructions should be added by the compiler. On the other hand, all other large constant uses are on relatively cold paths, or paths that are already expensive for other reasons. For example, global variable accesses have to materialize a pointer to the global. But that's not really a big deal, since a load from a global involves first the load itself and then type checks on the result - so probably the constant materialization is just not interesting. A store to a global often involves a store barrier, so the constant materialization is really not interesting. This patch codifies this heuristic in a pact between Air, B3, and the FTL: FTL demands that B3 pin the two tags in registers, and B3 relays the demand to Air. * JavaScriptCore.xcodeproj/project.pbxproj: * b3/B3CFG.h: Added. (JSC::B3::CFG::CFG): (JSC::B3::CFG::root): (JSC::B3::CFG::newMap): (JSC::B3::CFG::successors): (JSC::B3::CFG::predecessors): (JSC::B3::CFG::index): (JSC::B3::CFG::node): (JSC::B3::CFG::numNodes): (JSC::B3::CFG::dump): * b3/B3Dominators.h: Added. (JSC::B3::Dominators::Dominators): * b3/B3IndexMap.h: (JSC::B3::IndexMap::resize): (JSC::B3::IndexMap::size): (JSC::B3::IndexMap::operator[]): * b3/B3LowerMacros.cpp: * b3/B3LowerToAir.cpp: (JSC::B3::Air::LowerToAir::tmp): * b3/B3MoveConstants.cpp: * b3/B3Opcode.h: (JSC::B3::constPtrOpcode): (JSC::B3::isConstant): * b3/B3Procedure.cpp: (JSC::B3::Procedure::Procedure): (JSC::B3::Procedure::resetReachability): (JSC::B3::Procedure::invalidateCFG): (JSC::B3::Procedure::dump): (JSC::B3::Procedure::deleteValue): (JSC::B3::Procedure::dominators): (JSC::B3::Procedure::addFastConstant): (JSC::B3::Procedure::isFastConstant): (JSC::B3::Procedure::addDataSection): * b3/B3Procedure.h: (JSC::B3::Procedure::size): (JSC::B3::Procedure::cfg): (JSC::B3::Procedure::setLastPhaseName): * b3/B3ReduceStrength.cpp: * b3/B3ValueInlines.h: (JSC::B3::Value::isConstant): (JSC::B3::Value::isInteger): * b3/B3ValueKey.h: (JSC::B3::ValueKey::canMaterialize): (JSC::B3::ValueKey::isConstant): * b3/air/AirCode.cpp: (JSC::B3::Air::Code::findNextBlock): (JSC::B3::Air::Code::addFastTmp): * b3/air/AirCode.h: (JSC::B3::Air::Code::specials): (JSC::B3::Air::Code::isFastTmp): (JSC::B3::Air::Code::setLastPhaseName): * b3/air/AirIteratedRegisterCoalescing.cpp: * dfg/DFGDominators.h: * dfg/DFGSSACalculator.cpp: * ftl/FTLLowerDFGToLLVM.cpp: (JSC::FTL::DFG::LowerDFGToLLVM::lower): Source/WTF: Remove some remaining DFG-specific snippets from Dominators. This used to be a non-template DFG class, and some time ago I hoisted it into WTF and made it generic. But since the only user of the class was the DFG, this class still had a handful of DFG-specific snippets that didn't compile when I started using it from B3. Also renamed immediateDominatorOf() to idom(). This is the sort of abbreviation that we wouldn't ordinarily want to have in WebKit. But WebKit does allow for abbreviations that are "more canonical". The term "idom" is definitely more canonical than "immediateDominatorOf". * wtf/Dominators.h: (WTF::Dominators::dominates): (WTF::Dominators::idom): (WTF::Dominators::forAllStrictDominatorsOf): (WTF::Dominators::NaiveDominators::dominates): (WTF::Dominators::NaiveDominators::dump): (WTF::Dominators::ValidationContext::handleErrors): Canonical link: https://commits.webkit.org/170119@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@193682 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-12-08 02:46:22 +00:00
#include <wtf/FastBitVector.h>
Dominators should be factored out of the DFG https://bugs.webkit.org/show_bug.cgi?id=150764 Reviewed by Geoffrey Garen. Source/JavaScriptCore: Factored DFGDominators.h/DFGDominators.cpp into WTF. To do this, I made two changes to the DFG: 1) DFG now has a CFG abstraction called DFG::CFG. The cool thing about this is that in the future if we wanted to support inverted dominators, we could do it by just creating a DFG::BackwardCFG. 2) Got rid of DFG::Analysis. From now on, an Analysis being invalidated is expressed by the DFG::Graph having a null pointer for that analysis. When we "run" the analysis, we just instantiate it. This makes it much more natural to integrate WTF::Dominators into the DFG. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * dfg/DFGAnalysis.h: Removed. * dfg/DFGCFG.h: Added. (JSC::DFG::CFG::CFG): (JSC::DFG::CFG::root): (JSC::DFG::CFG::newMap<T>): (JSC::DFG::CFG::successors): (JSC::DFG::CFG::predecessors): (JSC::DFG::CFG::index): (JSC::DFG::CFG::node): (JSC::DFG::CFG::numNodes): (JSC::DFG::CFG::dump): * dfg/DFGCSEPhase.cpp: * dfg/DFGDisassembler.cpp: (JSC::DFG::Disassembler::createDumpList): * dfg/DFGDominators.cpp: Removed. * dfg/DFGDominators.h: (JSC::DFG::Dominators::Dominators): (JSC::DFG::Dominators::strictlyDominates): Deleted. (JSC::DFG::Dominators::dominates): Deleted. (JSC::DFG::Dominators::immediateDominatorOf): Deleted. (JSC::DFG::Dominators::forAllStrictDominatorsOf): Deleted. (JSC::DFG::Dominators::forAllDominatorsOf): Deleted. (JSC::DFG::Dominators::forAllBlocksStrictlyDominatedBy): Deleted. (JSC::DFG::Dominators::forAllBlocksDominatedBy): Deleted. (JSC::DFG::Dominators::forAllBlocksInDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInIteratedDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInPrunedIteratedDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInDominanceFrontierOfImpl): Deleted. (JSC::DFG::Dominators::forAllBlocksInIteratedDominanceFrontierOfImpl): Deleted. (JSC::DFG::Dominators::BlockData::BlockData): Deleted. * dfg/DFGEdgeDominates.h: (JSC::DFG::EdgeDominates::operator()): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::Graph): (JSC::DFG::Graph::dumpBlockHeader): (JSC::DFG::Graph::invalidateCFG): (JSC::DFG::Graph::substituteGetLocal): (JSC::DFG::Graph::handleAssertionFailure): (JSC::DFG::Graph::ensureDominators): (JSC::DFG::Graph::ensurePrePostNumbering): (JSC::DFG::Graph::ensureNaturalLoops): (JSC::DFG::Graph::valueProfileFor): * dfg/DFGGraph.h: (JSC::DFG::Graph::hasDebuggerEnabled): * dfg/DFGLICMPhase.cpp: (JSC::DFG::LICMPhase::run): (JSC::DFG::LICMPhase::attemptHoist): * dfg/DFGLoopPreHeaderCreationPhase.cpp: (JSC::DFG::createPreHeader): (JSC::DFG::LoopPreHeaderCreationPhase::run): * dfg/DFGNaturalLoops.cpp: (JSC::DFG::NaturalLoop::dump): (JSC::DFG::NaturalLoops::NaturalLoops): (JSC::DFG::NaturalLoops::~NaturalLoops): (JSC::DFG::NaturalLoops::loopsOf): (JSC::DFG::NaturalLoops::computeDependencies): Deleted. (JSC::DFG::NaturalLoops::compute): Deleted. * dfg/DFGNaturalLoops.h: (JSC::DFG::NaturalLoops::numLoops): * dfg/DFGNode.h: (JSC::DFG::Node::SuccessorsIterable::end): (JSC::DFG::Node::SuccessorsIterable::size): (JSC::DFG::Node::SuccessorsIterable::at): (JSC::DFG::Node::SuccessorsIterable::operator[]): * dfg/DFGOSREntrypointCreationPhase.cpp: (JSC::DFG::OSREntrypointCreationPhase::run): * dfg/DFGObjectAllocationSinkingPhase.cpp: * dfg/DFGPlan.cpp: (JSC::DFG::Plan::compileInThreadImpl): * dfg/DFGPrePostNumbering.cpp: (JSC::DFG::PrePostNumbering::PrePostNumbering): (JSC::DFG::PrePostNumbering::~PrePostNumbering): (JSC::DFG::PrePostNumbering::compute): Deleted. * dfg/DFGPrePostNumbering.h: (JSC::DFG::PrePostNumbering::preNumber): (JSC::DFG::PrePostNumbering::postNumber): * dfg/DFGPutStackSinkingPhase.cpp: * dfg/DFGSSACalculator.cpp: (JSC::DFG::SSACalculator::nonLocalReachingDef): (JSC::DFG::SSACalculator::reachingDefAtTail): * dfg/DFGSSACalculator.h: (JSC::DFG::SSACalculator::computePhis): * dfg/DFGSSAConversionPhase.cpp: (JSC::DFG::SSAConversionPhase::run): * ftl/FTLLink.cpp: (JSC::FTL::link): * ftl/FTLLowerDFGToLLVM.cpp: (JSC::FTL::DFG::LowerDFGToLLVM::lower): (JSC::FTL::DFG::LowerDFGToLLVM::safelyInvalidateAfterTermination): (JSC::FTL::DFG::LowerDFGToLLVM::isValid): Source/WTF: This takes what used to be DFGDominators.h/DFGDominators.cpp and turns it into a generic algorithm that can take any abstract graph. The idea is that you create Dominators<CFG> and pass it a CFG object, which defines the types of graph nodes and methods for getting successors, predecessors, etc. The DFG now defines a class called CFG, which is a wrapper for DFG::Graph that conforms to the thing that wtf/Dominators.h expects. When doing things to graphs, it's common to refer to the things in the graph as "nodes". Because I intend to reuse the CFG abstraction with many graph algorithms, that abstraction uses the term "node" to refer to a DFG basic block. But in Dominators, the method and variable names still use "block". This is because although Dominators are applicable to any kind of directed graph, it's super unlikely that we will ever use them for anything but compilers. Indeed, the only reason why I'm factoring them out of the DFG is so that I can use them with B3 and Air. This has the nice side effect that a user of WTF::Dominators<JSC::DFG::CFG> will see familiar terminology like "blocksStrictlyDominatedBy(...)" instead of "nodesStrictlyDominatedBy(...)", which would be super confusing. Overall, wtf/Dominators.h is a combination of what used to be in DFGDominators.h, DFGDominators.cpp, DFGNaiveDominators.h, and DFGNaiveDominators.cpp. I only changed code when I had to in order to make it generic. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/Dominators.h: Added. (WTF::Dominators::Dominators): (WTF::Dominators::compute): (WTF::Dominators::strictlyDominates): (WTF::Dominators::dominates): (WTF::Dominators::immediateDominatorOf): (WTF::Dominators::forAllStrictDominatorsOf): (WTF::Dominators::forAllDominatorsOf): (WTF::Dominators::forAllBlocksStrictlyDominatedBy): (WTF::Dominators::forAllBlocksDominatedBy): (WTF::Dominators::strictDominatorsOf): (WTF::Dominators::dominatorsOf): (WTF::Dominators::blocksStrictlyDominatedBy): (WTF::Dominators::blocksDominatedBy): (WTF::Dominators::forAllBlocksInDominanceFrontierOf): (WTF::Dominators::dominanceFrontierOf): (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOf): (WTF::Dominators::forAllBlocksInPrunedIteratedDominanceFrontierOf): (WTF::Dominators::iteratedDominanceFrontierOf): (WTF::Dominators::dump): (WTF::Dominators::LengauerTarjan::LengauerTarjan): (WTF::Dominators::LengauerTarjan::compute): (WTF::Dominators::LengauerTarjan::immediateDominator): (WTF::Dominators::LengauerTarjan::computeDepthFirstPreNumbering): (WTF::Dominators::LengauerTarjan::computeSemiDominatorsAndImplicitImmediateDominators): (WTF::Dominators::LengauerTarjan::computeExplicitImmediateDominators): (WTF::Dominators::LengauerTarjan::link): (WTF::Dominators::LengauerTarjan::eval): (WTF::Dominators::LengauerTarjan::compress): (WTF::Dominators::LengauerTarjan::BlockData::BlockData): (WTF::Dominators::NaiveDominators::NaiveDominators): (WTF::Dominators::NaiveDominators::dominates): (WTF::Dominators::NaiveDominators::dump): (WTF::Dominators::NaiveDominators::pruneDominators): (WTF::Dominators::ValidationContext::ValidationContext): (WTF::Dominators::ValidationContext::reportError): (WTF::Dominators::ValidationContext::handleErrors): (WTF::Dominators::naiveDominates): (WTF::Dominators::forAllBlocksInDominanceFrontierOfImpl): (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOfImpl): (WTF::Dominators::BlockData::BlockData): Canonical link: https://commits.webkit.org/168962@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@191870 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-11-02 00:48:03 +00:00
#include <wtf/GraphNodeWorklist.h>
#include <wtf/Vector.h>
Dominators should be factored out of the DFG https://bugs.webkit.org/show_bug.cgi?id=150764 Reviewed by Geoffrey Garen. Source/JavaScriptCore: Factored DFGDominators.h/DFGDominators.cpp into WTF. To do this, I made two changes to the DFG: 1) DFG now has a CFG abstraction called DFG::CFG. The cool thing about this is that in the future if we wanted to support inverted dominators, we could do it by just creating a DFG::BackwardCFG. 2) Got rid of DFG::Analysis. From now on, an Analysis being invalidated is expressed by the DFG::Graph having a null pointer for that analysis. When we "run" the analysis, we just instantiate it. This makes it much more natural to integrate WTF::Dominators into the DFG. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * dfg/DFGAnalysis.h: Removed. * dfg/DFGCFG.h: Added. (JSC::DFG::CFG::CFG): (JSC::DFG::CFG::root): (JSC::DFG::CFG::newMap<T>): (JSC::DFG::CFG::successors): (JSC::DFG::CFG::predecessors): (JSC::DFG::CFG::index): (JSC::DFG::CFG::node): (JSC::DFG::CFG::numNodes): (JSC::DFG::CFG::dump): * dfg/DFGCSEPhase.cpp: * dfg/DFGDisassembler.cpp: (JSC::DFG::Disassembler::createDumpList): * dfg/DFGDominators.cpp: Removed. * dfg/DFGDominators.h: (JSC::DFG::Dominators::Dominators): (JSC::DFG::Dominators::strictlyDominates): Deleted. (JSC::DFG::Dominators::dominates): Deleted. (JSC::DFG::Dominators::immediateDominatorOf): Deleted. (JSC::DFG::Dominators::forAllStrictDominatorsOf): Deleted. (JSC::DFG::Dominators::forAllDominatorsOf): Deleted. (JSC::DFG::Dominators::forAllBlocksStrictlyDominatedBy): Deleted. (JSC::DFG::Dominators::forAllBlocksDominatedBy): Deleted. (JSC::DFG::Dominators::forAllBlocksInDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInIteratedDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInPrunedIteratedDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInDominanceFrontierOfImpl): Deleted. (JSC::DFG::Dominators::forAllBlocksInIteratedDominanceFrontierOfImpl): Deleted. (JSC::DFG::Dominators::BlockData::BlockData): Deleted. * dfg/DFGEdgeDominates.h: (JSC::DFG::EdgeDominates::operator()): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::Graph): (JSC::DFG::Graph::dumpBlockHeader): (JSC::DFG::Graph::invalidateCFG): (JSC::DFG::Graph::substituteGetLocal): (JSC::DFG::Graph::handleAssertionFailure): (JSC::DFG::Graph::ensureDominators): (JSC::DFG::Graph::ensurePrePostNumbering): (JSC::DFG::Graph::ensureNaturalLoops): (JSC::DFG::Graph::valueProfileFor): * dfg/DFGGraph.h: (JSC::DFG::Graph::hasDebuggerEnabled): * dfg/DFGLICMPhase.cpp: (JSC::DFG::LICMPhase::run): (JSC::DFG::LICMPhase::attemptHoist): * dfg/DFGLoopPreHeaderCreationPhase.cpp: (JSC::DFG::createPreHeader): (JSC::DFG::LoopPreHeaderCreationPhase::run): * dfg/DFGNaturalLoops.cpp: (JSC::DFG::NaturalLoop::dump): (JSC::DFG::NaturalLoops::NaturalLoops): (JSC::DFG::NaturalLoops::~NaturalLoops): (JSC::DFG::NaturalLoops::loopsOf): (JSC::DFG::NaturalLoops::computeDependencies): Deleted. (JSC::DFG::NaturalLoops::compute): Deleted. * dfg/DFGNaturalLoops.h: (JSC::DFG::NaturalLoops::numLoops): * dfg/DFGNode.h: (JSC::DFG::Node::SuccessorsIterable::end): (JSC::DFG::Node::SuccessorsIterable::size): (JSC::DFG::Node::SuccessorsIterable::at): (JSC::DFG::Node::SuccessorsIterable::operator[]): * dfg/DFGOSREntrypointCreationPhase.cpp: (JSC::DFG::OSREntrypointCreationPhase::run): * dfg/DFGObjectAllocationSinkingPhase.cpp: * dfg/DFGPlan.cpp: (JSC::DFG::Plan::compileInThreadImpl): * dfg/DFGPrePostNumbering.cpp: (JSC::DFG::PrePostNumbering::PrePostNumbering): (JSC::DFG::PrePostNumbering::~PrePostNumbering): (JSC::DFG::PrePostNumbering::compute): Deleted. * dfg/DFGPrePostNumbering.h: (JSC::DFG::PrePostNumbering::preNumber): (JSC::DFG::PrePostNumbering::postNumber): * dfg/DFGPutStackSinkingPhase.cpp: * dfg/DFGSSACalculator.cpp: (JSC::DFG::SSACalculator::nonLocalReachingDef): (JSC::DFG::SSACalculator::reachingDefAtTail): * dfg/DFGSSACalculator.h: (JSC::DFG::SSACalculator::computePhis): * dfg/DFGSSAConversionPhase.cpp: (JSC::DFG::SSAConversionPhase::run): * ftl/FTLLink.cpp: (JSC::FTL::link): * ftl/FTLLowerDFGToLLVM.cpp: (JSC::FTL::DFG::LowerDFGToLLVM::lower): (JSC::FTL::DFG::LowerDFGToLLVM::safelyInvalidateAfterTermination): (JSC::FTL::DFG::LowerDFGToLLVM::isValid): Source/WTF: This takes what used to be DFGDominators.h/DFGDominators.cpp and turns it into a generic algorithm that can take any abstract graph. The idea is that you create Dominators<CFG> and pass it a CFG object, which defines the types of graph nodes and methods for getting successors, predecessors, etc. The DFG now defines a class called CFG, which is a wrapper for DFG::Graph that conforms to the thing that wtf/Dominators.h expects. When doing things to graphs, it's common to refer to the things in the graph as "nodes". Because I intend to reuse the CFG abstraction with many graph algorithms, that abstraction uses the term "node" to refer to a DFG basic block. But in Dominators, the method and variable names still use "block". This is because although Dominators are applicable to any kind of directed graph, it's super unlikely that we will ever use them for anything but compilers. Indeed, the only reason why I'm factoring them out of the DFG is so that I can use them with B3 and Air. This has the nice side effect that a user of WTF::Dominators<JSC::DFG::CFG> will see familiar terminology like "blocksStrictlyDominatedBy(...)" instead of "nodesStrictlyDominatedBy(...)", which would be super confusing. Overall, wtf/Dominators.h is a combination of what used to be in DFGDominators.h, DFGDominators.cpp, DFGNaiveDominators.h, and DFGNaiveDominators.cpp. I only changed code when I had to in order to make it generic. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/Dominators.h: Added. (WTF::Dominators::Dominators): (WTF::Dominators::compute): (WTF::Dominators::strictlyDominates): (WTF::Dominators::dominates): (WTF::Dominators::immediateDominatorOf): (WTF::Dominators::forAllStrictDominatorsOf): (WTF::Dominators::forAllDominatorsOf): (WTF::Dominators::forAllBlocksStrictlyDominatedBy): (WTF::Dominators::forAllBlocksDominatedBy): (WTF::Dominators::strictDominatorsOf): (WTF::Dominators::dominatorsOf): (WTF::Dominators::blocksStrictlyDominatedBy): (WTF::Dominators::blocksDominatedBy): (WTF::Dominators::forAllBlocksInDominanceFrontierOf): (WTF::Dominators::dominanceFrontierOf): (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOf): (WTF::Dominators::forAllBlocksInPrunedIteratedDominanceFrontierOf): (WTF::Dominators::iteratedDominanceFrontierOf): (WTF::Dominators::dump): (WTF::Dominators::LengauerTarjan::LengauerTarjan): (WTF::Dominators::LengauerTarjan::compute): (WTF::Dominators::LengauerTarjan::immediateDominator): (WTF::Dominators::LengauerTarjan::computeDepthFirstPreNumbering): (WTF::Dominators::LengauerTarjan::computeSemiDominatorsAndImplicitImmediateDominators): (WTF::Dominators::LengauerTarjan::computeExplicitImmediateDominators): (WTF::Dominators::LengauerTarjan::link): (WTF::Dominators::LengauerTarjan::eval): (WTF::Dominators::LengauerTarjan::compress): (WTF::Dominators::LengauerTarjan::BlockData::BlockData): (WTF::Dominators::NaiveDominators::NaiveDominators): (WTF::Dominators::NaiveDominators::dominates): (WTF::Dominators::NaiveDominators::dump): (WTF::Dominators::NaiveDominators::pruneDominators): (WTF::Dominators::ValidationContext::ValidationContext): (WTF::Dominators::ValidationContext::reportError): (WTF::Dominators::ValidationContext::handleErrors): (WTF::Dominators::naiveDominates): (WTF::Dominators::forAllBlocksInDominanceFrontierOfImpl): (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOfImpl): (WTF::Dominators::BlockData::BlockData): Canonical link: https://commits.webkit.org/168962@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@191870 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-11-02 00:48:03 +00:00
namespace WTF {
// This is a utility for finding the dominators of a graph. Dominators are almost universally used
// for control flow graph analysis, so this code will refer to the graph's "nodes" as "blocks". In
// that regard this code is kind of specialized for the various JSC compilers, but you could use it
// for non-compiler things if you are OK with referring to your "nodes" as "blocks".
template<typename Graph>
class Dominators {
[WTF][JSC] Make JSC and WTF aggressively-fast-malloced https://bugs.webkit.org/show_bug.cgi?id=200611 Reviewed by Saam Barati. Source/JavaScriptCore: This patch aggressively puts many classes into FastMalloc. In JSC side, we grep `std::make_unique` etc. to find potentially system-malloc-allocated classes. After this patch, all the JSC related allocations in JetStream2 cli is done from bmalloc. In the future, it would be nice that we add `WTF::makeUnique<T>` helper function and throw a compile error if `T` is not FastMalloc annotated[1]. Putting WebKit classes in FastMalloc has many benefits. 1. Simply, it is fast. 2. vmmap can tell the amount of memory used for WebKit. 3. bmalloc can isolate WebKit memory allocation from the rest of the world. This is useful since we can know more about what component is corrupting the memory from the memory corruption crash. [1]: https://bugs.webkit.org/show_bug.cgi?id=200620 * API/ObjCCallbackFunction.mm: * assembler/AbstractMacroAssembler.h: * b3/B3PhiChildren.h: * b3/air/AirAllocateRegistersAndStackAndGenerateCode.h: * b3/air/AirDisassembler.h: * bytecode/AccessCaseSnippetParams.h: * bytecode/CallVariant.h: * bytecode/DeferredSourceDump.h: * bytecode/ExecutionCounter.h: * bytecode/GetByIdStatus.h: * bytecode/GetByIdVariant.h: * bytecode/InByIdStatus.h: * bytecode/InByIdVariant.h: * bytecode/InstanceOfStatus.h: * bytecode/InstanceOfVariant.h: * bytecode/PutByIdStatus.h: * bytecode/PutByIdVariant.h: * bytecode/ValueProfile.h: * dfg/DFGAbstractInterpreter.h: * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::newVariableAccessData): * dfg/DFGFlowIndexing.h: * dfg/DFGFlowMap.h: * dfg/DFGLiveCatchVariablePreservationPhase.cpp: (JSC::DFG::LiveCatchVariablePreservationPhase::newVariableAccessData): * dfg/DFGMaximalFlushInsertionPhase.cpp: (JSC::DFG::MaximalFlushInsertionPhase::newVariableAccessData): * dfg/DFGOSRExit.h: * dfg/DFGSpeculativeJIT.h: * dfg/DFGVariableAccessData.h: * disassembler/ARM64/A64DOpcode.h: * inspector/remote/socket/RemoteInspectorMessageParser.h: * inspector/remote/socket/RemoteInspectorSocket.h: * inspector/remote/socket/RemoteInspectorSocketEndpoint.h: * jit/PCToCodeOriginMap.h: * runtime/BasicBlockLocation.h: * runtime/DoublePredictionFuzzerAgent.h: * runtime/JSRunLoopTimer.h: * runtime/PromiseDeferredTimer.h: (JSC::PromiseDeferredTimer::create): PromiseDeferredTimer should be allocated as `Ref<>` instead of `std::unique_ptr` since it is inheriting ThreadSafeRefCounted<>. Holding such a class with std::unique_ptr could lead to potentially dangerous operations (like, someone holds it with Ref<> while it is deleted by std::unique_ptr<>). * runtime/RandomizingFuzzerAgent.h: * runtime/SymbolTable.h: * runtime/VM.cpp: (JSC::VM::VM): * runtime/VM.h: * tools/JSDollarVM.cpp: * tools/SigillCrashAnalyzer.cpp: * wasm/WasmFormat.h: * wasm/WasmMemory.cpp: * wasm/WasmSignature.h: * yarr/YarrJIT.h: Source/WebCore: Changed the accessor since we changed std::unique_ptr to Ref for this field. No behavior change. * bindings/js/WorkerScriptController.cpp: (WebCore::WorkerScriptController::addTimerSetNotification): (WebCore::WorkerScriptController::removeTimerSetNotification): Source/WTF: WTF has many data structures, in particular, containers. And these containers can be allocated like `std::make_unique<Container>()`. Without WTF_MAKE_FAST_ALLOCATED, this container itself is allocated from the system malloc. This patch attaches WTF_MAKE_FAST_ALLOCATED more aggressively not to allocate them from the system malloc. And we add some `final` to containers and classes that would be never inherited. * wtf/Assertions.cpp: * wtf/Atomics.h: * wtf/AutodrainedPool.h: * wtf/Bag.h: (WTF::Bag::Bag): Deleted. (WTF::Bag::~Bag): Deleted. (WTF::Bag::clear): Deleted. (WTF::Bag::add): Deleted. (WTF::Bag::iterator::iterator): Deleted. (WTF::Bag::iterator::operator! const): Deleted. (WTF::Bag::iterator::operator* const): Deleted. (WTF::Bag::iterator::operator++): Deleted. (WTF::Bag::iterator::operator== const): Deleted. (WTF::Bag::iterator::operator!= const): Deleted. (WTF::Bag::begin): Deleted. (WTF::Bag::begin const): Deleted. (WTF::Bag::end const): Deleted. (WTF::Bag::isEmpty const): Deleted. (WTF::Bag::unwrappedHead const): Deleted. * wtf/BitVector.h: (WTF::BitVector::BitVector): Deleted. (WTF::BitVector::~BitVector): Deleted. (WTF::BitVector::operator=): Deleted. (WTF::BitVector::size const): Deleted. (WTF::BitVector::ensureSize): Deleted. (WTF::BitVector::quickGet const): Deleted. (WTF::BitVector::quickSet): Deleted. (WTF::BitVector::quickClear): Deleted. (WTF::BitVector::get const): Deleted. (WTF::BitVector::contains const): Deleted. (WTF::BitVector::set): Deleted. (WTF::BitVector::add): Deleted. (WTF::BitVector::ensureSizeAndSet): Deleted. (WTF::BitVector::clear): Deleted. (WTF::BitVector::remove): Deleted. (WTF::BitVector::merge): Deleted. (WTF::BitVector::filter): Deleted. (WTF::BitVector::exclude): Deleted. (WTF::BitVector::bitCount const): Deleted. (WTF::BitVector::isEmpty const): Deleted. (WTF::BitVector::findBit const): Deleted. (WTF::BitVector::isEmptyValue const): Deleted. (WTF::BitVector::isDeletedValue const): Deleted. (WTF::BitVector::isEmptyOrDeletedValue const): Deleted. (WTF::BitVector::operator== const): Deleted. (WTF::BitVector::hash const): Deleted. (WTF::BitVector::iterator::iterator): Deleted. (WTF::BitVector::iterator::operator* const): Deleted. (WTF::BitVector::iterator::operator++): Deleted. (WTF::BitVector::iterator::isAtEnd const): Deleted. (WTF::BitVector::iterator::operator== const): Deleted. (WTF::BitVector::iterator::operator!= const): Deleted. (WTF::BitVector::begin const): Deleted. (WTF::BitVector::end const): Deleted. (WTF::BitVector::bitsInPointer): Deleted. (WTF::BitVector::maxInlineBits): Deleted. (WTF::BitVector::byteCount): Deleted. (WTF::BitVector::makeInlineBits): Deleted. (WTF::BitVector::cleanseInlineBits): Deleted. (WTF::BitVector::bitCount): Deleted. (WTF::BitVector::findBitFast const): Deleted. (WTF::BitVector::findBitSimple const): Deleted. (WTF::BitVector::OutOfLineBits::numBits const): Deleted. (WTF::BitVector::OutOfLineBits::numWords const): Deleted. (WTF::BitVector::OutOfLineBits::bits): Deleted. (WTF::BitVector::OutOfLineBits::bits const): Deleted. (WTF::BitVector::OutOfLineBits::OutOfLineBits): Deleted. (WTF::BitVector::isInline const): Deleted. (WTF::BitVector::outOfLineBits const): Deleted. (WTF::BitVector::outOfLineBits): Deleted. (WTF::BitVector::bits): Deleted. (WTF::BitVector::bits const): Deleted. * wtf/Bitmap.h: (WTF::Bitmap::size): Deleted. (WTF::Bitmap::iterator::iterator): Deleted. (WTF::Bitmap::iterator::operator* const): Deleted. (WTF::Bitmap::iterator::operator++): Deleted. (WTF::Bitmap::iterator::operator== const): Deleted. (WTF::Bitmap::iterator::operator!= const): Deleted. (WTF::Bitmap::begin const): Deleted. (WTF::Bitmap::end const): Deleted. * wtf/Box.h: * wtf/BumpPointerAllocator.h: * wtf/CPUTime.h: * wtf/CheckedBoolean.h: * wtf/CommaPrinter.h: (WTF::CommaPrinter::CommaPrinter): Deleted. (WTF::CommaPrinter::dump const): Deleted. (WTF::CommaPrinter::didPrint const): Deleted. * wtf/CompactPointerTuple.h: (WTF::CompactPointerTuple::encodeType): Deleted. (WTF::CompactPointerTuple::decodeType): Deleted. (WTF::CompactPointerTuple::CompactPointerTuple): Deleted. (WTF::CompactPointerTuple::pointer const): Deleted. (WTF::CompactPointerTuple::setPointer): Deleted. (WTF::CompactPointerTuple::type const): Deleted. (WTF::CompactPointerTuple::setType): Deleted. * wtf/CompilationThread.h: (WTF::CompilationScope::CompilationScope): Deleted. (WTF::CompilationScope::~CompilationScope): Deleted. (WTF::CompilationScope::leaveEarly): Deleted. * wtf/CompletionHandler.h: (WTF::CompletionHandler<Out): (WTF::Detail::CallableWrapper<CompletionHandler<Out): (WTF::CompletionHandlerCallingScope::CompletionHandlerCallingScope): Deleted. (WTF::CompletionHandlerCallingScope::~CompletionHandlerCallingScope): Deleted. (WTF::CompletionHandlerCallingScope::CompletionHandler<void): Deleted. * wtf/ConcurrentBuffer.h: (WTF::ConcurrentBuffer::ConcurrentBuffer): Deleted. (WTF::ConcurrentBuffer::~ConcurrentBuffer): Deleted. (WTF::ConcurrentBuffer::growExact): Deleted. (WTF::ConcurrentBuffer::grow): Deleted. (WTF::ConcurrentBuffer::array const): Deleted. (WTF::ConcurrentBuffer::operator[]): Deleted. (WTF::ConcurrentBuffer::operator[] const): Deleted. (WTF::ConcurrentBuffer::createArray): Deleted. * wtf/ConcurrentPtrHashSet.h: (WTF::ConcurrentPtrHashSet::contains): Deleted. (WTF::ConcurrentPtrHashSet::add): Deleted. (WTF::ConcurrentPtrHashSet::size const): Deleted. (WTF::ConcurrentPtrHashSet::Table::maxLoad const): Deleted. (WTF::ConcurrentPtrHashSet::hash): Deleted. (WTF::ConcurrentPtrHashSet::cast): Deleted. (WTF::ConcurrentPtrHashSet::containsImpl const): Deleted. (WTF::ConcurrentPtrHashSet::addImpl): Deleted. * wtf/ConcurrentVector.h: (WTF::ConcurrentVector::~ConcurrentVector): Deleted. (WTF::ConcurrentVector::size const): Deleted. (WTF::ConcurrentVector::isEmpty const): Deleted. (WTF::ConcurrentVector::at): Deleted. (WTF::ConcurrentVector::at const): Deleted. (WTF::ConcurrentVector::operator[]): Deleted. (WTF::ConcurrentVector::operator[] const): Deleted. (WTF::ConcurrentVector::first): Deleted. (WTF::ConcurrentVector::first const): Deleted. (WTF::ConcurrentVector::last): Deleted. (WTF::ConcurrentVector::last const): Deleted. (WTF::ConcurrentVector::takeLast): Deleted. (WTF::ConcurrentVector::append): Deleted. (WTF::ConcurrentVector::alloc): Deleted. (WTF::ConcurrentVector::removeLast): Deleted. (WTF::ConcurrentVector::grow): Deleted. (WTF::ConcurrentVector::begin): Deleted. (WTF::ConcurrentVector::end): Deleted. (WTF::ConcurrentVector::segmentExistsFor): Deleted. (WTF::ConcurrentVector::segmentFor): Deleted. (WTF::ConcurrentVector::subscriptFor): Deleted. (WTF::ConcurrentVector::ensureSegmentsFor): Deleted. (WTF::ConcurrentVector::ensureSegment): Deleted. (WTF::ConcurrentVector::allocateSegment): Deleted. * wtf/Condition.h: (WTF::Condition::waitUntil): Deleted. (WTF::Condition::waitFor): Deleted. (WTF::Condition::wait): Deleted. (WTF::Condition::notifyOne): Deleted. (WTF::Condition::notifyAll): Deleted. * wtf/CountingLock.h: (WTF::CountingLock::LockHooks::lockHook): Deleted. (WTF::CountingLock::LockHooks::unlockHook): Deleted. (WTF::CountingLock::LockHooks::parkHook): Deleted. (WTF::CountingLock::LockHooks::handoffHook): Deleted. (WTF::CountingLock::tryLock): Deleted. (WTF::CountingLock::lock): Deleted. (WTF::CountingLock::unlock): Deleted. (WTF::CountingLock::isHeld const): Deleted. (WTF::CountingLock::isLocked const): Deleted. (WTF::CountingLock::Count::operator bool const): Deleted. (WTF::CountingLock::Count::operator== const): Deleted. (WTF::CountingLock::Count::operator!= const): Deleted. (WTF::CountingLock::tryOptimisticRead): Deleted. (WTF::CountingLock::validate): Deleted. (WTF::CountingLock::doOptimizedRead): Deleted. (WTF::CountingLock::tryOptimisticFencelessRead): Deleted. (WTF::CountingLock::fencelessValidate): Deleted. (WTF::CountingLock::doOptimizedFencelessRead): Deleted. (WTF::CountingLock::getCount): Deleted. * wtf/CrossThreadQueue.h: * wtf/CrossThreadTask.h: * wtf/CryptographicallyRandomNumber.cpp: * wtf/DataMutex.h: * wtf/DateMath.h: * wtf/Deque.h: (WTF::Deque::size const): Deleted. (WTF::Deque::isEmpty const): Deleted. (WTF::Deque::begin): Deleted. (WTF::Deque::end): Deleted. (WTF::Deque::begin const): Deleted. (WTF::Deque::end const): Deleted. (WTF::Deque::rbegin): Deleted. (WTF::Deque::rend): Deleted. (WTF::Deque::rbegin const): Deleted. (WTF::Deque::rend const): Deleted. (WTF::Deque::first): Deleted. (WTF::Deque::first const): Deleted. (WTF::Deque::last): Deleted. (WTF::Deque::last const): Deleted. (WTF::Deque::append): Deleted. * wtf/Dominators.h: * wtf/DoublyLinkedList.h: * wtf/Expected.h: * wtf/FastBitVector.h: * wtf/FileMetadata.h: * wtf/FileSystem.h: * wtf/GraphNodeWorklist.h: * wtf/GregorianDateTime.h: (WTF::GregorianDateTime::GregorianDateTime): Deleted. (WTF::GregorianDateTime::year const): Deleted. (WTF::GregorianDateTime::month const): Deleted. (WTF::GregorianDateTime::yearDay const): Deleted. (WTF::GregorianDateTime::monthDay const): Deleted. (WTF::GregorianDateTime::weekDay const): Deleted. (WTF::GregorianDateTime::hour const): Deleted. (WTF::GregorianDateTime::minute const): Deleted. (WTF::GregorianDateTime::second const): Deleted. (WTF::GregorianDateTime::utcOffset const): Deleted. (WTF::GregorianDateTime::isDST const): Deleted. (WTF::GregorianDateTime::setYear): Deleted. (WTF::GregorianDateTime::setMonth): Deleted. (WTF::GregorianDateTime::setYearDay): Deleted. (WTF::GregorianDateTime::setMonthDay): Deleted. (WTF::GregorianDateTime::setWeekDay): Deleted. (WTF::GregorianDateTime::setHour): Deleted. (WTF::GregorianDateTime::setMinute): Deleted. (WTF::GregorianDateTime::setSecond): Deleted. (WTF::GregorianDateTime::setUtcOffset): Deleted. (WTF::GregorianDateTime::setIsDST): Deleted. (WTF::GregorianDateTime::operator tm const): Deleted. (WTF::GregorianDateTime::copyFrom): Deleted. * wtf/HashTable.h: * wtf/Hasher.h: * wtf/HexNumber.h: * wtf/Indenter.h: * wtf/IndexMap.h: * wtf/IndexSet.h: * wtf/IndexSparseSet.h: * wtf/IndexedContainerIterator.h: * wtf/Insertion.h: * wtf/IteratorAdaptors.h: * wtf/IteratorRange.h: * wtf/KeyValuePair.h: * wtf/ListHashSet.h: (WTF::ListHashSet::begin): Deleted. (WTF::ListHashSet::end): Deleted. (WTF::ListHashSet::begin const): Deleted. (WTF::ListHashSet::end const): Deleted. (WTF::ListHashSet::random): Deleted. (WTF::ListHashSet::random const): Deleted. (WTF::ListHashSet::rbegin): Deleted. (WTF::ListHashSet::rend): Deleted. (WTF::ListHashSet::rbegin const): Deleted. (WTF::ListHashSet::rend const): Deleted. * wtf/Liveness.h: * wtf/LocklessBag.h: (WTF::LocklessBag::LocklessBag): Deleted. (WTF::LocklessBag::add): Deleted. (WTF::LocklessBag::iterate): Deleted. (WTF::LocklessBag::consumeAll): Deleted. (WTF::LocklessBag::consumeAllWithNode): Deleted. (WTF::LocklessBag::~LocklessBag): Deleted. * wtf/LoggingHashID.h: * wtf/MD5.h: * wtf/MachSendRight.h: * wtf/MainThreadData.h: * wtf/Markable.h: * wtf/MediaTime.h: * wtf/MemoryPressureHandler.h: * wtf/MessageQueue.h: (WTF::MessageQueue::MessageQueue): Deleted. * wtf/MetaAllocator.h: * wtf/MonotonicTime.h: (WTF::MonotonicTime::MonotonicTime): Deleted. (WTF::MonotonicTime::fromRawSeconds): Deleted. (WTF::MonotonicTime::infinity): Deleted. (WTF::MonotonicTime::nan): Deleted. (WTF::MonotonicTime::secondsSinceEpoch const): Deleted. (WTF::MonotonicTime::approximateMonotonicTime const): Deleted. (WTF::MonotonicTime::operator bool const): Deleted. (WTF::MonotonicTime::operator+ const): Deleted. (WTF::MonotonicTime::operator- const): Deleted. (WTF::MonotonicTime::operator% const): Deleted. (WTF::MonotonicTime::operator+=): Deleted. (WTF::MonotonicTime::operator-=): Deleted. (WTF::MonotonicTime::operator== const): Deleted. (WTF::MonotonicTime::operator!= const): Deleted. (WTF::MonotonicTime::operator< const): Deleted. (WTF::MonotonicTime::operator> const): Deleted. (WTF::MonotonicTime::operator<= const): Deleted. (WTF::MonotonicTime::operator>= const): Deleted. (WTF::MonotonicTime::isolatedCopy const): Deleted. (WTF::MonotonicTime::encode const): Deleted. (WTF::MonotonicTime::decode): Deleted. * wtf/NaturalLoops.h: * wtf/NoLock.h: * wtf/OSAllocator.h: * wtf/OptionSet.h: * wtf/Optional.h: * wtf/OrderMaker.h: * wtf/Packed.h: (WTF::alignof): * wtf/PackedIntVector.h: (WTF::PackedIntVector::PackedIntVector): Deleted. (WTF::PackedIntVector::operator=): Deleted. (WTF::PackedIntVector::size const): Deleted. (WTF::PackedIntVector::ensureSize): Deleted. (WTF::PackedIntVector::resize): Deleted. (WTF::PackedIntVector::clearAll): Deleted. (WTF::PackedIntVector::get const): Deleted. (WTF::PackedIntVector::set): Deleted. (WTF::PackedIntVector::mask): Deleted. * wtf/PageBlock.h: * wtf/ParallelJobsOpenMP.h: * wtf/ParkingLot.h: * wtf/PriorityQueue.h: (WTF::PriorityQueue::size const): Deleted. (WTF::PriorityQueue::isEmpty const): Deleted. (WTF::PriorityQueue::enqueue): Deleted. (WTF::PriorityQueue::peek const): Deleted. (WTF::PriorityQueue::dequeue): Deleted. (WTF::PriorityQueue::decreaseKey): Deleted. (WTF::PriorityQueue::increaseKey): Deleted. (WTF::PriorityQueue::begin const): Deleted. (WTF::PriorityQueue::end const): Deleted. (WTF::PriorityQueue::isValidHeap const): Deleted. (WTF::PriorityQueue::parentOf): Deleted. (WTF::PriorityQueue::leftChildOf): Deleted. (WTF::PriorityQueue::rightChildOf): Deleted. (WTF::PriorityQueue::siftUp): Deleted. (WTF::PriorityQueue::siftDown): Deleted. * wtf/RandomDevice.h: * wtf/Range.h: * wtf/RangeSet.h: (WTF::RangeSet::RangeSet): Deleted. (WTF::RangeSet::~RangeSet): Deleted. (WTF::RangeSet::add): Deleted. (WTF::RangeSet::contains const): Deleted. (WTF::RangeSet::overlaps const): Deleted. (WTF::RangeSet::clear): Deleted. (WTF::RangeSet::dump const): Deleted. (WTF::RangeSet::dumpRaw const): Deleted. (WTF::RangeSet::begin const): Deleted. (WTF::RangeSet::end const): Deleted. (WTF::RangeSet::addAll): Deleted. (WTF::RangeSet::compact): Deleted. (WTF::RangeSet::overlapsNonEmpty): Deleted. (WTF::RangeSet::subsumesNonEmpty): Deleted. (WTF::RangeSet::findRange const): Deleted. * wtf/RecursableLambda.h: * wtf/RedBlackTree.h: (WTF::RedBlackTree::Node::successor const): Deleted. (WTF::RedBlackTree::Node::predecessor const): Deleted. (WTF::RedBlackTree::Node::successor): Deleted. (WTF::RedBlackTree::Node::predecessor): Deleted. (WTF::RedBlackTree::Node::reset): Deleted. (WTF::RedBlackTree::Node::parent const): Deleted. (WTF::RedBlackTree::Node::setParent): Deleted. (WTF::RedBlackTree::Node::left const): Deleted. (WTF::RedBlackTree::Node::setLeft): Deleted. (WTF::RedBlackTree::Node::right const): Deleted. (WTF::RedBlackTree::Node::setRight): Deleted. (WTF::RedBlackTree::Node::color const): Deleted. (WTF::RedBlackTree::Node::setColor): Deleted. (WTF::RedBlackTree::RedBlackTree): Deleted. (WTF::RedBlackTree::insert): Deleted. (WTF::RedBlackTree::remove): Deleted. (WTF::RedBlackTree::findExact const): Deleted. (WTF::RedBlackTree::findLeastGreaterThanOrEqual const): Deleted. (WTF::RedBlackTree::findGreatestLessThanOrEqual const): Deleted. (WTF::RedBlackTree::first const): Deleted. (WTF::RedBlackTree::last const): Deleted. (WTF::RedBlackTree::size): Deleted. (WTF::RedBlackTree::isEmpty): Deleted. (WTF::RedBlackTree::treeMinimum): Deleted. (WTF::RedBlackTree::treeMaximum): Deleted. (WTF::RedBlackTree::treeInsert): Deleted. (WTF::RedBlackTree::leftRotate): Deleted. (WTF::RedBlackTree::rightRotate): Deleted. (WTF::RedBlackTree::removeFixup): Deleted. * wtf/ResourceUsage.h: * wtf/RunLoop.cpp: * wtf/RunLoopTimer.h: * wtf/SHA1.h: * wtf/Seconds.h: (WTF::Seconds::Seconds): Deleted. (WTF::Seconds::value const): Deleted. (WTF::Seconds::minutes const): Deleted. (WTF::Seconds::seconds const): Deleted. (WTF::Seconds::milliseconds const): Deleted. (WTF::Seconds::microseconds const): Deleted. (WTF::Seconds::nanoseconds const): Deleted. (WTF::Seconds::minutesAs const): Deleted. (WTF::Seconds::secondsAs const): Deleted. (WTF::Seconds::millisecondsAs const): Deleted. (WTF::Seconds::microsecondsAs const): Deleted. (WTF::Seconds::nanosecondsAs const): Deleted. (WTF::Seconds::fromMinutes): Deleted. (WTF::Seconds::fromHours): Deleted. (WTF::Seconds::fromMilliseconds): Deleted. (WTF::Seconds::fromMicroseconds): Deleted. (WTF::Seconds::fromNanoseconds): Deleted. (WTF::Seconds::infinity): Deleted. (WTF::Seconds::nan): Deleted. (WTF::Seconds::operator bool const): Deleted. (WTF::Seconds::operator+ const): Deleted. (WTF::Seconds::operator- const): Deleted. (WTF::Seconds::operator* const): Deleted. (WTF::Seconds::operator/ const): Deleted. (WTF::Seconds::operator% const): Deleted. (WTF::Seconds::operator+=): Deleted. (WTF::Seconds::operator-=): Deleted. (WTF::Seconds::operator*=): Deleted. (WTF::Seconds::operator/=): Deleted. (WTF::Seconds::operator%=): Deleted. (WTF::Seconds::operator== const): Deleted. (WTF::Seconds::operator!= const): Deleted. (WTF::Seconds::operator< const): Deleted. (WTF::Seconds::operator> const): Deleted. (WTF::Seconds::operator<= const): Deleted. (WTF::Seconds::operator>= const): Deleted. (WTF::Seconds::isolatedCopy const): Deleted. (WTF::Seconds::encode const): Deleted. (WTF::Seconds::decode): Deleted. * wtf/SegmentedVector.h: (WTF::SegmentedVector::~SegmentedVector): Deleted. (WTF::SegmentedVector::size const): Deleted. (WTF::SegmentedVector::isEmpty const): Deleted. (WTF::SegmentedVector::at): Deleted. (WTF::SegmentedVector::at const): Deleted. (WTF::SegmentedVector::operator[]): Deleted. (WTF::SegmentedVector::operator[] const): Deleted. (WTF::SegmentedVector::first): Deleted. (WTF::SegmentedVector::first const): Deleted. (WTF::SegmentedVector::last): Deleted. (WTF::SegmentedVector::last const): Deleted. (WTF::SegmentedVector::takeLast): Deleted. (WTF::SegmentedVector::append): Deleted. (WTF::SegmentedVector::alloc): Deleted. (WTF::SegmentedVector::removeLast): Deleted. (WTF::SegmentedVector::grow): Deleted. (WTF::SegmentedVector::clear): Deleted. (WTF::SegmentedVector::begin): Deleted. (WTF::SegmentedVector::end): Deleted. (WTF::SegmentedVector::shrinkToFit): Deleted. (WTF::SegmentedVector::deleteAllSegments): Deleted. (WTF::SegmentedVector::segmentExistsFor): Deleted. (WTF::SegmentedVector::segmentFor): Deleted. (WTF::SegmentedVector::subscriptFor): Deleted. (WTF::SegmentedVector::ensureSegmentsFor): Deleted. (WTF::SegmentedVector::ensureSegment): Deleted. (WTF::SegmentedVector::allocateSegment): Deleted. * wtf/SetForScope.h: * wtf/SingleRootGraph.h: * wtf/SinglyLinkedList.h: * wtf/SmallPtrSet.h: * wtf/SpanningTree.h: * wtf/Spectrum.h: * wtf/StackBounds.h: * wtf/StackShot.h: * wtf/StackShotProfiler.h: * wtf/StackStats.h: * wtf/StackTrace.h: * wtf/StreamBuffer.h: * wtf/SynchronizedFixedQueue.h: (WTF::SynchronizedFixedQueue::create): Deleted. (WTF::SynchronizedFixedQueue::open): Deleted. (WTF::SynchronizedFixedQueue::close): Deleted. (WTF::SynchronizedFixedQueue::isOpen): Deleted. (WTF::SynchronizedFixedQueue::enqueue): Deleted. (WTF::SynchronizedFixedQueue::dequeue): Deleted. (WTF::SynchronizedFixedQueue::SynchronizedFixedQueue): Deleted. * wtf/SystemTracing.h: * wtf/ThreadGroup.h: (WTF::ThreadGroup::create): Deleted. (WTF::ThreadGroup::threads const): Deleted. (WTF::ThreadGroup::getLock): Deleted. (WTF::ThreadGroup::weakFromThis): Deleted. * wtf/ThreadSpecific.h: * wtf/ThreadingPrimitives.h: (WTF::Mutex::impl): Deleted. * wtf/TimeWithDynamicClockType.h: (WTF::TimeWithDynamicClockType::TimeWithDynamicClockType): Deleted. (WTF::TimeWithDynamicClockType::fromRawSeconds): Deleted. (WTF::TimeWithDynamicClockType::secondsSinceEpoch const): Deleted. (WTF::TimeWithDynamicClockType::clockType const): Deleted. (WTF::TimeWithDynamicClockType::withSameClockAndRawSeconds const): Deleted. (WTF::TimeWithDynamicClockType::operator bool const): Deleted. (WTF::TimeWithDynamicClockType::operator+ const): Deleted. (WTF::TimeWithDynamicClockType::operator- const): Deleted. (WTF::TimeWithDynamicClockType::operator+=): Deleted. (WTF::TimeWithDynamicClockType::operator-=): Deleted. (WTF::TimeWithDynamicClockType::operator== const): Deleted. (WTF::TimeWithDynamicClockType::operator!= const): Deleted. * wtf/TimingScope.h: * wtf/TinyLRUCache.h: * wtf/TinyPtrSet.h: * wtf/URLParser.cpp: * wtf/URLParser.h: * wtf/Unexpected.h: * wtf/Variant.h: * wtf/WTFSemaphore.h: (WTF::Semaphore::Semaphore): Deleted. (WTF::Semaphore::signal): Deleted. (WTF::Semaphore::waitUntil): Deleted. (WTF::Semaphore::waitFor): Deleted. (WTF::Semaphore::wait): Deleted. * wtf/WallTime.h: (WTF::WallTime::WallTime): Deleted. (WTF::WallTime::fromRawSeconds): Deleted. (WTF::WallTime::infinity): Deleted. (WTF::WallTime::nan): Deleted. (WTF::WallTime::secondsSinceEpoch const): Deleted. (WTF::WallTime::approximateWallTime const): Deleted. (WTF::WallTime::operator bool const): Deleted. (WTF::WallTime::operator+ const): Deleted. (WTF::WallTime::operator- const): Deleted. (WTF::WallTime::operator+=): Deleted. (WTF::WallTime::operator-=): Deleted. (WTF::WallTime::operator== const): Deleted. (WTF::WallTime::operator!= const): Deleted. (WTF::WallTime::operator< const): Deleted. (WTF::WallTime::operator> const): Deleted. (WTF::WallTime::operator<= const): Deleted. (WTF::WallTime::operator>= const): Deleted. (WTF::WallTime::isolatedCopy const): Deleted. * wtf/WeakHashSet.h: (WTF::WeakHashSet::WeakHashSetConstIterator::WeakHashSetConstIterator): Deleted. (WTF::WeakHashSet::WeakHashSetConstIterator::get const): Deleted. (WTF::WeakHashSet::WeakHashSetConstIterator::operator* const): Deleted. (WTF::WeakHashSet::WeakHashSetConstIterator::operator-> const): Deleted. (WTF::WeakHashSet::WeakHashSetConstIterator::operator++): Deleted. (WTF::WeakHashSet::WeakHashSetConstIterator::skipEmptyBuckets): Deleted. (WTF::WeakHashSet::WeakHashSetConstIterator::operator== const): Deleted. (WTF::WeakHashSet::WeakHashSetConstIterator::operator!= const): Deleted. (WTF::WeakHashSet::WeakHashSet): Deleted. (WTF::WeakHashSet::begin const): Deleted. (WTF::WeakHashSet::end const): Deleted. (WTF::WeakHashSet::add): Deleted. (WTF::WeakHashSet::remove): Deleted. (WTF::WeakHashSet::contains const): Deleted. (WTF::WeakHashSet::capacity const): Deleted. (WTF::WeakHashSet::computesEmpty const): Deleted. (WTF::WeakHashSet::hasNullReferences const): Deleted. (WTF::WeakHashSet::computeSize const): Deleted. (WTF::WeakHashSet::checkConsistency const): Deleted. * wtf/WeakRandom.h: (WTF::WeakRandom::WeakRandom): Deleted. (WTF::WeakRandom::setSeed): Deleted. (WTF::WeakRandom::seed const): Deleted. (WTF::WeakRandom::get): Deleted. (WTF::WeakRandom::getUint32): Deleted. (WTF::WeakRandom::lowOffset): Deleted. (WTF::WeakRandom::highOffset): Deleted. (WTF::WeakRandom::nextState): Deleted. (WTF::WeakRandom::generate): Deleted. (WTF::WeakRandom::advance): Deleted. * wtf/WordLock.h: (WTF::WordLock::lock): Deleted. (WTF::WordLock::unlock): Deleted. (WTF::WordLock::isHeld const): Deleted. (WTF::WordLock::isLocked const): Deleted. (WTF::WordLock::isFullyReset const): Deleted. * wtf/generic/MainThreadGeneric.cpp: * wtf/glib/GMutexLocker.h: * wtf/linux/CurrentProcessMemoryStatus.h: * wtf/posix/ThreadingPOSIX.cpp: (WTF::Semaphore::Semaphore): Deleted. (WTF::Semaphore::~Semaphore): Deleted. (WTF::Semaphore::wait): Deleted. (WTF::Semaphore::post): Deleted. * wtf/text/ASCIILiteral.h: (WTF::ASCIILiteral::operator const char* const): Deleted. (WTF::ASCIILiteral::fromLiteralUnsafe): Deleted. (WTF::ASCIILiteral::null): Deleted. (WTF::ASCIILiteral::characters const): Deleted. (WTF::ASCIILiteral::ASCIILiteral): Deleted. * wtf/text/AtomString.h: (WTF::AtomString::operator=): Deleted. (WTF::AtomString::isHashTableDeletedValue const): Deleted. (WTF::AtomString::existingHash const): Deleted. (WTF::AtomString::operator const String& const): Deleted. (WTF::AtomString::string const): Deleted. (WTF::AtomString::impl const): Deleted. (WTF::AtomString::is8Bit const): Deleted. (WTF::AtomString::characters8 const): Deleted. (WTF::AtomString::characters16 const): Deleted. (WTF::AtomString::length const): Deleted. (WTF::AtomString::operator[] const): Deleted. (WTF::AtomString::contains const): Deleted. (WTF::AtomString::containsIgnoringASCIICase const): Deleted. (WTF::AtomString::find const): Deleted. (WTF::AtomString::findIgnoringASCIICase const): Deleted. (WTF::AtomString::startsWith const): Deleted. (WTF::AtomString::startsWithIgnoringASCIICase const): Deleted. (WTF::AtomString::endsWith const): Deleted. (WTF::AtomString::endsWithIgnoringASCIICase const): Deleted. (WTF::AtomString::toInt const): Deleted. (WTF::AtomString::toDouble const): Deleted. (WTF::AtomString::toFloat const): Deleted. (WTF::AtomString::percentage const): Deleted. (WTF::AtomString::isNull const): Deleted. (WTF::AtomString::isEmpty const): Deleted. (WTF::AtomString::operator NSString * const): Deleted. * wtf/text/AtomStringImpl.h: (WTF::AtomStringImpl::lookUp): Deleted. (WTF::AtomStringImpl::add): Deleted. (WTF::AtomStringImpl::addWithStringTableProvider): Deleted. * wtf/text/CString.h: (WTF::CStringBuffer::data): Deleted. (WTF::CStringBuffer::length const): Deleted. (WTF::CStringBuffer::CStringBuffer): Deleted. (WTF::CStringBuffer::mutableData): Deleted. (WTF::CString::CString): Deleted. (WTF::CString::data const): Deleted. (WTF::CString::length const): Deleted. (WTF::CString::isNull const): Deleted. (WTF::CString::buffer const): Deleted. (WTF::CString::isHashTableDeletedValue const): Deleted. * wtf/text/ExternalStringImpl.h: (WTF::ExternalStringImpl::freeExternalBuffer): Deleted. * wtf/text/LineBreakIteratorPoolICU.h: * wtf/text/NullTextBreakIterator.h: * wtf/text/OrdinalNumber.h: * wtf/text/StringBuffer.h: * wtf/text/StringBuilder.h: * wtf/text/StringConcatenateNumbers.h: * wtf/text/StringHasher.h: * wtf/text/StringImpl.h: * wtf/text/StringView.cpp: * wtf/text/StringView.h: (WTF::StringView::left const): Deleted. (WTF::StringView::right const): Deleted. (WTF::StringView::underlyingStringIsValid const): Deleted. (WTF::StringView::setUnderlyingString): Deleted. * wtf/text/SymbolImpl.h: (WTF::SymbolImpl::StaticSymbolImpl::StaticSymbolImpl): Deleted. (WTF::SymbolImpl::StaticSymbolImpl::operator SymbolImpl&): Deleted. (WTF::PrivateSymbolImpl::PrivateSymbolImpl): Deleted. (WTF::RegisteredSymbolImpl::symbolRegistry const): Deleted. (WTF::RegisteredSymbolImpl::clearSymbolRegistry): Deleted. (WTF::RegisteredSymbolImpl::RegisteredSymbolImpl): Deleted. * wtf/text/SymbolRegistry.h: * wtf/text/TextBreakIterator.h: * wtf/text/TextPosition.h: * wtf/text/TextStream.h: * wtf/text/WTFString.h: (WTF::String::swap): Deleted. (WTF::String::adopt): Deleted. (WTF::String::isNull const): Deleted. (WTF::String::isEmpty const): Deleted. (WTF::String::impl const): Deleted. (WTF::String::releaseImpl): Deleted. (WTF::String::length const): Deleted. (WTF::String::characters8 const): Deleted. (WTF::String::characters16 const): Deleted. (WTF::String::is8Bit const): Deleted. (WTF::String::sizeInBytes const): Deleted. (WTF::String::operator[] const): Deleted. (WTF::String::find const): Deleted. (WTF::String::findIgnoringASCIICase const): Deleted. (WTF::String::reverseFind const): Deleted. (WTF::String::contains const): Deleted. (WTF::String::containsIgnoringASCIICase const): Deleted. (WTF::String::startsWith const): Deleted. (WTF::String::startsWithIgnoringASCIICase const): Deleted. (WTF::String::hasInfixStartingAt const): Deleted. (WTF::String::endsWith const): Deleted. (WTF::String::endsWithIgnoringASCIICase const): Deleted. (WTF::String::hasInfixEndingAt const): Deleted. (WTF::String::append): Deleted. (WTF::String::left const): Deleted. (WTF::String::right const): Deleted. (WTF::String::createUninitialized): Deleted. (WTF::String::fromUTF8WithLatin1Fallback): Deleted. (WTF::String::isAllASCII const): Deleted. (WTF::String::isAllLatin1 const): Deleted. (WTF::String::isSpecialCharacter const): Deleted. (WTF::String::isHashTableDeletedValue const): Deleted. (WTF::String::hash const): Deleted. (WTF::String::existingHash const): Deleted. * wtf/text/cf/TextBreakIteratorCF.h: * wtf/text/icu/TextBreakIteratorICU.h: * wtf/text/icu/UTextProviderLatin1.h: * wtf/threads/BinarySemaphore.h: (WTF::BinarySemaphore::waitFor): Deleted. (WTF::BinarySemaphore::wait): Deleted. * wtf/unicode/Collator.h: * wtf/win/GDIObject.h: * wtf/win/PathWalker.h: * wtf/win/Win32Handle.h: Canonical link: https://commits.webkit.org/214396@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248546 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-08-12 20:57:15 +00:00
WTF_MAKE_FAST_ALLOCATED;
Dominators should be factored out of the DFG https://bugs.webkit.org/show_bug.cgi?id=150764 Reviewed by Geoffrey Garen. Source/JavaScriptCore: Factored DFGDominators.h/DFGDominators.cpp into WTF. To do this, I made two changes to the DFG: 1) DFG now has a CFG abstraction called DFG::CFG. The cool thing about this is that in the future if we wanted to support inverted dominators, we could do it by just creating a DFG::BackwardCFG. 2) Got rid of DFG::Analysis. From now on, an Analysis being invalidated is expressed by the DFG::Graph having a null pointer for that analysis. When we "run" the analysis, we just instantiate it. This makes it much more natural to integrate WTF::Dominators into the DFG. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * dfg/DFGAnalysis.h: Removed. * dfg/DFGCFG.h: Added. (JSC::DFG::CFG::CFG): (JSC::DFG::CFG::root): (JSC::DFG::CFG::newMap<T>): (JSC::DFG::CFG::successors): (JSC::DFG::CFG::predecessors): (JSC::DFG::CFG::index): (JSC::DFG::CFG::node): (JSC::DFG::CFG::numNodes): (JSC::DFG::CFG::dump): * dfg/DFGCSEPhase.cpp: * dfg/DFGDisassembler.cpp: (JSC::DFG::Disassembler::createDumpList): * dfg/DFGDominators.cpp: Removed. * dfg/DFGDominators.h: (JSC::DFG::Dominators::Dominators): (JSC::DFG::Dominators::strictlyDominates): Deleted. (JSC::DFG::Dominators::dominates): Deleted. (JSC::DFG::Dominators::immediateDominatorOf): Deleted. (JSC::DFG::Dominators::forAllStrictDominatorsOf): Deleted. (JSC::DFG::Dominators::forAllDominatorsOf): Deleted. (JSC::DFG::Dominators::forAllBlocksStrictlyDominatedBy): Deleted. (JSC::DFG::Dominators::forAllBlocksDominatedBy): Deleted. (JSC::DFG::Dominators::forAllBlocksInDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInIteratedDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInPrunedIteratedDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInDominanceFrontierOfImpl): Deleted. (JSC::DFG::Dominators::forAllBlocksInIteratedDominanceFrontierOfImpl): Deleted. (JSC::DFG::Dominators::BlockData::BlockData): Deleted. * dfg/DFGEdgeDominates.h: (JSC::DFG::EdgeDominates::operator()): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::Graph): (JSC::DFG::Graph::dumpBlockHeader): (JSC::DFG::Graph::invalidateCFG): (JSC::DFG::Graph::substituteGetLocal): (JSC::DFG::Graph::handleAssertionFailure): (JSC::DFG::Graph::ensureDominators): (JSC::DFG::Graph::ensurePrePostNumbering): (JSC::DFG::Graph::ensureNaturalLoops): (JSC::DFG::Graph::valueProfileFor): * dfg/DFGGraph.h: (JSC::DFG::Graph::hasDebuggerEnabled): * dfg/DFGLICMPhase.cpp: (JSC::DFG::LICMPhase::run): (JSC::DFG::LICMPhase::attemptHoist): * dfg/DFGLoopPreHeaderCreationPhase.cpp: (JSC::DFG::createPreHeader): (JSC::DFG::LoopPreHeaderCreationPhase::run): * dfg/DFGNaturalLoops.cpp: (JSC::DFG::NaturalLoop::dump): (JSC::DFG::NaturalLoops::NaturalLoops): (JSC::DFG::NaturalLoops::~NaturalLoops): (JSC::DFG::NaturalLoops::loopsOf): (JSC::DFG::NaturalLoops::computeDependencies): Deleted. (JSC::DFG::NaturalLoops::compute): Deleted. * dfg/DFGNaturalLoops.h: (JSC::DFG::NaturalLoops::numLoops): * dfg/DFGNode.h: (JSC::DFG::Node::SuccessorsIterable::end): (JSC::DFG::Node::SuccessorsIterable::size): (JSC::DFG::Node::SuccessorsIterable::at): (JSC::DFG::Node::SuccessorsIterable::operator[]): * dfg/DFGOSREntrypointCreationPhase.cpp: (JSC::DFG::OSREntrypointCreationPhase::run): * dfg/DFGObjectAllocationSinkingPhase.cpp: * dfg/DFGPlan.cpp: (JSC::DFG::Plan::compileInThreadImpl): * dfg/DFGPrePostNumbering.cpp: (JSC::DFG::PrePostNumbering::PrePostNumbering): (JSC::DFG::PrePostNumbering::~PrePostNumbering): (JSC::DFG::PrePostNumbering::compute): Deleted. * dfg/DFGPrePostNumbering.h: (JSC::DFG::PrePostNumbering::preNumber): (JSC::DFG::PrePostNumbering::postNumber): * dfg/DFGPutStackSinkingPhase.cpp: * dfg/DFGSSACalculator.cpp: (JSC::DFG::SSACalculator::nonLocalReachingDef): (JSC::DFG::SSACalculator::reachingDefAtTail): * dfg/DFGSSACalculator.h: (JSC::DFG::SSACalculator::computePhis): * dfg/DFGSSAConversionPhase.cpp: (JSC::DFG::SSAConversionPhase::run): * ftl/FTLLink.cpp: (JSC::FTL::link): * ftl/FTLLowerDFGToLLVM.cpp: (JSC::FTL::DFG::LowerDFGToLLVM::lower): (JSC::FTL::DFG::LowerDFGToLLVM::safelyInvalidateAfterTermination): (JSC::FTL::DFG::LowerDFGToLLVM::isValid): Source/WTF: This takes what used to be DFGDominators.h/DFGDominators.cpp and turns it into a generic algorithm that can take any abstract graph. The idea is that you create Dominators<CFG> and pass it a CFG object, which defines the types of graph nodes and methods for getting successors, predecessors, etc. The DFG now defines a class called CFG, which is a wrapper for DFG::Graph that conforms to the thing that wtf/Dominators.h expects. When doing things to graphs, it's common to refer to the things in the graph as "nodes". Because I intend to reuse the CFG abstraction with many graph algorithms, that abstraction uses the term "node" to refer to a DFG basic block. But in Dominators, the method and variable names still use "block". This is because although Dominators are applicable to any kind of directed graph, it's super unlikely that we will ever use them for anything but compilers. Indeed, the only reason why I'm factoring them out of the DFG is so that I can use them with B3 and Air. This has the nice side effect that a user of WTF::Dominators<JSC::DFG::CFG> will see familiar terminology like "blocksStrictlyDominatedBy(...)" instead of "nodesStrictlyDominatedBy(...)", which would be super confusing. Overall, wtf/Dominators.h is a combination of what used to be in DFGDominators.h, DFGDominators.cpp, DFGNaiveDominators.h, and DFGNaiveDominators.cpp. I only changed code when I had to in order to make it generic. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/Dominators.h: Added. (WTF::Dominators::Dominators): (WTF::Dominators::compute): (WTF::Dominators::strictlyDominates): (WTF::Dominators::dominates): (WTF::Dominators::immediateDominatorOf): (WTF::Dominators::forAllStrictDominatorsOf): (WTF::Dominators::forAllDominatorsOf): (WTF::Dominators::forAllBlocksStrictlyDominatedBy): (WTF::Dominators::forAllBlocksDominatedBy): (WTF::Dominators::strictDominatorsOf): (WTF::Dominators::dominatorsOf): (WTF::Dominators::blocksStrictlyDominatedBy): (WTF::Dominators::blocksDominatedBy): (WTF::Dominators::forAllBlocksInDominanceFrontierOf): (WTF::Dominators::dominanceFrontierOf): (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOf): (WTF::Dominators::forAllBlocksInPrunedIteratedDominanceFrontierOf): (WTF::Dominators::iteratedDominanceFrontierOf): (WTF::Dominators::dump): (WTF::Dominators::LengauerTarjan::LengauerTarjan): (WTF::Dominators::LengauerTarjan::compute): (WTF::Dominators::LengauerTarjan::immediateDominator): (WTF::Dominators::LengauerTarjan::computeDepthFirstPreNumbering): (WTF::Dominators::LengauerTarjan::computeSemiDominatorsAndImplicitImmediateDominators): (WTF::Dominators::LengauerTarjan::computeExplicitImmediateDominators): (WTF::Dominators::LengauerTarjan::link): (WTF::Dominators::LengauerTarjan::eval): (WTF::Dominators::LengauerTarjan::compress): (WTF::Dominators::LengauerTarjan::BlockData::BlockData): (WTF::Dominators::NaiveDominators::NaiveDominators): (WTF::Dominators::NaiveDominators::dominates): (WTF::Dominators::NaiveDominators::dump): (WTF::Dominators::NaiveDominators::pruneDominators): (WTF::Dominators::ValidationContext::ValidationContext): (WTF::Dominators::ValidationContext::reportError): (WTF::Dominators::ValidationContext::handleErrors): (WTF::Dominators::naiveDominates): (WTF::Dominators::forAllBlocksInDominanceFrontierOfImpl): (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOfImpl): (WTF::Dominators::BlockData::BlockData): Canonical link: https://commits.webkit.org/168962@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@191870 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-11-02 00:48:03 +00:00
public:
Support compiling catch in the DFG https://bugs.webkit.org/show_bug.cgi?id=174590 <rdar://problem/34047845> Reviewed by Filip Pizlo. JSTests: * microbenchmarks/delta-blue-try-catch.js: Added. (exception): (value): (OrderedCollection): (OrderedCollection.prototype.add): (OrderedCollection.prototype.at): (OrderedCollection.prototype.size): (OrderedCollection.prototype.removeFirst): (OrderedCollection.prototype.remove): (Strength): (Strength.stronger): (Strength.weaker): (Strength.weakestOf): (Strength.strongest): (Strength.prototype.nextWeaker): (Constraint): (Constraint.prototype.addConstraint): (Constraint.prototype.satisfy): (Constraint.prototype.destroyConstraint): (Constraint.prototype.isInput): (UnaryConstraint): (UnaryConstraint.prototype.addToGraph): (UnaryConstraint.prototype.chooseMethod): (UnaryConstraint.prototype.isSatisfied): (UnaryConstraint.prototype.markInputs): (UnaryConstraint.prototype.output): (UnaryConstraint.prototype.recalculate): (UnaryConstraint.prototype.markUnsatisfied): (UnaryConstraint.prototype.inputsKnown): (UnaryConstraint.prototype.removeFromGraph): (StayConstraint): (StayConstraint.prototype.execute): (EditConstraint.prototype.isInput): (EditConstraint.prototype.execute): (BinaryConstraint): (BinaryConstraint.prototype.chooseMethod): (BinaryConstraint.prototype.addToGraph): (BinaryConstraint.prototype.isSatisfied): (BinaryConstraint.prototype.markInputs): (BinaryConstraint.prototype.input): (BinaryConstraint.prototype.output): (BinaryConstraint.prototype.recalculate): (BinaryConstraint.prototype.markUnsatisfied): (BinaryConstraint.prototype.inputsKnown): (BinaryConstraint.prototype.removeFromGraph): (ScaleConstraint): (ScaleConstraint.prototype.addToGraph): (ScaleConstraint.prototype.removeFromGraph): (ScaleConstraint.prototype.markInputs): (ScaleConstraint.prototype.execute): (ScaleConstraint.prototype.recalculate): (EqualityConstraint): (EqualityConstraint.prototype.execute): (Variable): (Variable.prototype.addConstraint): (Variable.prototype.removeConstraint): (Planner): (Planner.prototype.incrementalAdd): (Planner.prototype.incrementalRemove): (Planner.prototype.newMark): (Planner.prototype.makePlan): (Planner.prototype.extractPlanFromConstraints): (Planner.prototype.addPropagate): (Planner.prototype.removePropagateFrom): (Planner.prototype.addConstraintsConsumingTo): (Plan): (Plan.prototype.addConstraint): (Plan.prototype.size): (Plan.prototype.constraintAt): (Plan.prototype.execute): (chainTest): (projectionTest): (change): (deltaBlue): * microbenchmarks/fake-iterators-that-throw-when-finished.js: Added. (assert): (Numbers): (Numbers.prototype.next): (return.Transpose): (return.Transpose.prototype.next): (transpose): (verifyEven): (verifyString): (foo): (runIterators): * microbenchmarks/try-catch-word-count.js: Added. (let.assert): (EOF): (let.texts): (let.o.apply): (foo): (bar): (f): (run): (test1): (test2): (test3): (fn): (A): (B): (A.prototype.getValue): (B.prototype.getParentValue): (strlen): (sum.0): (test): (result.test.o): (set add.set add): (set forEach): (stringHash): (set if): (testFunction): (set delete.set has.set add): * stress/catch-set-argument-speculation-failure.js: Added. (o): (e): (e2): (escape): (baz): (noInline.run): (noInline): * stress/osr-enter-to-catch-with-set-local-type-check-failure.js: Added. (foo): (e): (baz): (bar): Source/JavaScriptCore: This patch implements OSR entry into op_catch in the DFG. We will support OSR entry into the FTL in a followup: https://bugs.webkit.org/show_bug.cgi?id=175396 To implement catch in the DFG, this patch introduces the concept of multiple entrypoints into CPS/LoadStore DFG IR. A lot of this patch is stringing this concept through the DFG. Many phases used to assume that Graph::block(0) is the only root, and this patch contains many straight forward changes generalizing the code to handle more than one entrypoint. A main building block of this is moving to two CFG types: SSACFG and CPSCFG. SSACFG is the same CFG we used to have. CPSCFG is a new type that introduces a fake root that has an outgoing edge to all the entrypoints. This allows our existing graph algorithms to Just Work over CPSCFG. For example, there is now the concept of SSADominators vs CPSDominators, and SSANaturalLoops vs CPSNaturalLoops. The way we compile the catch entrypoint is by bootstrapping the state of the program by loading all live bytecode locals from a buffer. The OSR entry code will store all live values into that buffer before jumping to the entrypoint. The OSR entry code is also responsible for performing type proofs of the arguments before doing an OSR entry. If there is a type mismatch, it's not legal to OSR enter into the DFG compilation. Currently, each catch entrypoint knows the argument type proofs it must perform to enter into the DFG. Currently, all entrypoints' arguments flush format are unified via ArgumentPosition, but this is just an implementation detail. The code is written more generally to assume that each entrypoint may perform its own distinct proof. op_catch now performs value profiling for all live bytecode locals in the LLInt and baseline JIT. This information is then fed into the DFG via the ExtractCatchLocal node in the prediction propagation phase. This patch also changes how we generate op_catch in bytecode. All op_catches are now split out at the end of the program in bytecode. This ensures that no op_catch is inside a try block. This is needed to ensure correctness in the DFGLiveCatchVariablePreservationPhase. That phase only inserts flushes before SetLocals inside a try block. If an op_catch were in a try block, this would cause the phase to insert a Flush before one of the state bootstrapping SetLocals, which would generate invalid IR. Moving op_catch to be generated on its own at the end of a bytecode stream seemed like the most elegant solution since it better represents that we treat op_catch as an entrypoint. This is true both in the DFG and in the baseline and LLInt: we don't reach an op_catch via normal control flow. Because op_catch cannot throw, this will not break any previous semantics of op_catch. Logically, it'd be valid to split try blocks around any non-throwing bytecode operation. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * bytecode/BytecodeDumper.cpp: (JSC::BytecodeDumper<Block>::dumpBytecode): * bytecode/BytecodeList.json: * bytecode/BytecodeUseDef.h: (JSC::computeUsesForBytecodeOffset): * bytecode/CodeBlock.cpp: (JSC::CodeBlock::finishCreation): (JSC::CodeBlock::ensureCatchLivenessIsComputedForBytecodeOffset): (JSC::CodeBlock::updateAllPredictionsAndCountLiveness): (JSC::CodeBlock::validate): * bytecode/CodeBlock.h: * bytecode/ValueProfile.h: (JSC::ValueProfile::ValueProfile): (JSC::ValueProfileAndOperandBuffer::ValueProfileAndOperandBuffer): (JSC::ValueProfileAndOperandBuffer::~ValueProfileAndOperandBuffer): (JSC::ValueProfileAndOperandBuffer::forEach): * bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::generate): (JSC::BytecodeGenerator::BytecodeGenerator): (JSC::BytecodeGenerator::emitCatch): (JSC::BytecodeGenerator::emitEnumeration): * bytecompiler/BytecodeGenerator.h: * bytecompiler/NodesCodegen.cpp: (JSC::TryNode::emitBytecode): * dfg/DFGAbstractInterpreterInlines.h: (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects): * dfg/DFGBackwardsCFG.h: (JSC::DFG::BackwardsCFG::BackwardsCFG): * dfg/DFGBasicBlock.cpp: (JSC::DFG::BasicBlock::BasicBlock): * dfg/DFGBasicBlock.h: (JSC::DFG::BasicBlock::findTerminal const): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::setDirect): (JSC::DFG::ByteCodeParser::flush): (JSC::DFG::ByteCodeParser::DelayedSetLocal::DelayedSetLocal): (JSC::DFG::ByteCodeParser::DelayedSetLocal::execute): (JSC::DFG::ByteCodeParser::parseBlock): (JSC::DFG::ByteCodeParser::parseCodeBlock): (JSC::DFG::ByteCodeParser::parse): * dfg/DFGCFG.h: (JSC::DFG::CFG::root): (JSC::DFG::CFG::roots): (JSC::DFG::CPSCFG::CPSCFG): (JSC::DFG::selectCFG): * dfg/DFGCPSRethreadingPhase.cpp: (JSC::DFG::CPSRethreadingPhase::specialCaseArguments): * dfg/DFGCSEPhase.cpp: * dfg/DFGClobberize.h: (JSC::DFG::clobberize): * dfg/DFGControlEquivalenceAnalysis.h: (JSC::DFG::ControlEquivalenceAnalysis::ControlEquivalenceAnalysis): * dfg/DFGDCEPhase.cpp: (JSC::DFG::DCEPhase::run): * dfg/DFGDisassembler.cpp: (JSC::DFG::Disassembler::createDumpList): * dfg/DFGDoesGC.cpp: (JSC::DFG::doesGC): * dfg/DFGDominators.h: (JSC::DFG::Dominators::Dominators): (JSC::DFG::ensureDominatorsForCFG): * dfg/DFGEdgeDominates.h: (JSC::DFG::EdgeDominates::EdgeDominates): (JSC::DFG::EdgeDominates::operator()): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): (JSC::DFG::FixupPhase::fixupChecksInBlock): * dfg/DFGFlushFormat.h: * dfg/DFGGraph.cpp: (JSC::DFG::Graph::Graph): (JSC::DFG::unboxLoopNode): (JSC::DFG::Graph::dumpBlockHeader): (JSC::DFG::Graph::dump): (JSC::DFG::Graph::determineReachability): (JSC::DFG::Graph::invalidateCFG): (JSC::DFG::Graph::blocksInPreOrder): (JSC::DFG::Graph::blocksInPostOrder): (JSC::DFG::Graph::ensureCPSDominators): (JSC::DFG::Graph::ensureSSADominators): (JSC::DFG::Graph::ensureCPSNaturalLoops): (JSC::DFG::Graph::ensureSSANaturalLoops): (JSC::DFG::Graph::ensureBackwardsCFG): (JSC::DFG::Graph::ensureBackwardsDominators): (JSC::DFG::Graph::ensureControlEquivalenceAnalysis): (JSC::DFG::Graph::methodOfGettingAValueProfileFor): (JSC::DFG::Graph::clearCPSCFGData): (JSC::DFG::Graph::ensureDominators): Deleted. (JSC::DFG::Graph::ensurePrePostNumbering): Deleted. (JSC::DFG::Graph::ensureNaturalLoops): Deleted. * dfg/DFGGraph.h: (JSC::DFG::Graph::willCatchExceptionInMachineFrame): (JSC::DFG::Graph::isEntrypoint const): * dfg/DFGInPlaceAbstractState.cpp: (JSC::DFG::InPlaceAbstractState::initialize): (JSC::DFG::InPlaceAbstractState::mergeToSuccessors): * dfg/DFGJITCode.cpp: (JSC::DFG::JITCode::shrinkToFit): * dfg/DFGJITCode.h: (JSC::DFG::JITCode::catchOSREntryDataForBytecodeIndex): (JSC::DFG::JITCode::finalizeCatchOSREntrypoints): (JSC::DFG::JITCode::appendCatchEntrypoint): * dfg/DFGJITCompiler.cpp: (JSC::DFG::JITCompiler::compile): (JSC::DFG::JITCompiler::compileFunction): (JSC::DFG::JITCompiler::noticeCatchEntrypoint): (JSC::DFG::JITCompiler::noticeOSREntry): (JSC::DFG::JITCompiler::makeCatchOSREntryBuffer): * dfg/DFGJITCompiler.h: * dfg/DFGLICMPhase.cpp: (JSC::DFG::LICMPhase::run): (JSC::DFG::LICMPhase::attemptHoist): * dfg/DFGLiveCatchVariablePreservationPhase.cpp: (JSC::DFG::LiveCatchVariablePreservationPhase::run): (JSC::DFG::LiveCatchVariablePreservationPhase::isValidFlushLocation): (JSC::DFG::LiveCatchVariablePreservationPhase::handleBlockForTryCatch): (JSC::DFG::LiveCatchVariablePreservationPhase::newVariableAccessData): (JSC::DFG::LiveCatchVariablePreservationPhase::willCatchException): Deleted. (JSC::DFG::LiveCatchVariablePreservationPhase::handleBlock): Deleted. * dfg/DFGLoopPreHeaderCreationPhase.cpp: (JSC::DFG::createPreHeader): (JSC::DFG::LoopPreHeaderCreationPhase::run): * dfg/DFGMaximalFlushInsertionPhase.cpp: (JSC::DFG::MaximalFlushInsertionPhase::run): (JSC::DFG::MaximalFlushInsertionPhase::treatRegularBlock): (JSC::DFG::MaximalFlushInsertionPhase::treatRootBlock): * dfg/DFGMayExit.cpp: * dfg/DFGNaturalLoops.h: (JSC::DFG::NaturalLoops::NaturalLoops): * dfg/DFGNode.h: (JSC::DFG::Node::isSwitch const): (JSC::DFG::Node::successor): (JSC::DFG::Node::catchOSREntryIndex const): (JSC::DFG::Node::catchLocalPrediction): (JSC::DFG::Node::isSwitch): Deleted. * dfg/DFGNodeType.h: * dfg/DFGOSREntry.cpp: (JSC::DFG::prepareCatchOSREntry): * dfg/DFGOSREntry.h: * dfg/DFGOSREntrypointCreationPhase.cpp: (JSC::DFG::OSREntrypointCreationPhase::run): * dfg/DFGOSRExitCompilerCommon.cpp: (JSC::DFG::handleExitCounts): * dfg/DFGObjectAllocationSinkingPhase.cpp: * dfg/DFGPlan.cpp: (JSC::DFG::Plan::compileInThreadImpl): * dfg/DFGPrePostNumbering.cpp: (JSC::DFG::PrePostNumbering::PrePostNumbering): Deleted. (JSC::DFG::PrePostNumbering::~PrePostNumbering): Deleted. (WTF::printInternal): Deleted. * dfg/DFGPrePostNumbering.h: (): Deleted. (JSC::DFG::PrePostNumbering::preNumber const): Deleted. (JSC::DFG::PrePostNumbering::postNumber const): Deleted. (JSC::DFG::PrePostNumbering::isStrictAncestorOf const): Deleted. (JSC::DFG::PrePostNumbering::isAncestorOf const): Deleted. (JSC::DFG::PrePostNumbering::isStrictDescendantOf const): Deleted. (JSC::DFG::PrePostNumbering::isDescendantOf const): Deleted. (JSC::DFG::PrePostNumbering::edgeKind const): Deleted. * dfg/DFGPredictionInjectionPhase.cpp: (JSC::DFG::PredictionInjectionPhase::run): * dfg/DFGPredictionPropagationPhase.cpp: * dfg/DFGPutStackSinkingPhase.cpp: * dfg/DFGSSACalculator.cpp: (JSC::DFG::SSACalculator::nonLocalReachingDef): (JSC::DFG::SSACalculator::reachingDefAtTail): * dfg/DFGSSACalculator.h: (JSC::DFG::SSACalculator::computePhis): * dfg/DFGSSAConversionPhase.cpp: (JSC::DFG::SSAConversionPhase::run): (JSC::DFG::performSSAConversion): * dfg/DFGSafeToExecute.h: (JSC::DFG::safeToExecute): * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::compileCurrentBlock): (JSC::DFG::SpeculativeJIT::checkArgumentTypes): (JSC::DFG::SpeculativeJIT::createOSREntries): (JSC::DFG::SpeculativeJIT::linkOSREntries): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGStaticExecutionCountEstimationPhase.cpp: (JSC::DFG::StaticExecutionCountEstimationPhase::run): * dfg/DFGStrengthReductionPhase.cpp: (JSC::DFG::StrengthReductionPhase::handleNode): * dfg/DFGTierUpCheckInjectionPhase.cpp: (JSC::DFG::TierUpCheckInjectionPhase::run): (JSC::DFG::TierUpCheckInjectionPhase::buildNaturalLoopToLoopHintMap): * dfg/DFGTypeCheckHoistingPhase.cpp: (JSC::DFG::TypeCheckHoistingPhase::run): * dfg/DFGValidate.cpp: * ftl/FTLLink.cpp: (JSC::FTL::link): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::lower): (JSC::FTL::DFG::LowerDFGToB3::safelyInvalidateAfterTermination): (JSC::FTL::DFG::LowerDFGToB3::isValid): * jit/JIT.h: * jit/JITInlines.h: (JSC::JIT::callOperation): * jit/JITOpcodes.cpp: (JSC::JIT::emit_op_catch): * jit/JITOpcodes32_64.cpp: (JSC::JIT::emit_op_catch): * jit/JITOperations.cpp: * jit/JITOperations.h: * llint/LLIntSlowPaths.cpp: (JSC::LLInt::LLINT_SLOW_PATH_DECL): * llint/LLIntSlowPaths.h: * llint/LowLevelInterpreter32_64.asm: * llint/LowLevelInterpreter64.asm: Source/WTF: This patch generalizes the BackwardsGraph fake root into a more generalizable class called SingleRootGraph. SingleRootGraph exposes the general graph interface used in Dominators and NaturalLoops. SingleRootGraph takes as input a graph with the normal graph interface, but also allows the input graph to contain more than one root. SingleRootGraph then exposes a single root, which it creates, that has an outgoing edge to all the roots in the original graph. * WTF.xcodeproj/project.pbxproj: * wtf/BackwardsGraph.h: (WTF::BackwardsGraph::dump const): (WTF::BackwardsGraph::rootName): Deleted. (WTF::BackwardsGraph::Node::Node): Deleted. (WTF::BackwardsGraph::Node::root): Deleted. (WTF::BackwardsGraph::Node::operator== const): Deleted. (WTF::BackwardsGraph::Node::operator!= const): Deleted. (WTF::BackwardsGraph::Node::operator bool const): Deleted. (WTF::BackwardsGraph::Node::isRoot const): Deleted. (WTF::BackwardsGraph::Node::node const): Deleted. (): Deleted. (WTF::BackwardsGraph::Set::Set): Deleted. (WTF::BackwardsGraph::Set::add): Deleted. (WTF::BackwardsGraph::Set::remove): Deleted. (WTF::BackwardsGraph::Set::contains): Deleted. (WTF::BackwardsGraph::Set::dump const): Deleted. (WTF::BackwardsGraph::Map::Map): Deleted. (WTF::BackwardsGraph::Map::clear): Deleted. (WTF::BackwardsGraph::Map::size const): Deleted. (WTF::BackwardsGraph::Map::operator[]): Deleted. (WTF::BackwardsGraph::Map::operator[] const): Deleted. * wtf/Dominators.h: (WTF::Dominators::Dominators): (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOf): (WTF::Dominators::forAllBlocksInPrunedIteratedDominanceFrontierOf): (WTF::Dominators::iteratedDominanceFrontierOf const): (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOfImpl const): * wtf/SingleRootGraph.h: Added. (WTF::SingleRootGraphNode::rootName): (WTF::SingleRootGraphNode::SingleRootGraphNode): (WTF::SingleRootGraphNode::root): (WTF::SingleRootGraphNode::operator== const): (WTF::SingleRootGraphNode::operator!= const): (WTF::SingleRootGraphNode::operator bool const): (WTF::SingleRootGraphNode::isRoot const): (WTF::SingleRootGraphNode::node const): (WTF::SingleRootGraphSet::add): (WTF::SingleRootGraphSet::remove): (WTF::SingleRootGraphSet::contains): (WTF::SingleRootGraphSet::dump const): (WTF::SingleRootMap::SingleRootMap): (WTF::SingleRootMap::clear): (WTF::SingleRootMap::size const): (WTF::SingleRootMap::operator[]): (WTF::SingleRootMap::operator[] const): (WTF::SingleRootGraph::SingleRootGraph): (WTF::SingleRootGraph::root const): (WTF::SingleRootGraph::newMap): (WTF::SingleRootGraph::successors const): (WTF::SingleRootGraph::predecessors const): (WTF::SingleRootGraph::index const): (WTF::SingleRootGraph::node const): (WTF::SingleRootGraph::numNodes const): (WTF::SingleRootGraph::dump const): (WTF::SingleRootGraph::assertIsConsistent const): Canonical link: https://commits.webkit.org/192644@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@221196 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-08-25 18:26:15 +00:00
using List = typename Graph::List;
Dominators should be factored out of the DFG https://bugs.webkit.org/show_bug.cgi?id=150764 Reviewed by Geoffrey Garen. Source/JavaScriptCore: Factored DFGDominators.h/DFGDominators.cpp into WTF. To do this, I made two changes to the DFG: 1) DFG now has a CFG abstraction called DFG::CFG. The cool thing about this is that in the future if we wanted to support inverted dominators, we could do it by just creating a DFG::BackwardCFG. 2) Got rid of DFG::Analysis. From now on, an Analysis being invalidated is expressed by the DFG::Graph having a null pointer for that analysis. When we "run" the analysis, we just instantiate it. This makes it much more natural to integrate WTF::Dominators into the DFG. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * dfg/DFGAnalysis.h: Removed. * dfg/DFGCFG.h: Added. (JSC::DFG::CFG::CFG): (JSC::DFG::CFG::root): (JSC::DFG::CFG::newMap<T>): (JSC::DFG::CFG::successors): (JSC::DFG::CFG::predecessors): (JSC::DFG::CFG::index): (JSC::DFG::CFG::node): (JSC::DFG::CFG::numNodes): (JSC::DFG::CFG::dump): * dfg/DFGCSEPhase.cpp: * dfg/DFGDisassembler.cpp: (JSC::DFG::Disassembler::createDumpList): * dfg/DFGDominators.cpp: Removed. * dfg/DFGDominators.h: (JSC::DFG::Dominators::Dominators): (JSC::DFG::Dominators::strictlyDominates): Deleted. (JSC::DFG::Dominators::dominates): Deleted. (JSC::DFG::Dominators::immediateDominatorOf): Deleted. (JSC::DFG::Dominators::forAllStrictDominatorsOf): Deleted. (JSC::DFG::Dominators::forAllDominatorsOf): Deleted. (JSC::DFG::Dominators::forAllBlocksStrictlyDominatedBy): Deleted. (JSC::DFG::Dominators::forAllBlocksDominatedBy): Deleted. (JSC::DFG::Dominators::forAllBlocksInDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInIteratedDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInPrunedIteratedDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInDominanceFrontierOfImpl): Deleted. (JSC::DFG::Dominators::forAllBlocksInIteratedDominanceFrontierOfImpl): Deleted. (JSC::DFG::Dominators::BlockData::BlockData): Deleted. * dfg/DFGEdgeDominates.h: (JSC::DFG::EdgeDominates::operator()): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::Graph): (JSC::DFG::Graph::dumpBlockHeader): (JSC::DFG::Graph::invalidateCFG): (JSC::DFG::Graph::substituteGetLocal): (JSC::DFG::Graph::handleAssertionFailure): (JSC::DFG::Graph::ensureDominators): (JSC::DFG::Graph::ensurePrePostNumbering): (JSC::DFG::Graph::ensureNaturalLoops): (JSC::DFG::Graph::valueProfileFor): * dfg/DFGGraph.h: (JSC::DFG::Graph::hasDebuggerEnabled): * dfg/DFGLICMPhase.cpp: (JSC::DFG::LICMPhase::run): (JSC::DFG::LICMPhase::attemptHoist): * dfg/DFGLoopPreHeaderCreationPhase.cpp: (JSC::DFG::createPreHeader): (JSC::DFG::LoopPreHeaderCreationPhase::run): * dfg/DFGNaturalLoops.cpp: (JSC::DFG::NaturalLoop::dump): (JSC::DFG::NaturalLoops::NaturalLoops): (JSC::DFG::NaturalLoops::~NaturalLoops): (JSC::DFG::NaturalLoops::loopsOf): (JSC::DFG::NaturalLoops::computeDependencies): Deleted. (JSC::DFG::NaturalLoops::compute): Deleted. * dfg/DFGNaturalLoops.h: (JSC::DFG::NaturalLoops::numLoops): * dfg/DFGNode.h: (JSC::DFG::Node::SuccessorsIterable::end): (JSC::DFG::Node::SuccessorsIterable::size): (JSC::DFG::Node::SuccessorsIterable::at): (JSC::DFG::Node::SuccessorsIterable::operator[]): * dfg/DFGOSREntrypointCreationPhase.cpp: (JSC::DFG::OSREntrypointCreationPhase::run): * dfg/DFGObjectAllocationSinkingPhase.cpp: * dfg/DFGPlan.cpp: (JSC::DFG::Plan::compileInThreadImpl): * dfg/DFGPrePostNumbering.cpp: (JSC::DFG::PrePostNumbering::PrePostNumbering): (JSC::DFG::PrePostNumbering::~PrePostNumbering): (JSC::DFG::PrePostNumbering::compute): Deleted. * dfg/DFGPrePostNumbering.h: (JSC::DFG::PrePostNumbering::preNumber): (JSC::DFG::PrePostNumbering::postNumber): * dfg/DFGPutStackSinkingPhase.cpp: * dfg/DFGSSACalculator.cpp: (JSC::DFG::SSACalculator::nonLocalReachingDef): (JSC::DFG::SSACalculator::reachingDefAtTail): * dfg/DFGSSACalculator.h: (JSC::DFG::SSACalculator::computePhis): * dfg/DFGSSAConversionPhase.cpp: (JSC::DFG::SSAConversionPhase::run): * ftl/FTLLink.cpp: (JSC::FTL::link): * ftl/FTLLowerDFGToLLVM.cpp: (JSC::FTL::DFG::LowerDFGToLLVM::lower): (JSC::FTL::DFG::LowerDFGToLLVM::safelyInvalidateAfterTermination): (JSC::FTL::DFG::LowerDFGToLLVM::isValid): Source/WTF: This takes what used to be DFGDominators.h/DFGDominators.cpp and turns it into a generic algorithm that can take any abstract graph. The idea is that you create Dominators<CFG> and pass it a CFG object, which defines the types of graph nodes and methods for getting successors, predecessors, etc. The DFG now defines a class called CFG, which is a wrapper for DFG::Graph that conforms to the thing that wtf/Dominators.h expects. When doing things to graphs, it's common to refer to the things in the graph as "nodes". Because I intend to reuse the CFG abstraction with many graph algorithms, that abstraction uses the term "node" to refer to a DFG basic block. But in Dominators, the method and variable names still use "block". This is because although Dominators are applicable to any kind of directed graph, it's super unlikely that we will ever use them for anything but compilers. Indeed, the only reason why I'm factoring them out of the DFG is so that I can use them with B3 and Air. This has the nice side effect that a user of WTF::Dominators<JSC::DFG::CFG> will see familiar terminology like "blocksStrictlyDominatedBy(...)" instead of "nodesStrictlyDominatedBy(...)", which would be super confusing. Overall, wtf/Dominators.h is a combination of what used to be in DFGDominators.h, DFGDominators.cpp, DFGNaiveDominators.h, and DFGNaiveDominators.cpp. I only changed code when I had to in order to make it generic. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/Dominators.h: Added. (WTF::Dominators::Dominators): (WTF::Dominators::compute): (WTF::Dominators::strictlyDominates): (WTF::Dominators::dominates): (WTF::Dominators::immediateDominatorOf): (WTF::Dominators::forAllStrictDominatorsOf): (WTF::Dominators::forAllDominatorsOf): (WTF::Dominators::forAllBlocksStrictlyDominatedBy): (WTF::Dominators::forAllBlocksDominatedBy): (WTF::Dominators::strictDominatorsOf): (WTF::Dominators::dominatorsOf): (WTF::Dominators::blocksStrictlyDominatedBy): (WTF::Dominators::blocksDominatedBy): (WTF::Dominators::forAllBlocksInDominanceFrontierOf): (WTF::Dominators::dominanceFrontierOf): (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOf): (WTF::Dominators::forAllBlocksInPrunedIteratedDominanceFrontierOf): (WTF::Dominators::iteratedDominanceFrontierOf): (WTF::Dominators::dump): (WTF::Dominators::LengauerTarjan::LengauerTarjan): (WTF::Dominators::LengauerTarjan::compute): (WTF::Dominators::LengauerTarjan::immediateDominator): (WTF::Dominators::LengauerTarjan::computeDepthFirstPreNumbering): (WTF::Dominators::LengauerTarjan::computeSemiDominatorsAndImplicitImmediateDominators): (WTF::Dominators::LengauerTarjan::computeExplicitImmediateDominators): (WTF::Dominators::LengauerTarjan::link): (WTF::Dominators::LengauerTarjan::eval): (WTF::Dominators::LengauerTarjan::compress): (WTF::Dominators::LengauerTarjan::BlockData::BlockData): (WTF::Dominators::NaiveDominators::NaiveDominators): (WTF::Dominators::NaiveDominators::dominates): (WTF::Dominators::NaiveDominators::dump): (WTF::Dominators::NaiveDominators::pruneDominators): (WTF::Dominators::ValidationContext::ValidationContext): (WTF::Dominators::ValidationContext::reportError): (WTF::Dominators::ValidationContext::handleErrors): (WTF::Dominators::naiveDominates): (WTF::Dominators::forAllBlocksInDominanceFrontierOfImpl): (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOfImpl): (WTF::Dominators::BlockData::BlockData): Canonical link: https://commits.webkit.org/168962@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@191870 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-11-02 00:48:03 +00:00
Dominators(Graph& graph, bool selfCheck = false)
: m_graph(graph)
DFG::LICMPhase shouldn't hoist type checks unless it knows that the check will succeed at the loop pre-header https://bugs.webkit.org/show_bug.cgi?id=144527 Reviewed by Saam Barati. Source/JavaScriptCore: This adds a control flow equivalence analysis (called ControlEquivalenceAnalysis) based on dominator analysis over the backwards CFG. Two basic blocks are control flow equivalent if the execution of one implies that the other one must also execute. It means that the two blocks' forward and backward dominance are reciprocated: (A dom B and B backdom A) or (B dom A and A backdom B). LICM now uses it to become more conservative about hoisting checks, if this has caused problems in the past. If we hoist something that may exit from a block that was not control equivalent to the pre-header then it's possible that the node's speculation will fail even though it wouldn't have if it wasn't hoisted. So, we flag these nodes' origins as being "wasHoisted" and we track all of their exits as "HoistingFailed". LICM will turn off such speculative hoisting if the CodeBlock from which we are hoisting had the HoistingFailed exit kind. Note that this deliberately still allows us to hoist things that may exit even if they are not control equivalent to the pre-header. This is necessary because the profitability of hoisting is so huge in all of the cases that we're aware of that it's worth giving it a shot. This is neutral on macrobenchmarks since none of the benchmarks we track have a hoistable operation that would exit only if hoisted. I added microbenchmarks to illustrate the problem and two of them speed up by ~40% while one of them is neutral (Int52 saves us from having problems on that program even though LICM previously did the wrong thing). * JavaScriptCore.xcodeproj/project.pbxproj: * bytecode/ExitKind.cpp: (JSC::exitKindToString): * bytecode/ExitKind.h: * dfg/DFGAtTailAbstractState.h: (JSC::DFG::AtTailAbstractState::operator bool): (JSC::DFG::AtTailAbstractState::initializeTo): * dfg/DFGBackwardsCFG.h: Added. (JSC::DFG::BackwardsCFG::BackwardsCFG): * dfg/DFGBackwardsDominators.h: Added. (JSC::DFG::BackwardsDominators::BackwardsDominators): * dfg/DFGCommon.h: (JSC::DFG::checkAndSet): Deleted. * dfg/DFGControlEquivalenceAnalysis.h: Added. (JSC::DFG::ControlEquivalenceAnalysis::ControlEquivalenceAnalysis): (JSC::DFG::ControlEquivalenceAnalysis::dominatesEquivalently): (JSC::DFG::ControlEquivalenceAnalysis::areEquivalent): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::dump): (JSC::DFG::Graph::dumpBlockHeader): (JSC::DFG::Graph::invalidateCFG): (JSC::DFG::Graph::substituteGetLocal): (JSC::DFG::Graph::handleAssertionFailure): (JSC::DFG::Graph::ensureDominators): (JSC::DFG::Graph::ensurePrePostNumbering): (JSC::DFG::Graph::ensureNaturalLoops): (JSC::DFG::Graph::ensureBackwardsCFG): (JSC::DFG::Graph::ensureBackwardsDominators): (JSC::DFG::Graph::ensureControlEquivalenceAnalysis): (JSC::DFG::Graph::methodOfGettingAValueProfileFor): * dfg/DFGGraph.h: (JSC::DFG::Graph::hasDebuggerEnabled): * dfg/DFGInPlaceAbstractState.h: (JSC::DFG::InPlaceAbstractState::operator bool): (JSC::DFG::InPlaceAbstractState::createValueForNode): (JSC::DFG::InPlaceAbstractState::forNode): * dfg/DFGLICMPhase.cpp: (JSC::DFG::LICMPhase::run): (JSC::DFG::LICMPhase::attemptHoist): * dfg/DFGMayExit.cpp: (JSC::DFG::mayExit): * dfg/DFGMayExit.h: * dfg/DFGNode.h: * dfg/DFGNodeOrigin.cpp: (JSC::DFG::NodeOrigin::dump): * dfg/DFGNodeOrigin.h: (JSC::DFG::NodeOrigin::takeValidExit): (JSC::DFG::NodeOrigin::withWasHoisted): (JSC::DFG::NodeOrigin::forInsertingAfter): * dfg/DFGNullAbstractState.h: Added. (JSC::DFG::NullAbstractState::NullAbstractState): (JSC::DFG::NullAbstractState::operator bool): (JSC::DFG::NullAbstractState::forNode): * dfg/DFGOSRExit.cpp: (JSC::DFG::OSRExit::OSRExit): * dfg/DFGOSRExitBase.cpp: (JSC::DFG::OSRExitBase::considerAddingAsFrequentExitSiteSlow): * dfg/DFGOSRExitBase.h: (JSC::DFG::OSRExitBase::OSRExitBase): * dfg/DFGTypeCheckHoistingPhase.cpp: (JSC::DFG::TypeCheckHoistingPhase::run): * ftl/FTLOSRExit.cpp: (JSC::FTL::OSRExitDescriptor::prepareOSRExitHandle): (JSC::FTL::OSRExit::OSRExit): * ftl/FTLOSRExit.h: Source/WTF: This adds an adaptor for graphs called BackwardsGraph. The WTF graph framework is based on passing around a Graph template argument that follows the protocol shared by DFG::CFG, B3::CFG, and Air::CFG. These graphs always have a single root node but may have many leaf nodes. This new BackwardsGraph adaptor reverses the graph by creating a synthetic return node that it uses as the root in the inverted graph. This currently may resort to some heuristics in programs that have an infinite loop, but other than that, it'll work well in the general case. This allows us to say Dominators<BackwardsGraph<some graph type>> as a way of computing backwards dominators, which then allows us to easily answer control flow equivalence queries. * CMakeLists.txt: * WTF.xcodeproj/project.pbxproj: * wtf/BackwardsGraph.h: Added. (WTF::BackwardsGraph::Node::Node): (WTF::BackwardsGraph::Node::root): (WTF::BackwardsGraph::Node::operator==): (WTF::BackwardsGraph::Node::operator!=): (WTF::BackwardsGraph::Node::operator bool): (WTF::BackwardsGraph::Node::isRoot): (WTF::BackwardsGraph::Node::node): (WTF::BackwardsGraph::Set::Set): (WTF::BackwardsGraph::Set::add): (WTF::BackwardsGraph::Set::remove): (WTF::BackwardsGraph::Set::contains): (WTF::BackwardsGraph::Set::dump): (WTF::BackwardsGraph::Map::Map): (WTF::BackwardsGraph::Map::clear): (WTF::BackwardsGraph::Map::size): (WTF::BackwardsGraph::Map::operator[]): (WTF::BackwardsGraph::BackwardsGraph): (WTF::BackwardsGraph::root): (WTF::BackwardsGraph::newMap): (WTF::BackwardsGraph::successors): (WTF::BackwardsGraph::predecessors): (WTF::BackwardsGraph::index): (WTF::BackwardsGraph::node): (WTF::BackwardsGraph::numNodes): (WTF::BackwardsGraph::dump): * wtf/Dominators.h: (WTF::Dominators::Dominators): (WTF::Dominators::dump): (WTF::Dominators::LengauerTarjan::computeDepthFirstPreNumbering): * wtf/GraphNodeWorklist.h: (WTF::GraphNodeWith::GraphNodeWith): (WTF::GraphNodeWith::operator bool): * wtf/StdLibExtras.h: (WTF::callStatelessLambda): (WTF::checkAndSet): LayoutTests: Add tests for LICM hoisting things that would only exit if hoisted. * js/regress/licm-dragons-expected.txt: Added. * js/regress/licm-dragons-out-of-bounds-expected.txt: Added. * js/regress/licm-dragons-out-of-bounds.html: Added. * js/regress/licm-dragons-overflow-expected.txt: Added. * js/regress/licm-dragons-overflow.html: Added. * js/regress/licm-dragons.html: Added. * js/regress/script-tests/licm-dragons-out-of-bounds.js: Added. (foo): * js/regress/script-tests/licm-dragons-overflow.js: Added. (foo): * js/regress/script-tests/licm-dragons.js: Added. (foo): Canonical link: https://commits.webkit.org/176032@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@201182 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-05-19 21:25:29 +00:00
, m_data(graph.template newMap<BlockData>())
Dominators should be factored out of the DFG https://bugs.webkit.org/show_bug.cgi?id=150764 Reviewed by Geoffrey Garen. Source/JavaScriptCore: Factored DFGDominators.h/DFGDominators.cpp into WTF. To do this, I made two changes to the DFG: 1) DFG now has a CFG abstraction called DFG::CFG. The cool thing about this is that in the future if we wanted to support inverted dominators, we could do it by just creating a DFG::BackwardCFG. 2) Got rid of DFG::Analysis. From now on, an Analysis being invalidated is expressed by the DFG::Graph having a null pointer for that analysis. When we "run" the analysis, we just instantiate it. This makes it much more natural to integrate WTF::Dominators into the DFG. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * dfg/DFGAnalysis.h: Removed. * dfg/DFGCFG.h: Added. (JSC::DFG::CFG::CFG): (JSC::DFG::CFG::root): (JSC::DFG::CFG::newMap<T>): (JSC::DFG::CFG::successors): (JSC::DFG::CFG::predecessors): (JSC::DFG::CFG::index): (JSC::DFG::CFG::node): (JSC::DFG::CFG::numNodes): (JSC::DFG::CFG::dump): * dfg/DFGCSEPhase.cpp: * dfg/DFGDisassembler.cpp: (JSC::DFG::Disassembler::createDumpList): * dfg/DFGDominators.cpp: Removed. * dfg/DFGDominators.h: (JSC::DFG::Dominators::Dominators): (JSC::DFG::Dominators::strictlyDominates): Deleted. (JSC::DFG::Dominators::dominates): Deleted. (JSC::DFG::Dominators::immediateDominatorOf): Deleted. (JSC::DFG::Dominators::forAllStrictDominatorsOf): Deleted. (JSC::DFG::Dominators::forAllDominatorsOf): Deleted. (JSC::DFG::Dominators::forAllBlocksStrictlyDominatedBy): Deleted. (JSC::DFG::Dominators::forAllBlocksDominatedBy): Deleted. (JSC::DFG::Dominators::forAllBlocksInDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInIteratedDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInPrunedIteratedDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInDominanceFrontierOfImpl): Deleted. (JSC::DFG::Dominators::forAllBlocksInIteratedDominanceFrontierOfImpl): Deleted. (JSC::DFG::Dominators::BlockData::BlockData): Deleted. * dfg/DFGEdgeDominates.h: (JSC::DFG::EdgeDominates::operator()): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::Graph): (JSC::DFG::Graph::dumpBlockHeader): (JSC::DFG::Graph::invalidateCFG): (JSC::DFG::Graph::substituteGetLocal): (JSC::DFG::Graph::handleAssertionFailure): (JSC::DFG::Graph::ensureDominators): (JSC::DFG::Graph::ensurePrePostNumbering): (JSC::DFG::Graph::ensureNaturalLoops): (JSC::DFG::Graph::valueProfileFor): * dfg/DFGGraph.h: (JSC::DFG::Graph::hasDebuggerEnabled): * dfg/DFGLICMPhase.cpp: (JSC::DFG::LICMPhase::run): (JSC::DFG::LICMPhase::attemptHoist): * dfg/DFGLoopPreHeaderCreationPhase.cpp: (JSC::DFG::createPreHeader): (JSC::DFG::LoopPreHeaderCreationPhase::run): * dfg/DFGNaturalLoops.cpp: (JSC::DFG::NaturalLoop::dump): (JSC::DFG::NaturalLoops::NaturalLoops): (JSC::DFG::NaturalLoops::~NaturalLoops): (JSC::DFG::NaturalLoops::loopsOf): (JSC::DFG::NaturalLoops::computeDependencies): Deleted. (JSC::DFG::NaturalLoops::compute): Deleted. * dfg/DFGNaturalLoops.h: (JSC::DFG::NaturalLoops::numLoops): * dfg/DFGNode.h: (JSC::DFG::Node::SuccessorsIterable::end): (JSC::DFG::Node::SuccessorsIterable::size): (JSC::DFG::Node::SuccessorsIterable::at): (JSC::DFG::Node::SuccessorsIterable::operator[]): * dfg/DFGOSREntrypointCreationPhase.cpp: (JSC::DFG::OSREntrypointCreationPhase::run): * dfg/DFGObjectAllocationSinkingPhase.cpp: * dfg/DFGPlan.cpp: (JSC::DFG::Plan::compileInThreadImpl): * dfg/DFGPrePostNumbering.cpp: (JSC::DFG::PrePostNumbering::PrePostNumbering): (JSC::DFG::PrePostNumbering::~PrePostNumbering): (JSC::DFG::PrePostNumbering::compute): Deleted. * dfg/DFGPrePostNumbering.h: (JSC::DFG::PrePostNumbering::preNumber): (JSC::DFG::PrePostNumbering::postNumber): * dfg/DFGPutStackSinkingPhase.cpp: * dfg/DFGSSACalculator.cpp: (JSC::DFG::SSACalculator::nonLocalReachingDef): (JSC::DFG::SSACalculator::reachingDefAtTail): * dfg/DFGSSACalculator.h: (JSC::DFG::SSACalculator::computePhis): * dfg/DFGSSAConversionPhase.cpp: (JSC::DFG::SSAConversionPhase::run): * ftl/FTLLink.cpp: (JSC::FTL::link): * ftl/FTLLowerDFGToLLVM.cpp: (JSC::FTL::DFG::LowerDFGToLLVM::lower): (JSC::FTL::DFG::LowerDFGToLLVM::safelyInvalidateAfterTermination): (JSC::FTL::DFG::LowerDFGToLLVM::isValid): Source/WTF: This takes what used to be DFGDominators.h/DFGDominators.cpp and turns it into a generic algorithm that can take any abstract graph. The idea is that you create Dominators<CFG> and pass it a CFG object, which defines the types of graph nodes and methods for getting successors, predecessors, etc. The DFG now defines a class called CFG, which is a wrapper for DFG::Graph that conforms to the thing that wtf/Dominators.h expects. When doing things to graphs, it's common to refer to the things in the graph as "nodes". Because I intend to reuse the CFG abstraction with many graph algorithms, that abstraction uses the term "node" to refer to a DFG basic block. But in Dominators, the method and variable names still use "block". This is because although Dominators are applicable to any kind of directed graph, it's super unlikely that we will ever use them for anything but compilers. Indeed, the only reason why I'm factoring them out of the DFG is so that I can use them with B3 and Air. This has the nice side effect that a user of WTF::Dominators<JSC::DFG::CFG> will see familiar terminology like "blocksStrictlyDominatedBy(...)" instead of "nodesStrictlyDominatedBy(...)", which would be super confusing. Overall, wtf/Dominators.h is a combination of what used to be in DFGDominators.h, DFGDominators.cpp, DFGNaiveDominators.h, and DFGNaiveDominators.cpp. I only changed code when I had to in order to make it generic. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/Dominators.h: Added. (WTF::Dominators::Dominators): (WTF::Dominators::compute): (WTF::Dominators::strictlyDominates): (WTF::Dominators::dominates): (WTF::Dominators::immediateDominatorOf): (WTF::Dominators::forAllStrictDominatorsOf): (WTF::Dominators::forAllDominatorsOf): (WTF::Dominators::forAllBlocksStrictlyDominatedBy): (WTF::Dominators::forAllBlocksDominatedBy): (WTF::Dominators::strictDominatorsOf): (WTF::Dominators::dominatorsOf): (WTF::Dominators::blocksStrictlyDominatedBy): (WTF::Dominators::blocksDominatedBy): (WTF::Dominators::forAllBlocksInDominanceFrontierOf): (WTF::Dominators::dominanceFrontierOf): (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOf): (WTF::Dominators::forAllBlocksInPrunedIteratedDominanceFrontierOf): (WTF::Dominators::iteratedDominanceFrontierOf): (WTF::Dominators::dump): (WTF::Dominators::LengauerTarjan::LengauerTarjan): (WTF::Dominators::LengauerTarjan::compute): (WTF::Dominators::LengauerTarjan::immediateDominator): (WTF::Dominators::LengauerTarjan::computeDepthFirstPreNumbering): (WTF::Dominators::LengauerTarjan::computeSemiDominatorsAndImplicitImmediateDominators): (WTF::Dominators::LengauerTarjan::computeExplicitImmediateDominators): (WTF::Dominators::LengauerTarjan::link): (WTF::Dominators::LengauerTarjan::eval): (WTF::Dominators::LengauerTarjan::compress): (WTF::Dominators::LengauerTarjan::BlockData::BlockData): (WTF::Dominators::NaiveDominators::NaiveDominators): (WTF::Dominators::NaiveDominators::dominates): (WTF::Dominators::NaiveDominators::dump): (WTF::Dominators::NaiveDominators::pruneDominators): (WTF::Dominators::ValidationContext::ValidationContext): (WTF::Dominators::ValidationContext::reportError): (WTF::Dominators::ValidationContext::handleErrors): (WTF::Dominators::naiveDominates): (WTF::Dominators::forAllBlocksInDominanceFrontierOfImpl): (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOfImpl): (WTF::Dominators::BlockData::BlockData): Canonical link: https://commits.webkit.org/168962@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@191870 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-11-02 00:48:03 +00:00
{
LengauerTarjan lengauerTarjan(m_graph);
lengauerTarjan.compute();
// From here we want to build a spanning tree with both upward and downward links and we want
// to do a search over this tree to compute pre and post numbers that can be used for dominance
// tests.
for (unsigned blockIndex = m_graph.numNodes(); blockIndex--;) {
typename Graph::Node block = m_graph.node(blockIndex);
if (!block)
continue;
typename Graph::Node idomBlock = lengauerTarjan.immediateDominator(block);
m_data[block].idomParent = idomBlock;
if (idomBlock)
m_data[idomBlock].idomKids.append(block);
}
unsigned nextPreNumber = 0;
unsigned nextPostNumber = 0;
// Plain stack-based worklist because we are guaranteed to see each block exactly once anyway.
Vector<GraphNodeWithOrder<typename Graph::Node>> worklist;
DFG::LICMPhase shouldn't hoist type checks unless it knows that the check will succeed at the loop pre-header https://bugs.webkit.org/show_bug.cgi?id=144527 Reviewed by Saam Barati. Source/JavaScriptCore: This adds a control flow equivalence analysis (called ControlEquivalenceAnalysis) based on dominator analysis over the backwards CFG. Two basic blocks are control flow equivalent if the execution of one implies that the other one must also execute. It means that the two blocks' forward and backward dominance are reciprocated: (A dom B and B backdom A) or (B dom A and A backdom B). LICM now uses it to become more conservative about hoisting checks, if this has caused problems in the past. If we hoist something that may exit from a block that was not control equivalent to the pre-header then it's possible that the node's speculation will fail even though it wouldn't have if it wasn't hoisted. So, we flag these nodes' origins as being "wasHoisted" and we track all of their exits as "HoistingFailed". LICM will turn off such speculative hoisting if the CodeBlock from which we are hoisting had the HoistingFailed exit kind. Note that this deliberately still allows us to hoist things that may exit even if they are not control equivalent to the pre-header. This is necessary because the profitability of hoisting is so huge in all of the cases that we're aware of that it's worth giving it a shot. This is neutral on macrobenchmarks since none of the benchmarks we track have a hoistable operation that would exit only if hoisted. I added microbenchmarks to illustrate the problem and two of them speed up by ~40% while one of them is neutral (Int52 saves us from having problems on that program even though LICM previously did the wrong thing). * JavaScriptCore.xcodeproj/project.pbxproj: * bytecode/ExitKind.cpp: (JSC::exitKindToString): * bytecode/ExitKind.h: * dfg/DFGAtTailAbstractState.h: (JSC::DFG::AtTailAbstractState::operator bool): (JSC::DFG::AtTailAbstractState::initializeTo): * dfg/DFGBackwardsCFG.h: Added. (JSC::DFG::BackwardsCFG::BackwardsCFG): * dfg/DFGBackwardsDominators.h: Added. (JSC::DFG::BackwardsDominators::BackwardsDominators): * dfg/DFGCommon.h: (JSC::DFG::checkAndSet): Deleted. * dfg/DFGControlEquivalenceAnalysis.h: Added. (JSC::DFG::ControlEquivalenceAnalysis::ControlEquivalenceAnalysis): (JSC::DFG::ControlEquivalenceAnalysis::dominatesEquivalently): (JSC::DFG::ControlEquivalenceAnalysis::areEquivalent): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::dump): (JSC::DFG::Graph::dumpBlockHeader): (JSC::DFG::Graph::invalidateCFG): (JSC::DFG::Graph::substituteGetLocal): (JSC::DFG::Graph::handleAssertionFailure): (JSC::DFG::Graph::ensureDominators): (JSC::DFG::Graph::ensurePrePostNumbering): (JSC::DFG::Graph::ensureNaturalLoops): (JSC::DFG::Graph::ensureBackwardsCFG): (JSC::DFG::Graph::ensureBackwardsDominators): (JSC::DFG::Graph::ensureControlEquivalenceAnalysis): (JSC::DFG::Graph::methodOfGettingAValueProfileFor): * dfg/DFGGraph.h: (JSC::DFG::Graph::hasDebuggerEnabled): * dfg/DFGInPlaceAbstractState.h: (JSC::DFG::InPlaceAbstractState::operator bool): (JSC::DFG::InPlaceAbstractState::createValueForNode): (JSC::DFG::InPlaceAbstractState::forNode): * dfg/DFGLICMPhase.cpp: (JSC::DFG::LICMPhase::run): (JSC::DFG::LICMPhase::attemptHoist): * dfg/DFGMayExit.cpp: (JSC::DFG::mayExit): * dfg/DFGMayExit.h: * dfg/DFGNode.h: * dfg/DFGNodeOrigin.cpp: (JSC::DFG::NodeOrigin::dump): * dfg/DFGNodeOrigin.h: (JSC::DFG::NodeOrigin::takeValidExit): (JSC::DFG::NodeOrigin::withWasHoisted): (JSC::DFG::NodeOrigin::forInsertingAfter): * dfg/DFGNullAbstractState.h: Added. (JSC::DFG::NullAbstractState::NullAbstractState): (JSC::DFG::NullAbstractState::operator bool): (JSC::DFG::NullAbstractState::forNode): * dfg/DFGOSRExit.cpp: (JSC::DFG::OSRExit::OSRExit): * dfg/DFGOSRExitBase.cpp: (JSC::DFG::OSRExitBase::considerAddingAsFrequentExitSiteSlow): * dfg/DFGOSRExitBase.h: (JSC::DFG::OSRExitBase::OSRExitBase): * dfg/DFGTypeCheckHoistingPhase.cpp: (JSC::DFG::TypeCheckHoistingPhase::run): * ftl/FTLOSRExit.cpp: (JSC::FTL::OSRExitDescriptor::prepareOSRExitHandle): (JSC::FTL::OSRExit::OSRExit): * ftl/FTLOSRExit.h: Source/WTF: This adds an adaptor for graphs called BackwardsGraph. The WTF graph framework is based on passing around a Graph template argument that follows the protocol shared by DFG::CFG, B3::CFG, and Air::CFG. These graphs always have a single root node but may have many leaf nodes. This new BackwardsGraph adaptor reverses the graph by creating a synthetic return node that it uses as the root in the inverted graph. This currently may resort to some heuristics in programs that have an infinite loop, but other than that, it'll work well in the general case. This allows us to say Dominators<BackwardsGraph<some graph type>> as a way of computing backwards dominators, which then allows us to easily answer control flow equivalence queries. * CMakeLists.txt: * WTF.xcodeproj/project.pbxproj: * wtf/BackwardsGraph.h: Added. (WTF::BackwardsGraph::Node::Node): (WTF::BackwardsGraph::Node::root): (WTF::BackwardsGraph::Node::operator==): (WTF::BackwardsGraph::Node::operator!=): (WTF::BackwardsGraph::Node::operator bool): (WTF::BackwardsGraph::Node::isRoot): (WTF::BackwardsGraph::Node::node): (WTF::BackwardsGraph::Set::Set): (WTF::BackwardsGraph::Set::add): (WTF::BackwardsGraph::Set::remove): (WTF::BackwardsGraph::Set::contains): (WTF::BackwardsGraph::Set::dump): (WTF::BackwardsGraph::Map::Map): (WTF::BackwardsGraph::Map::clear): (WTF::BackwardsGraph::Map::size): (WTF::BackwardsGraph::Map::operator[]): (WTF::BackwardsGraph::BackwardsGraph): (WTF::BackwardsGraph::root): (WTF::BackwardsGraph::newMap): (WTF::BackwardsGraph::successors): (WTF::BackwardsGraph::predecessors): (WTF::BackwardsGraph::index): (WTF::BackwardsGraph::node): (WTF::BackwardsGraph::numNodes): (WTF::BackwardsGraph::dump): * wtf/Dominators.h: (WTF::Dominators::Dominators): (WTF::Dominators::dump): (WTF::Dominators::LengauerTarjan::computeDepthFirstPreNumbering): * wtf/GraphNodeWorklist.h: (WTF::GraphNodeWith::GraphNodeWith): (WTF::GraphNodeWith::operator bool): * wtf/StdLibExtras.h: (WTF::callStatelessLambda): (WTF::checkAndSet): LayoutTests: Add tests for LICM hoisting things that would only exit if hoisted. * js/regress/licm-dragons-expected.txt: Added. * js/regress/licm-dragons-out-of-bounds-expected.txt: Added. * js/regress/licm-dragons-out-of-bounds.html: Added. * js/regress/licm-dragons-overflow-expected.txt: Added. * js/regress/licm-dragons-overflow.html: Added. * js/regress/licm-dragons.html: Added. * js/regress/script-tests/licm-dragons-out-of-bounds.js: Added. (foo): * js/regress/script-tests/licm-dragons-overflow.js: Added. (foo): * js/regress/script-tests/licm-dragons.js: Added. (foo): Canonical link: https://commits.webkit.org/176032@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@201182 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-05-19 21:25:29 +00:00
worklist.append(GraphNodeWithOrder<typename Graph::Node>(m_graph.root(), GraphVisitOrder::Pre));
Dominators should be factored out of the DFG https://bugs.webkit.org/show_bug.cgi?id=150764 Reviewed by Geoffrey Garen. Source/JavaScriptCore: Factored DFGDominators.h/DFGDominators.cpp into WTF. To do this, I made two changes to the DFG: 1) DFG now has a CFG abstraction called DFG::CFG. The cool thing about this is that in the future if we wanted to support inverted dominators, we could do it by just creating a DFG::BackwardCFG. 2) Got rid of DFG::Analysis. From now on, an Analysis being invalidated is expressed by the DFG::Graph having a null pointer for that analysis. When we "run" the analysis, we just instantiate it. This makes it much more natural to integrate WTF::Dominators into the DFG. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * dfg/DFGAnalysis.h: Removed. * dfg/DFGCFG.h: Added. (JSC::DFG::CFG::CFG): (JSC::DFG::CFG::root): (JSC::DFG::CFG::newMap<T>): (JSC::DFG::CFG::successors): (JSC::DFG::CFG::predecessors): (JSC::DFG::CFG::index): (JSC::DFG::CFG::node): (JSC::DFG::CFG::numNodes): (JSC::DFG::CFG::dump): * dfg/DFGCSEPhase.cpp: * dfg/DFGDisassembler.cpp: (JSC::DFG::Disassembler::createDumpList): * dfg/DFGDominators.cpp: Removed. * dfg/DFGDominators.h: (JSC::DFG::Dominators::Dominators): (JSC::DFG::Dominators::strictlyDominates): Deleted. (JSC::DFG::Dominators::dominates): Deleted. (JSC::DFG::Dominators::immediateDominatorOf): Deleted. (JSC::DFG::Dominators::forAllStrictDominatorsOf): Deleted. (JSC::DFG::Dominators::forAllDominatorsOf): Deleted. (JSC::DFG::Dominators::forAllBlocksStrictlyDominatedBy): Deleted. (JSC::DFG::Dominators::forAllBlocksDominatedBy): Deleted. (JSC::DFG::Dominators::forAllBlocksInDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInIteratedDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInPrunedIteratedDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInDominanceFrontierOfImpl): Deleted. (JSC::DFG::Dominators::forAllBlocksInIteratedDominanceFrontierOfImpl): Deleted. (JSC::DFG::Dominators::BlockData::BlockData): Deleted. * dfg/DFGEdgeDominates.h: (JSC::DFG::EdgeDominates::operator()): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::Graph): (JSC::DFG::Graph::dumpBlockHeader): (JSC::DFG::Graph::invalidateCFG): (JSC::DFG::Graph::substituteGetLocal): (JSC::DFG::Graph::handleAssertionFailure): (JSC::DFG::Graph::ensureDominators): (JSC::DFG::Graph::ensurePrePostNumbering): (JSC::DFG::Graph::ensureNaturalLoops): (JSC::DFG::Graph::valueProfileFor): * dfg/DFGGraph.h: (JSC::DFG::Graph::hasDebuggerEnabled): * dfg/DFGLICMPhase.cpp: (JSC::DFG::LICMPhase::run): (JSC::DFG::LICMPhase::attemptHoist): * dfg/DFGLoopPreHeaderCreationPhase.cpp: (JSC::DFG::createPreHeader): (JSC::DFG::LoopPreHeaderCreationPhase::run): * dfg/DFGNaturalLoops.cpp: (JSC::DFG::NaturalLoop::dump): (JSC::DFG::NaturalLoops::NaturalLoops): (JSC::DFG::NaturalLoops::~NaturalLoops): (JSC::DFG::NaturalLoops::loopsOf): (JSC::DFG::NaturalLoops::computeDependencies): Deleted. (JSC::DFG::NaturalLoops::compute): Deleted. * dfg/DFGNaturalLoops.h: (JSC::DFG::NaturalLoops::numLoops): * dfg/DFGNode.h: (JSC::DFG::Node::SuccessorsIterable::end): (JSC::DFG::Node::SuccessorsIterable::size): (JSC::DFG::Node::SuccessorsIterable::at): (JSC::DFG::Node::SuccessorsIterable::operator[]): * dfg/DFGOSREntrypointCreationPhase.cpp: (JSC::DFG::OSREntrypointCreationPhase::run): * dfg/DFGObjectAllocationSinkingPhase.cpp: * dfg/DFGPlan.cpp: (JSC::DFG::Plan::compileInThreadImpl): * dfg/DFGPrePostNumbering.cpp: (JSC::DFG::PrePostNumbering::PrePostNumbering): (JSC::DFG::PrePostNumbering::~PrePostNumbering): (JSC::DFG::PrePostNumbering::compute): Deleted. * dfg/DFGPrePostNumbering.h: (JSC::DFG::PrePostNumbering::preNumber): (JSC::DFG::PrePostNumbering::postNumber): * dfg/DFGPutStackSinkingPhase.cpp: * dfg/DFGSSACalculator.cpp: (JSC::DFG::SSACalculator::nonLocalReachingDef): (JSC::DFG::SSACalculator::reachingDefAtTail): * dfg/DFGSSACalculator.h: (JSC::DFG::SSACalculator::computePhis): * dfg/DFGSSAConversionPhase.cpp: (JSC::DFG::SSAConversionPhase::run): * ftl/FTLLink.cpp: (JSC::FTL::link): * ftl/FTLLowerDFGToLLVM.cpp: (JSC::FTL::DFG::LowerDFGToLLVM::lower): (JSC::FTL::DFG::LowerDFGToLLVM::safelyInvalidateAfterTermination): (JSC::FTL::DFG::LowerDFGToLLVM::isValid): Source/WTF: This takes what used to be DFGDominators.h/DFGDominators.cpp and turns it into a generic algorithm that can take any abstract graph. The idea is that you create Dominators<CFG> and pass it a CFG object, which defines the types of graph nodes and methods for getting successors, predecessors, etc. The DFG now defines a class called CFG, which is a wrapper for DFG::Graph that conforms to the thing that wtf/Dominators.h expects. When doing things to graphs, it's common to refer to the things in the graph as "nodes". Because I intend to reuse the CFG abstraction with many graph algorithms, that abstraction uses the term "node" to refer to a DFG basic block. But in Dominators, the method and variable names still use "block". This is because although Dominators are applicable to any kind of directed graph, it's super unlikely that we will ever use them for anything but compilers. Indeed, the only reason why I'm factoring them out of the DFG is so that I can use them with B3 and Air. This has the nice side effect that a user of WTF::Dominators<JSC::DFG::CFG> will see familiar terminology like "blocksStrictlyDominatedBy(...)" instead of "nodesStrictlyDominatedBy(...)", which would be super confusing. Overall, wtf/Dominators.h is a combination of what used to be in DFGDominators.h, DFGDominators.cpp, DFGNaiveDominators.h, and DFGNaiveDominators.cpp. I only changed code when I had to in order to make it generic. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/Dominators.h: Added. (WTF::Dominators::Dominators): (WTF::Dominators::compute): (WTF::Dominators::strictlyDominates): (WTF::Dominators::dominates): (WTF::Dominators::immediateDominatorOf): (WTF::Dominators::forAllStrictDominatorsOf): (WTF::Dominators::forAllDominatorsOf): (WTF::Dominators::forAllBlocksStrictlyDominatedBy): (WTF::Dominators::forAllBlocksDominatedBy): (WTF::Dominators::strictDominatorsOf): (WTF::Dominators::dominatorsOf): (WTF::Dominators::blocksStrictlyDominatedBy): (WTF::Dominators::blocksDominatedBy): (WTF::Dominators::forAllBlocksInDominanceFrontierOf): (WTF::Dominators::dominanceFrontierOf): (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOf): (WTF::Dominators::forAllBlocksInPrunedIteratedDominanceFrontierOf): (WTF::Dominators::iteratedDominanceFrontierOf): (WTF::Dominators::dump): (WTF::Dominators::LengauerTarjan::LengauerTarjan): (WTF::Dominators::LengauerTarjan::compute): (WTF::Dominators::LengauerTarjan::immediateDominator): (WTF::Dominators::LengauerTarjan::computeDepthFirstPreNumbering): (WTF::Dominators::LengauerTarjan::computeSemiDominatorsAndImplicitImmediateDominators): (WTF::Dominators::LengauerTarjan::computeExplicitImmediateDominators): (WTF::Dominators::LengauerTarjan::link): (WTF::Dominators::LengauerTarjan::eval): (WTF::Dominators::LengauerTarjan::compress): (WTF::Dominators::LengauerTarjan::BlockData::BlockData): (WTF::Dominators::NaiveDominators::NaiveDominators): (WTF::Dominators::NaiveDominators::dominates): (WTF::Dominators::NaiveDominators::dump): (WTF::Dominators::NaiveDominators::pruneDominators): (WTF::Dominators::ValidationContext::ValidationContext): (WTF::Dominators::ValidationContext::reportError): (WTF::Dominators::ValidationContext::handleErrors): (WTF::Dominators::naiveDominates): (WTF::Dominators::forAllBlocksInDominanceFrontierOfImpl): (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOfImpl): (WTF::Dominators::BlockData::BlockData): Canonical link: https://commits.webkit.org/168962@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@191870 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-11-02 00:48:03 +00:00
while (!worklist.isEmpty()) {
GraphNodeWithOrder<typename Graph::Node> item = worklist.takeLast();
switch (item.order) {
case GraphVisitOrder::Pre:
m_data[item.node].preNumber = nextPreNumber++;
worklist.append(GraphNodeWithOrder<typename Graph::Node>(item.node, GraphVisitOrder::Post));
for (typename Graph::Node kid : m_data[item.node].idomKids)
worklist.append(GraphNodeWithOrder<typename Graph::Node>(kid, GraphVisitOrder::Pre));
break;
case GraphVisitOrder::Post:
m_data[item.node].postNumber = nextPostNumber++;
break;
}
}
if (selfCheck) {
// Check our dominator calculation:
// 1) Check that our range-based ancestry test is the same as a naive ancestry test.
// 2) Check that our notion of who dominates whom is identical to a naive (not
// Lengauer-Tarjan) dominator calculation.
ValidationContext context(m_graph, *this);
for (unsigned fromBlockIndex = m_graph.numNodes(); fromBlockIndex--;) {
typename Graph::Node fromBlock = m_graph.node(fromBlockIndex);
if (!fromBlock || m_data[fromBlock].preNumber == UINT_MAX)
continue;
for (unsigned toBlockIndex = m_graph.numNodes(); toBlockIndex--;) {
typename Graph::Node toBlock = m_graph.node(toBlockIndex);
if (!toBlock || m_data[toBlock].preNumber == UINT_MAX)
continue;
if (dominates(fromBlock, toBlock) != naiveDominates(fromBlock, toBlock))
context.reportError(fromBlock, toBlock, "Range-based domination check is broken");
if (dominates(fromBlock, toBlock) != context.naiveDominators.dominates(fromBlock, toBlock))
context.reportError(fromBlock, toBlock, "Lengauer-Tarjan domination is broken");
}
}
context.handleErrors();
}
}
bool strictlyDominates(typename Graph::Node from, typename Graph::Node to) const
{
return m_data[to].preNumber > m_data[from].preNumber
&& m_data[to].postNumber < m_data[from].postNumber;
}
bool dominates(typename Graph::Node from, typename Graph::Node to) const
{
return from == to || strictlyDominates(from, to);
}
FTL B3 should be able to flag the tag constants as being super important so that B3 can hoist them and Air can force them into registers https://bugs.webkit.org/show_bug.cgi?id=151955 Reviewed by Geoffrey Garen. Source/JavaScriptCore: Taught B3 about the concept of "fast constants". A client of B3 can now tell B3 which constants are super important. B3 will not spill the constant in that case and will ensure that the constant is materialized only once: statically once, and dynamically once per procedure execution. The hoistFastConstants() algorithm in B3MoveConstants.cpp achieves this by first picking the lowest common dominator of all uses of each fast constant, and then picking the materialization point by finding the lowest dominator of that dominator that is tied for lowest block frequency. In practice, the second step ensures that this is the lowest point in the program that is not in a loop (i.e. executes no more than once dynamically per procedure invocation). Taught Air about the concept of "fast tmps". B3 tells Air that a tmp is fast if it is used to hold the materialization of a fast constant. IRC will use the lowest possible spill score for fast tmps. In practice, this ensures that fast constants are never spilled. Added a small snippet of code to FTL::LowerDFGToLLVM that makes both of the tag constants into fast constants. My hope is that this very brute-force heuristic is good enough that we don't have to think about constants for a while. Based on my experience with how LLVM's constant hoisting works out, the heuristic in this patch is going to be tough to beat. LLVM's constant hoisting does good things when it hoists the tags, and usually causes nothing but problems when it hoists anything else. This is because there is no way a low-level compiler to really understand how a constant materialization impacts some operation's contribution to the overall execution time of a procedure. But, in the FTL we know that constant materializations for type checks are a bummer because we are super comfortable placing type checks on the hottest of paths. So those are the last paths where extra instructions should be added by the compiler. On the other hand, all other large constant uses are on relatively cold paths, or paths that are already expensive for other reasons. For example, global variable accesses have to materialize a pointer to the global. But that's not really a big deal, since a load from a global involves first the load itself and then type checks on the result - so probably the constant materialization is just not interesting. A store to a global often involves a store barrier, so the constant materialization is really not interesting. This patch codifies this heuristic in a pact between Air, B3, and the FTL: FTL demands that B3 pin the two tags in registers, and B3 relays the demand to Air. * JavaScriptCore.xcodeproj/project.pbxproj: * b3/B3CFG.h: Added. (JSC::B3::CFG::CFG): (JSC::B3::CFG::root): (JSC::B3::CFG::newMap): (JSC::B3::CFG::successors): (JSC::B3::CFG::predecessors): (JSC::B3::CFG::index): (JSC::B3::CFG::node): (JSC::B3::CFG::numNodes): (JSC::B3::CFG::dump): * b3/B3Dominators.h: Added. (JSC::B3::Dominators::Dominators): * b3/B3IndexMap.h: (JSC::B3::IndexMap::resize): (JSC::B3::IndexMap::size): (JSC::B3::IndexMap::operator[]): * b3/B3LowerMacros.cpp: * b3/B3LowerToAir.cpp: (JSC::B3::Air::LowerToAir::tmp): * b3/B3MoveConstants.cpp: * b3/B3Opcode.h: (JSC::B3::constPtrOpcode): (JSC::B3::isConstant): * b3/B3Procedure.cpp: (JSC::B3::Procedure::Procedure): (JSC::B3::Procedure::resetReachability): (JSC::B3::Procedure::invalidateCFG): (JSC::B3::Procedure::dump): (JSC::B3::Procedure::deleteValue): (JSC::B3::Procedure::dominators): (JSC::B3::Procedure::addFastConstant): (JSC::B3::Procedure::isFastConstant): (JSC::B3::Procedure::addDataSection): * b3/B3Procedure.h: (JSC::B3::Procedure::size): (JSC::B3::Procedure::cfg): (JSC::B3::Procedure::setLastPhaseName): * b3/B3ReduceStrength.cpp: * b3/B3ValueInlines.h: (JSC::B3::Value::isConstant): (JSC::B3::Value::isInteger): * b3/B3ValueKey.h: (JSC::B3::ValueKey::canMaterialize): (JSC::B3::ValueKey::isConstant): * b3/air/AirCode.cpp: (JSC::B3::Air::Code::findNextBlock): (JSC::B3::Air::Code::addFastTmp): * b3/air/AirCode.h: (JSC::B3::Air::Code::specials): (JSC::B3::Air::Code::isFastTmp): (JSC::B3::Air::Code::setLastPhaseName): * b3/air/AirIteratedRegisterCoalescing.cpp: * dfg/DFGDominators.h: * dfg/DFGSSACalculator.cpp: * ftl/FTLLowerDFGToLLVM.cpp: (JSC::FTL::DFG::LowerDFGToLLVM::lower): Source/WTF: Remove some remaining DFG-specific snippets from Dominators. This used to be a non-template DFG class, and some time ago I hoisted it into WTF and made it generic. But since the only user of the class was the DFG, this class still had a handful of DFG-specific snippets that didn't compile when I started using it from B3. Also renamed immediateDominatorOf() to idom(). This is the sort of abbreviation that we wouldn't ordinarily want to have in WebKit. But WebKit does allow for abbreviations that are "more canonical". The term "idom" is definitely more canonical than "immediateDominatorOf". * wtf/Dominators.h: (WTF::Dominators::dominates): (WTF::Dominators::idom): (WTF::Dominators::forAllStrictDominatorsOf): (WTF::Dominators::NaiveDominators::dominates): (WTF::Dominators::NaiveDominators::dump): (WTF::Dominators::ValidationContext::handleErrors): Canonical link: https://commits.webkit.org/170119@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@193682 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-12-08 02:46:22 +00:00
// Returns the immediate dominator of this block. Returns null for the root block.
typename Graph::Node idom(typename Graph::Node block) const
Dominators should be factored out of the DFG https://bugs.webkit.org/show_bug.cgi?id=150764 Reviewed by Geoffrey Garen. Source/JavaScriptCore: Factored DFGDominators.h/DFGDominators.cpp into WTF. To do this, I made two changes to the DFG: 1) DFG now has a CFG abstraction called DFG::CFG. The cool thing about this is that in the future if we wanted to support inverted dominators, we could do it by just creating a DFG::BackwardCFG. 2) Got rid of DFG::Analysis. From now on, an Analysis being invalidated is expressed by the DFG::Graph having a null pointer for that analysis. When we "run" the analysis, we just instantiate it. This makes it much more natural to integrate WTF::Dominators into the DFG. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * dfg/DFGAnalysis.h: Removed. * dfg/DFGCFG.h: Added. (JSC::DFG::CFG::CFG): (JSC::DFG::CFG::root): (JSC::DFG::CFG::newMap<T>): (JSC::DFG::CFG::successors): (JSC::DFG::CFG::predecessors): (JSC::DFG::CFG::index): (JSC::DFG::CFG::node): (JSC::DFG::CFG::numNodes): (JSC::DFG::CFG::dump): * dfg/DFGCSEPhase.cpp: * dfg/DFGDisassembler.cpp: (JSC::DFG::Disassembler::createDumpList): * dfg/DFGDominators.cpp: Removed. * dfg/DFGDominators.h: (JSC::DFG::Dominators::Dominators): (JSC::DFG::Dominators::strictlyDominates): Deleted. (JSC::DFG::Dominators::dominates): Deleted. (JSC::DFG::Dominators::immediateDominatorOf): Deleted. (JSC::DFG::Dominators::forAllStrictDominatorsOf): Deleted. (JSC::DFG::Dominators::forAllDominatorsOf): Deleted. (JSC::DFG::Dominators::forAllBlocksStrictlyDominatedBy): Deleted. (JSC::DFG::Dominators::forAllBlocksDominatedBy): Deleted. (JSC::DFG::Dominators::forAllBlocksInDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInIteratedDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInPrunedIteratedDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInDominanceFrontierOfImpl): Deleted. (JSC::DFG::Dominators::forAllBlocksInIteratedDominanceFrontierOfImpl): Deleted. (JSC::DFG::Dominators::BlockData::BlockData): Deleted. * dfg/DFGEdgeDominates.h: (JSC::DFG::EdgeDominates::operator()): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::Graph): (JSC::DFG::Graph::dumpBlockHeader): (JSC::DFG::Graph::invalidateCFG): (JSC::DFG::Graph::substituteGetLocal): (JSC::DFG::Graph::handleAssertionFailure): (JSC::DFG::Graph::ensureDominators): (JSC::DFG::Graph::ensurePrePostNumbering): (JSC::DFG::Graph::ensureNaturalLoops): (JSC::DFG::Graph::valueProfileFor): * dfg/DFGGraph.h: (JSC::DFG::Graph::hasDebuggerEnabled): * dfg/DFGLICMPhase.cpp: (JSC::DFG::LICMPhase::run): (JSC::DFG::LICMPhase::attemptHoist): * dfg/DFGLoopPreHeaderCreationPhase.cpp: (JSC::DFG::createPreHeader): (JSC::DFG::LoopPreHeaderCreationPhase::run): * dfg/DFGNaturalLoops.cpp: (JSC::DFG::NaturalLoop::dump): (JSC::DFG::NaturalLoops::NaturalLoops): (JSC::DFG::NaturalLoops::~NaturalLoops): (JSC::DFG::NaturalLoops::loopsOf): (JSC::DFG::NaturalLoops::computeDependencies): Deleted. (JSC::DFG::NaturalLoops::compute): Deleted. * dfg/DFGNaturalLoops.h: (JSC::DFG::NaturalLoops::numLoops): * dfg/DFGNode.h: (JSC::DFG::Node::SuccessorsIterable::end): (JSC::DFG::Node::SuccessorsIterable::size): (JSC::DFG::Node::SuccessorsIterable::at): (JSC::DFG::Node::SuccessorsIterable::operator[]): * dfg/DFGOSREntrypointCreationPhase.cpp: (JSC::DFG::OSREntrypointCreationPhase::run): * dfg/DFGObjectAllocationSinkingPhase.cpp: * dfg/DFGPlan.cpp: (JSC::DFG::Plan::compileInThreadImpl): * dfg/DFGPrePostNumbering.cpp: (JSC::DFG::PrePostNumbering::PrePostNumbering): (JSC::DFG::PrePostNumbering::~PrePostNumbering): (JSC::DFG::PrePostNumbering::compute): Deleted. * dfg/DFGPrePostNumbering.h: (JSC::DFG::PrePostNumbering::preNumber): (JSC::DFG::PrePostNumbering::postNumber): * dfg/DFGPutStackSinkingPhase.cpp: * dfg/DFGSSACalculator.cpp: (JSC::DFG::SSACalculator::nonLocalReachingDef): (JSC::DFG::SSACalculator::reachingDefAtTail): * dfg/DFGSSACalculator.h: (JSC::DFG::SSACalculator::computePhis): * dfg/DFGSSAConversionPhase.cpp: (JSC::DFG::SSAConversionPhase::run): * ftl/FTLLink.cpp: (JSC::FTL::link): * ftl/FTLLowerDFGToLLVM.cpp: (JSC::FTL::DFG::LowerDFGToLLVM::lower): (JSC::FTL::DFG::LowerDFGToLLVM::safelyInvalidateAfterTermination): (JSC::FTL::DFG::LowerDFGToLLVM::isValid): Source/WTF: This takes what used to be DFGDominators.h/DFGDominators.cpp and turns it into a generic algorithm that can take any abstract graph. The idea is that you create Dominators<CFG> and pass it a CFG object, which defines the types of graph nodes and methods for getting successors, predecessors, etc. The DFG now defines a class called CFG, which is a wrapper for DFG::Graph that conforms to the thing that wtf/Dominators.h expects. When doing things to graphs, it's common to refer to the things in the graph as "nodes". Because I intend to reuse the CFG abstraction with many graph algorithms, that abstraction uses the term "node" to refer to a DFG basic block. But in Dominators, the method and variable names still use "block". This is because although Dominators are applicable to any kind of directed graph, it's super unlikely that we will ever use them for anything but compilers. Indeed, the only reason why I'm factoring them out of the DFG is so that I can use them with B3 and Air. This has the nice side effect that a user of WTF::Dominators<JSC::DFG::CFG> will see familiar terminology like "blocksStrictlyDominatedBy(...)" instead of "nodesStrictlyDominatedBy(...)", which would be super confusing. Overall, wtf/Dominators.h is a combination of what used to be in DFGDominators.h, DFGDominators.cpp, DFGNaiveDominators.h, and DFGNaiveDominators.cpp. I only changed code when I had to in order to make it generic. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/Dominators.h: Added. (WTF::Dominators::Dominators): (WTF::Dominators::compute): (WTF::Dominators::strictlyDominates): (WTF::Dominators::dominates): (WTF::Dominators::immediateDominatorOf): (WTF::Dominators::forAllStrictDominatorsOf): (WTF::Dominators::forAllDominatorsOf): (WTF::Dominators::forAllBlocksStrictlyDominatedBy): (WTF::Dominators::forAllBlocksDominatedBy): (WTF::Dominators::strictDominatorsOf): (WTF::Dominators::dominatorsOf): (WTF::Dominators::blocksStrictlyDominatedBy): (WTF::Dominators::blocksDominatedBy): (WTF::Dominators::forAllBlocksInDominanceFrontierOf): (WTF::Dominators::dominanceFrontierOf): (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOf): (WTF::Dominators::forAllBlocksInPrunedIteratedDominanceFrontierOf): (WTF::Dominators::iteratedDominanceFrontierOf): (WTF::Dominators::dump): (WTF::Dominators::LengauerTarjan::LengauerTarjan): (WTF::Dominators::LengauerTarjan::compute): (WTF::Dominators::LengauerTarjan::immediateDominator): (WTF::Dominators::LengauerTarjan::computeDepthFirstPreNumbering): (WTF::Dominators::LengauerTarjan::computeSemiDominatorsAndImplicitImmediateDominators): (WTF::Dominators::LengauerTarjan::computeExplicitImmediateDominators): (WTF::Dominators::LengauerTarjan::link): (WTF::Dominators::LengauerTarjan::eval): (WTF::Dominators::LengauerTarjan::compress): (WTF::Dominators::LengauerTarjan::BlockData::BlockData): (WTF::Dominators::NaiveDominators::NaiveDominators): (WTF::Dominators::NaiveDominators::dominates): (WTF::Dominators::NaiveDominators::dump): (WTF::Dominators::NaiveDominators::pruneDominators): (WTF::Dominators::ValidationContext::ValidationContext): (WTF::Dominators::ValidationContext::reportError): (WTF::Dominators::ValidationContext::handleErrors): (WTF::Dominators::naiveDominates): (WTF::Dominators::forAllBlocksInDominanceFrontierOfImpl): (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOfImpl): (WTF::Dominators::BlockData::BlockData): Canonical link: https://commits.webkit.org/168962@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@191870 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-11-02 00:48:03 +00:00
{
return m_data[block].idomParent;
}
template<typename Functor>
void forAllStrictDominatorsOf(typename Graph::Node to, const Functor& functor) const
{
for (typename Graph::Node block = m_data[to].idomParent; block; block = m_data[block].idomParent)
functor(block);
}
B3::moveConstants should be able to edit code to minimize the number of constants https://bugs.webkit.org/show_bug.cgi?id=162764 Reviewed by Saam Barati. Source/JavaScriptCore: There are some interesting cases where we can reduce the number of constant materializations if we teach moveConstants() how to edit code. The two examples that this patch supports are: - Loads and stores from a constant pointer. Since loads and stores get an offset for free and the instruction selector is really good at handling it, and since we can query Air to see what kinds of offsets are legal, we can sometimes avoid using a constant pointer that is specific to the absolute address of that load and instead pick some other constant that is within offset distance of ours. - Add and Sub by a constant (x + c, x - c). Since x + c = x - -c and x - c = x + -c, we can flip Add to Sub or vice versa if the negated constant is available. This change makes moveConstants() pick the most dominant constant that works for an value. In the case of memory accesses, it uses Air::Arg::isValidAddrForm() to work out what other constants would work. In the case of Add/Sub, it simply looks for the negated constant. This should result in something like a minimal number of constants since these rules always pick the most dominant constant that works - so if an Add's constant is already most dominant then nothing changes, but if the negated one is more dominant then it becomes a Sub. This is a 0.5% speed-up on LongSpider and neutral elsewhere. It's a speed-up because the absolute address thing reduces the number of address materializations that we have to do, while the add/sub thing prevents us from having to materialize 0x1000000000000 to box doubles. However, this may introduce a pathology, which I've filed a bug for: bug 162796. * b3/B3MoveConstants.cpp: * b3/B3MoveConstants.h: * b3/B3UseCounts.h: * b3/air/AirFixObviousSpills.cpp: * b3/testb3.cpp: (JSC::B3::testMoveConstants): (JSC::B3::run): Source/WTF: I thought it would be a good idea to document the fact that dominator traversal happens in a particular order for a reason. * wtf/Dominators.h: Canonical link: https://commits.webkit.org/180753@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206682 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-30 22:29:24 +00:00
// Note: This will visit the dominators starting with the 'to' node and moving up the idom tree
// until it gets to the root. Some clients of this function, like B3::moveConstants(), rely on this
// order.
Dominators should be factored out of the DFG https://bugs.webkit.org/show_bug.cgi?id=150764 Reviewed by Geoffrey Garen. Source/JavaScriptCore: Factored DFGDominators.h/DFGDominators.cpp into WTF. To do this, I made two changes to the DFG: 1) DFG now has a CFG abstraction called DFG::CFG. The cool thing about this is that in the future if we wanted to support inverted dominators, we could do it by just creating a DFG::BackwardCFG. 2) Got rid of DFG::Analysis. From now on, an Analysis being invalidated is expressed by the DFG::Graph having a null pointer for that analysis. When we "run" the analysis, we just instantiate it. This makes it much more natural to integrate WTF::Dominators into the DFG. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * dfg/DFGAnalysis.h: Removed. * dfg/DFGCFG.h: Added. (JSC::DFG::CFG::CFG): (JSC::DFG::CFG::root): (JSC::DFG::CFG::newMap<T>): (JSC::DFG::CFG::successors): (JSC::DFG::CFG::predecessors): (JSC::DFG::CFG::index): (JSC::DFG::CFG::node): (JSC::DFG::CFG::numNodes): (JSC::DFG::CFG::dump): * dfg/DFGCSEPhase.cpp: * dfg/DFGDisassembler.cpp: (JSC::DFG::Disassembler::createDumpList): * dfg/DFGDominators.cpp: Removed. * dfg/DFGDominators.h: (JSC::DFG::Dominators::Dominators): (JSC::DFG::Dominators::strictlyDominates): Deleted. (JSC::DFG::Dominators::dominates): Deleted. (JSC::DFG::Dominators::immediateDominatorOf): Deleted. (JSC::DFG::Dominators::forAllStrictDominatorsOf): Deleted. (JSC::DFG::Dominators::forAllDominatorsOf): Deleted. (JSC::DFG::Dominators::forAllBlocksStrictlyDominatedBy): Deleted. (JSC::DFG::Dominators::forAllBlocksDominatedBy): Deleted. (JSC::DFG::Dominators::forAllBlocksInDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInIteratedDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInPrunedIteratedDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInDominanceFrontierOfImpl): Deleted. (JSC::DFG::Dominators::forAllBlocksInIteratedDominanceFrontierOfImpl): Deleted. (JSC::DFG::Dominators::BlockData::BlockData): Deleted. * dfg/DFGEdgeDominates.h: (JSC::DFG::EdgeDominates::operator()): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::Graph): (JSC::DFG::Graph::dumpBlockHeader): (JSC::DFG::Graph::invalidateCFG): (JSC::DFG::Graph::substituteGetLocal): (JSC::DFG::Graph::handleAssertionFailure): (JSC::DFG::Graph::ensureDominators): (JSC::DFG::Graph::ensurePrePostNumbering): (JSC::DFG::Graph::ensureNaturalLoops): (JSC::DFG::Graph::valueProfileFor): * dfg/DFGGraph.h: (JSC::DFG::Graph::hasDebuggerEnabled): * dfg/DFGLICMPhase.cpp: (JSC::DFG::LICMPhase::run): (JSC::DFG::LICMPhase::attemptHoist): * dfg/DFGLoopPreHeaderCreationPhase.cpp: (JSC::DFG::createPreHeader): (JSC::DFG::LoopPreHeaderCreationPhase::run): * dfg/DFGNaturalLoops.cpp: (JSC::DFG::NaturalLoop::dump): (JSC::DFG::NaturalLoops::NaturalLoops): (JSC::DFG::NaturalLoops::~NaturalLoops): (JSC::DFG::NaturalLoops::loopsOf): (JSC::DFG::NaturalLoops::computeDependencies): Deleted. (JSC::DFG::NaturalLoops::compute): Deleted. * dfg/DFGNaturalLoops.h: (JSC::DFG::NaturalLoops::numLoops): * dfg/DFGNode.h: (JSC::DFG::Node::SuccessorsIterable::end): (JSC::DFG::Node::SuccessorsIterable::size): (JSC::DFG::Node::SuccessorsIterable::at): (JSC::DFG::Node::SuccessorsIterable::operator[]): * dfg/DFGOSREntrypointCreationPhase.cpp: (JSC::DFG::OSREntrypointCreationPhase::run): * dfg/DFGObjectAllocationSinkingPhase.cpp: * dfg/DFGPlan.cpp: (JSC::DFG::Plan::compileInThreadImpl): * dfg/DFGPrePostNumbering.cpp: (JSC::DFG::PrePostNumbering::PrePostNumbering): (JSC::DFG::PrePostNumbering::~PrePostNumbering): (JSC::DFG::PrePostNumbering::compute): Deleted. * dfg/DFGPrePostNumbering.h: (JSC::DFG::PrePostNumbering::preNumber): (JSC::DFG::PrePostNumbering::postNumber): * dfg/DFGPutStackSinkingPhase.cpp: * dfg/DFGSSACalculator.cpp: (JSC::DFG::SSACalculator::nonLocalReachingDef): (JSC::DFG::SSACalculator::reachingDefAtTail): * dfg/DFGSSACalculator.h: (JSC::DFG::SSACalculator::computePhis): * dfg/DFGSSAConversionPhase.cpp: (JSC::DFG::SSAConversionPhase::run): * ftl/FTLLink.cpp: (JSC::FTL::link): * ftl/FTLLowerDFGToLLVM.cpp: (JSC::FTL::DFG::LowerDFGToLLVM::lower): (JSC::FTL::DFG::LowerDFGToLLVM::safelyInvalidateAfterTermination): (JSC::FTL::DFG::LowerDFGToLLVM::isValid): Source/WTF: This takes what used to be DFGDominators.h/DFGDominators.cpp and turns it into a generic algorithm that can take any abstract graph. The idea is that you create Dominators<CFG> and pass it a CFG object, which defines the types of graph nodes and methods for getting successors, predecessors, etc. The DFG now defines a class called CFG, which is a wrapper for DFG::Graph that conforms to the thing that wtf/Dominators.h expects. When doing things to graphs, it's common to refer to the things in the graph as "nodes". Because I intend to reuse the CFG abstraction with many graph algorithms, that abstraction uses the term "node" to refer to a DFG basic block. But in Dominators, the method and variable names still use "block". This is because although Dominators are applicable to any kind of directed graph, it's super unlikely that we will ever use them for anything but compilers. Indeed, the only reason why I'm factoring them out of the DFG is so that I can use them with B3 and Air. This has the nice side effect that a user of WTF::Dominators<JSC::DFG::CFG> will see familiar terminology like "blocksStrictlyDominatedBy(...)" instead of "nodesStrictlyDominatedBy(...)", which would be super confusing. Overall, wtf/Dominators.h is a combination of what used to be in DFGDominators.h, DFGDominators.cpp, DFGNaiveDominators.h, and DFGNaiveDominators.cpp. I only changed code when I had to in order to make it generic. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/Dominators.h: Added. (WTF::Dominators::Dominators): (WTF::Dominators::compute): (WTF::Dominators::strictlyDominates): (WTF::Dominators::dominates): (WTF::Dominators::immediateDominatorOf): (WTF::Dominators::forAllStrictDominatorsOf): (WTF::Dominators::forAllDominatorsOf): (WTF::Dominators::forAllBlocksStrictlyDominatedBy): (WTF::Dominators::forAllBlocksDominatedBy): (WTF::Dominators::strictDominatorsOf): (WTF::Dominators::dominatorsOf): (WTF::Dominators::blocksStrictlyDominatedBy): (WTF::Dominators::blocksDominatedBy): (WTF::Dominators::forAllBlocksInDominanceFrontierOf): (WTF::Dominators::dominanceFrontierOf): (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOf): (WTF::Dominators::forAllBlocksInPrunedIteratedDominanceFrontierOf): (WTF::Dominators::iteratedDominanceFrontierOf): (WTF::Dominators::dump): (WTF::Dominators::LengauerTarjan::LengauerTarjan): (WTF::Dominators::LengauerTarjan::compute): (WTF::Dominators::LengauerTarjan::immediateDominator): (WTF::Dominators::LengauerTarjan::computeDepthFirstPreNumbering): (WTF::Dominators::LengauerTarjan::computeSemiDominatorsAndImplicitImmediateDominators): (WTF::Dominators::LengauerTarjan::computeExplicitImmediateDominators): (WTF::Dominators::LengauerTarjan::link): (WTF::Dominators::LengauerTarjan::eval): (WTF::Dominators::LengauerTarjan::compress): (WTF::Dominators::LengauerTarjan::BlockData::BlockData): (WTF::Dominators::NaiveDominators::NaiveDominators): (WTF::Dominators::NaiveDominators::dominates): (WTF::Dominators::NaiveDominators::dump): (WTF::Dominators::NaiveDominators::pruneDominators): (WTF::Dominators::ValidationContext::ValidationContext): (WTF::Dominators::ValidationContext::reportError): (WTF::Dominators::ValidationContext::handleErrors): (WTF::Dominators::naiveDominates): (WTF::Dominators::forAllBlocksInDominanceFrontierOfImpl): (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOfImpl): (WTF::Dominators::BlockData::BlockData): Canonical link: https://commits.webkit.org/168962@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@191870 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-11-02 00:48:03 +00:00
template<typename Functor>
void forAllDominatorsOf(typename Graph::Node to, const Functor& functor) const
{
for (typename Graph::Node block = to; block; block = m_data[block].idomParent)
functor(block);
}
template<typename Functor>
void forAllBlocksStrictlyDominatedBy(typename Graph::Node from, const Functor& functor) const
{
Vector<typename Graph::Node, 16> worklist;
worklist.appendVector(m_data[from].idomKids);
while (!worklist.isEmpty()) {
typename Graph::Node block = worklist.takeLast();
functor(block);
worklist.appendVector(m_data[block].idomKids);
}
}
template<typename Functor>
void forAllBlocksDominatedBy(typename Graph::Node from, const Functor& functor) const
{
Vector<typename Graph::Node, 16> worklist;
worklist.append(from);
while (!worklist.isEmpty()) {
typename Graph::Node block = worklist.takeLast();
functor(block);
worklist.appendVector(m_data[block].idomKids);
}
}
typename Graph::Set strictDominatorsOf(typename Graph::Node to) const
{
typename Graph::Set result;
forAllStrictDominatorsOf(
to,
[&] (typename Graph::Node node) {
result.add(node);
});
return result;
}
typename Graph::Set dominatorsOf(typename Graph::Node to) const
{
typename Graph::Set result;
forAllDominatorsOf(
to,
[&] (typename Graph::Node node) {
result.add(node);
});
return result;
}
typename Graph::Set blocksStrictlyDominatedBy(typename Graph::Node from) const
{
typename Graph::Set result;
forAllBlocksStrictlyDominatedBy(
from,
[&] (typename Graph::Node node) {
result.add(node);
});
return result;
}
typename Graph::Set blocksDominatedBy(typename Graph::Node from) const
{
typename Graph::Set result;
forAllBlocksDominatedBy(
from,
[&] (typename Graph::Node node) {
result.add(node);
});
return result;
}
template<typename Functor>
void forAllBlocksInDominanceFrontierOf(
typename Graph::Node from, const Functor& functor) const
{
typename Graph::Set set;
forAllBlocksInDominanceFrontierOfImpl(
from,
[&] (typename Graph::Node block) {
if (set.add(block))
functor(block);
});
}
typename Graph::Set dominanceFrontierOf(typename Graph::Node from) const
{
typename Graph::Set result;
forAllBlocksInDominanceFrontierOf(
from,
[&] (typename Graph::Node node) {
result.add(node);
});
return result;
}
template<typename Functor>
Support compiling catch in the DFG https://bugs.webkit.org/show_bug.cgi?id=174590 <rdar://problem/34047845> Reviewed by Filip Pizlo. JSTests: * microbenchmarks/delta-blue-try-catch.js: Added. (exception): (value): (OrderedCollection): (OrderedCollection.prototype.add): (OrderedCollection.prototype.at): (OrderedCollection.prototype.size): (OrderedCollection.prototype.removeFirst): (OrderedCollection.prototype.remove): (Strength): (Strength.stronger): (Strength.weaker): (Strength.weakestOf): (Strength.strongest): (Strength.prototype.nextWeaker): (Constraint): (Constraint.prototype.addConstraint): (Constraint.prototype.satisfy): (Constraint.prototype.destroyConstraint): (Constraint.prototype.isInput): (UnaryConstraint): (UnaryConstraint.prototype.addToGraph): (UnaryConstraint.prototype.chooseMethod): (UnaryConstraint.prototype.isSatisfied): (UnaryConstraint.prototype.markInputs): (UnaryConstraint.prototype.output): (UnaryConstraint.prototype.recalculate): (UnaryConstraint.prototype.markUnsatisfied): (UnaryConstraint.prototype.inputsKnown): (UnaryConstraint.prototype.removeFromGraph): (StayConstraint): (StayConstraint.prototype.execute): (EditConstraint.prototype.isInput): (EditConstraint.prototype.execute): (BinaryConstraint): (BinaryConstraint.prototype.chooseMethod): (BinaryConstraint.prototype.addToGraph): (BinaryConstraint.prototype.isSatisfied): (BinaryConstraint.prototype.markInputs): (BinaryConstraint.prototype.input): (BinaryConstraint.prototype.output): (BinaryConstraint.prototype.recalculate): (BinaryConstraint.prototype.markUnsatisfied): (BinaryConstraint.prototype.inputsKnown): (BinaryConstraint.prototype.removeFromGraph): (ScaleConstraint): (ScaleConstraint.prototype.addToGraph): (ScaleConstraint.prototype.removeFromGraph): (ScaleConstraint.prototype.markInputs): (ScaleConstraint.prototype.execute): (ScaleConstraint.prototype.recalculate): (EqualityConstraint): (EqualityConstraint.prototype.execute): (Variable): (Variable.prototype.addConstraint): (Variable.prototype.removeConstraint): (Planner): (Planner.prototype.incrementalAdd): (Planner.prototype.incrementalRemove): (Planner.prototype.newMark): (Planner.prototype.makePlan): (Planner.prototype.extractPlanFromConstraints): (Planner.prototype.addPropagate): (Planner.prototype.removePropagateFrom): (Planner.prototype.addConstraintsConsumingTo): (Plan): (Plan.prototype.addConstraint): (Plan.prototype.size): (Plan.prototype.constraintAt): (Plan.prototype.execute): (chainTest): (projectionTest): (change): (deltaBlue): * microbenchmarks/fake-iterators-that-throw-when-finished.js: Added. (assert): (Numbers): (Numbers.prototype.next): (return.Transpose): (return.Transpose.prototype.next): (transpose): (verifyEven): (verifyString): (foo): (runIterators): * microbenchmarks/try-catch-word-count.js: Added. (let.assert): (EOF): (let.texts): (let.o.apply): (foo): (bar): (f): (run): (test1): (test2): (test3): (fn): (A): (B): (A.prototype.getValue): (B.prototype.getParentValue): (strlen): (sum.0): (test): (result.test.o): (set add.set add): (set forEach): (stringHash): (set if): (testFunction): (set delete.set has.set add): * stress/catch-set-argument-speculation-failure.js: Added. (o): (e): (e2): (escape): (baz): (noInline.run): (noInline): * stress/osr-enter-to-catch-with-set-local-type-check-failure.js: Added. (foo): (e): (baz): (bar): Source/JavaScriptCore: This patch implements OSR entry into op_catch in the DFG. We will support OSR entry into the FTL in a followup: https://bugs.webkit.org/show_bug.cgi?id=175396 To implement catch in the DFG, this patch introduces the concept of multiple entrypoints into CPS/LoadStore DFG IR. A lot of this patch is stringing this concept through the DFG. Many phases used to assume that Graph::block(0) is the only root, and this patch contains many straight forward changes generalizing the code to handle more than one entrypoint. A main building block of this is moving to two CFG types: SSACFG and CPSCFG. SSACFG is the same CFG we used to have. CPSCFG is a new type that introduces a fake root that has an outgoing edge to all the entrypoints. This allows our existing graph algorithms to Just Work over CPSCFG. For example, there is now the concept of SSADominators vs CPSDominators, and SSANaturalLoops vs CPSNaturalLoops. The way we compile the catch entrypoint is by bootstrapping the state of the program by loading all live bytecode locals from a buffer. The OSR entry code will store all live values into that buffer before jumping to the entrypoint. The OSR entry code is also responsible for performing type proofs of the arguments before doing an OSR entry. If there is a type mismatch, it's not legal to OSR enter into the DFG compilation. Currently, each catch entrypoint knows the argument type proofs it must perform to enter into the DFG. Currently, all entrypoints' arguments flush format are unified via ArgumentPosition, but this is just an implementation detail. The code is written more generally to assume that each entrypoint may perform its own distinct proof. op_catch now performs value profiling for all live bytecode locals in the LLInt and baseline JIT. This information is then fed into the DFG via the ExtractCatchLocal node in the prediction propagation phase. This patch also changes how we generate op_catch in bytecode. All op_catches are now split out at the end of the program in bytecode. This ensures that no op_catch is inside a try block. This is needed to ensure correctness in the DFGLiveCatchVariablePreservationPhase. That phase only inserts flushes before SetLocals inside a try block. If an op_catch were in a try block, this would cause the phase to insert a Flush before one of the state bootstrapping SetLocals, which would generate invalid IR. Moving op_catch to be generated on its own at the end of a bytecode stream seemed like the most elegant solution since it better represents that we treat op_catch as an entrypoint. This is true both in the DFG and in the baseline and LLInt: we don't reach an op_catch via normal control flow. Because op_catch cannot throw, this will not break any previous semantics of op_catch. Logically, it'd be valid to split try blocks around any non-throwing bytecode operation. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * bytecode/BytecodeDumper.cpp: (JSC::BytecodeDumper<Block>::dumpBytecode): * bytecode/BytecodeList.json: * bytecode/BytecodeUseDef.h: (JSC::computeUsesForBytecodeOffset): * bytecode/CodeBlock.cpp: (JSC::CodeBlock::finishCreation): (JSC::CodeBlock::ensureCatchLivenessIsComputedForBytecodeOffset): (JSC::CodeBlock::updateAllPredictionsAndCountLiveness): (JSC::CodeBlock::validate): * bytecode/CodeBlock.h: * bytecode/ValueProfile.h: (JSC::ValueProfile::ValueProfile): (JSC::ValueProfileAndOperandBuffer::ValueProfileAndOperandBuffer): (JSC::ValueProfileAndOperandBuffer::~ValueProfileAndOperandBuffer): (JSC::ValueProfileAndOperandBuffer::forEach): * bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::generate): (JSC::BytecodeGenerator::BytecodeGenerator): (JSC::BytecodeGenerator::emitCatch): (JSC::BytecodeGenerator::emitEnumeration): * bytecompiler/BytecodeGenerator.h: * bytecompiler/NodesCodegen.cpp: (JSC::TryNode::emitBytecode): * dfg/DFGAbstractInterpreterInlines.h: (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects): * dfg/DFGBackwardsCFG.h: (JSC::DFG::BackwardsCFG::BackwardsCFG): * dfg/DFGBasicBlock.cpp: (JSC::DFG::BasicBlock::BasicBlock): * dfg/DFGBasicBlock.h: (JSC::DFG::BasicBlock::findTerminal const): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::setDirect): (JSC::DFG::ByteCodeParser::flush): (JSC::DFG::ByteCodeParser::DelayedSetLocal::DelayedSetLocal): (JSC::DFG::ByteCodeParser::DelayedSetLocal::execute): (JSC::DFG::ByteCodeParser::parseBlock): (JSC::DFG::ByteCodeParser::parseCodeBlock): (JSC::DFG::ByteCodeParser::parse): * dfg/DFGCFG.h: (JSC::DFG::CFG::root): (JSC::DFG::CFG::roots): (JSC::DFG::CPSCFG::CPSCFG): (JSC::DFG::selectCFG): * dfg/DFGCPSRethreadingPhase.cpp: (JSC::DFG::CPSRethreadingPhase::specialCaseArguments): * dfg/DFGCSEPhase.cpp: * dfg/DFGClobberize.h: (JSC::DFG::clobberize): * dfg/DFGControlEquivalenceAnalysis.h: (JSC::DFG::ControlEquivalenceAnalysis::ControlEquivalenceAnalysis): * dfg/DFGDCEPhase.cpp: (JSC::DFG::DCEPhase::run): * dfg/DFGDisassembler.cpp: (JSC::DFG::Disassembler::createDumpList): * dfg/DFGDoesGC.cpp: (JSC::DFG::doesGC): * dfg/DFGDominators.h: (JSC::DFG::Dominators::Dominators): (JSC::DFG::ensureDominatorsForCFG): * dfg/DFGEdgeDominates.h: (JSC::DFG::EdgeDominates::EdgeDominates): (JSC::DFG::EdgeDominates::operator()): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): (JSC::DFG::FixupPhase::fixupChecksInBlock): * dfg/DFGFlushFormat.h: * dfg/DFGGraph.cpp: (JSC::DFG::Graph::Graph): (JSC::DFG::unboxLoopNode): (JSC::DFG::Graph::dumpBlockHeader): (JSC::DFG::Graph::dump): (JSC::DFG::Graph::determineReachability): (JSC::DFG::Graph::invalidateCFG): (JSC::DFG::Graph::blocksInPreOrder): (JSC::DFG::Graph::blocksInPostOrder): (JSC::DFG::Graph::ensureCPSDominators): (JSC::DFG::Graph::ensureSSADominators): (JSC::DFG::Graph::ensureCPSNaturalLoops): (JSC::DFG::Graph::ensureSSANaturalLoops): (JSC::DFG::Graph::ensureBackwardsCFG): (JSC::DFG::Graph::ensureBackwardsDominators): (JSC::DFG::Graph::ensureControlEquivalenceAnalysis): (JSC::DFG::Graph::methodOfGettingAValueProfileFor): (JSC::DFG::Graph::clearCPSCFGData): (JSC::DFG::Graph::ensureDominators): Deleted. (JSC::DFG::Graph::ensurePrePostNumbering): Deleted. (JSC::DFG::Graph::ensureNaturalLoops): Deleted. * dfg/DFGGraph.h: (JSC::DFG::Graph::willCatchExceptionInMachineFrame): (JSC::DFG::Graph::isEntrypoint const): * dfg/DFGInPlaceAbstractState.cpp: (JSC::DFG::InPlaceAbstractState::initialize): (JSC::DFG::InPlaceAbstractState::mergeToSuccessors): * dfg/DFGJITCode.cpp: (JSC::DFG::JITCode::shrinkToFit): * dfg/DFGJITCode.h: (JSC::DFG::JITCode::catchOSREntryDataForBytecodeIndex): (JSC::DFG::JITCode::finalizeCatchOSREntrypoints): (JSC::DFG::JITCode::appendCatchEntrypoint): * dfg/DFGJITCompiler.cpp: (JSC::DFG::JITCompiler::compile): (JSC::DFG::JITCompiler::compileFunction): (JSC::DFG::JITCompiler::noticeCatchEntrypoint): (JSC::DFG::JITCompiler::noticeOSREntry): (JSC::DFG::JITCompiler::makeCatchOSREntryBuffer): * dfg/DFGJITCompiler.h: * dfg/DFGLICMPhase.cpp: (JSC::DFG::LICMPhase::run): (JSC::DFG::LICMPhase::attemptHoist): * dfg/DFGLiveCatchVariablePreservationPhase.cpp: (JSC::DFG::LiveCatchVariablePreservationPhase::run): (JSC::DFG::LiveCatchVariablePreservationPhase::isValidFlushLocation): (JSC::DFG::LiveCatchVariablePreservationPhase::handleBlockForTryCatch): (JSC::DFG::LiveCatchVariablePreservationPhase::newVariableAccessData): (JSC::DFG::LiveCatchVariablePreservationPhase::willCatchException): Deleted. (JSC::DFG::LiveCatchVariablePreservationPhase::handleBlock): Deleted. * dfg/DFGLoopPreHeaderCreationPhase.cpp: (JSC::DFG::createPreHeader): (JSC::DFG::LoopPreHeaderCreationPhase::run): * dfg/DFGMaximalFlushInsertionPhase.cpp: (JSC::DFG::MaximalFlushInsertionPhase::run): (JSC::DFG::MaximalFlushInsertionPhase::treatRegularBlock): (JSC::DFG::MaximalFlushInsertionPhase::treatRootBlock): * dfg/DFGMayExit.cpp: * dfg/DFGNaturalLoops.h: (JSC::DFG::NaturalLoops::NaturalLoops): * dfg/DFGNode.h: (JSC::DFG::Node::isSwitch const): (JSC::DFG::Node::successor): (JSC::DFG::Node::catchOSREntryIndex const): (JSC::DFG::Node::catchLocalPrediction): (JSC::DFG::Node::isSwitch): Deleted. * dfg/DFGNodeType.h: * dfg/DFGOSREntry.cpp: (JSC::DFG::prepareCatchOSREntry): * dfg/DFGOSREntry.h: * dfg/DFGOSREntrypointCreationPhase.cpp: (JSC::DFG::OSREntrypointCreationPhase::run): * dfg/DFGOSRExitCompilerCommon.cpp: (JSC::DFG::handleExitCounts): * dfg/DFGObjectAllocationSinkingPhase.cpp: * dfg/DFGPlan.cpp: (JSC::DFG::Plan::compileInThreadImpl): * dfg/DFGPrePostNumbering.cpp: (JSC::DFG::PrePostNumbering::PrePostNumbering): Deleted. (JSC::DFG::PrePostNumbering::~PrePostNumbering): Deleted. (WTF::printInternal): Deleted. * dfg/DFGPrePostNumbering.h: (): Deleted. (JSC::DFG::PrePostNumbering::preNumber const): Deleted. (JSC::DFG::PrePostNumbering::postNumber const): Deleted. (JSC::DFG::PrePostNumbering::isStrictAncestorOf const): Deleted. (JSC::DFG::PrePostNumbering::isAncestorOf const): Deleted. (JSC::DFG::PrePostNumbering::isStrictDescendantOf const): Deleted. (JSC::DFG::PrePostNumbering::isDescendantOf const): Deleted. (JSC::DFG::PrePostNumbering::edgeKind const): Deleted. * dfg/DFGPredictionInjectionPhase.cpp: (JSC::DFG::PredictionInjectionPhase::run): * dfg/DFGPredictionPropagationPhase.cpp: * dfg/DFGPutStackSinkingPhase.cpp: * dfg/DFGSSACalculator.cpp: (JSC::DFG::SSACalculator::nonLocalReachingDef): (JSC::DFG::SSACalculator::reachingDefAtTail): * dfg/DFGSSACalculator.h: (JSC::DFG::SSACalculator::computePhis): * dfg/DFGSSAConversionPhase.cpp: (JSC::DFG::SSAConversionPhase::run): (JSC::DFG::performSSAConversion): * dfg/DFGSafeToExecute.h: (JSC::DFG::safeToExecute): * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::compileCurrentBlock): (JSC::DFG::SpeculativeJIT::checkArgumentTypes): (JSC::DFG::SpeculativeJIT::createOSREntries): (JSC::DFG::SpeculativeJIT::linkOSREntries): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGStaticExecutionCountEstimationPhase.cpp: (JSC::DFG::StaticExecutionCountEstimationPhase::run): * dfg/DFGStrengthReductionPhase.cpp: (JSC::DFG::StrengthReductionPhase::handleNode): * dfg/DFGTierUpCheckInjectionPhase.cpp: (JSC::DFG::TierUpCheckInjectionPhase::run): (JSC::DFG::TierUpCheckInjectionPhase::buildNaturalLoopToLoopHintMap): * dfg/DFGTypeCheckHoistingPhase.cpp: (JSC::DFG::TypeCheckHoistingPhase::run): * dfg/DFGValidate.cpp: * ftl/FTLLink.cpp: (JSC::FTL::link): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::lower): (JSC::FTL::DFG::LowerDFGToB3::safelyInvalidateAfterTermination): (JSC::FTL::DFG::LowerDFGToB3::isValid): * jit/JIT.h: * jit/JITInlines.h: (JSC::JIT::callOperation): * jit/JITOpcodes.cpp: (JSC::JIT::emit_op_catch): * jit/JITOpcodes32_64.cpp: (JSC::JIT::emit_op_catch): * jit/JITOperations.cpp: * jit/JITOperations.h: * llint/LLIntSlowPaths.cpp: (JSC::LLInt::LLINT_SLOW_PATH_DECL): * llint/LLIntSlowPaths.h: * llint/LowLevelInterpreter32_64.asm: * llint/LowLevelInterpreter64.asm: Source/WTF: This patch generalizes the BackwardsGraph fake root into a more generalizable class called SingleRootGraph. SingleRootGraph exposes the general graph interface used in Dominators and NaturalLoops. SingleRootGraph takes as input a graph with the normal graph interface, but also allows the input graph to contain more than one root. SingleRootGraph then exposes a single root, which it creates, that has an outgoing edge to all the roots in the original graph. * WTF.xcodeproj/project.pbxproj: * wtf/BackwardsGraph.h: (WTF::BackwardsGraph::dump const): (WTF::BackwardsGraph::rootName): Deleted. (WTF::BackwardsGraph::Node::Node): Deleted. (WTF::BackwardsGraph::Node::root): Deleted. (WTF::BackwardsGraph::Node::operator== const): Deleted. (WTF::BackwardsGraph::Node::operator!= const): Deleted. (WTF::BackwardsGraph::Node::operator bool const): Deleted. (WTF::BackwardsGraph::Node::isRoot const): Deleted. (WTF::BackwardsGraph::Node::node const): Deleted. (): Deleted. (WTF::BackwardsGraph::Set::Set): Deleted. (WTF::BackwardsGraph::Set::add): Deleted. (WTF::BackwardsGraph::Set::remove): Deleted. (WTF::BackwardsGraph::Set::contains): Deleted. (WTF::BackwardsGraph::Set::dump const): Deleted. (WTF::BackwardsGraph::Map::Map): Deleted. (WTF::BackwardsGraph::Map::clear): Deleted. (WTF::BackwardsGraph::Map::size const): Deleted. (WTF::BackwardsGraph::Map::operator[]): Deleted. (WTF::BackwardsGraph::Map::operator[] const): Deleted. * wtf/Dominators.h: (WTF::Dominators::Dominators): (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOf): (WTF::Dominators::forAllBlocksInPrunedIteratedDominanceFrontierOf): (WTF::Dominators::iteratedDominanceFrontierOf const): (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOfImpl const): * wtf/SingleRootGraph.h: Added. (WTF::SingleRootGraphNode::rootName): (WTF::SingleRootGraphNode::SingleRootGraphNode): (WTF::SingleRootGraphNode::root): (WTF::SingleRootGraphNode::operator== const): (WTF::SingleRootGraphNode::operator!= const): (WTF::SingleRootGraphNode::operator bool const): (WTF::SingleRootGraphNode::isRoot const): (WTF::SingleRootGraphNode::node const): (WTF::SingleRootGraphSet::add): (WTF::SingleRootGraphSet::remove): (WTF::SingleRootGraphSet::contains): (WTF::SingleRootGraphSet::dump const): (WTF::SingleRootMap::SingleRootMap): (WTF::SingleRootMap::clear): (WTF::SingleRootMap::size const): (WTF::SingleRootMap::operator[]): (WTF::SingleRootMap::operator[] const): (WTF::SingleRootGraph::SingleRootGraph): (WTF::SingleRootGraph::root const): (WTF::SingleRootGraph::newMap): (WTF::SingleRootGraph::successors const): (WTF::SingleRootGraph::predecessors const): (WTF::SingleRootGraph::index const): (WTF::SingleRootGraph::node const): (WTF::SingleRootGraph::numNodes const): (WTF::SingleRootGraph::dump const): (WTF::SingleRootGraph::assertIsConsistent const): Canonical link: https://commits.webkit.org/192644@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@221196 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-08-25 18:26:15 +00:00
void forAllBlocksInIteratedDominanceFrontierOf(const List& from, const Functor& functor)
Dominators should be factored out of the DFG https://bugs.webkit.org/show_bug.cgi?id=150764 Reviewed by Geoffrey Garen. Source/JavaScriptCore: Factored DFGDominators.h/DFGDominators.cpp into WTF. To do this, I made two changes to the DFG: 1) DFG now has a CFG abstraction called DFG::CFG. The cool thing about this is that in the future if we wanted to support inverted dominators, we could do it by just creating a DFG::BackwardCFG. 2) Got rid of DFG::Analysis. From now on, an Analysis being invalidated is expressed by the DFG::Graph having a null pointer for that analysis. When we "run" the analysis, we just instantiate it. This makes it much more natural to integrate WTF::Dominators into the DFG. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * dfg/DFGAnalysis.h: Removed. * dfg/DFGCFG.h: Added. (JSC::DFG::CFG::CFG): (JSC::DFG::CFG::root): (JSC::DFG::CFG::newMap<T>): (JSC::DFG::CFG::successors): (JSC::DFG::CFG::predecessors): (JSC::DFG::CFG::index): (JSC::DFG::CFG::node): (JSC::DFG::CFG::numNodes): (JSC::DFG::CFG::dump): * dfg/DFGCSEPhase.cpp: * dfg/DFGDisassembler.cpp: (JSC::DFG::Disassembler::createDumpList): * dfg/DFGDominators.cpp: Removed. * dfg/DFGDominators.h: (JSC::DFG::Dominators::Dominators): (JSC::DFG::Dominators::strictlyDominates): Deleted. (JSC::DFG::Dominators::dominates): Deleted. (JSC::DFG::Dominators::immediateDominatorOf): Deleted. (JSC::DFG::Dominators::forAllStrictDominatorsOf): Deleted. (JSC::DFG::Dominators::forAllDominatorsOf): Deleted. (JSC::DFG::Dominators::forAllBlocksStrictlyDominatedBy): Deleted. (JSC::DFG::Dominators::forAllBlocksDominatedBy): Deleted. (JSC::DFG::Dominators::forAllBlocksInDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInIteratedDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInPrunedIteratedDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInDominanceFrontierOfImpl): Deleted. (JSC::DFG::Dominators::forAllBlocksInIteratedDominanceFrontierOfImpl): Deleted. (JSC::DFG::Dominators::BlockData::BlockData): Deleted. * dfg/DFGEdgeDominates.h: (JSC::DFG::EdgeDominates::operator()): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::Graph): (JSC::DFG::Graph::dumpBlockHeader): (JSC::DFG::Graph::invalidateCFG): (JSC::DFG::Graph::substituteGetLocal): (JSC::DFG::Graph::handleAssertionFailure): (JSC::DFG::Graph::ensureDominators): (JSC::DFG::Graph::ensurePrePostNumbering): (JSC::DFG::Graph::ensureNaturalLoops): (JSC::DFG::Graph::valueProfileFor): * dfg/DFGGraph.h: (JSC::DFG::Graph::hasDebuggerEnabled): * dfg/DFGLICMPhase.cpp: (JSC::DFG::LICMPhase::run): (JSC::DFG::LICMPhase::attemptHoist): * dfg/DFGLoopPreHeaderCreationPhase.cpp: (JSC::DFG::createPreHeader): (JSC::DFG::LoopPreHeaderCreationPhase::run): * dfg/DFGNaturalLoops.cpp: (JSC::DFG::NaturalLoop::dump): (JSC::DFG::NaturalLoops::NaturalLoops): (JSC::DFG::NaturalLoops::~NaturalLoops): (JSC::DFG::NaturalLoops::loopsOf): (JSC::DFG::NaturalLoops::computeDependencies): Deleted. (JSC::DFG::NaturalLoops::compute): Deleted. * dfg/DFGNaturalLoops.h: (JSC::DFG::NaturalLoops::numLoops): * dfg/DFGNode.h: (JSC::DFG::Node::SuccessorsIterable::end): (JSC::DFG::Node::SuccessorsIterable::size): (JSC::DFG::Node::SuccessorsIterable::at): (JSC::DFG::Node::SuccessorsIterable::operator[]): * dfg/DFGOSREntrypointCreationPhase.cpp: (JSC::DFG::OSREntrypointCreationPhase::run): * dfg/DFGObjectAllocationSinkingPhase.cpp: * dfg/DFGPlan.cpp: (JSC::DFG::Plan::compileInThreadImpl): * dfg/DFGPrePostNumbering.cpp: (JSC::DFG::PrePostNumbering::PrePostNumbering): (JSC::DFG::PrePostNumbering::~PrePostNumbering): (JSC::DFG::PrePostNumbering::compute): Deleted. * dfg/DFGPrePostNumbering.h: (JSC::DFG::PrePostNumbering::preNumber): (JSC::DFG::PrePostNumbering::postNumber): * dfg/DFGPutStackSinkingPhase.cpp: * dfg/DFGSSACalculator.cpp: (JSC::DFG::SSACalculator::nonLocalReachingDef): (JSC::DFG::SSACalculator::reachingDefAtTail): * dfg/DFGSSACalculator.h: (JSC::DFG::SSACalculator::computePhis): * dfg/DFGSSAConversionPhase.cpp: (JSC::DFG::SSAConversionPhase::run): * ftl/FTLLink.cpp: (JSC::FTL::link): * ftl/FTLLowerDFGToLLVM.cpp: (JSC::FTL::DFG::LowerDFGToLLVM::lower): (JSC::FTL::DFG::LowerDFGToLLVM::safelyInvalidateAfterTermination): (JSC::FTL::DFG::LowerDFGToLLVM::isValid): Source/WTF: This takes what used to be DFGDominators.h/DFGDominators.cpp and turns it into a generic algorithm that can take any abstract graph. The idea is that you create Dominators<CFG> and pass it a CFG object, which defines the types of graph nodes and methods for getting successors, predecessors, etc. The DFG now defines a class called CFG, which is a wrapper for DFG::Graph that conforms to the thing that wtf/Dominators.h expects. When doing things to graphs, it's common to refer to the things in the graph as "nodes". Because I intend to reuse the CFG abstraction with many graph algorithms, that abstraction uses the term "node" to refer to a DFG basic block. But in Dominators, the method and variable names still use "block". This is because although Dominators are applicable to any kind of directed graph, it's super unlikely that we will ever use them for anything but compilers. Indeed, the only reason why I'm factoring them out of the DFG is so that I can use them with B3 and Air. This has the nice side effect that a user of WTF::Dominators<JSC::DFG::CFG> will see familiar terminology like "blocksStrictlyDominatedBy(...)" instead of "nodesStrictlyDominatedBy(...)", which would be super confusing. Overall, wtf/Dominators.h is a combination of what used to be in DFGDominators.h, DFGDominators.cpp, DFGNaiveDominators.h, and DFGNaiveDominators.cpp. I only changed code when I had to in order to make it generic. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/Dominators.h: Added. (WTF::Dominators::Dominators): (WTF::Dominators::compute): (WTF::Dominators::strictlyDominates): (WTF::Dominators::dominates): (WTF::Dominators::immediateDominatorOf): (WTF::Dominators::forAllStrictDominatorsOf): (WTF::Dominators::forAllDominatorsOf): (WTF::Dominators::forAllBlocksStrictlyDominatedBy): (WTF::Dominators::forAllBlocksDominatedBy): (WTF::Dominators::strictDominatorsOf): (WTF::Dominators::dominatorsOf): (WTF::Dominators::blocksStrictlyDominatedBy): (WTF::Dominators::blocksDominatedBy): (WTF::Dominators::forAllBlocksInDominanceFrontierOf): (WTF::Dominators::dominanceFrontierOf): (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOf): (WTF::Dominators::forAllBlocksInPrunedIteratedDominanceFrontierOf): (WTF::Dominators::iteratedDominanceFrontierOf): (WTF::Dominators::dump): (WTF::Dominators::LengauerTarjan::LengauerTarjan): (WTF::Dominators::LengauerTarjan::compute): (WTF::Dominators::LengauerTarjan::immediateDominator): (WTF::Dominators::LengauerTarjan::computeDepthFirstPreNumbering): (WTF::Dominators::LengauerTarjan::computeSemiDominatorsAndImplicitImmediateDominators): (WTF::Dominators::LengauerTarjan::computeExplicitImmediateDominators): (WTF::Dominators::LengauerTarjan::link): (WTF::Dominators::LengauerTarjan::eval): (WTF::Dominators::LengauerTarjan::compress): (WTF::Dominators::LengauerTarjan::BlockData::BlockData): (WTF::Dominators::NaiveDominators::NaiveDominators): (WTF::Dominators::NaiveDominators::dominates): (WTF::Dominators::NaiveDominators::dump): (WTF::Dominators::NaiveDominators::pruneDominators): (WTF::Dominators::ValidationContext::ValidationContext): (WTF::Dominators::ValidationContext::reportError): (WTF::Dominators::ValidationContext::handleErrors): (WTF::Dominators::naiveDominates): (WTF::Dominators::forAllBlocksInDominanceFrontierOfImpl): (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOfImpl): (WTF::Dominators::BlockData::BlockData): Canonical link: https://commits.webkit.org/168962@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@191870 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-11-02 00:48:03 +00:00
{
forAllBlocksInPrunedIteratedDominanceFrontierOf(
from,
[&] (typename Graph::Node block) -> bool {
functor(block);
return true;
});
}
// This is a close relative of forAllBlocksInIteratedDominanceFrontierOf(), which allows the
// given functor to return false to indicate that we don't wish to consider the given block.
// Useful for computing pruned SSA form.
template<typename Functor>
void forAllBlocksInPrunedIteratedDominanceFrontierOf(
Support compiling catch in the DFG https://bugs.webkit.org/show_bug.cgi?id=174590 <rdar://problem/34047845> Reviewed by Filip Pizlo. JSTests: * microbenchmarks/delta-blue-try-catch.js: Added. (exception): (value): (OrderedCollection): (OrderedCollection.prototype.add): (OrderedCollection.prototype.at): (OrderedCollection.prototype.size): (OrderedCollection.prototype.removeFirst): (OrderedCollection.prototype.remove): (Strength): (Strength.stronger): (Strength.weaker): (Strength.weakestOf): (Strength.strongest): (Strength.prototype.nextWeaker): (Constraint): (Constraint.prototype.addConstraint): (Constraint.prototype.satisfy): (Constraint.prototype.destroyConstraint): (Constraint.prototype.isInput): (UnaryConstraint): (UnaryConstraint.prototype.addToGraph): (UnaryConstraint.prototype.chooseMethod): (UnaryConstraint.prototype.isSatisfied): (UnaryConstraint.prototype.markInputs): (UnaryConstraint.prototype.output): (UnaryConstraint.prototype.recalculate): (UnaryConstraint.prototype.markUnsatisfied): (UnaryConstraint.prototype.inputsKnown): (UnaryConstraint.prototype.removeFromGraph): (StayConstraint): (StayConstraint.prototype.execute): (EditConstraint.prototype.isInput): (EditConstraint.prototype.execute): (BinaryConstraint): (BinaryConstraint.prototype.chooseMethod): (BinaryConstraint.prototype.addToGraph): (BinaryConstraint.prototype.isSatisfied): (BinaryConstraint.prototype.markInputs): (BinaryConstraint.prototype.input): (BinaryConstraint.prototype.output): (BinaryConstraint.prototype.recalculate): (BinaryConstraint.prototype.markUnsatisfied): (BinaryConstraint.prototype.inputsKnown): (BinaryConstraint.prototype.removeFromGraph): (ScaleConstraint): (ScaleConstraint.prototype.addToGraph): (ScaleConstraint.prototype.removeFromGraph): (ScaleConstraint.prototype.markInputs): (ScaleConstraint.prototype.execute): (ScaleConstraint.prototype.recalculate): (EqualityConstraint): (EqualityConstraint.prototype.execute): (Variable): (Variable.prototype.addConstraint): (Variable.prototype.removeConstraint): (Planner): (Planner.prototype.incrementalAdd): (Planner.prototype.incrementalRemove): (Planner.prototype.newMark): (Planner.prototype.makePlan): (Planner.prototype.extractPlanFromConstraints): (Planner.prototype.addPropagate): (Planner.prototype.removePropagateFrom): (Planner.prototype.addConstraintsConsumingTo): (Plan): (Plan.prototype.addConstraint): (Plan.prototype.size): (Plan.prototype.constraintAt): (Plan.prototype.execute): (chainTest): (projectionTest): (change): (deltaBlue): * microbenchmarks/fake-iterators-that-throw-when-finished.js: Added. (assert): (Numbers): (Numbers.prototype.next): (return.Transpose): (return.Transpose.prototype.next): (transpose): (verifyEven): (verifyString): (foo): (runIterators): * microbenchmarks/try-catch-word-count.js: Added. (let.assert): (EOF): (let.texts): (let.o.apply): (foo): (bar): (f): (run): (test1): (test2): (test3): (fn): (A): (B): (A.prototype.getValue): (B.prototype.getParentValue): (strlen): (sum.0): (test): (result.test.o): (set add.set add): (set forEach): (stringHash): (set if): (testFunction): (set delete.set has.set add): * stress/catch-set-argument-speculation-failure.js: Added. (o): (e): (e2): (escape): (baz): (noInline.run): (noInline): * stress/osr-enter-to-catch-with-set-local-type-check-failure.js: Added. (foo): (e): (baz): (bar): Source/JavaScriptCore: This patch implements OSR entry into op_catch in the DFG. We will support OSR entry into the FTL in a followup: https://bugs.webkit.org/show_bug.cgi?id=175396 To implement catch in the DFG, this patch introduces the concept of multiple entrypoints into CPS/LoadStore DFG IR. A lot of this patch is stringing this concept through the DFG. Many phases used to assume that Graph::block(0) is the only root, and this patch contains many straight forward changes generalizing the code to handle more than one entrypoint. A main building block of this is moving to two CFG types: SSACFG and CPSCFG. SSACFG is the same CFG we used to have. CPSCFG is a new type that introduces a fake root that has an outgoing edge to all the entrypoints. This allows our existing graph algorithms to Just Work over CPSCFG. For example, there is now the concept of SSADominators vs CPSDominators, and SSANaturalLoops vs CPSNaturalLoops. The way we compile the catch entrypoint is by bootstrapping the state of the program by loading all live bytecode locals from a buffer. The OSR entry code will store all live values into that buffer before jumping to the entrypoint. The OSR entry code is also responsible for performing type proofs of the arguments before doing an OSR entry. If there is a type mismatch, it's not legal to OSR enter into the DFG compilation. Currently, each catch entrypoint knows the argument type proofs it must perform to enter into the DFG. Currently, all entrypoints' arguments flush format are unified via ArgumentPosition, but this is just an implementation detail. The code is written more generally to assume that each entrypoint may perform its own distinct proof. op_catch now performs value profiling for all live bytecode locals in the LLInt and baseline JIT. This information is then fed into the DFG via the ExtractCatchLocal node in the prediction propagation phase. This patch also changes how we generate op_catch in bytecode. All op_catches are now split out at the end of the program in bytecode. This ensures that no op_catch is inside a try block. This is needed to ensure correctness in the DFGLiveCatchVariablePreservationPhase. That phase only inserts flushes before SetLocals inside a try block. If an op_catch were in a try block, this would cause the phase to insert a Flush before one of the state bootstrapping SetLocals, which would generate invalid IR. Moving op_catch to be generated on its own at the end of a bytecode stream seemed like the most elegant solution since it better represents that we treat op_catch as an entrypoint. This is true both in the DFG and in the baseline and LLInt: we don't reach an op_catch via normal control flow. Because op_catch cannot throw, this will not break any previous semantics of op_catch. Logically, it'd be valid to split try blocks around any non-throwing bytecode operation. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * bytecode/BytecodeDumper.cpp: (JSC::BytecodeDumper<Block>::dumpBytecode): * bytecode/BytecodeList.json: * bytecode/BytecodeUseDef.h: (JSC::computeUsesForBytecodeOffset): * bytecode/CodeBlock.cpp: (JSC::CodeBlock::finishCreation): (JSC::CodeBlock::ensureCatchLivenessIsComputedForBytecodeOffset): (JSC::CodeBlock::updateAllPredictionsAndCountLiveness): (JSC::CodeBlock::validate): * bytecode/CodeBlock.h: * bytecode/ValueProfile.h: (JSC::ValueProfile::ValueProfile): (JSC::ValueProfileAndOperandBuffer::ValueProfileAndOperandBuffer): (JSC::ValueProfileAndOperandBuffer::~ValueProfileAndOperandBuffer): (JSC::ValueProfileAndOperandBuffer::forEach): * bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::generate): (JSC::BytecodeGenerator::BytecodeGenerator): (JSC::BytecodeGenerator::emitCatch): (JSC::BytecodeGenerator::emitEnumeration): * bytecompiler/BytecodeGenerator.h: * bytecompiler/NodesCodegen.cpp: (JSC::TryNode::emitBytecode): * dfg/DFGAbstractInterpreterInlines.h: (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects): * dfg/DFGBackwardsCFG.h: (JSC::DFG::BackwardsCFG::BackwardsCFG): * dfg/DFGBasicBlock.cpp: (JSC::DFG::BasicBlock::BasicBlock): * dfg/DFGBasicBlock.h: (JSC::DFG::BasicBlock::findTerminal const): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::setDirect): (JSC::DFG::ByteCodeParser::flush): (JSC::DFG::ByteCodeParser::DelayedSetLocal::DelayedSetLocal): (JSC::DFG::ByteCodeParser::DelayedSetLocal::execute): (JSC::DFG::ByteCodeParser::parseBlock): (JSC::DFG::ByteCodeParser::parseCodeBlock): (JSC::DFG::ByteCodeParser::parse): * dfg/DFGCFG.h: (JSC::DFG::CFG::root): (JSC::DFG::CFG::roots): (JSC::DFG::CPSCFG::CPSCFG): (JSC::DFG::selectCFG): * dfg/DFGCPSRethreadingPhase.cpp: (JSC::DFG::CPSRethreadingPhase::specialCaseArguments): * dfg/DFGCSEPhase.cpp: * dfg/DFGClobberize.h: (JSC::DFG::clobberize): * dfg/DFGControlEquivalenceAnalysis.h: (JSC::DFG::ControlEquivalenceAnalysis::ControlEquivalenceAnalysis): * dfg/DFGDCEPhase.cpp: (JSC::DFG::DCEPhase::run): * dfg/DFGDisassembler.cpp: (JSC::DFG::Disassembler::createDumpList): * dfg/DFGDoesGC.cpp: (JSC::DFG::doesGC): * dfg/DFGDominators.h: (JSC::DFG::Dominators::Dominators): (JSC::DFG::ensureDominatorsForCFG): * dfg/DFGEdgeDominates.h: (JSC::DFG::EdgeDominates::EdgeDominates): (JSC::DFG::EdgeDominates::operator()): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): (JSC::DFG::FixupPhase::fixupChecksInBlock): * dfg/DFGFlushFormat.h: * dfg/DFGGraph.cpp: (JSC::DFG::Graph::Graph): (JSC::DFG::unboxLoopNode): (JSC::DFG::Graph::dumpBlockHeader): (JSC::DFG::Graph::dump): (JSC::DFG::Graph::determineReachability): (JSC::DFG::Graph::invalidateCFG): (JSC::DFG::Graph::blocksInPreOrder): (JSC::DFG::Graph::blocksInPostOrder): (JSC::DFG::Graph::ensureCPSDominators): (JSC::DFG::Graph::ensureSSADominators): (JSC::DFG::Graph::ensureCPSNaturalLoops): (JSC::DFG::Graph::ensureSSANaturalLoops): (JSC::DFG::Graph::ensureBackwardsCFG): (JSC::DFG::Graph::ensureBackwardsDominators): (JSC::DFG::Graph::ensureControlEquivalenceAnalysis): (JSC::DFG::Graph::methodOfGettingAValueProfileFor): (JSC::DFG::Graph::clearCPSCFGData): (JSC::DFG::Graph::ensureDominators): Deleted. (JSC::DFG::Graph::ensurePrePostNumbering): Deleted. (JSC::DFG::Graph::ensureNaturalLoops): Deleted. * dfg/DFGGraph.h: (JSC::DFG::Graph::willCatchExceptionInMachineFrame): (JSC::DFG::Graph::isEntrypoint const): * dfg/DFGInPlaceAbstractState.cpp: (JSC::DFG::InPlaceAbstractState::initialize): (JSC::DFG::InPlaceAbstractState::mergeToSuccessors): * dfg/DFGJITCode.cpp: (JSC::DFG::JITCode::shrinkToFit): * dfg/DFGJITCode.h: (JSC::DFG::JITCode::catchOSREntryDataForBytecodeIndex): (JSC::DFG::JITCode::finalizeCatchOSREntrypoints): (JSC::DFG::JITCode::appendCatchEntrypoint): * dfg/DFGJITCompiler.cpp: (JSC::DFG::JITCompiler::compile): (JSC::DFG::JITCompiler::compileFunction): (JSC::DFG::JITCompiler::noticeCatchEntrypoint): (JSC::DFG::JITCompiler::noticeOSREntry): (JSC::DFG::JITCompiler::makeCatchOSREntryBuffer): * dfg/DFGJITCompiler.h: * dfg/DFGLICMPhase.cpp: (JSC::DFG::LICMPhase::run): (JSC::DFG::LICMPhase::attemptHoist): * dfg/DFGLiveCatchVariablePreservationPhase.cpp: (JSC::DFG::LiveCatchVariablePreservationPhase::run): (JSC::DFG::LiveCatchVariablePreservationPhase::isValidFlushLocation): (JSC::DFG::LiveCatchVariablePreservationPhase::handleBlockForTryCatch): (JSC::DFG::LiveCatchVariablePreservationPhase::newVariableAccessData): (JSC::DFG::LiveCatchVariablePreservationPhase::willCatchException): Deleted. (JSC::DFG::LiveCatchVariablePreservationPhase::handleBlock): Deleted. * dfg/DFGLoopPreHeaderCreationPhase.cpp: (JSC::DFG::createPreHeader): (JSC::DFG::LoopPreHeaderCreationPhase::run): * dfg/DFGMaximalFlushInsertionPhase.cpp: (JSC::DFG::MaximalFlushInsertionPhase::run): (JSC::DFG::MaximalFlushInsertionPhase::treatRegularBlock): (JSC::DFG::MaximalFlushInsertionPhase::treatRootBlock): * dfg/DFGMayExit.cpp: * dfg/DFGNaturalLoops.h: (JSC::DFG::NaturalLoops::NaturalLoops): * dfg/DFGNode.h: (JSC::DFG::Node::isSwitch const): (JSC::DFG::Node::successor): (JSC::DFG::Node::catchOSREntryIndex const): (JSC::DFG::Node::catchLocalPrediction): (JSC::DFG::Node::isSwitch): Deleted. * dfg/DFGNodeType.h: * dfg/DFGOSREntry.cpp: (JSC::DFG::prepareCatchOSREntry): * dfg/DFGOSREntry.h: * dfg/DFGOSREntrypointCreationPhase.cpp: (JSC::DFG::OSREntrypointCreationPhase::run): * dfg/DFGOSRExitCompilerCommon.cpp: (JSC::DFG::handleExitCounts): * dfg/DFGObjectAllocationSinkingPhase.cpp: * dfg/DFGPlan.cpp: (JSC::DFG::Plan::compileInThreadImpl): * dfg/DFGPrePostNumbering.cpp: (JSC::DFG::PrePostNumbering::PrePostNumbering): Deleted. (JSC::DFG::PrePostNumbering::~PrePostNumbering): Deleted. (WTF::printInternal): Deleted. * dfg/DFGPrePostNumbering.h: (): Deleted. (JSC::DFG::PrePostNumbering::preNumber const): Deleted. (JSC::DFG::PrePostNumbering::postNumber const): Deleted. (JSC::DFG::PrePostNumbering::isStrictAncestorOf const): Deleted. (JSC::DFG::PrePostNumbering::isAncestorOf const): Deleted. (JSC::DFG::PrePostNumbering::isStrictDescendantOf const): Deleted. (JSC::DFG::PrePostNumbering::isDescendantOf const): Deleted. (JSC::DFG::PrePostNumbering::edgeKind const): Deleted. * dfg/DFGPredictionInjectionPhase.cpp: (JSC::DFG::PredictionInjectionPhase::run): * dfg/DFGPredictionPropagationPhase.cpp: * dfg/DFGPutStackSinkingPhase.cpp: * dfg/DFGSSACalculator.cpp: (JSC::DFG::SSACalculator::nonLocalReachingDef): (JSC::DFG::SSACalculator::reachingDefAtTail): * dfg/DFGSSACalculator.h: (JSC::DFG::SSACalculator::computePhis): * dfg/DFGSSAConversionPhase.cpp: (JSC::DFG::SSAConversionPhase::run): (JSC::DFG::performSSAConversion): * dfg/DFGSafeToExecute.h: (JSC::DFG::safeToExecute): * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::compileCurrentBlock): (JSC::DFG::SpeculativeJIT::checkArgumentTypes): (JSC::DFG::SpeculativeJIT::createOSREntries): (JSC::DFG::SpeculativeJIT::linkOSREntries): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGStaticExecutionCountEstimationPhase.cpp: (JSC::DFG::StaticExecutionCountEstimationPhase::run): * dfg/DFGStrengthReductionPhase.cpp: (JSC::DFG::StrengthReductionPhase::handleNode): * dfg/DFGTierUpCheckInjectionPhase.cpp: (JSC::DFG::TierUpCheckInjectionPhase::run): (JSC::DFG::TierUpCheckInjectionPhase::buildNaturalLoopToLoopHintMap): * dfg/DFGTypeCheckHoistingPhase.cpp: (JSC::DFG::TypeCheckHoistingPhase::run): * dfg/DFGValidate.cpp: * ftl/FTLLink.cpp: (JSC::FTL::link): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::lower): (JSC::FTL::DFG::LowerDFGToB3::safelyInvalidateAfterTermination): (JSC::FTL::DFG::LowerDFGToB3::isValid): * jit/JIT.h: * jit/JITInlines.h: (JSC::JIT::callOperation): * jit/JITOpcodes.cpp: (JSC::JIT::emit_op_catch): * jit/JITOpcodes32_64.cpp: (JSC::JIT::emit_op_catch): * jit/JITOperations.cpp: * jit/JITOperations.h: * llint/LLIntSlowPaths.cpp: (JSC::LLInt::LLINT_SLOW_PATH_DECL): * llint/LLIntSlowPaths.h: * llint/LowLevelInterpreter32_64.asm: * llint/LowLevelInterpreter64.asm: Source/WTF: This patch generalizes the BackwardsGraph fake root into a more generalizable class called SingleRootGraph. SingleRootGraph exposes the general graph interface used in Dominators and NaturalLoops. SingleRootGraph takes as input a graph with the normal graph interface, but also allows the input graph to contain more than one root. SingleRootGraph then exposes a single root, which it creates, that has an outgoing edge to all the roots in the original graph. * WTF.xcodeproj/project.pbxproj: * wtf/BackwardsGraph.h: (WTF::BackwardsGraph::dump const): (WTF::BackwardsGraph::rootName): Deleted. (WTF::BackwardsGraph::Node::Node): Deleted. (WTF::BackwardsGraph::Node::root): Deleted. (WTF::BackwardsGraph::Node::operator== const): Deleted. (WTF::BackwardsGraph::Node::operator!= const): Deleted. (WTF::BackwardsGraph::Node::operator bool const): Deleted. (WTF::BackwardsGraph::Node::isRoot const): Deleted. (WTF::BackwardsGraph::Node::node const): Deleted. (): Deleted. (WTF::BackwardsGraph::Set::Set): Deleted. (WTF::BackwardsGraph::Set::add): Deleted. (WTF::BackwardsGraph::Set::remove): Deleted. (WTF::BackwardsGraph::Set::contains): Deleted. (WTF::BackwardsGraph::Set::dump const): Deleted. (WTF::BackwardsGraph::Map::Map): Deleted. (WTF::BackwardsGraph::Map::clear): Deleted. (WTF::BackwardsGraph::Map::size const): Deleted. (WTF::BackwardsGraph::Map::operator[]): Deleted. (WTF::BackwardsGraph::Map::operator[] const): Deleted. * wtf/Dominators.h: (WTF::Dominators::Dominators): (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOf): (WTF::Dominators::forAllBlocksInPrunedIteratedDominanceFrontierOf): (WTF::Dominators::iteratedDominanceFrontierOf const): (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOfImpl const): * wtf/SingleRootGraph.h: Added. (WTF::SingleRootGraphNode::rootName): (WTF::SingleRootGraphNode::SingleRootGraphNode): (WTF::SingleRootGraphNode::root): (WTF::SingleRootGraphNode::operator== const): (WTF::SingleRootGraphNode::operator!= const): (WTF::SingleRootGraphNode::operator bool const): (WTF::SingleRootGraphNode::isRoot const): (WTF::SingleRootGraphNode::node const): (WTF::SingleRootGraphSet::add): (WTF::SingleRootGraphSet::remove): (WTF::SingleRootGraphSet::contains): (WTF::SingleRootGraphSet::dump const): (WTF::SingleRootMap::SingleRootMap): (WTF::SingleRootMap::clear): (WTF::SingleRootMap::size const): (WTF::SingleRootMap::operator[]): (WTF::SingleRootMap::operator[] const): (WTF::SingleRootGraph::SingleRootGraph): (WTF::SingleRootGraph::root const): (WTF::SingleRootGraph::newMap): (WTF::SingleRootGraph::successors const): (WTF::SingleRootGraph::predecessors const): (WTF::SingleRootGraph::index const): (WTF::SingleRootGraph::node const): (WTF::SingleRootGraph::numNodes const): (WTF::SingleRootGraph::dump const): (WTF::SingleRootGraph::assertIsConsistent const): Canonical link: https://commits.webkit.org/192644@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@221196 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-08-25 18:26:15 +00:00
const List& from, const Functor& functor)
Dominators should be factored out of the DFG https://bugs.webkit.org/show_bug.cgi?id=150764 Reviewed by Geoffrey Garen. Source/JavaScriptCore: Factored DFGDominators.h/DFGDominators.cpp into WTF. To do this, I made two changes to the DFG: 1) DFG now has a CFG abstraction called DFG::CFG. The cool thing about this is that in the future if we wanted to support inverted dominators, we could do it by just creating a DFG::BackwardCFG. 2) Got rid of DFG::Analysis. From now on, an Analysis being invalidated is expressed by the DFG::Graph having a null pointer for that analysis. When we "run" the analysis, we just instantiate it. This makes it much more natural to integrate WTF::Dominators into the DFG. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * dfg/DFGAnalysis.h: Removed. * dfg/DFGCFG.h: Added. (JSC::DFG::CFG::CFG): (JSC::DFG::CFG::root): (JSC::DFG::CFG::newMap<T>): (JSC::DFG::CFG::successors): (JSC::DFG::CFG::predecessors): (JSC::DFG::CFG::index): (JSC::DFG::CFG::node): (JSC::DFG::CFG::numNodes): (JSC::DFG::CFG::dump): * dfg/DFGCSEPhase.cpp: * dfg/DFGDisassembler.cpp: (JSC::DFG::Disassembler::createDumpList): * dfg/DFGDominators.cpp: Removed. * dfg/DFGDominators.h: (JSC::DFG::Dominators::Dominators): (JSC::DFG::Dominators::strictlyDominates): Deleted. (JSC::DFG::Dominators::dominates): Deleted. (JSC::DFG::Dominators::immediateDominatorOf): Deleted. (JSC::DFG::Dominators::forAllStrictDominatorsOf): Deleted. (JSC::DFG::Dominators::forAllDominatorsOf): Deleted. (JSC::DFG::Dominators::forAllBlocksStrictlyDominatedBy): Deleted. (JSC::DFG::Dominators::forAllBlocksDominatedBy): Deleted. (JSC::DFG::Dominators::forAllBlocksInDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInIteratedDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInPrunedIteratedDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInDominanceFrontierOfImpl): Deleted. (JSC::DFG::Dominators::forAllBlocksInIteratedDominanceFrontierOfImpl): Deleted. (JSC::DFG::Dominators::BlockData::BlockData): Deleted. * dfg/DFGEdgeDominates.h: (JSC::DFG::EdgeDominates::operator()): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::Graph): (JSC::DFG::Graph::dumpBlockHeader): (JSC::DFG::Graph::invalidateCFG): (JSC::DFG::Graph::substituteGetLocal): (JSC::DFG::Graph::handleAssertionFailure): (JSC::DFG::Graph::ensureDominators): (JSC::DFG::Graph::ensurePrePostNumbering): (JSC::DFG::Graph::ensureNaturalLoops): (JSC::DFG::Graph::valueProfileFor): * dfg/DFGGraph.h: (JSC::DFG::Graph::hasDebuggerEnabled): * dfg/DFGLICMPhase.cpp: (JSC::DFG::LICMPhase::run): (JSC::DFG::LICMPhase::attemptHoist): * dfg/DFGLoopPreHeaderCreationPhase.cpp: (JSC::DFG::createPreHeader): (JSC::DFG::LoopPreHeaderCreationPhase::run): * dfg/DFGNaturalLoops.cpp: (JSC::DFG::NaturalLoop::dump): (JSC::DFG::NaturalLoops::NaturalLoops): (JSC::DFG::NaturalLoops::~NaturalLoops): (JSC::DFG::NaturalLoops::loopsOf): (JSC::DFG::NaturalLoops::computeDependencies): Deleted. (JSC::DFG::NaturalLoops::compute): Deleted. * dfg/DFGNaturalLoops.h: (JSC::DFG::NaturalLoops::numLoops): * dfg/DFGNode.h: (JSC::DFG::Node::SuccessorsIterable::end): (JSC::DFG::Node::SuccessorsIterable::size): (JSC::DFG::Node::SuccessorsIterable::at): (JSC::DFG::Node::SuccessorsIterable::operator[]): * dfg/DFGOSREntrypointCreationPhase.cpp: (JSC::DFG::OSREntrypointCreationPhase::run): * dfg/DFGObjectAllocationSinkingPhase.cpp: * dfg/DFGPlan.cpp: (JSC::DFG::Plan::compileInThreadImpl): * dfg/DFGPrePostNumbering.cpp: (JSC::DFG::PrePostNumbering::PrePostNumbering): (JSC::DFG::PrePostNumbering::~PrePostNumbering): (JSC::DFG::PrePostNumbering::compute): Deleted. * dfg/DFGPrePostNumbering.h: (JSC::DFG::PrePostNumbering::preNumber): (JSC::DFG::PrePostNumbering::postNumber): * dfg/DFGPutStackSinkingPhase.cpp: * dfg/DFGSSACalculator.cpp: (JSC::DFG::SSACalculator::nonLocalReachingDef): (JSC::DFG::SSACalculator::reachingDefAtTail): * dfg/DFGSSACalculator.h: (JSC::DFG::SSACalculator::computePhis): * dfg/DFGSSAConversionPhase.cpp: (JSC::DFG::SSAConversionPhase::run): * ftl/FTLLink.cpp: (JSC::FTL::link): * ftl/FTLLowerDFGToLLVM.cpp: (JSC::FTL::DFG::LowerDFGToLLVM::lower): (JSC::FTL::DFG::LowerDFGToLLVM::safelyInvalidateAfterTermination): (JSC::FTL::DFG::LowerDFGToLLVM::isValid): Source/WTF: This takes what used to be DFGDominators.h/DFGDominators.cpp and turns it into a generic algorithm that can take any abstract graph. The idea is that you create Dominators<CFG> and pass it a CFG object, which defines the types of graph nodes and methods for getting successors, predecessors, etc. The DFG now defines a class called CFG, which is a wrapper for DFG::Graph that conforms to the thing that wtf/Dominators.h expects. When doing things to graphs, it's common to refer to the things in the graph as "nodes". Because I intend to reuse the CFG abstraction with many graph algorithms, that abstraction uses the term "node" to refer to a DFG basic block. But in Dominators, the method and variable names still use "block". This is because although Dominators are applicable to any kind of directed graph, it's super unlikely that we will ever use them for anything but compilers. Indeed, the only reason why I'm factoring them out of the DFG is so that I can use them with B3 and Air. This has the nice side effect that a user of WTF::Dominators<JSC::DFG::CFG> will see familiar terminology like "blocksStrictlyDominatedBy(...)" instead of "nodesStrictlyDominatedBy(...)", which would be super confusing. Overall, wtf/Dominators.h is a combination of what used to be in DFGDominators.h, DFGDominators.cpp, DFGNaiveDominators.h, and DFGNaiveDominators.cpp. I only changed code when I had to in order to make it generic. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/Dominators.h: Added. (WTF::Dominators::Dominators): (WTF::Dominators::compute): (WTF::Dominators::strictlyDominates): (WTF::Dominators::dominates): (WTF::Dominators::immediateDominatorOf): (WTF::Dominators::forAllStrictDominatorsOf): (WTF::Dominators::forAllDominatorsOf): (WTF::Dominators::forAllBlocksStrictlyDominatedBy): (WTF::Dominators::forAllBlocksDominatedBy): (WTF::Dominators::strictDominatorsOf): (WTF::Dominators::dominatorsOf): (WTF::Dominators::blocksStrictlyDominatedBy): (WTF::Dominators::blocksDominatedBy): (WTF::Dominators::forAllBlocksInDominanceFrontierOf): (WTF::Dominators::dominanceFrontierOf): (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOf): (WTF::Dominators::forAllBlocksInPrunedIteratedDominanceFrontierOf): (WTF::Dominators::iteratedDominanceFrontierOf): (WTF::Dominators::dump): (WTF::Dominators::LengauerTarjan::LengauerTarjan): (WTF::Dominators::LengauerTarjan::compute): (WTF::Dominators::LengauerTarjan::immediateDominator): (WTF::Dominators::LengauerTarjan::computeDepthFirstPreNumbering): (WTF::Dominators::LengauerTarjan::computeSemiDominatorsAndImplicitImmediateDominators): (WTF::Dominators::LengauerTarjan::computeExplicitImmediateDominators): (WTF::Dominators::LengauerTarjan::link): (WTF::Dominators::LengauerTarjan::eval): (WTF::Dominators::LengauerTarjan::compress): (WTF::Dominators::LengauerTarjan::BlockData::BlockData): (WTF::Dominators::NaiveDominators::NaiveDominators): (WTF::Dominators::NaiveDominators::dominates): (WTF::Dominators::NaiveDominators::dump): (WTF::Dominators::NaiveDominators::pruneDominators): (WTF::Dominators::ValidationContext::ValidationContext): (WTF::Dominators::ValidationContext::reportError): (WTF::Dominators::ValidationContext::handleErrors): (WTF::Dominators::naiveDominates): (WTF::Dominators::forAllBlocksInDominanceFrontierOfImpl): (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOfImpl): (WTF::Dominators::BlockData::BlockData): Canonical link: https://commits.webkit.org/168962@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@191870 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-11-02 00:48:03 +00:00
{
typename Graph::Set set;
forAllBlocksInIteratedDominanceFrontierOfImpl(
from,
[&] (typename Graph::Node block) -> bool {
if (!set.add(block))
return false;
return functor(block);
});
}
Support compiling catch in the DFG https://bugs.webkit.org/show_bug.cgi?id=174590 <rdar://problem/34047845> Reviewed by Filip Pizlo. JSTests: * microbenchmarks/delta-blue-try-catch.js: Added. (exception): (value): (OrderedCollection): (OrderedCollection.prototype.add): (OrderedCollection.prototype.at): (OrderedCollection.prototype.size): (OrderedCollection.prototype.removeFirst): (OrderedCollection.prototype.remove): (Strength): (Strength.stronger): (Strength.weaker): (Strength.weakestOf): (Strength.strongest): (Strength.prototype.nextWeaker): (Constraint): (Constraint.prototype.addConstraint): (Constraint.prototype.satisfy): (Constraint.prototype.destroyConstraint): (Constraint.prototype.isInput): (UnaryConstraint): (UnaryConstraint.prototype.addToGraph): (UnaryConstraint.prototype.chooseMethod): (UnaryConstraint.prototype.isSatisfied): (UnaryConstraint.prototype.markInputs): (UnaryConstraint.prototype.output): (UnaryConstraint.prototype.recalculate): (UnaryConstraint.prototype.markUnsatisfied): (UnaryConstraint.prototype.inputsKnown): (UnaryConstraint.prototype.removeFromGraph): (StayConstraint): (StayConstraint.prototype.execute): (EditConstraint.prototype.isInput): (EditConstraint.prototype.execute): (BinaryConstraint): (BinaryConstraint.prototype.chooseMethod): (BinaryConstraint.prototype.addToGraph): (BinaryConstraint.prototype.isSatisfied): (BinaryConstraint.prototype.markInputs): (BinaryConstraint.prototype.input): (BinaryConstraint.prototype.output): (BinaryConstraint.prototype.recalculate): (BinaryConstraint.prototype.markUnsatisfied): (BinaryConstraint.prototype.inputsKnown): (BinaryConstraint.prototype.removeFromGraph): (ScaleConstraint): (ScaleConstraint.prototype.addToGraph): (ScaleConstraint.prototype.removeFromGraph): (ScaleConstraint.prototype.markInputs): (ScaleConstraint.prototype.execute): (ScaleConstraint.prototype.recalculate): (EqualityConstraint): (EqualityConstraint.prototype.execute): (Variable): (Variable.prototype.addConstraint): (Variable.prototype.removeConstraint): (Planner): (Planner.prototype.incrementalAdd): (Planner.prototype.incrementalRemove): (Planner.prototype.newMark): (Planner.prototype.makePlan): (Planner.prototype.extractPlanFromConstraints): (Planner.prototype.addPropagate): (Planner.prototype.removePropagateFrom): (Planner.prototype.addConstraintsConsumingTo): (Plan): (Plan.prototype.addConstraint): (Plan.prototype.size): (Plan.prototype.constraintAt): (Plan.prototype.execute): (chainTest): (projectionTest): (change): (deltaBlue): * microbenchmarks/fake-iterators-that-throw-when-finished.js: Added. (assert): (Numbers): (Numbers.prototype.next): (return.Transpose): (return.Transpose.prototype.next): (transpose): (verifyEven): (verifyString): (foo): (runIterators): * microbenchmarks/try-catch-word-count.js: Added. (let.assert): (EOF): (let.texts): (let.o.apply): (foo): (bar): (f): (run): (test1): (test2): (test3): (fn): (A): (B): (A.prototype.getValue): (B.prototype.getParentValue): (strlen): (sum.0): (test): (result.test.o): (set add.set add): (set forEach): (stringHash): (set if): (testFunction): (set delete.set has.set add): * stress/catch-set-argument-speculation-failure.js: Added. (o): (e): (e2): (escape): (baz): (noInline.run): (noInline): * stress/osr-enter-to-catch-with-set-local-type-check-failure.js: Added. (foo): (e): (baz): (bar): Source/JavaScriptCore: This patch implements OSR entry into op_catch in the DFG. We will support OSR entry into the FTL in a followup: https://bugs.webkit.org/show_bug.cgi?id=175396 To implement catch in the DFG, this patch introduces the concept of multiple entrypoints into CPS/LoadStore DFG IR. A lot of this patch is stringing this concept through the DFG. Many phases used to assume that Graph::block(0) is the only root, and this patch contains many straight forward changes generalizing the code to handle more than one entrypoint. A main building block of this is moving to two CFG types: SSACFG and CPSCFG. SSACFG is the same CFG we used to have. CPSCFG is a new type that introduces a fake root that has an outgoing edge to all the entrypoints. This allows our existing graph algorithms to Just Work over CPSCFG. For example, there is now the concept of SSADominators vs CPSDominators, and SSANaturalLoops vs CPSNaturalLoops. The way we compile the catch entrypoint is by bootstrapping the state of the program by loading all live bytecode locals from a buffer. The OSR entry code will store all live values into that buffer before jumping to the entrypoint. The OSR entry code is also responsible for performing type proofs of the arguments before doing an OSR entry. If there is a type mismatch, it's not legal to OSR enter into the DFG compilation. Currently, each catch entrypoint knows the argument type proofs it must perform to enter into the DFG. Currently, all entrypoints' arguments flush format are unified via ArgumentPosition, but this is just an implementation detail. The code is written more generally to assume that each entrypoint may perform its own distinct proof. op_catch now performs value profiling for all live bytecode locals in the LLInt and baseline JIT. This information is then fed into the DFG via the ExtractCatchLocal node in the prediction propagation phase. This patch also changes how we generate op_catch in bytecode. All op_catches are now split out at the end of the program in bytecode. This ensures that no op_catch is inside a try block. This is needed to ensure correctness in the DFGLiveCatchVariablePreservationPhase. That phase only inserts flushes before SetLocals inside a try block. If an op_catch were in a try block, this would cause the phase to insert a Flush before one of the state bootstrapping SetLocals, which would generate invalid IR. Moving op_catch to be generated on its own at the end of a bytecode stream seemed like the most elegant solution since it better represents that we treat op_catch as an entrypoint. This is true both in the DFG and in the baseline and LLInt: we don't reach an op_catch via normal control flow. Because op_catch cannot throw, this will not break any previous semantics of op_catch. Logically, it'd be valid to split try blocks around any non-throwing bytecode operation. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * bytecode/BytecodeDumper.cpp: (JSC::BytecodeDumper<Block>::dumpBytecode): * bytecode/BytecodeList.json: * bytecode/BytecodeUseDef.h: (JSC::computeUsesForBytecodeOffset): * bytecode/CodeBlock.cpp: (JSC::CodeBlock::finishCreation): (JSC::CodeBlock::ensureCatchLivenessIsComputedForBytecodeOffset): (JSC::CodeBlock::updateAllPredictionsAndCountLiveness): (JSC::CodeBlock::validate): * bytecode/CodeBlock.h: * bytecode/ValueProfile.h: (JSC::ValueProfile::ValueProfile): (JSC::ValueProfileAndOperandBuffer::ValueProfileAndOperandBuffer): (JSC::ValueProfileAndOperandBuffer::~ValueProfileAndOperandBuffer): (JSC::ValueProfileAndOperandBuffer::forEach): * bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::generate): (JSC::BytecodeGenerator::BytecodeGenerator): (JSC::BytecodeGenerator::emitCatch): (JSC::BytecodeGenerator::emitEnumeration): * bytecompiler/BytecodeGenerator.h: * bytecompiler/NodesCodegen.cpp: (JSC::TryNode::emitBytecode): * dfg/DFGAbstractInterpreterInlines.h: (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects): * dfg/DFGBackwardsCFG.h: (JSC::DFG::BackwardsCFG::BackwardsCFG): * dfg/DFGBasicBlock.cpp: (JSC::DFG::BasicBlock::BasicBlock): * dfg/DFGBasicBlock.h: (JSC::DFG::BasicBlock::findTerminal const): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::setDirect): (JSC::DFG::ByteCodeParser::flush): (JSC::DFG::ByteCodeParser::DelayedSetLocal::DelayedSetLocal): (JSC::DFG::ByteCodeParser::DelayedSetLocal::execute): (JSC::DFG::ByteCodeParser::parseBlock): (JSC::DFG::ByteCodeParser::parseCodeBlock): (JSC::DFG::ByteCodeParser::parse): * dfg/DFGCFG.h: (JSC::DFG::CFG::root): (JSC::DFG::CFG::roots): (JSC::DFG::CPSCFG::CPSCFG): (JSC::DFG::selectCFG): * dfg/DFGCPSRethreadingPhase.cpp: (JSC::DFG::CPSRethreadingPhase::specialCaseArguments): * dfg/DFGCSEPhase.cpp: * dfg/DFGClobberize.h: (JSC::DFG::clobberize): * dfg/DFGControlEquivalenceAnalysis.h: (JSC::DFG::ControlEquivalenceAnalysis::ControlEquivalenceAnalysis): * dfg/DFGDCEPhase.cpp: (JSC::DFG::DCEPhase::run): * dfg/DFGDisassembler.cpp: (JSC::DFG::Disassembler::createDumpList): * dfg/DFGDoesGC.cpp: (JSC::DFG::doesGC): * dfg/DFGDominators.h: (JSC::DFG::Dominators::Dominators): (JSC::DFG::ensureDominatorsForCFG): * dfg/DFGEdgeDominates.h: (JSC::DFG::EdgeDominates::EdgeDominates): (JSC::DFG::EdgeDominates::operator()): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): (JSC::DFG::FixupPhase::fixupChecksInBlock): * dfg/DFGFlushFormat.h: * dfg/DFGGraph.cpp: (JSC::DFG::Graph::Graph): (JSC::DFG::unboxLoopNode): (JSC::DFG::Graph::dumpBlockHeader): (JSC::DFG::Graph::dump): (JSC::DFG::Graph::determineReachability): (JSC::DFG::Graph::invalidateCFG): (JSC::DFG::Graph::blocksInPreOrder): (JSC::DFG::Graph::blocksInPostOrder): (JSC::DFG::Graph::ensureCPSDominators): (JSC::DFG::Graph::ensureSSADominators): (JSC::DFG::Graph::ensureCPSNaturalLoops): (JSC::DFG::Graph::ensureSSANaturalLoops): (JSC::DFG::Graph::ensureBackwardsCFG): (JSC::DFG::Graph::ensureBackwardsDominators): (JSC::DFG::Graph::ensureControlEquivalenceAnalysis): (JSC::DFG::Graph::methodOfGettingAValueProfileFor): (JSC::DFG::Graph::clearCPSCFGData): (JSC::DFG::Graph::ensureDominators): Deleted. (JSC::DFG::Graph::ensurePrePostNumbering): Deleted. (JSC::DFG::Graph::ensureNaturalLoops): Deleted. * dfg/DFGGraph.h: (JSC::DFG::Graph::willCatchExceptionInMachineFrame): (JSC::DFG::Graph::isEntrypoint const): * dfg/DFGInPlaceAbstractState.cpp: (JSC::DFG::InPlaceAbstractState::initialize): (JSC::DFG::InPlaceAbstractState::mergeToSuccessors): * dfg/DFGJITCode.cpp: (JSC::DFG::JITCode::shrinkToFit): * dfg/DFGJITCode.h: (JSC::DFG::JITCode::catchOSREntryDataForBytecodeIndex): (JSC::DFG::JITCode::finalizeCatchOSREntrypoints): (JSC::DFG::JITCode::appendCatchEntrypoint): * dfg/DFGJITCompiler.cpp: (JSC::DFG::JITCompiler::compile): (JSC::DFG::JITCompiler::compileFunction): (JSC::DFG::JITCompiler::noticeCatchEntrypoint): (JSC::DFG::JITCompiler::noticeOSREntry): (JSC::DFG::JITCompiler::makeCatchOSREntryBuffer): * dfg/DFGJITCompiler.h: * dfg/DFGLICMPhase.cpp: (JSC::DFG::LICMPhase::run): (JSC::DFG::LICMPhase::attemptHoist): * dfg/DFGLiveCatchVariablePreservationPhase.cpp: (JSC::DFG::LiveCatchVariablePreservationPhase::run): (JSC::DFG::LiveCatchVariablePreservationPhase::isValidFlushLocation): (JSC::DFG::LiveCatchVariablePreservationPhase::handleBlockForTryCatch): (JSC::DFG::LiveCatchVariablePreservationPhase::newVariableAccessData): (JSC::DFG::LiveCatchVariablePreservationPhase::willCatchException): Deleted. (JSC::DFG::LiveCatchVariablePreservationPhase::handleBlock): Deleted. * dfg/DFGLoopPreHeaderCreationPhase.cpp: (JSC::DFG::createPreHeader): (JSC::DFG::LoopPreHeaderCreationPhase::run): * dfg/DFGMaximalFlushInsertionPhase.cpp: (JSC::DFG::MaximalFlushInsertionPhase::run): (JSC::DFG::MaximalFlushInsertionPhase::treatRegularBlock): (JSC::DFG::MaximalFlushInsertionPhase::treatRootBlock): * dfg/DFGMayExit.cpp: * dfg/DFGNaturalLoops.h: (JSC::DFG::NaturalLoops::NaturalLoops): * dfg/DFGNode.h: (JSC::DFG::Node::isSwitch const): (JSC::DFG::Node::successor): (JSC::DFG::Node::catchOSREntryIndex const): (JSC::DFG::Node::catchLocalPrediction): (JSC::DFG::Node::isSwitch): Deleted. * dfg/DFGNodeType.h: * dfg/DFGOSREntry.cpp: (JSC::DFG::prepareCatchOSREntry): * dfg/DFGOSREntry.h: * dfg/DFGOSREntrypointCreationPhase.cpp: (JSC::DFG::OSREntrypointCreationPhase::run): * dfg/DFGOSRExitCompilerCommon.cpp: (JSC::DFG::handleExitCounts): * dfg/DFGObjectAllocationSinkingPhase.cpp: * dfg/DFGPlan.cpp: (JSC::DFG::Plan::compileInThreadImpl): * dfg/DFGPrePostNumbering.cpp: (JSC::DFG::PrePostNumbering::PrePostNumbering): Deleted. (JSC::DFG::PrePostNumbering::~PrePostNumbering): Deleted. (WTF::printInternal): Deleted. * dfg/DFGPrePostNumbering.h: (): Deleted. (JSC::DFG::PrePostNumbering::preNumber const): Deleted. (JSC::DFG::PrePostNumbering::postNumber const): Deleted. (JSC::DFG::PrePostNumbering::isStrictAncestorOf const): Deleted. (JSC::DFG::PrePostNumbering::isAncestorOf const): Deleted. (JSC::DFG::PrePostNumbering::isStrictDescendantOf const): Deleted. (JSC::DFG::PrePostNumbering::isDescendantOf const): Deleted. (JSC::DFG::PrePostNumbering::edgeKind const): Deleted. * dfg/DFGPredictionInjectionPhase.cpp: (JSC::DFG::PredictionInjectionPhase::run): * dfg/DFGPredictionPropagationPhase.cpp: * dfg/DFGPutStackSinkingPhase.cpp: * dfg/DFGSSACalculator.cpp: (JSC::DFG::SSACalculator::nonLocalReachingDef): (JSC::DFG::SSACalculator::reachingDefAtTail): * dfg/DFGSSACalculator.h: (JSC::DFG::SSACalculator::computePhis): * dfg/DFGSSAConversionPhase.cpp: (JSC::DFG::SSAConversionPhase::run): (JSC::DFG::performSSAConversion): * dfg/DFGSafeToExecute.h: (JSC::DFG::safeToExecute): * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::compileCurrentBlock): (JSC::DFG::SpeculativeJIT::checkArgumentTypes): (JSC::DFG::SpeculativeJIT::createOSREntries): (JSC::DFG::SpeculativeJIT::linkOSREntries): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGStaticExecutionCountEstimationPhase.cpp: (JSC::DFG::StaticExecutionCountEstimationPhase::run): * dfg/DFGStrengthReductionPhase.cpp: (JSC::DFG::StrengthReductionPhase::handleNode): * dfg/DFGTierUpCheckInjectionPhase.cpp: (JSC::DFG::TierUpCheckInjectionPhase::run): (JSC::DFG::TierUpCheckInjectionPhase::buildNaturalLoopToLoopHintMap): * dfg/DFGTypeCheckHoistingPhase.cpp: (JSC::DFG::TypeCheckHoistingPhase::run): * dfg/DFGValidate.cpp: * ftl/FTLLink.cpp: (JSC::FTL::link): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::lower): (JSC::FTL::DFG::LowerDFGToB3::safelyInvalidateAfterTermination): (JSC::FTL::DFG::LowerDFGToB3::isValid): * jit/JIT.h: * jit/JITInlines.h: (JSC::JIT::callOperation): * jit/JITOpcodes.cpp: (JSC::JIT::emit_op_catch): * jit/JITOpcodes32_64.cpp: (JSC::JIT::emit_op_catch): * jit/JITOperations.cpp: * jit/JITOperations.h: * llint/LLIntSlowPaths.cpp: (JSC::LLInt::LLINT_SLOW_PATH_DECL): * llint/LLIntSlowPaths.h: * llint/LowLevelInterpreter32_64.asm: * llint/LowLevelInterpreter64.asm: Source/WTF: This patch generalizes the BackwardsGraph fake root into a more generalizable class called SingleRootGraph. SingleRootGraph exposes the general graph interface used in Dominators and NaturalLoops. SingleRootGraph takes as input a graph with the normal graph interface, but also allows the input graph to contain more than one root. SingleRootGraph then exposes a single root, which it creates, that has an outgoing edge to all the roots in the original graph. * WTF.xcodeproj/project.pbxproj: * wtf/BackwardsGraph.h: (WTF::BackwardsGraph::dump const): (WTF::BackwardsGraph::rootName): Deleted. (WTF::BackwardsGraph::Node::Node): Deleted. (WTF::BackwardsGraph::Node::root): Deleted. (WTF::BackwardsGraph::Node::operator== const): Deleted. (WTF::BackwardsGraph::Node::operator!= const): Deleted. (WTF::BackwardsGraph::Node::operator bool const): Deleted. (WTF::BackwardsGraph::Node::isRoot const): Deleted. (WTF::BackwardsGraph::Node::node const): Deleted. (): Deleted. (WTF::BackwardsGraph::Set::Set): Deleted. (WTF::BackwardsGraph::Set::add): Deleted. (WTF::BackwardsGraph::Set::remove): Deleted. (WTF::BackwardsGraph::Set::contains): Deleted. (WTF::BackwardsGraph::Set::dump const): Deleted. (WTF::BackwardsGraph::Map::Map): Deleted. (WTF::BackwardsGraph::Map::clear): Deleted. (WTF::BackwardsGraph::Map::size const): Deleted. (WTF::BackwardsGraph::Map::operator[]): Deleted. (WTF::BackwardsGraph::Map::operator[] const): Deleted. * wtf/Dominators.h: (WTF::Dominators::Dominators): (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOf): (WTF::Dominators::forAllBlocksInPrunedIteratedDominanceFrontierOf): (WTF::Dominators::iteratedDominanceFrontierOf const): (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOfImpl const): * wtf/SingleRootGraph.h: Added. (WTF::SingleRootGraphNode::rootName): (WTF::SingleRootGraphNode::SingleRootGraphNode): (WTF::SingleRootGraphNode::root): (WTF::SingleRootGraphNode::operator== const): (WTF::SingleRootGraphNode::operator!= const): (WTF::SingleRootGraphNode::operator bool const): (WTF::SingleRootGraphNode::isRoot const): (WTF::SingleRootGraphNode::node const): (WTF::SingleRootGraphSet::add): (WTF::SingleRootGraphSet::remove): (WTF::SingleRootGraphSet::contains): (WTF::SingleRootGraphSet::dump const): (WTF::SingleRootMap::SingleRootMap): (WTF::SingleRootMap::clear): (WTF::SingleRootMap::size const): (WTF::SingleRootMap::operator[]): (WTF::SingleRootMap::operator[] const): (WTF::SingleRootGraph::SingleRootGraph): (WTF::SingleRootGraph::root const): (WTF::SingleRootGraph::newMap): (WTF::SingleRootGraph::successors const): (WTF::SingleRootGraph::predecessors const): (WTF::SingleRootGraph::index const): (WTF::SingleRootGraph::node const): (WTF::SingleRootGraph::numNodes const): (WTF::SingleRootGraph::dump const): (WTF::SingleRootGraph::assertIsConsistent const): Canonical link: https://commits.webkit.org/192644@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@221196 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-08-25 18:26:15 +00:00
typename Graph::Set iteratedDominanceFrontierOf(const List& from) const
Dominators should be factored out of the DFG https://bugs.webkit.org/show_bug.cgi?id=150764 Reviewed by Geoffrey Garen. Source/JavaScriptCore: Factored DFGDominators.h/DFGDominators.cpp into WTF. To do this, I made two changes to the DFG: 1) DFG now has a CFG abstraction called DFG::CFG. The cool thing about this is that in the future if we wanted to support inverted dominators, we could do it by just creating a DFG::BackwardCFG. 2) Got rid of DFG::Analysis. From now on, an Analysis being invalidated is expressed by the DFG::Graph having a null pointer for that analysis. When we "run" the analysis, we just instantiate it. This makes it much more natural to integrate WTF::Dominators into the DFG. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * dfg/DFGAnalysis.h: Removed. * dfg/DFGCFG.h: Added. (JSC::DFG::CFG::CFG): (JSC::DFG::CFG::root): (JSC::DFG::CFG::newMap<T>): (JSC::DFG::CFG::successors): (JSC::DFG::CFG::predecessors): (JSC::DFG::CFG::index): (JSC::DFG::CFG::node): (JSC::DFG::CFG::numNodes): (JSC::DFG::CFG::dump): * dfg/DFGCSEPhase.cpp: * dfg/DFGDisassembler.cpp: (JSC::DFG::Disassembler::createDumpList): * dfg/DFGDominators.cpp: Removed. * dfg/DFGDominators.h: (JSC::DFG::Dominators::Dominators): (JSC::DFG::Dominators::strictlyDominates): Deleted. (JSC::DFG::Dominators::dominates): Deleted. (JSC::DFG::Dominators::immediateDominatorOf): Deleted. (JSC::DFG::Dominators::forAllStrictDominatorsOf): Deleted. (JSC::DFG::Dominators::forAllDominatorsOf): Deleted. (JSC::DFG::Dominators::forAllBlocksStrictlyDominatedBy): Deleted. (JSC::DFG::Dominators::forAllBlocksDominatedBy): Deleted. (JSC::DFG::Dominators::forAllBlocksInDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInIteratedDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInPrunedIteratedDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInDominanceFrontierOfImpl): Deleted. (JSC::DFG::Dominators::forAllBlocksInIteratedDominanceFrontierOfImpl): Deleted. (JSC::DFG::Dominators::BlockData::BlockData): Deleted. * dfg/DFGEdgeDominates.h: (JSC::DFG::EdgeDominates::operator()): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::Graph): (JSC::DFG::Graph::dumpBlockHeader): (JSC::DFG::Graph::invalidateCFG): (JSC::DFG::Graph::substituteGetLocal): (JSC::DFG::Graph::handleAssertionFailure): (JSC::DFG::Graph::ensureDominators): (JSC::DFG::Graph::ensurePrePostNumbering): (JSC::DFG::Graph::ensureNaturalLoops): (JSC::DFG::Graph::valueProfileFor): * dfg/DFGGraph.h: (JSC::DFG::Graph::hasDebuggerEnabled): * dfg/DFGLICMPhase.cpp: (JSC::DFG::LICMPhase::run): (JSC::DFG::LICMPhase::attemptHoist): * dfg/DFGLoopPreHeaderCreationPhase.cpp: (JSC::DFG::createPreHeader): (JSC::DFG::LoopPreHeaderCreationPhase::run): * dfg/DFGNaturalLoops.cpp: (JSC::DFG::NaturalLoop::dump): (JSC::DFG::NaturalLoops::NaturalLoops): (JSC::DFG::NaturalLoops::~NaturalLoops): (JSC::DFG::NaturalLoops::loopsOf): (JSC::DFG::NaturalLoops::computeDependencies): Deleted. (JSC::DFG::NaturalLoops::compute): Deleted. * dfg/DFGNaturalLoops.h: (JSC::DFG::NaturalLoops::numLoops): * dfg/DFGNode.h: (JSC::DFG::Node::SuccessorsIterable::end): (JSC::DFG::Node::SuccessorsIterable::size): (JSC::DFG::Node::SuccessorsIterable::at): (JSC::DFG::Node::SuccessorsIterable::operator[]): * dfg/DFGOSREntrypointCreationPhase.cpp: (JSC::DFG::OSREntrypointCreationPhase::run): * dfg/DFGObjectAllocationSinkingPhase.cpp: * dfg/DFGPlan.cpp: (JSC::DFG::Plan::compileInThreadImpl): * dfg/DFGPrePostNumbering.cpp: (JSC::DFG::PrePostNumbering::PrePostNumbering): (JSC::DFG::PrePostNumbering::~PrePostNumbering): (JSC::DFG::PrePostNumbering::compute): Deleted. * dfg/DFGPrePostNumbering.h: (JSC::DFG::PrePostNumbering::preNumber): (JSC::DFG::PrePostNumbering::postNumber): * dfg/DFGPutStackSinkingPhase.cpp: * dfg/DFGSSACalculator.cpp: (JSC::DFG::SSACalculator::nonLocalReachingDef): (JSC::DFG::SSACalculator::reachingDefAtTail): * dfg/DFGSSACalculator.h: (JSC::DFG::SSACalculator::computePhis): * dfg/DFGSSAConversionPhase.cpp: (JSC::DFG::SSAConversionPhase::run): * ftl/FTLLink.cpp: (JSC::FTL::link): * ftl/FTLLowerDFGToLLVM.cpp: (JSC::FTL::DFG::LowerDFGToLLVM::lower): (JSC::FTL::DFG::LowerDFGToLLVM::safelyInvalidateAfterTermination): (JSC::FTL::DFG::LowerDFGToLLVM::isValid): Source/WTF: This takes what used to be DFGDominators.h/DFGDominators.cpp and turns it into a generic algorithm that can take any abstract graph. The idea is that you create Dominators<CFG> and pass it a CFG object, which defines the types of graph nodes and methods for getting successors, predecessors, etc. The DFG now defines a class called CFG, which is a wrapper for DFG::Graph that conforms to the thing that wtf/Dominators.h expects. When doing things to graphs, it's common to refer to the things in the graph as "nodes". Because I intend to reuse the CFG abstraction with many graph algorithms, that abstraction uses the term "node" to refer to a DFG basic block. But in Dominators, the method and variable names still use "block". This is because although Dominators are applicable to any kind of directed graph, it's super unlikely that we will ever use them for anything but compilers. Indeed, the only reason why I'm factoring them out of the DFG is so that I can use them with B3 and Air. This has the nice side effect that a user of WTF::Dominators<JSC::DFG::CFG> will see familiar terminology like "blocksStrictlyDominatedBy(...)" instead of "nodesStrictlyDominatedBy(...)", which would be super confusing. Overall, wtf/Dominators.h is a combination of what used to be in DFGDominators.h, DFGDominators.cpp, DFGNaiveDominators.h, and DFGNaiveDominators.cpp. I only changed code when I had to in order to make it generic. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/Dominators.h: Added. (WTF::Dominators::Dominators): (WTF::Dominators::compute): (WTF::Dominators::strictlyDominates): (WTF::Dominators::dominates): (WTF::Dominators::immediateDominatorOf): (WTF::Dominators::forAllStrictDominatorsOf): (WTF::Dominators::forAllDominatorsOf): (WTF::Dominators::forAllBlocksStrictlyDominatedBy): (WTF::Dominators::forAllBlocksDominatedBy): (WTF::Dominators::strictDominatorsOf): (WTF::Dominators::dominatorsOf): (WTF::Dominators::blocksStrictlyDominatedBy): (WTF::Dominators::blocksDominatedBy): (WTF::Dominators::forAllBlocksInDominanceFrontierOf): (WTF::Dominators::dominanceFrontierOf): (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOf): (WTF::Dominators::forAllBlocksInPrunedIteratedDominanceFrontierOf): (WTF::Dominators::iteratedDominanceFrontierOf): (WTF::Dominators::dump): (WTF::Dominators::LengauerTarjan::LengauerTarjan): (WTF::Dominators::LengauerTarjan::compute): (WTF::Dominators::LengauerTarjan::immediateDominator): (WTF::Dominators::LengauerTarjan::computeDepthFirstPreNumbering): (WTF::Dominators::LengauerTarjan::computeSemiDominatorsAndImplicitImmediateDominators): (WTF::Dominators::LengauerTarjan::computeExplicitImmediateDominators): (WTF::Dominators::LengauerTarjan::link): (WTF::Dominators::LengauerTarjan::eval): (WTF::Dominators::LengauerTarjan::compress): (WTF::Dominators::LengauerTarjan::BlockData::BlockData): (WTF::Dominators::NaiveDominators::NaiveDominators): (WTF::Dominators::NaiveDominators::dominates): (WTF::Dominators::NaiveDominators::dump): (WTF::Dominators::NaiveDominators::pruneDominators): (WTF::Dominators::ValidationContext::ValidationContext): (WTF::Dominators::ValidationContext::reportError): (WTF::Dominators::ValidationContext::handleErrors): (WTF::Dominators::naiveDominates): (WTF::Dominators::forAllBlocksInDominanceFrontierOfImpl): (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOfImpl): (WTF::Dominators::BlockData::BlockData): Canonical link: https://commits.webkit.org/168962@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@191870 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-11-02 00:48:03 +00:00
{
typename Graph::Set result;
forAllBlocksInIteratedDominanceFrontierOfImpl(
from,
[&] (typename Graph::Node node) -> bool {
return result.add(node);
});
return result;
}
void dump(PrintStream& out) const
{
for (unsigned blockIndex = 0; blockIndex < m_data.size(); ++blockIndex) {
if (m_data[blockIndex].preNumber == UINT_MAX)
continue;
DFG::LICMPhase shouldn't hoist type checks unless it knows that the check will succeed at the loop pre-header https://bugs.webkit.org/show_bug.cgi?id=144527 Reviewed by Saam Barati. Source/JavaScriptCore: This adds a control flow equivalence analysis (called ControlEquivalenceAnalysis) based on dominator analysis over the backwards CFG. Two basic blocks are control flow equivalent if the execution of one implies that the other one must also execute. It means that the two blocks' forward and backward dominance are reciprocated: (A dom B and B backdom A) or (B dom A and A backdom B). LICM now uses it to become more conservative about hoisting checks, if this has caused problems in the past. If we hoist something that may exit from a block that was not control equivalent to the pre-header then it's possible that the node's speculation will fail even though it wouldn't have if it wasn't hoisted. So, we flag these nodes' origins as being "wasHoisted" and we track all of their exits as "HoistingFailed". LICM will turn off such speculative hoisting if the CodeBlock from which we are hoisting had the HoistingFailed exit kind. Note that this deliberately still allows us to hoist things that may exit even if they are not control equivalent to the pre-header. This is necessary because the profitability of hoisting is so huge in all of the cases that we're aware of that it's worth giving it a shot. This is neutral on macrobenchmarks since none of the benchmarks we track have a hoistable operation that would exit only if hoisted. I added microbenchmarks to illustrate the problem and two of them speed up by ~40% while one of them is neutral (Int52 saves us from having problems on that program even though LICM previously did the wrong thing). * JavaScriptCore.xcodeproj/project.pbxproj: * bytecode/ExitKind.cpp: (JSC::exitKindToString): * bytecode/ExitKind.h: * dfg/DFGAtTailAbstractState.h: (JSC::DFG::AtTailAbstractState::operator bool): (JSC::DFG::AtTailAbstractState::initializeTo): * dfg/DFGBackwardsCFG.h: Added. (JSC::DFG::BackwardsCFG::BackwardsCFG): * dfg/DFGBackwardsDominators.h: Added. (JSC::DFG::BackwardsDominators::BackwardsDominators): * dfg/DFGCommon.h: (JSC::DFG::checkAndSet): Deleted. * dfg/DFGControlEquivalenceAnalysis.h: Added. (JSC::DFG::ControlEquivalenceAnalysis::ControlEquivalenceAnalysis): (JSC::DFG::ControlEquivalenceAnalysis::dominatesEquivalently): (JSC::DFG::ControlEquivalenceAnalysis::areEquivalent): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::dump): (JSC::DFG::Graph::dumpBlockHeader): (JSC::DFG::Graph::invalidateCFG): (JSC::DFG::Graph::substituteGetLocal): (JSC::DFG::Graph::handleAssertionFailure): (JSC::DFG::Graph::ensureDominators): (JSC::DFG::Graph::ensurePrePostNumbering): (JSC::DFG::Graph::ensureNaturalLoops): (JSC::DFG::Graph::ensureBackwardsCFG): (JSC::DFG::Graph::ensureBackwardsDominators): (JSC::DFG::Graph::ensureControlEquivalenceAnalysis): (JSC::DFG::Graph::methodOfGettingAValueProfileFor): * dfg/DFGGraph.h: (JSC::DFG::Graph::hasDebuggerEnabled): * dfg/DFGInPlaceAbstractState.h: (JSC::DFG::InPlaceAbstractState::operator bool): (JSC::DFG::InPlaceAbstractState::createValueForNode): (JSC::DFG::InPlaceAbstractState::forNode): * dfg/DFGLICMPhase.cpp: (JSC::DFG::LICMPhase::run): (JSC::DFG::LICMPhase::attemptHoist): * dfg/DFGMayExit.cpp: (JSC::DFG::mayExit): * dfg/DFGMayExit.h: * dfg/DFGNode.h: * dfg/DFGNodeOrigin.cpp: (JSC::DFG::NodeOrigin::dump): * dfg/DFGNodeOrigin.h: (JSC::DFG::NodeOrigin::takeValidExit): (JSC::DFG::NodeOrigin::withWasHoisted): (JSC::DFG::NodeOrigin::forInsertingAfter): * dfg/DFGNullAbstractState.h: Added. (JSC::DFG::NullAbstractState::NullAbstractState): (JSC::DFG::NullAbstractState::operator bool): (JSC::DFG::NullAbstractState::forNode): * dfg/DFGOSRExit.cpp: (JSC::DFG::OSRExit::OSRExit): * dfg/DFGOSRExitBase.cpp: (JSC::DFG::OSRExitBase::considerAddingAsFrequentExitSiteSlow): * dfg/DFGOSRExitBase.h: (JSC::DFG::OSRExitBase::OSRExitBase): * dfg/DFGTypeCheckHoistingPhase.cpp: (JSC::DFG::TypeCheckHoistingPhase::run): * ftl/FTLOSRExit.cpp: (JSC::FTL::OSRExitDescriptor::prepareOSRExitHandle): (JSC::FTL::OSRExit::OSRExit): * ftl/FTLOSRExit.h: Source/WTF: This adds an adaptor for graphs called BackwardsGraph. The WTF graph framework is based on passing around a Graph template argument that follows the protocol shared by DFG::CFG, B3::CFG, and Air::CFG. These graphs always have a single root node but may have many leaf nodes. This new BackwardsGraph adaptor reverses the graph by creating a synthetic return node that it uses as the root in the inverted graph. This currently may resort to some heuristics in programs that have an infinite loop, but other than that, it'll work well in the general case. This allows us to say Dominators<BackwardsGraph<some graph type>> as a way of computing backwards dominators, which then allows us to easily answer control flow equivalence queries. * CMakeLists.txt: * WTF.xcodeproj/project.pbxproj: * wtf/BackwardsGraph.h: Added. (WTF::BackwardsGraph::Node::Node): (WTF::BackwardsGraph::Node::root): (WTF::BackwardsGraph::Node::operator==): (WTF::BackwardsGraph::Node::operator!=): (WTF::BackwardsGraph::Node::operator bool): (WTF::BackwardsGraph::Node::isRoot): (WTF::BackwardsGraph::Node::node): (WTF::BackwardsGraph::Set::Set): (WTF::BackwardsGraph::Set::add): (WTF::BackwardsGraph::Set::remove): (WTF::BackwardsGraph::Set::contains): (WTF::BackwardsGraph::Set::dump): (WTF::BackwardsGraph::Map::Map): (WTF::BackwardsGraph::Map::clear): (WTF::BackwardsGraph::Map::size): (WTF::BackwardsGraph::Map::operator[]): (WTF::BackwardsGraph::BackwardsGraph): (WTF::BackwardsGraph::root): (WTF::BackwardsGraph::newMap): (WTF::BackwardsGraph::successors): (WTF::BackwardsGraph::predecessors): (WTF::BackwardsGraph::index): (WTF::BackwardsGraph::node): (WTF::BackwardsGraph::numNodes): (WTF::BackwardsGraph::dump): * wtf/Dominators.h: (WTF::Dominators::Dominators): (WTF::Dominators::dump): (WTF::Dominators::LengauerTarjan::computeDepthFirstPreNumbering): * wtf/GraphNodeWorklist.h: (WTF::GraphNodeWith::GraphNodeWith): (WTF::GraphNodeWith::operator bool): * wtf/StdLibExtras.h: (WTF::callStatelessLambda): (WTF::checkAndSet): LayoutTests: Add tests for LICM hoisting things that would only exit if hoisted. * js/regress/licm-dragons-expected.txt: Added. * js/regress/licm-dragons-out-of-bounds-expected.txt: Added. * js/regress/licm-dragons-out-of-bounds.html: Added. * js/regress/licm-dragons-overflow-expected.txt: Added. * js/regress/licm-dragons-overflow.html: Added. * js/regress/licm-dragons.html: Added. * js/regress/script-tests/licm-dragons-out-of-bounds.js: Added. (foo): * js/regress/script-tests/licm-dragons-overflow.js: Added. (foo): * js/regress/script-tests/licm-dragons.js: Added. (foo): Canonical link: https://commits.webkit.org/176032@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@201182 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-05-19 21:25:29 +00:00
out.print(" Block #", blockIndex, ": idom = ", m_graph.dump(m_data[blockIndex].idomParent), ", idomKids = [");
Dominators should be factored out of the DFG https://bugs.webkit.org/show_bug.cgi?id=150764 Reviewed by Geoffrey Garen. Source/JavaScriptCore: Factored DFGDominators.h/DFGDominators.cpp into WTF. To do this, I made two changes to the DFG: 1) DFG now has a CFG abstraction called DFG::CFG. The cool thing about this is that in the future if we wanted to support inverted dominators, we could do it by just creating a DFG::BackwardCFG. 2) Got rid of DFG::Analysis. From now on, an Analysis being invalidated is expressed by the DFG::Graph having a null pointer for that analysis. When we "run" the analysis, we just instantiate it. This makes it much more natural to integrate WTF::Dominators into the DFG. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * dfg/DFGAnalysis.h: Removed. * dfg/DFGCFG.h: Added. (JSC::DFG::CFG::CFG): (JSC::DFG::CFG::root): (JSC::DFG::CFG::newMap<T>): (JSC::DFG::CFG::successors): (JSC::DFG::CFG::predecessors): (JSC::DFG::CFG::index): (JSC::DFG::CFG::node): (JSC::DFG::CFG::numNodes): (JSC::DFG::CFG::dump): * dfg/DFGCSEPhase.cpp: * dfg/DFGDisassembler.cpp: (JSC::DFG::Disassembler::createDumpList): * dfg/DFGDominators.cpp: Removed. * dfg/DFGDominators.h: (JSC::DFG::Dominators::Dominators): (JSC::DFG::Dominators::strictlyDominates): Deleted. (JSC::DFG::Dominators::dominates): Deleted. (JSC::DFG::Dominators::immediateDominatorOf): Deleted. (JSC::DFG::Dominators::forAllStrictDominatorsOf): Deleted. (JSC::DFG::Dominators::forAllDominatorsOf): Deleted. (JSC::DFG::Dominators::forAllBlocksStrictlyDominatedBy): Deleted. (JSC::DFG::Dominators::forAllBlocksDominatedBy): Deleted. (JSC::DFG::Dominators::forAllBlocksInDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInIteratedDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInPrunedIteratedDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInDominanceFrontierOfImpl): Deleted. (JSC::DFG::Dominators::forAllBlocksInIteratedDominanceFrontierOfImpl): Deleted. (JSC::DFG::Dominators::BlockData::BlockData): Deleted. * dfg/DFGEdgeDominates.h: (JSC::DFG::EdgeDominates::operator()): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::Graph): (JSC::DFG::Graph::dumpBlockHeader): (JSC::DFG::Graph::invalidateCFG): (JSC::DFG::Graph::substituteGetLocal): (JSC::DFG::Graph::handleAssertionFailure): (JSC::DFG::Graph::ensureDominators): (JSC::DFG::Graph::ensurePrePostNumbering): (JSC::DFG::Graph::ensureNaturalLoops): (JSC::DFG::Graph::valueProfileFor): * dfg/DFGGraph.h: (JSC::DFG::Graph::hasDebuggerEnabled): * dfg/DFGLICMPhase.cpp: (JSC::DFG::LICMPhase::run): (JSC::DFG::LICMPhase::attemptHoist): * dfg/DFGLoopPreHeaderCreationPhase.cpp: (JSC::DFG::createPreHeader): (JSC::DFG::LoopPreHeaderCreationPhase::run): * dfg/DFGNaturalLoops.cpp: (JSC::DFG::NaturalLoop::dump): (JSC::DFG::NaturalLoops::NaturalLoops): (JSC::DFG::NaturalLoops::~NaturalLoops): (JSC::DFG::NaturalLoops::loopsOf): (JSC::DFG::NaturalLoops::computeDependencies): Deleted. (JSC::DFG::NaturalLoops::compute): Deleted. * dfg/DFGNaturalLoops.h: (JSC::DFG::NaturalLoops::numLoops): * dfg/DFGNode.h: (JSC::DFG::Node::SuccessorsIterable::end): (JSC::DFG::Node::SuccessorsIterable::size): (JSC::DFG::Node::SuccessorsIterable::at): (JSC::DFG::Node::SuccessorsIterable::operator[]): * dfg/DFGOSREntrypointCreationPhase.cpp: (JSC::DFG::OSREntrypointCreationPhase::run): * dfg/DFGObjectAllocationSinkingPhase.cpp: * dfg/DFGPlan.cpp: (JSC::DFG::Plan::compileInThreadImpl): * dfg/DFGPrePostNumbering.cpp: (JSC::DFG::PrePostNumbering::PrePostNumbering): (JSC::DFG::PrePostNumbering::~PrePostNumbering): (JSC::DFG::PrePostNumbering::compute): Deleted. * dfg/DFGPrePostNumbering.h: (JSC::DFG::PrePostNumbering::preNumber): (JSC::DFG::PrePostNumbering::postNumber): * dfg/DFGPutStackSinkingPhase.cpp: * dfg/DFGSSACalculator.cpp: (JSC::DFG::SSACalculator::nonLocalReachingDef): (JSC::DFG::SSACalculator::reachingDefAtTail): * dfg/DFGSSACalculator.h: (JSC::DFG::SSACalculator::computePhis): * dfg/DFGSSAConversionPhase.cpp: (JSC::DFG::SSAConversionPhase::run): * ftl/FTLLink.cpp: (JSC::FTL::link): * ftl/FTLLowerDFGToLLVM.cpp: (JSC::FTL::DFG::LowerDFGToLLVM::lower): (JSC::FTL::DFG::LowerDFGToLLVM::safelyInvalidateAfterTermination): (JSC::FTL::DFG::LowerDFGToLLVM::isValid): Source/WTF: This takes what used to be DFGDominators.h/DFGDominators.cpp and turns it into a generic algorithm that can take any abstract graph. The idea is that you create Dominators<CFG> and pass it a CFG object, which defines the types of graph nodes and methods for getting successors, predecessors, etc. The DFG now defines a class called CFG, which is a wrapper for DFG::Graph that conforms to the thing that wtf/Dominators.h expects. When doing things to graphs, it's common to refer to the things in the graph as "nodes". Because I intend to reuse the CFG abstraction with many graph algorithms, that abstraction uses the term "node" to refer to a DFG basic block. But in Dominators, the method and variable names still use "block". This is because although Dominators are applicable to any kind of directed graph, it's super unlikely that we will ever use them for anything but compilers. Indeed, the only reason why I'm factoring them out of the DFG is so that I can use them with B3 and Air. This has the nice side effect that a user of WTF::Dominators<JSC::DFG::CFG> will see familiar terminology like "blocksStrictlyDominatedBy(...)" instead of "nodesStrictlyDominatedBy(...)", which would be super confusing. Overall, wtf/Dominators.h is a combination of what used to be in DFGDominators.h, DFGDominators.cpp, DFGNaiveDominators.h, and DFGNaiveDominators.cpp. I only changed code when I had to in order to make it generic. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/Dominators.h: Added. (WTF::Dominators::Dominators): (WTF::Dominators::compute): (WTF::Dominators::strictlyDominates): (WTF::Dominators::dominates): (WTF::Dominators::immediateDominatorOf): (WTF::Dominators::forAllStrictDominatorsOf): (WTF::Dominators::forAllDominatorsOf): (WTF::Dominators::forAllBlocksStrictlyDominatedBy): (WTF::Dominators::forAllBlocksDominatedBy): (WTF::Dominators::strictDominatorsOf): (WTF::Dominators::dominatorsOf): (WTF::Dominators::blocksStrictlyDominatedBy): (WTF::Dominators::blocksDominatedBy): (WTF::Dominators::forAllBlocksInDominanceFrontierOf): (WTF::Dominators::dominanceFrontierOf): (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOf): (WTF::Dominators::forAllBlocksInPrunedIteratedDominanceFrontierOf): (WTF::Dominators::iteratedDominanceFrontierOf): (WTF::Dominators::dump): (WTF::Dominators::LengauerTarjan::LengauerTarjan): (WTF::Dominators::LengauerTarjan::compute): (WTF::Dominators::LengauerTarjan::immediateDominator): (WTF::Dominators::LengauerTarjan::computeDepthFirstPreNumbering): (WTF::Dominators::LengauerTarjan::computeSemiDominatorsAndImplicitImmediateDominators): (WTF::Dominators::LengauerTarjan::computeExplicitImmediateDominators): (WTF::Dominators::LengauerTarjan::link): (WTF::Dominators::LengauerTarjan::eval): (WTF::Dominators::LengauerTarjan::compress): (WTF::Dominators::LengauerTarjan::BlockData::BlockData): (WTF::Dominators::NaiveDominators::NaiveDominators): (WTF::Dominators::NaiveDominators::dominates): (WTF::Dominators::NaiveDominators::dump): (WTF::Dominators::NaiveDominators::pruneDominators): (WTF::Dominators::ValidationContext::ValidationContext): (WTF::Dominators::ValidationContext::reportError): (WTF::Dominators::ValidationContext::handleErrors): (WTF::Dominators::naiveDominates): (WTF::Dominators::forAllBlocksInDominanceFrontierOfImpl): (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOfImpl): (WTF::Dominators::BlockData::BlockData): Canonical link: https://commits.webkit.org/168962@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@191870 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-11-02 00:48:03 +00:00
CommaPrinter comma;
for (unsigned i = 0; i < m_data[blockIndex].idomKids.size(); ++i)
DFG::LICMPhase shouldn't hoist type checks unless it knows that the check will succeed at the loop pre-header https://bugs.webkit.org/show_bug.cgi?id=144527 Reviewed by Saam Barati. Source/JavaScriptCore: This adds a control flow equivalence analysis (called ControlEquivalenceAnalysis) based on dominator analysis over the backwards CFG. Two basic blocks are control flow equivalent if the execution of one implies that the other one must also execute. It means that the two blocks' forward and backward dominance are reciprocated: (A dom B and B backdom A) or (B dom A and A backdom B). LICM now uses it to become more conservative about hoisting checks, if this has caused problems in the past. If we hoist something that may exit from a block that was not control equivalent to the pre-header then it's possible that the node's speculation will fail even though it wouldn't have if it wasn't hoisted. So, we flag these nodes' origins as being "wasHoisted" and we track all of their exits as "HoistingFailed". LICM will turn off such speculative hoisting if the CodeBlock from which we are hoisting had the HoistingFailed exit kind. Note that this deliberately still allows us to hoist things that may exit even if they are not control equivalent to the pre-header. This is necessary because the profitability of hoisting is so huge in all of the cases that we're aware of that it's worth giving it a shot. This is neutral on macrobenchmarks since none of the benchmarks we track have a hoistable operation that would exit only if hoisted. I added microbenchmarks to illustrate the problem and two of them speed up by ~40% while one of them is neutral (Int52 saves us from having problems on that program even though LICM previously did the wrong thing). * JavaScriptCore.xcodeproj/project.pbxproj: * bytecode/ExitKind.cpp: (JSC::exitKindToString): * bytecode/ExitKind.h: * dfg/DFGAtTailAbstractState.h: (JSC::DFG::AtTailAbstractState::operator bool): (JSC::DFG::AtTailAbstractState::initializeTo): * dfg/DFGBackwardsCFG.h: Added. (JSC::DFG::BackwardsCFG::BackwardsCFG): * dfg/DFGBackwardsDominators.h: Added. (JSC::DFG::BackwardsDominators::BackwardsDominators): * dfg/DFGCommon.h: (JSC::DFG::checkAndSet): Deleted. * dfg/DFGControlEquivalenceAnalysis.h: Added. (JSC::DFG::ControlEquivalenceAnalysis::ControlEquivalenceAnalysis): (JSC::DFG::ControlEquivalenceAnalysis::dominatesEquivalently): (JSC::DFG::ControlEquivalenceAnalysis::areEquivalent): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::dump): (JSC::DFG::Graph::dumpBlockHeader): (JSC::DFG::Graph::invalidateCFG): (JSC::DFG::Graph::substituteGetLocal): (JSC::DFG::Graph::handleAssertionFailure): (JSC::DFG::Graph::ensureDominators): (JSC::DFG::Graph::ensurePrePostNumbering): (JSC::DFG::Graph::ensureNaturalLoops): (JSC::DFG::Graph::ensureBackwardsCFG): (JSC::DFG::Graph::ensureBackwardsDominators): (JSC::DFG::Graph::ensureControlEquivalenceAnalysis): (JSC::DFG::Graph::methodOfGettingAValueProfileFor): * dfg/DFGGraph.h: (JSC::DFG::Graph::hasDebuggerEnabled): * dfg/DFGInPlaceAbstractState.h: (JSC::DFG::InPlaceAbstractState::operator bool): (JSC::DFG::InPlaceAbstractState::createValueForNode): (JSC::DFG::InPlaceAbstractState::forNode): * dfg/DFGLICMPhase.cpp: (JSC::DFG::LICMPhase::run): (JSC::DFG::LICMPhase::attemptHoist): * dfg/DFGMayExit.cpp: (JSC::DFG::mayExit): * dfg/DFGMayExit.h: * dfg/DFGNode.h: * dfg/DFGNodeOrigin.cpp: (JSC::DFG::NodeOrigin::dump): * dfg/DFGNodeOrigin.h: (JSC::DFG::NodeOrigin::takeValidExit): (JSC::DFG::NodeOrigin::withWasHoisted): (JSC::DFG::NodeOrigin::forInsertingAfter): * dfg/DFGNullAbstractState.h: Added. (JSC::DFG::NullAbstractState::NullAbstractState): (JSC::DFG::NullAbstractState::operator bool): (JSC::DFG::NullAbstractState::forNode): * dfg/DFGOSRExit.cpp: (JSC::DFG::OSRExit::OSRExit): * dfg/DFGOSRExitBase.cpp: (JSC::DFG::OSRExitBase::considerAddingAsFrequentExitSiteSlow): * dfg/DFGOSRExitBase.h: (JSC::DFG::OSRExitBase::OSRExitBase): * dfg/DFGTypeCheckHoistingPhase.cpp: (JSC::DFG::TypeCheckHoistingPhase::run): * ftl/FTLOSRExit.cpp: (JSC::FTL::OSRExitDescriptor::prepareOSRExitHandle): (JSC::FTL::OSRExit::OSRExit): * ftl/FTLOSRExit.h: Source/WTF: This adds an adaptor for graphs called BackwardsGraph. The WTF graph framework is based on passing around a Graph template argument that follows the protocol shared by DFG::CFG, B3::CFG, and Air::CFG. These graphs always have a single root node but may have many leaf nodes. This new BackwardsGraph adaptor reverses the graph by creating a synthetic return node that it uses as the root in the inverted graph. This currently may resort to some heuristics in programs that have an infinite loop, but other than that, it'll work well in the general case. This allows us to say Dominators<BackwardsGraph<some graph type>> as a way of computing backwards dominators, which then allows us to easily answer control flow equivalence queries. * CMakeLists.txt: * WTF.xcodeproj/project.pbxproj: * wtf/BackwardsGraph.h: Added. (WTF::BackwardsGraph::Node::Node): (WTF::BackwardsGraph::Node::root): (WTF::BackwardsGraph::Node::operator==): (WTF::BackwardsGraph::Node::operator!=): (WTF::BackwardsGraph::Node::operator bool): (WTF::BackwardsGraph::Node::isRoot): (WTF::BackwardsGraph::Node::node): (WTF::BackwardsGraph::Set::Set): (WTF::BackwardsGraph::Set::add): (WTF::BackwardsGraph::Set::remove): (WTF::BackwardsGraph::Set::contains): (WTF::BackwardsGraph::Set::dump): (WTF::BackwardsGraph::Map::Map): (WTF::BackwardsGraph::Map::clear): (WTF::BackwardsGraph::Map::size): (WTF::BackwardsGraph::Map::operator[]): (WTF::BackwardsGraph::BackwardsGraph): (WTF::BackwardsGraph::root): (WTF::BackwardsGraph::newMap): (WTF::BackwardsGraph::successors): (WTF::BackwardsGraph::predecessors): (WTF::BackwardsGraph::index): (WTF::BackwardsGraph::node): (WTF::BackwardsGraph::numNodes): (WTF::BackwardsGraph::dump): * wtf/Dominators.h: (WTF::Dominators::Dominators): (WTF::Dominators::dump): (WTF::Dominators::LengauerTarjan::computeDepthFirstPreNumbering): * wtf/GraphNodeWorklist.h: (WTF::GraphNodeWith::GraphNodeWith): (WTF::GraphNodeWith::operator bool): * wtf/StdLibExtras.h: (WTF::callStatelessLambda): (WTF::checkAndSet): LayoutTests: Add tests for LICM hoisting things that would only exit if hoisted. * js/regress/licm-dragons-expected.txt: Added. * js/regress/licm-dragons-out-of-bounds-expected.txt: Added. * js/regress/licm-dragons-out-of-bounds.html: Added. * js/regress/licm-dragons-overflow-expected.txt: Added. * js/regress/licm-dragons-overflow.html: Added. * js/regress/licm-dragons.html: Added. * js/regress/script-tests/licm-dragons-out-of-bounds.js: Added. (foo): * js/regress/script-tests/licm-dragons-overflow.js: Added. (foo): * js/regress/script-tests/licm-dragons.js: Added. (foo): Canonical link: https://commits.webkit.org/176032@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@201182 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-05-19 21:25:29 +00:00
out.print(comma, m_graph.dump(m_data[blockIndex].idomKids[i]));
Dominators should be factored out of the DFG https://bugs.webkit.org/show_bug.cgi?id=150764 Reviewed by Geoffrey Garen. Source/JavaScriptCore: Factored DFGDominators.h/DFGDominators.cpp into WTF. To do this, I made two changes to the DFG: 1) DFG now has a CFG abstraction called DFG::CFG. The cool thing about this is that in the future if we wanted to support inverted dominators, we could do it by just creating a DFG::BackwardCFG. 2) Got rid of DFG::Analysis. From now on, an Analysis being invalidated is expressed by the DFG::Graph having a null pointer for that analysis. When we "run" the analysis, we just instantiate it. This makes it much more natural to integrate WTF::Dominators into the DFG. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * dfg/DFGAnalysis.h: Removed. * dfg/DFGCFG.h: Added. (JSC::DFG::CFG::CFG): (JSC::DFG::CFG::root): (JSC::DFG::CFG::newMap<T>): (JSC::DFG::CFG::successors): (JSC::DFG::CFG::predecessors): (JSC::DFG::CFG::index): (JSC::DFG::CFG::node): (JSC::DFG::CFG::numNodes): (JSC::DFG::CFG::dump): * dfg/DFGCSEPhase.cpp: * dfg/DFGDisassembler.cpp: (JSC::DFG::Disassembler::createDumpList): * dfg/DFGDominators.cpp: Removed. * dfg/DFGDominators.h: (JSC::DFG::Dominators::Dominators): (JSC::DFG::Dominators::strictlyDominates): Deleted. (JSC::DFG::Dominators::dominates): Deleted. (JSC::DFG::Dominators::immediateDominatorOf): Deleted. (JSC::DFG::Dominators::forAllStrictDominatorsOf): Deleted. (JSC::DFG::Dominators::forAllDominatorsOf): Deleted. (JSC::DFG::Dominators::forAllBlocksStrictlyDominatedBy): Deleted. (JSC::DFG::Dominators::forAllBlocksDominatedBy): Deleted. (JSC::DFG::Dominators::forAllBlocksInDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInIteratedDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInPrunedIteratedDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInDominanceFrontierOfImpl): Deleted. (JSC::DFG::Dominators::forAllBlocksInIteratedDominanceFrontierOfImpl): Deleted. (JSC::DFG::Dominators::BlockData::BlockData): Deleted. * dfg/DFGEdgeDominates.h: (JSC::DFG::EdgeDominates::operator()): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::Graph): (JSC::DFG::Graph::dumpBlockHeader): (JSC::DFG::Graph::invalidateCFG): (JSC::DFG::Graph::substituteGetLocal): (JSC::DFG::Graph::handleAssertionFailure): (JSC::DFG::Graph::ensureDominators): (JSC::DFG::Graph::ensurePrePostNumbering): (JSC::DFG::Graph::ensureNaturalLoops): (JSC::DFG::Graph::valueProfileFor): * dfg/DFGGraph.h: (JSC::DFG::Graph::hasDebuggerEnabled): * dfg/DFGLICMPhase.cpp: (JSC::DFG::LICMPhase::run): (JSC::DFG::LICMPhase::attemptHoist): * dfg/DFGLoopPreHeaderCreationPhase.cpp: (JSC::DFG::createPreHeader): (JSC::DFG::LoopPreHeaderCreationPhase::run): * dfg/DFGNaturalLoops.cpp: (JSC::DFG::NaturalLoop::dump): (JSC::DFG::NaturalLoops::NaturalLoops): (JSC::DFG::NaturalLoops::~NaturalLoops): (JSC::DFG::NaturalLoops::loopsOf): (JSC::DFG::NaturalLoops::computeDependencies): Deleted. (JSC::DFG::NaturalLoops::compute): Deleted. * dfg/DFGNaturalLoops.h: (JSC::DFG::NaturalLoops::numLoops): * dfg/DFGNode.h: (JSC::DFG::Node::SuccessorsIterable::end): (JSC::DFG::Node::SuccessorsIterable::size): (JSC::DFG::Node::SuccessorsIterable::at): (JSC::DFG::Node::SuccessorsIterable::operator[]): * dfg/DFGOSREntrypointCreationPhase.cpp: (JSC::DFG::OSREntrypointCreationPhase::run): * dfg/DFGObjectAllocationSinkingPhase.cpp: * dfg/DFGPlan.cpp: (JSC::DFG::Plan::compileInThreadImpl): * dfg/DFGPrePostNumbering.cpp: (JSC::DFG::PrePostNumbering::PrePostNumbering): (JSC::DFG::PrePostNumbering::~PrePostNumbering): (JSC::DFG::PrePostNumbering::compute): Deleted. * dfg/DFGPrePostNumbering.h: (JSC::DFG::PrePostNumbering::preNumber): (JSC::DFG::PrePostNumbering::postNumber): * dfg/DFGPutStackSinkingPhase.cpp: * dfg/DFGSSACalculator.cpp: (JSC::DFG::SSACalculator::nonLocalReachingDef): (JSC::DFG::SSACalculator::reachingDefAtTail): * dfg/DFGSSACalculator.h: (JSC::DFG::SSACalculator::computePhis): * dfg/DFGSSAConversionPhase.cpp: (JSC::DFG::SSAConversionPhase::run): * ftl/FTLLink.cpp: (JSC::FTL::link): * ftl/FTLLowerDFGToLLVM.cpp: (JSC::FTL::DFG::LowerDFGToLLVM::lower): (JSC::FTL::DFG::LowerDFGToLLVM::safelyInvalidateAfterTermination): (JSC::FTL::DFG::LowerDFGToLLVM::isValid): Source/WTF: This takes what used to be DFGDominators.h/DFGDominators.cpp and turns it into a generic algorithm that can take any abstract graph. The idea is that you create Dominators<CFG> and pass it a CFG object, which defines the types of graph nodes and methods for getting successors, predecessors, etc. The DFG now defines a class called CFG, which is a wrapper for DFG::Graph that conforms to the thing that wtf/Dominators.h expects. When doing things to graphs, it's common to refer to the things in the graph as "nodes". Because I intend to reuse the CFG abstraction with many graph algorithms, that abstraction uses the term "node" to refer to a DFG basic block. But in Dominators, the method and variable names still use "block". This is because although Dominators are applicable to any kind of directed graph, it's super unlikely that we will ever use them for anything but compilers. Indeed, the only reason why I'm factoring them out of the DFG is so that I can use them with B3 and Air. This has the nice side effect that a user of WTF::Dominators<JSC::DFG::CFG> will see familiar terminology like "blocksStrictlyDominatedBy(...)" instead of "nodesStrictlyDominatedBy(...)", which would be super confusing. Overall, wtf/Dominators.h is a combination of what used to be in DFGDominators.h, DFGDominators.cpp, DFGNaiveDominators.h, and DFGNaiveDominators.cpp. I only changed code when I had to in order to make it generic. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/Dominators.h: Added. (WTF::Dominators::Dominators): (WTF::Dominators::compute): (WTF::Dominators::strictlyDominates): (WTF::Dominators::dominates): (WTF::Dominators::immediateDominatorOf): (WTF::Dominators::forAllStrictDominatorsOf): (WTF::Dominators::forAllDominatorsOf): (WTF::Dominators::forAllBlocksStrictlyDominatedBy): (WTF::Dominators::forAllBlocksDominatedBy): (WTF::Dominators::strictDominatorsOf): (WTF::Dominators::dominatorsOf): (WTF::Dominators::blocksStrictlyDominatedBy): (WTF::Dominators::blocksDominatedBy): (WTF::Dominators::forAllBlocksInDominanceFrontierOf): (WTF::Dominators::dominanceFrontierOf): (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOf): (WTF::Dominators::forAllBlocksInPrunedIteratedDominanceFrontierOf): (WTF::Dominators::iteratedDominanceFrontierOf): (WTF::Dominators::dump): (WTF::Dominators::LengauerTarjan::LengauerTarjan): (WTF::Dominators::LengauerTarjan::compute): (WTF::Dominators::LengauerTarjan::immediateDominator): (WTF::Dominators::LengauerTarjan::computeDepthFirstPreNumbering): (WTF::Dominators::LengauerTarjan::computeSemiDominatorsAndImplicitImmediateDominators): (WTF::Dominators::LengauerTarjan::computeExplicitImmediateDominators): (WTF::Dominators::LengauerTarjan::link): (WTF::Dominators::LengauerTarjan::eval): (WTF::Dominators::LengauerTarjan::compress): (WTF::Dominators::LengauerTarjan::BlockData::BlockData): (WTF::Dominators::NaiveDominators::NaiveDominators): (WTF::Dominators::NaiveDominators::dominates): (WTF::Dominators::NaiveDominators::dump): (WTF::Dominators::NaiveDominators::pruneDominators): (WTF::Dominators::ValidationContext::ValidationContext): (WTF::Dominators::ValidationContext::reportError): (WTF::Dominators::ValidationContext::handleErrors): (WTF::Dominators::naiveDominates): (WTF::Dominators::forAllBlocksInDominanceFrontierOfImpl): (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOfImpl): (WTF::Dominators::BlockData::BlockData): Canonical link: https://commits.webkit.org/168962@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@191870 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-11-02 00:48:03 +00:00
out.print("], pre/post = ", m_data[blockIndex].preNumber, "/", m_data[blockIndex].postNumber, "\n");
}
}
private:
// This implements Lengauer and Tarjan's "A Fast Algorithm for Finding Dominators in a Flowgraph"
// (TOPLAS 1979). It uses the "simple" implementation of LINK and EVAL, which yields an O(n log n)
// solution. The full paper is linked below; this code attempts to closely follow the algorithm as
// it is presented in the paper; in particular sections 3 and 4 as well as appendix B.
// https://www.cs.princeton.edu/courses/archive/fall03/cs528/handouts/a%20fast%20algorithm%20for%20finding.pdf
//
// This code is very subtle. The Lengauer-Tarjan algorithm is incredibly deep to begin with. The
// goal of this code is to follow the code in the paper, however our implementation must deviate
// from the paper when it comes to recursion. The authors had used recursion to implement DFS, and
// also to implement the "simple" EVAL. We convert both of those into worklist-based solutions.
// Finally, once the algorithm gives us immediate dominators, we implement dominance tests by
// walking the dominator tree and computing pre and post numbers. We then use the range inclusion
// check trick that was first discovered by Paul F. Dietz in 1982 in "Maintaining order in a linked
// list" (see http://dl.acm.org/citation.cfm?id=802184).
class LengauerTarjan {
[WTF][JSC] Make JSC and WTF aggressively-fast-malloced https://bugs.webkit.org/show_bug.cgi?id=200611 Reviewed by Saam Barati. Source/JavaScriptCore: This patch aggressively puts many classes into FastMalloc. In JSC side, we grep `std::make_unique` etc. to find potentially system-malloc-allocated classes. After this patch, all the JSC related allocations in JetStream2 cli is done from bmalloc. In the future, it would be nice that we add `WTF::makeUnique<T>` helper function and throw a compile error if `T` is not FastMalloc annotated[1]. Putting WebKit classes in FastMalloc has many benefits. 1. Simply, it is fast. 2. vmmap can tell the amount of memory used for WebKit. 3. bmalloc can isolate WebKit memory allocation from the rest of the world. This is useful since we can know more about what component is corrupting the memory from the memory corruption crash. [1]: https://bugs.webkit.org/show_bug.cgi?id=200620 * API/ObjCCallbackFunction.mm: * assembler/AbstractMacroAssembler.h: * b3/B3PhiChildren.h: * b3/air/AirAllocateRegistersAndStackAndGenerateCode.h: * b3/air/AirDisassembler.h: * bytecode/AccessCaseSnippetParams.h: * bytecode/CallVariant.h: * bytecode/DeferredSourceDump.h: * bytecode/ExecutionCounter.h: * bytecode/GetByIdStatus.h: * bytecode/GetByIdVariant.h: * bytecode/InByIdStatus.h: * bytecode/InByIdVariant.h: * bytecode/InstanceOfStatus.h: * bytecode/InstanceOfVariant.h: * bytecode/PutByIdStatus.h: * bytecode/PutByIdVariant.h: * bytecode/ValueProfile.h: * dfg/DFGAbstractInterpreter.h: * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::newVariableAccessData): * dfg/DFGFlowIndexing.h: * dfg/DFGFlowMap.h: * dfg/DFGLiveCatchVariablePreservationPhase.cpp: (JSC::DFG::LiveCatchVariablePreservationPhase::newVariableAccessData): * dfg/DFGMaximalFlushInsertionPhase.cpp: (JSC::DFG::MaximalFlushInsertionPhase::newVariableAccessData): * dfg/DFGOSRExit.h: * dfg/DFGSpeculativeJIT.h: * dfg/DFGVariableAccessData.h: * disassembler/ARM64/A64DOpcode.h: * inspector/remote/socket/RemoteInspectorMessageParser.h: * inspector/remote/socket/RemoteInspectorSocket.h: * inspector/remote/socket/RemoteInspectorSocketEndpoint.h: * jit/PCToCodeOriginMap.h: * runtime/BasicBlockLocation.h: * runtime/DoublePredictionFuzzerAgent.h: * runtime/JSRunLoopTimer.h: * runtime/PromiseDeferredTimer.h: (JSC::PromiseDeferredTimer::create): PromiseDeferredTimer should be allocated as `Ref<>` instead of `std::unique_ptr` since it is inheriting ThreadSafeRefCounted<>. Holding such a class with std::unique_ptr could lead to potentially dangerous operations (like, someone holds it with Ref<> while it is deleted by std::unique_ptr<>). * runtime/RandomizingFuzzerAgent.h: * runtime/SymbolTable.h: * runtime/VM.cpp: (JSC::VM::VM): * runtime/VM.h: * tools/JSDollarVM.cpp: * tools/SigillCrashAnalyzer.cpp: * wasm/WasmFormat.h: * wasm/WasmMemory.cpp: * wasm/WasmSignature.h: * yarr/YarrJIT.h: Source/WebCore: Changed the accessor since we changed std::unique_ptr to Ref for this field. No behavior change. * bindings/js/WorkerScriptController.cpp: (WebCore::WorkerScriptController::addTimerSetNotification): (WebCore::WorkerScriptController::removeTimerSetNotification): Source/WTF: WTF has many data structures, in particular, containers. And these containers can be allocated like `std::make_unique<Container>()`. Without WTF_MAKE_FAST_ALLOCATED, this container itself is allocated from the system malloc. This patch attaches WTF_MAKE_FAST_ALLOCATED more aggressively not to allocate them from the system malloc. And we add some `final` to containers and classes that would be never inherited. * wtf/Assertions.cpp: * wtf/Atomics.h: * wtf/AutodrainedPool.h: * wtf/Bag.h: (WTF::Bag::Bag): Deleted. (WTF::Bag::~Bag): Deleted. (WTF::Bag::clear): Deleted. (WTF::Bag::add): Deleted. (WTF::Bag::iterator::iterator): Deleted. (WTF::Bag::iterator::operator! const): Deleted. (WTF::Bag::iterator::operator* const): Deleted. (WTF::Bag::iterator::operator++): Deleted. (WTF::Bag::iterator::operator== const): Deleted. (WTF::Bag::iterator::operator!= const): Deleted. (WTF::Bag::begin): Deleted. (WTF::Bag::begin const): Deleted. (WTF::Bag::end const): Deleted. (WTF::Bag::isEmpty const): Deleted. (WTF::Bag::unwrappedHead const): Deleted. * wtf/BitVector.h: (WTF::BitVector::BitVector): Deleted. (WTF::BitVector::~BitVector): Deleted. (WTF::BitVector::operator=): Deleted. (WTF::BitVector::size const): Deleted. (WTF::BitVector::ensureSize): Deleted. (WTF::BitVector::quickGet const): Deleted. (WTF::BitVector::quickSet): Deleted. (WTF::BitVector::quickClear): Deleted. (WTF::BitVector::get const): Deleted. (WTF::BitVector::contains const): Deleted. (WTF::BitVector::set): Deleted. (WTF::BitVector::add): Deleted. (WTF::BitVector::ensureSizeAndSet): Deleted. (WTF::BitVector::clear): Deleted. (WTF::BitVector::remove): Deleted. (WTF::BitVector::merge): Deleted. (WTF::BitVector::filter): Deleted. (WTF::BitVector::exclude): Deleted. (WTF::BitVector::bitCount const): Deleted. (WTF::BitVector::isEmpty const): Deleted. (WTF::BitVector::findBit const): Deleted. (WTF::BitVector::isEmptyValue const): Deleted. (WTF::BitVector::isDeletedValue const): Deleted. (WTF::BitVector::isEmptyOrDeletedValue const): Deleted. (WTF::BitVector::operator== const): Deleted. (WTF::BitVector::hash const): Deleted. (WTF::BitVector::iterator::iterator): Deleted. (WTF::BitVector::iterator::operator* const): Deleted. (WTF::BitVector::iterator::operator++): Deleted. (WTF::BitVector::iterator::isAtEnd const): Deleted. (WTF::BitVector::iterator::operator== const): Deleted. (WTF::BitVector::iterator::operator!= const): Deleted. (WTF::BitVector::begin const): Deleted. (WTF::BitVector::end const): Deleted. (WTF::BitVector::bitsInPointer): Deleted. (WTF::BitVector::maxInlineBits): Deleted. (WTF::BitVector::byteCount): Deleted. (WTF::BitVector::makeInlineBits): Deleted. (WTF::BitVector::cleanseInlineBits): Deleted. (WTF::BitVector::bitCount): Deleted. (WTF::BitVector::findBitFast const): Deleted. (WTF::BitVector::findBitSimple const): Deleted. (WTF::BitVector::OutOfLineBits::numBits const): Deleted. (WTF::BitVector::OutOfLineBits::numWords const): Deleted. (WTF::BitVector::OutOfLineBits::bits): Deleted. (WTF::BitVector::OutOfLineBits::bits const): Deleted. (WTF::BitVector::OutOfLineBits::OutOfLineBits): Deleted. (WTF::BitVector::isInline const): Deleted. (WTF::BitVector::outOfLineBits const): Deleted. (WTF::BitVector::outOfLineBits): Deleted. (WTF::BitVector::bits): Deleted. (WTF::BitVector::bits const): Deleted. * wtf/Bitmap.h: (WTF::Bitmap::size): Deleted. (WTF::Bitmap::iterator::iterator): Deleted. (WTF::Bitmap::iterator::operator* const): Deleted. (WTF::Bitmap::iterator::operator++): Deleted. (WTF::Bitmap::iterator::operator== const): Deleted. (WTF::Bitmap::iterator::operator!= const): Deleted. (WTF::Bitmap::begin const): Deleted. (WTF::Bitmap::end const): Deleted. * wtf/Box.h: * wtf/BumpPointerAllocator.h: * wtf/CPUTime.h: * wtf/CheckedBoolean.h: * wtf/CommaPrinter.h: (WTF::CommaPrinter::CommaPrinter): Deleted. (WTF::CommaPrinter::dump const): Deleted. (WTF::CommaPrinter::didPrint const): Deleted. * wtf/CompactPointerTuple.h: (WTF::CompactPointerTuple::encodeType): Deleted. (WTF::CompactPointerTuple::decodeType): Deleted. (WTF::CompactPointerTuple::CompactPointerTuple): Deleted. (WTF::CompactPointerTuple::pointer const): Deleted. (WTF::CompactPointerTuple::setPointer): Deleted. (WTF::CompactPointerTuple::type const): Deleted. (WTF::CompactPointerTuple::setType): Deleted. * wtf/CompilationThread.h: (WTF::CompilationScope::CompilationScope): Deleted. (WTF::CompilationScope::~CompilationScope): Deleted. (WTF::CompilationScope::leaveEarly): Deleted. * wtf/CompletionHandler.h: (WTF::CompletionHandler<Out): (WTF::Detail::CallableWrapper<CompletionHandler<Out): (WTF::CompletionHandlerCallingScope::CompletionHandlerCallingScope): Deleted. (WTF::CompletionHandlerCallingScope::~CompletionHandlerCallingScope): Deleted. (WTF::CompletionHandlerCallingScope::CompletionHandler<void): Deleted. * wtf/ConcurrentBuffer.h: (WTF::ConcurrentBuffer::ConcurrentBuffer): Deleted. (WTF::ConcurrentBuffer::~ConcurrentBuffer): Deleted. (WTF::ConcurrentBuffer::growExact): Deleted. (WTF::ConcurrentBuffer::grow): Deleted. (WTF::ConcurrentBuffer::array const): Deleted. (WTF::ConcurrentBuffer::operator[]): Deleted. (WTF::ConcurrentBuffer::operator[] const): Deleted. (WTF::ConcurrentBuffer::createArray): Deleted. * wtf/ConcurrentPtrHashSet.h: (WTF::ConcurrentPtrHashSet::contains): Deleted. (WTF::ConcurrentPtrHashSet::add): Deleted. (WTF::ConcurrentPtrHashSet::size const): Deleted. (WTF::ConcurrentPtrHashSet::Table::maxLoad const): Deleted. (WTF::ConcurrentPtrHashSet::hash): Deleted. (WTF::ConcurrentPtrHashSet::cast): Deleted. (WTF::ConcurrentPtrHashSet::containsImpl const): Deleted. (WTF::ConcurrentPtrHashSet::addImpl): Deleted. * wtf/ConcurrentVector.h: (WTF::ConcurrentVector::~ConcurrentVector): Deleted. (WTF::ConcurrentVector::size const): Deleted. (WTF::ConcurrentVector::isEmpty const): Deleted. (WTF::ConcurrentVector::at): Deleted. (WTF::ConcurrentVector::at const): Deleted. (WTF::ConcurrentVector::operator[]): Deleted. (WTF::ConcurrentVector::operator[] const): Deleted. (WTF::ConcurrentVector::first): Deleted. (WTF::ConcurrentVector::first const): Deleted. (WTF::ConcurrentVector::last): Deleted. (WTF::ConcurrentVector::last const): Deleted. (WTF::ConcurrentVector::takeLast): Deleted. (WTF::ConcurrentVector::append): Deleted. (WTF::ConcurrentVector::alloc): Deleted. (WTF::ConcurrentVector::removeLast): Deleted. (WTF::ConcurrentVector::grow): Deleted. (WTF::ConcurrentVector::begin): Deleted. (WTF::ConcurrentVector::end): Deleted. (WTF::ConcurrentVector::segmentExistsFor): Deleted. (WTF::ConcurrentVector::segmentFor): Deleted. (WTF::ConcurrentVector::subscriptFor): Deleted. (WTF::ConcurrentVector::ensureSegmentsFor): Deleted. (WTF::ConcurrentVector::ensureSegment): Deleted. (WTF::ConcurrentVector::allocateSegment): Deleted. * wtf/Condition.h: (WTF::Condition::waitUntil): Deleted. (WTF::Condition::waitFor): Deleted. (WTF::Condition::wait): Deleted. (WTF::Condition::notifyOne): Deleted. (WTF::Condition::notifyAll): Deleted. * wtf/CountingLock.h: (WTF::CountingLock::LockHooks::lockHook): Deleted. (WTF::CountingLock::LockHooks::unlockHook): Deleted. (WTF::CountingLock::LockHooks::parkHook): Deleted. (WTF::CountingLock::LockHooks::handoffHook): Deleted. (WTF::CountingLock::tryLock): Deleted. (WTF::CountingLock::lock): Deleted. (WTF::CountingLock::unlock): Deleted. (WTF::CountingLock::isHeld const): Deleted. (WTF::CountingLock::isLocked const): Deleted. (WTF::CountingLock::Count::operator bool const): Deleted. (WTF::CountingLock::Count::operator== const): Deleted. (WTF::CountingLock::Count::operator!= const): Deleted. (WTF::CountingLock::tryOptimisticRead): Deleted. (WTF::CountingLock::validate): Deleted. (WTF::CountingLock::doOptimizedRead): Deleted. (WTF::CountingLock::tryOptimisticFencelessRead): Deleted. (WTF::CountingLock::fencelessValidate): Deleted. (WTF::CountingLock::doOptimizedFencelessRead): Deleted. (WTF::CountingLock::getCount): Deleted. * wtf/CrossThreadQueue.h: * wtf/CrossThreadTask.h: * wtf/CryptographicallyRandomNumber.cpp: * wtf/DataMutex.h: * wtf/DateMath.h: * wtf/Deque.h: (WTF::Deque::size const): Deleted. (WTF::Deque::isEmpty const): Deleted. (WTF::Deque::begin): Deleted. (WTF::Deque::end): Deleted. (WTF::Deque::begin const): Deleted. (WTF::Deque::end const): Deleted. (WTF::Deque::rbegin): Deleted. (WTF::Deque::rend): Deleted. (WTF::Deque::rbegin const): Deleted. (WTF::Deque::rend const): Deleted. (WTF::Deque::first): Deleted. (WTF::Deque::first const): Deleted. (WTF::Deque::last): Deleted. (WTF::Deque::last const): Deleted. (WTF::Deque::append): Deleted. * wtf/Dominators.h: * wtf/DoublyLinkedList.h: * wtf/Expected.h: * wtf/FastBitVector.h: * wtf/FileMetadata.h: * wtf/FileSystem.h: * wtf/GraphNodeWorklist.h: * wtf/GregorianDateTime.h: (WTF::GregorianDateTime::GregorianDateTime): Deleted. (WTF::GregorianDateTime::year const): Deleted. (WTF::GregorianDateTime::month const): Deleted. (WTF::GregorianDateTime::yearDay const): Deleted. (WTF::GregorianDateTime::monthDay const): Deleted. (WTF::GregorianDateTime::weekDay const): Deleted. (WTF::GregorianDateTime::hour const): Deleted. (WTF::GregorianDateTime::minute const): Deleted. (WTF::GregorianDateTime::second const): Deleted. (WTF::GregorianDateTime::utcOffset const): Deleted. (WTF::GregorianDateTime::isDST const): Deleted. (WTF::GregorianDateTime::setYear): Deleted. (WTF::GregorianDateTime::setMonth): Deleted. (WTF::GregorianDateTime::setYearDay): Deleted. (WTF::GregorianDateTime::setMonthDay): Deleted. (WTF::GregorianDateTime::setWeekDay): Deleted. (WTF::GregorianDateTime::setHour): Deleted. (WTF::GregorianDateTime::setMinute): Deleted. (WTF::GregorianDateTime::setSecond): Deleted. (WTF::GregorianDateTime::setUtcOffset): Deleted. (WTF::GregorianDateTime::setIsDST): Deleted. (WTF::GregorianDateTime::operator tm const): Deleted. (WTF::GregorianDateTime::copyFrom): Deleted. * wtf/HashTable.h: * wtf/Hasher.h: * wtf/HexNumber.h: * wtf/Indenter.h: * wtf/IndexMap.h: * wtf/IndexSet.h: * wtf/IndexSparseSet.h: * wtf/IndexedContainerIterator.h: * wtf/Insertion.h: * wtf/IteratorAdaptors.h: * wtf/IteratorRange.h: * wtf/KeyValuePair.h: * wtf/ListHashSet.h: (WTF::ListHashSet::begin): Deleted. (WTF::ListHashSet::end): Deleted. (WTF::ListHashSet::begin const): Deleted. (WTF::ListHashSet::end const): Deleted. (WTF::ListHashSet::random): Deleted. (WTF::ListHashSet::random const): Deleted. (WTF::ListHashSet::rbegin): Deleted. (WTF::ListHashSet::rend): Deleted. (WTF::ListHashSet::rbegin const): Deleted. (WTF::ListHashSet::rend const): Deleted. * wtf/Liveness.h: * wtf/LocklessBag.h: (WTF::LocklessBag::LocklessBag): Deleted. (WTF::LocklessBag::add): Deleted. (WTF::LocklessBag::iterate): Deleted. (WTF::LocklessBag::consumeAll): Deleted. (WTF::LocklessBag::consumeAllWithNode): Deleted. (WTF::LocklessBag::~LocklessBag): Deleted. * wtf/LoggingHashID.h: * wtf/MD5.h: * wtf/MachSendRight.h: * wtf/MainThreadData.h: * wtf/Markable.h: * wtf/MediaTime.h: * wtf/MemoryPressureHandler.h: * wtf/MessageQueue.h: (WTF::MessageQueue::MessageQueue): Deleted. * wtf/MetaAllocator.h: * wtf/MonotonicTime.h: (WTF::MonotonicTime::MonotonicTime): Deleted. (WTF::MonotonicTime::fromRawSeconds): Deleted. (WTF::MonotonicTime::infinity): Deleted. (WTF::MonotonicTime::nan): Deleted. (WTF::MonotonicTime::secondsSinceEpoch const): Deleted. (WTF::MonotonicTime::approximateMonotonicTime const): Deleted. (WTF::MonotonicTime::operator bool const): Deleted. (WTF::MonotonicTime::operator+ const): Deleted. (WTF::MonotonicTime::operator- const): Deleted. (WTF::MonotonicTime::operator% const): Deleted. (WTF::MonotonicTime::operator+=): Deleted. (WTF::MonotonicTime::operator-=): Deleted. (WTF::MonotonicTime::operator== const): Deleted. (WTF::MonotonicTime::operator!= const): Deleted. (WTF::MonotonicTime::operator< const): Deleted. (WTF::MonotonicTime::operator> const): Deleted. (WTF::MonotonicTime::operator<= const): Deleted. (WTF::MonotonicTime::operator>= const): Deleted. (WTF::MonotonicTime::isolatedCopy const): Deleted. (WTF::MonotonicTime::encode const): Deleted. (WTF::MonotonicTime::decode): Deleted. * wtf/NaturalLoops.h: * wtf/NoLock.h: * wtf/OSAllocator.h: * wtf/OptionSet.h: * wtf/Optional.h: * wtf/OrderMaker.h: * wtf/Packed.h: (WTF::alignof): * wtf/PackedIntVector.h: (WTF::PackedIntVector::PackedIntVector): Deleted. (WTF::PackedIntVector::operator=): Deleted. (WTF::PackedIntVector::size const): Deleted. (WTF::PackedIntVector::ensureSize): Deleted. (WTF::PackedIntVector::resize): Deleted. (WTF::PackedIntVector::clearAll): Deleted. (WTF::PackedIntVector::get const): Deleted. (WTF::PackedIntVector::set): Deleted. (WTF::PackedIntVector::mask): Deleted. * wtf/PageBlock.h: * wtf/ParallelJobsOpenMP.h: * wtf/ParkingLot.h: * wtf/PriorityQueue.h: (WTF::PriorityQueue::size const): Deleted. (WTF::PriorityQueue::isEmpty const): Deleted. (WTF::PriorityQueue::enqueue): Deleted. (WTF::PriorityQueue::peek const): Deleted. (WTF::PriorityQueue::dequeue): Deleted. (WTF::PriorityQueue::decreaseKey): Deleted. (WTF::PriorityQueue::increaseKey): Deleted. (WTF::PriorityQueue::begin const): Deleted. (WTF::PriorityQueue::end const): Deleted. (WTF::PriorityQueue::isValidHeap const): Deleted. (WTF::PriorityQueue::parentOf): Deleted. (WTF::PriorityQueue::leftChildOf): Deleted. (WTF::PriorityQueue::rightChildOf): Deleted. (WTF::PriorityQueue::siftUp): Deleted. (WTF::PriorityQueue::siftDown): Deleted. * wtf/RandomDevice.h: * wtf/Range.h: * wtf/RangeSet.h: (WTF::RangeSet::RangeSet): Deleted. (WTF::RangeSet::~RangeSet): Deleted. (WTF::RangeSet::add): Deleted. (WTF::RangeSet::contains const): Deleted. (WTF::RangeSet::overlaps const): Deleted. (WTF::RangeSet::clear): Deleted. (WTF::RangeSet::dump const): Deleted. (WTF::RangeSet::dumpRaw const): Deleted. (WTF::RangeSet::begin const): Deleted. (WTF::RangeSet::end const): Deleted. (WTF::RangeSet::addAll): Deleted. (WTF::RangeSet::compact): Deleted. (WTF::RangeSet::overlapsNonEmpty): Deleted. (WTF::RangeSet::subsumesNonEmpty): Deleted. (WTF::RangeSet::findRange const): Deleted. * wtf/RecursableLambda.h: * wtf/RedBlackTree.h: (WTF::RedBlackTree::Node::successor const): Deleted. (WTF::RedBlackTree::Node::predecessor const): Deleted. (WTF::RedBlackTree::Node::successor): Deleted. (WTF::RedBlackTree::Node::predecessor): Deleted. (WTF::RedBlackTree::Node::reset): Deleted. (WTF::RedBlackTree::Node::parent const): Deleted. (WTF::RedBlackTree::Node::setParent): Deleted. (WTF::RedBlackTree::Node::left const): Deleted. (WTF::RedBlackTree::Node::setLeft): Deleted. (WTF::RedBlackTree::Node::right const): Deleted. (WTF::RedBlackTree::Node::setRight): Deleted. (WTF::RedBlackTree::Node::color const): Deleted. (WTF::RedBlackTree::Node::setColor): Deleted. (WTF::RedBlackTree::RedBlackTree): Deleted. (WTF::RedBlackTree::insert): Deleted. (WTF::RedBlackTree::remove): Deleted. (WTF::RedBlackTree::findExact const): Deleted. (WTF::RedBlackTree::findLeastGreaterThanOrEqual const): Deleted. (WTF::RedBlackTree::findGreatestLessThanOrEqual const): Deleted. (WTF::RedBlackTree::first const): Deleted. (WTF::RedBlackTree::last const): Deleted. (WTF::RedBlackTree::size): Deleted. (WTF::RedBlackTree::isEmpty): Deleted. (WTF::RedBlackTree::treeMinimum): Deleted. (WTF::RedBlackTree::treeMaximum): Deleted. (WTF::RedBlackTree::treeInsert): Deleted. (WTF::RedBlackTree::leftRotate): Deleted. (WTF::RedBlackTree::rightRotate): Deleted. (WTF::RedBlackTree::removeFixup): Deleted. * wtf/ResourceUsage.h: * wtf/RunLoop.cpp: * wtf/RunLoopTimer.h: * wtf/SHA1.h: * wtf/Seconds.h: (WTF::Seconds::Seconds): Deleted. (WTF::Seconds::value const): Deleted. (WTF::Seconds::minutes const): Deleted. (WTF::Seconds::seconds const): Deleted. (WTF::Seconds::milliseconds const): Deleted. (WTF::Seconds::microseconds const): Deleted. (WTF::Seconds::nanoseconds const): Deleted. (WTF::Seconds::minutesAs const): Deleted. (WTF::Seconds::secondsAs const): Deleted. (WTF::Seconds::millisecondsAs const): Deleted. (WTF::Seconds::microsecondsAs const): Deleted. (WTF::Seconds::nanosecondsAs const): Deleted. (WTF::Seconds::fromMinutes): Deleted. (WTF::Seconds::fromHours): Deleted. (WTF::Seconds::fromMilliseconds): Deleted. (WTF::Seconds::fromMicroseconds): Deleted. (WTF::Seconds::fromNanoseconds): Deleted. (WTF::Seconds::infinity): Deleted. (WTF::Seconds::nan): Deleted. (WTF::Seconds::operator bool const): Deleted. (WTF::Seconds::operator+ const): Deleted. (WTF::Seconds::operator- const): Deleted. (WTF::Seconds::operator* const): Deleted. (WTF::Seconds::operator/ const): Deleted. (WTF::Seconds::operator% const): Deleted. (WTF::Seconds::operator+=): Deleted. (WTF::Seconds::operator-=): Deleted. (WTF::Seconds::operator*=): Deleted. (WTF::Seconds::operator/=): Deleted. (WTF::Seconds::operator%=): Deleted. (WTF::Seconds::operator== const): Deleted. (WTF::Seconds::operator!= const): Deleted. (WTF::Seconds::operator< const): Deleted. (WTF::Seconds::operator> const): Deleted. (WTF::Seconds::operator<= const): Deleted. (WTF::Seconds::operator>= const): Deleted. (WTF::Seconds::isolatedCopy const): Deleted. (WTF::Seconds::encode const): Deleted. (WTF::Seconds::decode): Deleted. * wtf/SegmentedVector.h: (WTF::SegmentedVector::~SegmentedVector): Deleted. (WTF::SegmentedVector::size const): Deleted. (WTF::SegmentedVector::isEmpty const): Deleted. (WTF::SegmentedVector::at): Deleted. (WTF::SegmentedVector::at const): Deleted. (WTF::SegmentedVector::operator[]): Deleted. (WTF::SegmentedVector::operator[] const): Deleted. (WTF::SegmentedVector::first): Deleted. (WTF::SegmentedVector::first const): Deleted. (WTF::SegmentedVector::last): Deleted. (WTF::SegmentedVector::last const): Deleted. (WTF::SegmentedVector::takeLast): Deleted. (WTF::SegmentedVector::append): Deleted. (WTF::SegmentedVector::alloc): Deleted. (WTF::SegmentedVector::removeLast): Deleted. (WTF::SegmentedVector::grow): Deleted. (WTF::SegmentedVector::clear): Deleted. (WTF::SegmentedVector::begin): Deleted. (WTF::SegmentedVector::end): Deleted. (WTF::SegmentedVector::shrinkToFit): Deleted. (WTF::SegmentedVector::deleteAllSegments): Deleted. (WTF::SegmentedVector::segmentExistsFor): Deleted. (WTF::SegmentedVector::segmentFor): Deleted. (WTF::SegmentedVector::subscriptFor): Deleted. (WTF::SegmentedVector::ensureSegmentsFor): Deleted. (WTF::SegmentedVector::ensureSegment): Deleted. (WTF::SegmentedVector::allocateSegment): Deleted. * wtf/SetForScope.h: * wtf/SingleRootGraph.h: * wtf/SinglyLinkedList.h: * wtf/SmallPtrSet.h: * wtf/SpanningTree.h: * wtf/Spectrum.h: * wtf/StackBounds.h: * wtf/StackShot.h: * wtf/StackShotProfiler.h: * wtf/StackStats.h: * wtf/StackTrace.h: * wtf/StreamBuffer.h: * wtf/SynchronizedFixedQueue.h: (WTF::SynchronizedFixedQueue::create): Deleted. (WTF::SynchronizedFixedQueue::open): Deleted. (WTF::SynchronizedFixedQueue::close): Deleted. (WTF::SynchronizedFixedQueue::isOpen): Deleted. (WTF::SynchronizedFixedQueue::enqueue): Deleted. (WTF::SynchronizedFixedQueue::dequeue): Deleted. (WTF::SynchronizedFixedQueue::SynchronizedFixedQueue): Deleted. * wtf/SystemTracing.h: * wtf/ThreadGroup.h: (WTF::ThreadGroup::create): Deleted. (WTF::ThreadGroup::threads const): Deleted. (WTF::ThreadGroup::getLock): Deleted. (WTF::ThreadGroup::weakFromThis): Deleted. * wtf/ThreadSpecific.h: * wtf/ThreadingPrimitives.h: (WTF::Mutex::impl): Deleted. * wtf/TimeWithDynamicClockType.h: (WTF::TimeWithDynamicClockType::TimeWithDynamicClockType): Deleted. (WTF::TimeWithDynamicClockType::fromRawSeconds): Deleted. (WTF::TimeWithDynamicClockType::secondsSinceEpoch const): Deleted. (WTF::TimeWithDynamicClockType::clockType const): Deleted. (WTF::TimeWithDynamicClockType::withSameClockAndRawSeconds const): Deleted. (WTF::TimeWithDynamicClockType::operator bool const): Deleted. (WTF::TimeWithDynamicClockType::operator+ const): Deleted. (WTF::TimeWithDynamicClockType::operator- const): Deleted. (WTF::TimeWithDynamicClockType::operator+=): Deleted. (WTF::TimeWithDynamicClockType::operator-=): Deleted. (WTF::TimeWithDynamicClockType::operator== const): Deleted. (WTF::TimeWithDynamicClockType::operator!= const): Deleted. * wtf/TimingScope.h: * wtf/TinyLRUCache.h: * wtf/TinyPtrSet.h: * wtf/URLParser.cpp: * wtf/URLParser.h: * wtf/Unexpected.h: * wtf/Variant.h: * wtf/WTFSemaphore.h: (WTF::Semaphore::Semaphore): Deleted. (WTF::Semaphore::signal): Deleted. (WTF::Semaphore::waitUntil): Deleted. (WTF::Semaphore::waitFor): Deleted. (WTF::Semaphore::wait): Deleted. * wtf/WallTime.h: (WTF::WallTime::WallTime): Deleted. (WTF::WallTime::fromRawSeconds): Deleted. (WTF::WallTime::infinity): Deleted. (WTF::WallTime::nan): Deleted. (WTF::WallTime::secondsSinceEpoch const): Deleted. (WTF::WallTime::approximateWallTime const): Deleted. (WTF::WallTime::operator bool const): Deleted. (WTF::WallTime::operator+ const): Deleted. (WTF::WallTime::operator- const): Deleted. (WTF::WallTime::operator+=): Deleted. (WTF::WallTime::operator-=): Deleted. (WTF::WallTime::operator== const): Deleted. (WTF::WallTime::operator!= const): Deleted. (WTF::WallTime::operator< const): Deleted. (WTF::WallTime::operator> const): Deleted. (WTF::WallTime::operator<= const): Deleted. (WTF::WallTime::operator>= const): Deleted. (WTF::WallTime::isolatedCopy const): Deleted. * wtf/WeakHashSet.h: (WTF::WeakHashSet::WeakHashSetConstIterator::WeakHashSetConstIterator): Deleted. (WTF::WeakHashSet::WeakHashSetConstIterator::get const): Deleted. (WTF::WeakHashSet::WeakHashSetConstIterator::operator* const): Deleted. (WTF::WeakHashSet::WeakHashSetConstIterator::operator-> const): Deleted. (WTF::WeakHashSet::WeakHashSetConstIterator::operator++): Deleted. (WTF::WeakHashSet::WeakHashSetConstIterator::skipEmptyBuckets): Deleted. (WTF::WeakHashSet::WeakHashSetConstIterator::operator== const): Deleted. (WTF::WeakHashSet::WeakHashSetConstIterator::operator!= const): Deleted. (WTF::WeakHashSet::WeakHashSet): Deleted. (WTF::WeakHashSet::begin const): Deleted. (WTF::WeakHashSet::end const): Deleted. (WTF::WeakHashSet::add): Deleted. (WTF::WeakHashSet::remove): Deleted. (WTF::WeakHashSet::contains const): Deleted. (WTF::WeakHashSet::capacity const): Deleted. (WTF::WeakHashSet::computesEmpty const): Deleted. (WTF::WeakHashSet::hasNullReferences const): Deleted. (WTF::WeakHashSet::computeSize const): Deleted. (WTF::WeakHashSet::checkConsistency const): Deleted. * wtf/WeakRandom.h: (WTF::WeakRandom::WeakRandom): Deleted. (WTF::WeakRandom::setSeed): Deleted. (WTF::WeakRandom::seed const): Deleted. (WTF::WeakRandom::get): Deleted. (WTF::WeakRandom::getUint32): Deleted. (WTF::WeakRandom::lowOffset): Deleted. (WTF::WeakRandom::highOffset): Deleted. (WTF::WeakRandom::nextState): Deleted. (WTF::WeakRandom::generate): Deleted. (WTF::WeakRandom::advance): Deleted. * wtf/WordLock.h: (WTF::WordLock::lock): Deleted. (WTF::WordLock::unlock): Deleted. (WTF::WordLock::isHeld const): Deleted. (WTF::WordLock::isLocked const): Deleted. (WTF::WordLock::isFullyReset const): Deleted. * wtf/generic/MainThreadGeneric.cpp: * wtf/glib/GMutexLocker.h: * wtf/linux/CurrentProcessMemoryStatus.h: * wtf/posix/ThreadingPOSIX.cpp: (WTF::Semaphore::Semaphore): Deleted. (WTF::Semaphore::~Semaphore): Deleted. (WTF::Semaphore::wait): Deleted. (WTF::Semaphore::post): Deleted. * wtf/text/ASCIILiteral.h: (WTF::ASCIILiteral::operator const char* const): Deleted. (WTF::ASCIILiteral::fromLiteralUnsafe): Deleted. (WTF::ASCIILiteral::null): Deleted. (WTF::ASCIILiteral::characters const): Deleted. (WTF::ASCIILiteral::ASCIILiteral): Deleted. * wtf/text/AtomString.h: (WTF::AtomString::operator=): Deleted. (WTF::AtomString::isHashTableDeletedValue const): Deleted. (WTF::AtomString::existingHash const): Deleted. (WTF::AtomString::operator const String& const): Deleted. (WTF::AtomString::string const): Deleted. (WTF::AtomString::impl const): Deleted. (WTF::AtomString::is8Bit const): Deleted. (WTF::AtomString::characters8 const): Deleted. (WTF::AtomString::characters16 const): Deleted. (WTF::AtomString::length const): Deleted. (WTF::AtomString::operator[] const): Deleted. (WTF::AtomString::contains const): Deleted. (WTF::AtomString::containsIgnoringASCIICase const): Deleted. (WTF::AtomString::find const): Deleted. (WTF::AtomString::findIgnoringASCIICase const): Deleted. (WTF::AtomString::startsWith const): Deleted. (WTF::AtomString::startsWithIgnoringASCIICase const): Deleted. (WTF::AtomString::endsWith const): Deleted. (WTF::AtomString::endsWithIgnoringASCIICase const): Deleted. (WTF::AtomString::toInt const): Deleted. (WTF::AtomString::toDouble const): Deleted. (WTF::AtomString::toFloat const): Deleted. (WTF::AtomString::percentage const): Deleted. (WTF::AtomString::isNull const): Deleted. (WTF::AtomString::isEmpty const): Deleted. (WTF::AtomString::operator NSString * const): Deleted. * wtf/text/AtomStringImpl.h: (WTF::AtomStringImpl::lookUp): Deleted. (WTF::AtomStringImpl::add): Deleted. (WTF::AtomStringImpl::addWithStringTableProvider): Deleted. * wtf/text/CString.h: (WTF::CStringBuffer::data): Deleted. (WTF::CStringBuffer::length const): Deleted. (WTF::CStringBuffer::CStringBuffer): Deleted. (WTF::CStringBuffer::mutableData): Deleted. (WTF::CString::CString): Deleted. (WTF::CString::data const): Deleted. (WTF::CString::length const): Deleted. (WTF::CString::isNull const): Deleted. (WTF::CString::buffer const): Deleted. (WTF::CString::isHashTableDeletedValue const): Deleted. * wtf/text/ExternalStringImpl.h: (WTF::ExternalStringImpl::freeExternalBuffer): Deleted. * wtf/text/LineBreakIteratorPoolICU.h: * wtf/text/NullTextBreakIterator.h: * wtf/text/OrdinalNumber.h: * wtf/text/StringBuffer.h: * wtf/text/StringBuilder.h: * wtf/text/StringConcatenateNumbers.h: * wtf/text/StringHasher.h: * wtf/text/StringImpl.h: * wtf/text/StringView.cpp: * wtf/text/StringView.h: (WTF::StringView::left const): Deleted. (WTF::StringView::right const): Deleted. (WTF::StringView::underlyingStringIsValid const): Deleted. (WTF::StringView::setUnderlyingString): Deleted. * wtf/text/SymbolImpl.h: (WTF::SymbolImpl::StaticSymbolImpl::StaticSymbolImpl): Deleted. (WTF::SymbolImpl::StaticSymbolImpl::operator SymbolImpl&): Deleted. (WTF::PrivateSymbolImpl::PrivateSymbolImpl): Deleted. (WTF::RegisteredSymbolImpl::symbolRegistry const): Deleted. (WTF::RegisteredSymbolImpl::clearSymbolRegistry): Deleted. (WTF::RegisteredSymbolImpl::RegisteredSymbolImpl): Deleted. * wtf/text/SymbolRegistry.h: * wtf/text/TextBreakIterator.h: * wtf/text/TextPosition.h: * wtf/text/TextStream.h: * wtf/text/WTFString.h: (WTF::String::swap): Deleted. (WTF::String::adopt): Deleted. (WTF::String::isNull const): Deleted. (WTF::String::isEmpty const): Deleted. (WTF::String::impl const): Deleted. (WTF::String::releaseImpl): Deleted. (WTF::String::length const): Deleted. (WTF::String::characters8 const): Deleted. (WTF::String::characters16 const): Deleted. (WTF::String::is8Bit const): Deleted. (WTF::String::sizeInBytes const): Deleted. (WTF::String::operator[] const): Deleted. (WTF::String::find const): Deleted. (WTF::String::findIgnoringASCIICase const): Deleted. (WTF::String::reverseFind const): Deleted. (WTF::String::contains const): Deleted. (WTF::String::containsIgnoringASCIICase const): Deleted. (WTF::String::startsWith const): Deleted. (WTF::String::startsWithIgnoringASCIICase const): Deleted. (WTF::String::hasInfixStartingAt const): Deleted. (WTF::String::endsWith const): Deleted. (WTF::String::endsWithIgnoringASCIICase const): Deleted. (WTF::String::hasInfixEndingAt const): Deleted. (WTF::String::append): Deleted. (WTF::String::left const): Deleted. (WTF::String::right const): Deleted. (WTF::String::createUninitialized): Deleted. (WTF::String::fromUTF8WithLatin1Fallback): Deleted. (WTF::String::isAllASCII const): Deleted. (WTF::String::isAllLatin1 const): Deleted. (WTF::String::isSpecialCharacter const): Deleted. (WTF::String::isHashTableDeletedValue const): Deleted. (WTF::String::hash const): Deleted. (WTF::String::existingHash const): Deleted. * wtf/text/cf/TextBreakIteratorCF.h: * wtf/text/icu/TextBreakIteratorICU.h: * wtf/text/icu/UTextProviderLatin1.h: * wtf/threads/BinarySemaphore.h: (WTF::BinarySemaphore::waitFor): Deleted. (WTF::BinarySemaphore::wait): Deleted. * wtf/unicode/Collator.h: * wtf/win/GDIObject.h: * wtf/win/PathWalker.h: * wtf/win/Win32Handle.h: Canonical link: https://commits.webkit.org/214396@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248546 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-08-12 20:57:15 +00:00
WTF_MAKE_FAST_ALLOCATED;
Dominators should be factored out of the DFG https://bugs.webkit.org/show_bug.cgi?id=150764 Reviewed by Geoffrey Garen. Source/JavaScriptCore: Factored DFGDominators.h/DFGDominators.cpp into WTF. To do this, I made two changes to the DFG: 1) DFG now has a CFG abstraction called DFG::CFG. The cool thing about this is that in the future if we wanted to support inverted dominators, we could do it by just creating a DFG::BackwardCFG. 2) Got rid of DFG::Analysis. From now on, an Analysis being invalidated is expressed by the DFG::Graph having a null pointer for that analysis. When we "run" the analysis, we just instantiate it. This makes it much more natural to integrate WTF::Dominators into the DFG. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * dfg/DFGAnalysis.h: Removed. * dfg/DFGCFG.h: Added. (JSC::DFG::CFG::CFG): (JSC::DFG::CFG::root): (JSC::DFG::CFG::newMap<T>): (JSC::DFG::CFG::successors): (JSC::DFG::CFG::predecessors): (JSC::DFG::CFG::index): (JSC::DFG::CFG::node): (JSC::DFG::CFG::numNodes): (JSC::DFG::CFG::dump): * dfg/DFGCSEPhase.cpp: * dfg/DFGDisassembler.cpp: (JSC::DFG::Disassembler::createDumpList): * dfg/DFGDominators.cpp: Removed. * dfg/DFGDominators.h: (JSC::DFG::Dominators::Dominators): (JSC::DFG::Dominators::strictlyDominates): Deleted. (JSC::DFG::Dominators::dominates): Deleted. (JSC::DFG::Dominators::immediateDominatorOf): Deleted. (JSC::DFG::Dominators::forAllStrictDominatorsOf): Deleted. (JSC::DFG::Dominators::forAllDominatorsOf): Deleted. (JSC::DFG::Dominators::forAllBlocksStrictlyDominatedBy): Deleted. (JSC::DFG::Dominators::forAllBlocksDominatedBy): Deleted. (JSC::DFG::Dominators::forAllBlocksInDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInIteratedDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInPrunedIteratedDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInDominanceFrontierOfImpl): Deleted. (JSC::DFG::Dominators::forAllBlocksInIteratedDominanceFrontierOfImpl): Deleted. (JSC::DFG::Dominators::BlockData::BlockData): Deleted. * dfg/DFGEdgeDominates.h: (JSC::DFG::EdgeDominates::operator()): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::Graph): (JSC::DFG::Graph::dumpBlockHeader): (JSC::DFG::Graph::invalidateCFG): (JSC::DFG::Graph::substituteGetLocal): (JSC::DFG::Graph::handleAssertionFailure): (JSC::DFG::Graph::ensureDominators): (JSC::DFG::Graph::ensurePrePostNumbering): (JSC::DFG::Graph::ensureNaturalLoops): (JSC::DFG::Graph::valueProfileFor): * dfg/DFGGraph.h: (JSC::DFG::Graph::hasDebuggerEnabled): * dfg/DFGLICMPhase.cpp: (JSC::DFG::LICMPhase::run): (JSC::DFG::LICMPhase::attemptHoist): * dfg/DFGLoopPreHeaderCreationPhase.cpp: (JSC::DFG::createPreHeader): (JSC::DFG::LoopPreHeaderCreationPhase::run): * dfg/DFGNaturalLoops.cpp: (JSC::DFG::NaturalLoop::dump): (JSC::DFG::NaturalLoops::NaturalLoops): (JSC::DFG::NaturalLoops::~NaturalLoops): (JSC::DFG::NaturalLoops::loopsOf): (JSC::DFG::NaturalLoops::computeDependencies): Deleted. (JSC::DFG::NaturalLoops::compute): Deleted. * dfg/DFGNaturalLoops.h: (JSC::DFG::NaturalLoops::numLoops): * dfg/DFGNode.h: (JSC::DFG::Node::SuccessorsIterable::end): (JSC::DFG::Node::SuccessorsIterable::size): (JSC::DFG::Node::SuccessorsIterable::at): (JSC::DFG::Node::SuccessorsIterable::operator[]): * dfg/DFGOSREntrypointCreationPhase.cpp: (JSC::DFG::OSREntrypointCreationPhase::run): * dfg/DFGObjectAllocationSinkingPhase.cpp: * dfg/DFGPlan.cpp: (JSC::DFG::Plan::compileInThreadImpl): * dfg/DFGPrePostNumbering.cpp: (JSC::DFG::PrePostNumbering::PrePostNumbering): (JSC::DFG::PrePostNumbering::~PrePostNumbering): (JSC::DFG::PrePostNumbering::compute): Deleted. * dfg/DFGPrePostNumbering.h: (JSC::DFG::PrePostNumbering::preNumber): (JSC::DFG::PrePostNumbering::postNumber): * dfg/DFGPutStackSinkingPhase.cpp: * dfg/DFGSSACalculator.cpp: (JSC::DFG::SSACalculator::nonLocalReachingDef): (JSC::DFG::SSACalculator::reachingDefAtTail): * dfg/DFGSSACalculator.h: (JSC::DFG::SSACalculator::computePhis): * dfg/DFGSSAConversionPhase.cpp: (JSC::DFG::SSAConversionPhase::run): * ftl/FTLLink.cpp: (JSC::FTL::link): * ftl/FTLLowerDFGToLLVM.cpp: (JSC::FTL::DFG::LowerDFGToLLVM::lower): (JSC::FTL::DFG::LowerDFGToLLVM::safelyInvalidateAfterTermination): (JSC::FTL::DFG::LowerDFGToLLVM::isValid): Source/WTF: This takes what used to be DFGDominators.h/DFGDominators.cpp and turns it into a generic algorithm that can take any abstract graph. The idea is that you create Dominators<CFG> and pass it a CFG object, which defines the types of graph nodes and methods for getting successors, predecessors, etc. The DFG now defines a class called CFG, which is a wrapper for DFG::Graph that conforms to the thing that wtf/Dominators.h expects. When doing things to graphs, it's common to refer to the things in the graph as "nodes". Because I intend to reuse the CFG abstraction with many graph algorithms, that abstraction uses the term "node" to refer to a DFG basic block. But in Dominators, the method and variable names still use "block". This is because although Dominators are applicable to any kind of directed graph, it's super unlikely that we will ever use them for anything but compilers. Indeed, the only reason why I'm factoring them out of the DFG is so that I can use them with B3 and Air. This has the nice side effect that a user of WTF::Dominators<JSC::DFG::CFG> will see familiar terminology like "blocksStrictlyDominatedBy(...)" instead of "nodesStrictlyDominatedBy(...)", which would be super confusing. Overall, wtf/Dominators.h is a combination of what used to be in DFGDominators.h, DFGDominators.cpp, DFGNaiveDominators.h, and DFGNaiveDominators.cpp. I only changed code when I had to in order to make it generic. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/Dominators.h: Added. (WTF::Dominators::Dominators): (WTF::Dominators::compute): (WTF::Dominators::strictlyDominates): (WTF::Dominators::dominates): (WTF::Dominators::immediateDominatorOf): (WTF::Dominators::forAllStrictDominatorsOf): (WTF::Dominators::forAllDominatorsOf): (WTF::Dominators::forAllBlocksStrictlyDominatedBy): (WTF::Dominators::forAllBlocksDominatedBy): (WTF::Dominators::strictDominatorsOf): (WTF::Dominators::dominatorsOf): (WTF::Dominators::blocksStrictlyDominatedBy): (WTF::Dominators::blocksDominatedBy): (WTF::Dominators::forAllBlocksInDominanceFrontierOf): (WTF::Dominators::dominanceFrontierOf): (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOf): (WTF::Dominators::forAllBlocksInPrunedIteratedDominanceFrontierOf): (WTF::Dominators::iteratedDominanceFrontierOf): (WTF::Dominators::dump): (WTF::Dominators::LengauerTarjan::LengauerTarjan): (WTF::Dominators::LengauerTarjan::compute): (WTF::Dominators::LengauerTarjan::immediateDominator): (WTF::Dominators::LengauerTarjan::computeDepthFirstPreNumbering): (WTF::Dominators::LengauerTarjan::computeSemiDominatorsAndImplicitImmediateDominators): (WTF::Dominators::LengauerTarjan::computeExplicitImmediateDominators): (WTF::Dominators::LengauerTarjan::link): (WTF::Dominators::LengauerTarjan::eval): (WTF::Dominators::LengauerTarjan::compress): (WTF::Dominators::LengauerTarjan::BlockData::BlockData): (WTF::Dominators::NaiveDominators::NaiveDominators): (WTF::Dominators::NaiveDominators::dominates): (WTF::Dominators::NaiveDominators::dump): (WTF::Dominators::NaiveDominators::pruneDominators): (WTF::Dominators::ValidationContext::ValidationContext): (WTF::Dominators::ValidationContext::reportError): (WTF::Dominators::ValidationContext::handleErrors): (WTF::Dominators::naiveDominates): (WTF::Dominators::forAllBlocksInDominanceFrontierOfImpl): (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOfImpl): (WTF::Dominators::BlockData::BlockData): Canonical link: https://commits.webkit.org/168962@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@191870 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-11-02 00:48:03 +00:00
public:
LengauerTarjan(Graph& graph)
: m_graph(graph)
, m_data(graph.template newMap<BlockData>())
{
for (unsigned blockIndex = m_graph.numNodes(); blockIndex--;) {
typename Graph::Node block = m_graph.node(blockIndex);
if (!block)
continue;
m_data[block].label = block;
}
}
void compute()
{
computeDepthFirstPreNumbering(); // Step 1.
computeSemiDominatorsAndImplicitImmediateDominators(); // Steps 2 and 3.
computeExplicitImmediateDominators(); // Step 4.
}
typename Graph::Node immediateDominator(typename Graph::Node block)
{
return m_data[block].dom;
}
private:
void computeDepthFirstPreNumbering()
{
// Use a block worklist that also tracks the index inside the successor list. This is
// necessary for ensuring that we don't attempt to visit a successor until the previous
// successors that we had visited are fully processed. This ends up being revealed in the
// output of this method because the first time we see an edge to a block, we set the
// block's parent. So, if we have:
//
// A -> B
// A -> C
// B -> C
//
// And we're processing A, then we want to ensure that if we see A->B first (and hence set
// B's prenumber before we set C's) then we also end up setting C's parent to B by virtue
// of not noticing A->C until we're done processing B.
ExtendedGraphNodeWorklist<typename Graph::Node, unsigned, typename Graph::Set> worklist;
DFG::LICMPhase shouldn't hoist type checks unless it knows that the check will succeed at the loop pre-header https://bugs.webkit.org/show_bug.cgi?id=144527 Reviewed by Saam Barati. Source/JavaScriptCore: This adds a control flow equivalence analysis (called ControlEquivalenceAnalysis) based on dominator analysis over the backwards CFG. Two basic blocks are control flow equivalent if the execution of one implies that the other one must also execute. It means that the two blocks' forward and backward dominance are reciprocated: (A dom B and B backdom A) or (B dom A and A backdom B). LICM now uses it to become more conservative about hoisting checks, if this has caused problems in the past. If we hoist something that may exit from a block that was not control equivalent to the pre-header then it's possible that the node's speculation will fail even though it wouldn't have if it wasn't hoisted. So, we flag these nodes' origins as being "wasHoisted" and we track all of their exits as "HoistingFailed". LICM will turn off such speculative hoisting if the CodeBlock from which we are hoisting had the HoistingFailed exit kind. Note that this deliberately still allows us to hoist things that may exit even if they are not control equivalent to the pre-header. This is necessary because the profitability of hoisting is so huge in all of the cases that we're aware of that it's worth giving it a shot. This is neutral on macrobenchmarks since none of the benchmarks we track have a hoistable operation that would exit only if hoisted. I added microbenchmarks to illustrate the problem and two of them speed up by ~40% while one of them is neutral (Int52 saves us from having problems on that program even though LICM previously did the wrong thing). * JavaScriptCore.xcodeproj/project.pbxproj: * bytecode/ExitKind.cpp: (JSC::exitKindToString): * bytecode/ExitKind.h: * dfg/DFGAtTailAbstractState.h: (JSC::DFG::AtTailAbstractState::operator bool): (JSC::DFG::AtTailAbstractState::initializeTo): * dfg/DFGBackwardsCFG.h: Added. (JSC::DFG::BackwardsCFG::BackwardsCFG): * dfg/DFGBackwardsDominators.h: Added. (JSC::DFG::BackwardsDominators::BackwardsDominators): * dfg/DFGCommon.h: (JSC::DFG::checkAndSet): Deleted. * dfg/DFGControlEquivalenceAnalysis.h: Added. (JSC::DFG::ControlEquivalenceAnalysis::ControlEquivalenceAnalysis): (JSC::DFG::ControlEquivalenceAnalysis::dominatesEquivalently): (JSC::DFG::ControlEquivalenceAnalysis::areEquivalent): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::dump): (JSC::DFG::Graph::dumpBlockHeader): (JSC::DFG::Graph::invalidateCFG): (JSC::DFG::Graph::substituteGetLocal): (JSC::DFG::Graph::handleAssertionFailure): (JSC::DFG::Graph::ensureDominators): (JSC::DFG::Graph::ensurePrePostNumbering): (JSC::DFG::Graph::ensureNaturalLoops): (JSC::DFG::Graph::ensureBackwardsCFG): (JSC::DFG::Graph::ensureBackwardsDominators): (JSC::DFG::Graph::ensureControlEquivalenceAnalysis): (JSC::DFG::Graph::methodOfGettingAValueProfileFor): * dfg/DFGGraph.h: (JSC::DFG::Graph::hasDebuggerEnabled): * dfg/DFGInPlaceAbstractState.h: (JSC::DFG::InPlaceAbstractState::operator bool): (JSC::DFG::InPlaceAbstractState::createValueForNode): (JSC::DFG::InPlaceAbstractState::forNode): * dfg/DFGLICMPhase.cpp: (JSC::DFG::LICMPhase::run): (JSC::DFG::LICMPhase::attemptHoist): * dfg/DFGMayExit.cpp: (JSC::DFG::mayExit): * dfg/DFGMayExit.h: * dfg/DFGNode.h: * dfg/DFGNodeOrigin.cpp: (JSC::DFG::NodeOrigin::dump): * dfg/DFGNodeOrigin.h: (JSC::DFG::NodeOrigin::takeValidExit): (JSC::DFG::NodeOrigin::withWasHoisted): (JSC::DFG::NodeOrigin::forInsertingAfter): * dfg/DFGNullAbstractState.h: Added. (JSC::DFG::NullAbstractState::NullAbstractState): (JSC::DFG::NullAbstractState::operator bool): (JSC::DFG::NullAbstractState::forNode): * dfg/DFGOSRExit.cpp: (JSC::DFG::OSRExit::OSRExit): * dfg/DFGOSRExitBase.cpp: (JSC::DFG::OSRExitBase::considerAddingAsFrequentExitSiteSlow): * dfg/DFGOSRExitBase.h: (JSC::DFG::OSRExitBase::OSRExitBase): * dfg/DFGTypeCheckHoistingPhase.cpp: (JSC::DFG::TypeCheckHoistingPhase::run): * ftl/FTLOSRExit.cpp: (JSC::FTL::OSRExitDescriptor::prepareOSRExitHandle): (JSC::FTL::OSRExit::OSRExit): * ftl/FTLOSRExit.h: Source/WTF: This adds an adaptor for graphs called BackwardsGraph. The WTF graph framework is based on passing around a Graph template argument that follows the protocol shared by DFG::CFG, B3::CFG, and Air::CFG. These graphs always have a single root node but may have many leaf nodes. This new BackwardsGraph adaptor reverses the graph by creating a synthetic return node that it uses as the root in the inverted graph. This currently may resort to some heuristics in programs that have an infinite loop, but other than that, it'll work well in the general case. This allows us to say Dominators<BackwardsGraph<some graph type>> as a way of computing backwards dominators, which then allows us to easily answer control flow equivalence queries. * CMakeLists.txt: * WTF.xcodeproj/project.pbxproj: * wtf/BackwardsGraph.h: Added. (WTF::BackwardsGraph::Node::Node): (WTF::BackwardsGraph::Node::root): (WTF::BackwardsGraph::Node::operator==): (WTF::BackwardsGraph::Node::operator!=): (WTF::BackwardsGraph::Node::operator bool): (WTF::BackwardsGraph::Node::isRoot): (WTF::BackwardsGraph::Node::node): (WTF::BackwardsGraph::Set::Set): (WTF::BackwardsGraph::Set::add): (WTF::BackwardsGraph::Set::remove): (WTF::BackwardsGraph::Set::contains): (WTF::BackwardsGraph::Set::dump): (WTF::BackwardsGraph::Map::Map): (WTF::BackwardsGraph::Map::clear): (WTF::BackwardsGraph::Map::size): (WTF::BackwardsGraph::Map::operator[]): (WTF::BackwardsGraph::BackwardsGraph): (WTF::BackwardsGraph::root): (WTF::BackwardsGraph::newMap): (WTF::BackwardsGraph::successors): (WTF::BackwardsGraph::predecessors): (WTF::BackwardsGraph::index): (WTF::BackwardsGraph::node): (WTF::BackwardsGraph::numNodes): (WTF::BackwardsGraph::dump): * wtf/Dominators.h: (WTF::Dominators::Dominators): (WTF::Dominators::dump): (WTF::Dominators::LengauerTarjan::computeDepthFirstPreNumbering): * wtf/GraphNodeWorklist.h: (WTF::GraphNodeWith::GraphNodeWith): (WTF::GraphNodeWith::operator bool): * wtf/StdLibExtras.h: (WTF::callStatelessLambda): (WTF::checkAndSet): LayoutTests: Add tests for LICM hoisting things that would only exit if hoisted. * js/regress/licm-dragons-expected.txt: Added. * js/regress/licm-dragons-out-of-bounds-expected.txt: Added. * js/regress/licm-dragons-out-of-bounds.html: Added. * js/regress/licm-dragons-overflow-expected.txt: Added. * js/regress/licm-dragons-overflow.html: Added. * js/regress/licm-dragons.html: Added. * js/regress/script-tests/licm-dragons-out-of-bounds.js: Added. (foo): * js/regress/script-tests/licm-dragons-overflow.js: Added. (foo): * js/regress/script-tests/licm-dragons.js: Added. (foo): Canonical link: https://commits.webkit.org/176032@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@201182 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-05-19 21:25:29 +00:00
worklist.push(m_graph.root(), 0);
Dominators should be factored out of the DFG https://bugs.webkit.org/show_bug.cgi?id=150764 Reviewed by Geoffrey Garen. Source/JavaScriptCore: Factored DFGDominators.h/DFGDominators.cpp into WTF. To do this, I made two changes to the DFG: 1) DFG now has a CFG abstraction called DFG::CFG. The cool thing about this is that in the future if we wanted to support inverted dominators, we could do it by just creating a DFG::BackwardCFG. 2) Got rid of DFG::Analysis. From now on, an Analysis being invalidated is expressed by the DFG::Graph having a null pointer for that analysis. When we "run" the analysis, we just instantiate it. This makes it much more natural to integrate WTF::Dominators into the DFG. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * dfg/DFGAnalysis.h: Removed. * dfg/DFGCFG.h: Added. (JSC::DFG::CFG::CFG): (JSC::DFG::CFG::root): (JSC::DFG::CFG::newMap<T>): (JSC::DFG::CFG::successors): (JSC::DFG::CFG::predecessors): (JSC::DFG::CFG::index): (JSC::DFG::CFG::node): (JSC::DFG::CFG::numNodes): (JSC::DFG::CFG::dump): * dfg/DFGCSEPhase.cpp: * dfg/DFGDisassembler.cpp: (JSC::DFG::Disassembler::createDumpList): * dfg/DFGDominators.cpp: Removed. * dfg/DFGDominators.h: (JSC::DFG::Dominators::Dominators): (JSC::DFG::Dominators::strictlyDominates): Deleted. (JSC::DFG::Dominators::dominates): Deleted. (JSC::DFG::Dominators::immediateDominatorOf): Deleted. (JSC::DFG::Dominators::forAllStrictDominatorsOf): Deleted. (JSC::DFG::Dominators::forAllDominatorsOf): Deleted. (JSC::DFG::Dominators::forAllBlocksStrictlyDominatedBy): Deleted. (JSC::DFG::Dominators::forAllBlocksDominatedBy): Deleted. (JSC::DFG::Dominators::forAllBlocksInDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInIteratedDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInPrunedIteratedDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInDominanceFrontierOfImpl): Deleted. (JSC::DFG::Dominators::forAllBlocksInIteratedDominanceFrontierOfImpl): Deleted. (JSC::DFG::Dominators::BlockData::BlockData): Deleted. * dfg/DFGEdgeDominates.h: (JSC::DFG::EdgeDominates::operator()): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::Graph): (JSC::DFG::Graph::dumpBlockHeader): (JSC::DFG::Graph::invalidateCFG): (JSC::DFG::Graph::substituteGetLocal): (JSC::DFG::Graph::handleAssertionFailure): (JSC::DFG::Graph::ensureDominators): (JSC::DFG::Graph::ensurePrePostNumbering): (JSC::DFG::Graph::ensureNaturalLoops): (JSC::DFG::Graph::valueProfileFor): * dfg/DFGGraph.h: (JSC::DFG::Graph::hasDebuggerEnabled): * dfg/DFGLICMPhase.cpp: (JSC::DFG::LICMPhase::run): (JSC::DFG::LICMPhase::attemptHoist): * dfg/DFGLoopPreHeaderCreationPhase.cpp: (JSC::DFG::createPreHeader): (JSC::DFG::LoopPreHeaderCreationPhase::run): * dfg/DFGNaturalLoops.cpp: (JSC::DFG::NaturalLoop::dump): (JSC::DFG::NaturalLoops::NaturalLoops): (JSC::DFG::NaturalLoops::~NaturalLoops): (JSC::DFG::NaturalLoops::loopsOf): (JSC::DFG::NaturalLoops::computeDependencies): Deleted. (JSC::DFG::NaturalLoops::compute): Deleted. * dfg/DFGNaturalLoops.h: (JSC::DFG::NaturalLoops::numLoops): * dfg/DFGNode.h: (JSC::DFG::Node::SuccessorsIterable::end): (JSC::DFG::Node::SuccessorsIterable::size): (JSC::DFG::Node::SuccessorsIterable::at): (JSC::DFG::Node::SuccessorsIterable::operator[]): * dfg/DFGOSREntrypointCreationPhase.cpp: (JSC::DFG::OSREntrypointCreationPhase::run): * dfg/DFGObjectAllocationSinkingPhase.cpp: * dfg/DFGPlan.cpp: (JSC::DFG::Plan::compileInThreadImpl): * dfg/DFGPrePostNumbering.cpp: (JSC::DFG::PrePostNumbering::PrePostNumbering): (JSC::DFG::PrePostNumbering::~PrePostNumbering): (JSC::DFG::PrePostNumbering::compute): Deleted. * dfg/DFGPrePostNumbering.h: (JSC::DFG::PrePostNumbering::preNumber): (JSC::DFG::PrePostNumbering::postNumber): * dfg/DFGPutStackSinkingPhase.cpp: * dfg/DFGSSACalculator.cpp: (JSC::DFG::SSACalculator::nonLocalReachingDef): (JSC::DFG::SSACalculator::reachingDefAtTail): * dfg/DFGSSACalculator.h: (JSC::DFG::SSACalculator::computePhis): * dfg/DFGSSAConversionPhase.cpp: (JSC::DFG::SSAConversionPhase::run): * ftl/FTLLink.cpp: (JSC::FTL::link): * ftl/FTLLowerDFGToLLVM.cpp: (JSC::FTL::DFG::LowerDFGToLLVM::lower): (JSC::FTL::DFG::LowerDFGToLLVM::safelyInvalidateAfterTermination): (JSC::FTL::DFG::LowerDFGToLLVM::isValid): Source/WTF: This takes what used to be DFGDominators.h/DFGDominators.cpp and turns it into a generic algorithm that can take any abstract graph. The idea is that you create Dominators<CFG> and pass it a CFG object, which defines the types of graph nodes and methods for getting successors, predecessors, etc. The DFG now defines a class called CFG, which is a wrapper for DFG::Graph that conforms to the thing that wtf/Dominators.h expects. When doing things to graphs, it's common to refer to the things in the graph as "nodes". Because I intend to reuse the CFG abstraction with many graph algorithms, that abstraction uses the term "node" to refer to a DFG basic block. But in Dominators, the method and variable names still use "block". This is because although Dominators are applicable to any kind of directed graph, it's super unlikely that we will ever use them for anything but compilers. Indeed, the only reason why I'm factoring them out of the DFG is so that I can use them with B3 and Air. This has the nice side effect that a user of WTF::Dominators<JSC::DFG::CFG> will see familiar terminology like "blocksStrictlyDominatedBy(...)" instead of "nodesStrictlyDominatedBy(...)", which would be super confusing. Overall, wtf/Dominators.h is a combination of what used to be in DFGDominators.h, DFGDominators.cpp, DFGNaiveDominators.h, and DFGNaiveDominators.cpp. I only changed code when I had to in order to make it generic. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/Dominators.h: Added. (WTF::Dominators::Dominators): (WTF::Dominators::compute): (WTF::Dominators::strictlyDominates): (WTF::Dominators::dominates): (WTF::Dominators::immediateDominatorOf): (WTF::Dominators::forAllStrictDominatorsOf): (WTF::Dominators::forAllDominatorsOf): (WTF::Dominators::forAllBlocksStrictlyDominatedBy): (WTF::Dominators::forAllBlocksDominatedBy): (WTF::Dominators::strictDominatorsOf): (WTF::Dominators::dominatorsOf): (WTF::Dominators::blocksStrictlyDominatedBy): (WTF::Dominators::blocksDominatedBy): (WTF::Dominators::forAllBlocksInDominanceFrontierOf): (WTF::Dominators::dominanceFrontierOf): (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOf): (WTF::Dominators::forAllBlocksInPrunedIteratedDominanceFrontierOf): (WTF::Dominators::iteratedDominanceFrontierOf): (WTF::Dominators::dump): (WTF::Dominators::LengauerTarjan::LengauerTarjan): (WTF::Dominators::LengauerTarjan::compute): (WTF::Dominators::LengauerTarjan::immediateDominator): (WTF::Dominators::LengauerTarjan::computeDepthFirstPreNumbering): (WTF::Dominators::LengauerTarjan::computeSemiDominatorsAndImplicitImmediateDominators): (WTF::Dominators::LengauerTarjan::computeExplicitImmediateDominators): (WTF::Dominators::LengauerTarjan::link): (WTF::Dominators::LengauerTarjan::eval): (WTF::Dominators::LengauerTarjan::compress): (WTF::Dominators::LengauerTarjan::BlockData::BlockData): (WTF::Dominators::NaiveDominators::NaiveDominators): (WTF::Dominators::NaiveDominators::dominates): (WTF::Dominators::NaiveDominators::dump): (WTF::Dominators::NaiveDominators::pruneDominators): (WTF::Dominators::ValidationContext::ValidationContext): (WTF::Dominators::ValidationContext::reportError): (WTF::Dominators::ValidationContext::handleErrors): (WTF::Dominators::naiveDominates): (WTF::Dominators::forAllBlocksInDominanceFrontierOfImpl): (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOfImpl): (WTF::Dominators::BlockData::BlockData): Canonical link: https://commits.webkit.org/168962@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@191870 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-11-02 00:48:03 +00:00
while (GraphNodeWith<typename Graph::Node, unsigned> item = worklist.pop()) {
typename Graph::Node block = item.node;
unsigned successorIndex = item.data;
// We initially push with successorIndex = 0 regardless of whether or not we have any
// successors. This is so that we can assign our prenumber. Subsequently we get pushed
// with higher successorIndex values, but only if they are in range.
ASSERT(!successorIndex || successorIndex < m_graph.successors(block).size());
if (!successorIndex) {
m_data[block].semiNumber = m_blockByPreNumber.size();
m_blockByPreNumber.append(block);
}
if (successorIndex < m_graph.successors(block).size()) {
unsigned nextSuccessorIndex = successorIndex + 1;
if (nextSuccessorIndex < m_graph.successors(block).size())
worklist.forcePush(block, nextSuccessorIndex);
typename Graph::Node successorBlock = m_graph.successors(block)[successorIndex];
if (worklist.push(successorBlock, 0))
m_data[successorBlock].parent = block;
}
}
}
void computeSemiDominatorsAndImplicitImmediateDominators()
{
for (unsigned currentPreNumber = m_blockByPreNumber.size(); currentPreNumber-- > 1;) {
typename Graph::Node block = m_blockByPreNumber[currentPreNumber];
BlockData& blockData = m_data[block];
// Step 2:
for (typename Graph::Node predecessorBlock : m_graph.predecessors(block)) {
typename Graph::Node intermediateBlock = eval(predecessorBlock);
blockData.semiNumber = std::min(
m_data[intermediateBlock].semiNumber, blockData.semiNumber);
}
unsigned bucketPreNumber = blockData.semiNumber;
ASSERT(bucketPreNumber <= currentPreNumber);
m_data[m_blockByPreNumber[bucketPreNumber]].bucket.append(block);
link(blockData.parent, block);
// Step 3:
for (typename Graph::Node semiDominee : m_data[blockData.parent].bucket) {
typename Graph::Node possibleDominator = eval(semiDominee);
BlockData& semiDomineeData = m_data[semiDominee];
ASSERT(m_blockByPreNumber[semiDomineeData.semiNumber] == blockData.parent);
BlockData& possibleDominatorData = m_data[possibleDominator];
if (possibleDominatorData.semiNumber < semiDomineeData.semiNumber)
semiDomineeData.dom = possibleDominator;
else
semiDomineeData.dom = blockData.parent;
}
m_data[blockData.parent].bucket.clear();
}
}
void computeExplicitImmediateDominators()
{
for (unsigned currentPreNumber = 1; currentPreNumber < m_blockByPreNumber.size(); ++currentPreNumber) {
typename Graph::Node block = m_blockByPreNumber[currentPreNumber];
BlockData& blockData = m_data[block];
if (blockData.dom != m_blockByPreNumber[blockData.semiNumber])
blockData.dom = m_data[blockData.dom].dom;
}
}
void link(typename Graph::Node from, typename Graph::Node to)
{
m_data[to].ancestor = from;
}
typename Graph::Node eval(typename Graph::Node block)
{
if (!m_data[block].ancestor)
return block;
compress(block);
return m_data[block].label;
}
void compress(typename Graph::Node initialBlock)
{
// This was meant to be a recursive function, but we don't like recursion because we don't
// want to blow the stack. The original function will call compress() recursively on the
// ancestor of anything that has an ancestor. So, we populate our worklist with the
// recursive ancestors of initialBlock. Then we process the list starting from the block
// that is furthest up the ancestor chain.
typename Graph::Node ancestor = m_data[initialBlock].ancestor;
ASSERT(ancestor);
if (!m_data[ancestor].ancestor)
return;
Vector<typename Graph::Node, 16> stack;
for (typename Graph::Node block = initialBlock; block; block = m_data[block].ancestor)
stack.append(block);
// We only care about blocks that have an ancestor that has an ancestor. The last two
// elements in the stack won't satisfy this property.
ASSERT(stack.size() >= 2);
ASSERT(!m_data[stack[stack.size() - 1]].ancestor);
ASSERT(!m_data[m_data[stack[stack.size() - 2]].ancestor].ancestor);
for (unsigned i = stack.size() - 2; i--;) {
typename Graph::Node block = stack[i];
typename Graph::Node& labelOfBlock = m_data[block].label;
typename Graph::Node& ancestorOfBlock = m_data[block].ancestor;
ASSERT(ancestorOfBlock);
ASSERT(m_data[ancestorOfBlock].ancestor);
typename Graph::Node labelOfAncestorOfBlock = m_data[ancestorOfBlock].label;
if (m_data[labelOfAncestorOfBlock].semiNumber < m_data[labelOfBlock].semiNumber)
labelOfBlock = labelOfAncestorOfBlock;
ancestorOfBlock = m_data[ancestorOfBlock].ancestor;
}
}
struct BlockData {
[WTF][JSC] Make JSC and WTF aggressively-fast-malloced https://bugs.webkit.org/show_bug.cgi?id=200611 Reviewed by Saam Barati. Source/JavaScriptCore: This patch aggressively puts many classes into FastMalloc. In JSC side, we grep `std::make_unique` etc. to find potentially system-malloc-allocated classes. After this patch, all the JSC related allocations in JetStream2 cli is done from bmalloc. In the future, it would be nice that we add `WTF::makeUnique<T>` helper function and throw a compile error if `T` is not FastMalloc annotated[1]. Putting WebKit classes in FastMalloc has many benefits. 1. Simply, it is fast. 2. vmmap can tell the amount of memory used for WebKit. 3. bmalloc can isolate WebKit memory allocation from the rest of the world. This is useful since we can know more about what component is corrupting the memory from the memory corruption crash. [1]: https://bugs.webkit.org/show_bug.cgi?id=200620 * API/ObjCCallbackFunction.mm: * assembler/AbstractMacroAssembler.h: * b3/B3PhiChildren.h: * b3/air/AirAllocateRegistersAndStackAndGenerateCode.h: * b3/air/AirDisassembler.h: * bytecode/AccessCaseSnippetParams.h: * bytecode/CallVariant.h: * bytecode/DeferredSourceDump.h: * bytecode/ExecutionCounter.h: * bytecode/GetByIdStatus.h: * bytecode/GetByIdVariant.h: * bytecode/InByIdStatus.h: * bytecode/InByIdVariant.h: * bytecode/InstanceOfStatus.h: * bytecode/InstanceOfVariant.h: * bytecode/PutByIdStatus.h: * bytecode/PutByIdVariant.h: * bytecode/ValueProfile.h: * dfg/DFGAbstractInterpreter.h: * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::newVariableAccessData): * dfg/DFGFlowIndexing.h: * dfg/DFGFlowMap.h: * dfg/DFGLiveCatchVariablePreservationPhase.cpp: (JSC::DFG::LiveCatchVariablePreservationPhase::newVariableAccessData): * dfg/DFGMaximalFlushInsertionPhase.cpp: (JSC::DFG::MaximalFlushInsertionPhase::newVariableAccessData): * dfg/DFGOSRExit.h: * dfg/DFGSpeculativeJIT.h: * dfg/DFGVariableAccessData.h: * disassembler/ARM64/A64DOpcode.h: * inspector/remote/socket/RemoteInspectorMessageParser.h: * inspector/remote/socket/RemoteInspectorSocket.h: * inspector/remote/socket/RemoteInspectorSocketEndpoint.h: * jit/PCToCodeOriginMap.h: * runtime/BasicBlockLocation.h: * runtime/DoublePredictionFuzzerAgent.h: * runtime/JSRunLoopTimer.h: * runtime/PromiseDeferredTimer.h: (JSC::PromiseDeferredTimer::create): PromiseDeferredTimer should be allocated as `Ref<>` instead of `std::unique_ptr` since it is inheriting ThreadSafeRefCounted<>. Holding such a class with std::unique_ptr could lead to potentially dangerous operations (like, someone holds it with Ref<> while it is deleted by std::unique_ptr<>). * runtime/RandomizingFuzzerAgent.h: * runtime/SymbolTable.h: * runtime/VM.cpp: (JSC::VM::VM): * runtime/VM.h: * tools/JSDollarVM.cpp: * tools/SigillCrashAnalyzer.cpp: * wasm/WasmFormat.h: * wasm/WasmMemory.cpp: * wasm/WasmSignature.h: * yarr/YarrJIT.h: Source/WebCore: Changed the accessor since we changed std::unique_ptr to Ref for this field. No behavior change. * bindings/js/WorkerScriptController.cpp: (WebCore::WorkerScriptController::addTimerSetNotification): (WebCore::WorkerScriptController::removeTimerSetNotification): Source/WTF: WTF has many data structures, in particular, containers. And these containers can be allocated like `std::make_unique<Container>()`. Without WTF_MAKE_FAST_ALLOCATED, this container itself is allocated from the system malloc. This patch attaches WTF_MAKE_FAST_ALLOCATED more aggressively not to allocate them from the system malloc. And we add some `final` to containers and classes that would be never inherited. * wtf/Assertions.cpp: * wtf/Atomics.h: * wtf/AutodrainedPool.h: * wtf/Bag.h: (WTF::Bag::Bag): Deleted. (WTF::Bag::~Bag): Deleted. (WTF::Bag::clear): Deleted. (WTF::Bag::add): Deleted. (WTF::Bag::iterator::iterator): Deleted. (WTF::Bag::iterator::operator! const): Deleted. (WTF::Bag::iterator::operator* const): Deleted. (WTF::Bag::iterator::operator++): Deleted. (WTF::Bag::iterator::operator== const): Deleted. (WTF::Bag::iterator::operator!= const): Deleted. (WTF::Bag::begin): Deleted. (WTF::Bag::begin const): Deleted. (WTF::Bag::end const): Deleted. (WTF::Bag::isEmpty const): Deleted. (WTF::Bag::unwrappedHead const): Deleted. * wtf/BitVector.h: (WTF::BitVector::BitVector): Deleted. (WTF::BitVector::~BitVector): Deleted. (WTF::BitVector::operator=): Deleted. (WTF::BitVector::size const): Deleted. (WTF::BitVector::ensureSize): Deleted. (WTF::BitVector::quickGet const): Deleted. (WTF::BitVector::quickSet): Deleted. (WTF::BitVector::quickClear): Deleted. (WTF::BitVector::get const): Deleted. (WTF::BitVector::contains const): Deleted. (WTF::BitVector::set): Deleted. (WTF::BitVector::add): Deleted. (WTF::BitVector::ensureSizeAndSet): Deleted. (WTF::BitVector::clear): Deleted. (WTF::BitVector::remove): Deleted. (WTF::BitVector::merge): Deleted. (WTF::BitVector::filter): Deleted. (WTF::BitVector::exclude): Deleted. (WTF::BitVector::bitCount const): Deleted. (WTF::BitVector::isEmpty const): Deleted. (WTF::BitVector::findBit const): Deleted. (WTF::BitVector::isEmptyValue const): Deleted. (WTF::BitVector::isDeletedValue const): Deleted. (WTF::BitVector::isEmptyOrDeletedValue const): Deleted. (WTF::BitVector::operator== const): Deleted. (WTF::BitVector::hash const): Deleted. (WTF::BitVector::iterator::iterator): Deleted. (WTF::BitVector::iterator::operator* const): Deleted. (WTF::BitVector::iterator::operator++): Deleted. (WTF::BitVector::iterator::isAtEnd const): Deleted. (WTF::BitVector::iterator::operator== const): Deleted. (WTF::BitVector::iterator::operator!= const): Deleted. (WTF::BitVector::begin const): Deleted. (WTF::BitVector::end const): Deleted. (WTF::BitVector::bitsInPointer): Deleted. (WTF::BitVector::maxInlineBits): Deleted. (WTF::BitVector::byteCount): Deleted. (WTF::BitVector::makeInlineBits): Deleted. (WTF::BitVector::cleanseInlineBits): Deleted. (WTF::BitVector::bitCount): Deleted. (WTF::BitVector::findBitFast const): Deleted. (WTF::BitVector::findBitSimple const): Deleted. (WTF::BitVector::OutOfLineBits::numBits const): Deleted. (WTF::BitVector::OutOfLineBits::numWords const): Deleted. (WTF::BitVector::OutOfLineBits::bits): Deleted. (WTF::BitVector::OutOfLineBits::bits const): Deleted. (WTF::BitVector::OutOfLineBits::OutOfLineBits): Deleted. (WTF::BitVector::isInline const): Deleted. (WTF::BitVector::outOfLineBits const): Deleted. (WTF::BitVector::outOfLineBits): Deleted. (WTF::BitVector::bits): Deleted. (WTF::BitVector::bits const): Deleted. * wtf/Bitmap.h: (WTF::Bitmap::size): Deleted. (WTF::Bitmap::iterator::iterator): Deleted. (WTF::Bitmap::iterator::operator* const): Deleted. (WTF::Bitmap::iterator::operator++): Deleted. (WTF::Bitmap::iterator::operator== const): Deleted. (WTF::Bitmap::iterator::operator!= const): Deleted. (WTF::Bitmap::begin const): Deleted. (WTF::Bitmap::end const): Deleted. * wtf/Box.h: * wtf/BumpPointerAllocator.h: * wtf/CPUTime.h: * wtf/CheckedBoolean.h: * wtf/CommaPrinter.h: (WTF::CommaPrinter::CommaPrinter): Deleted. (WTF::CommaPrinter::dump const): Deleted. (WTF::CommaPrinter::didPrint const): Deleted. * wtf/CompactPointerTuple.h: (WTF::CompactPointerTuple::encodeType): Deleted. (WTF::CompactPointerTuple::decodeType): Deleted. (WTF::CompactPointerTuple::CompactPointerTuple): Deleted. (WTF::CompactPointerTuple::pointer const): Deleted. (WTF::CompactPointerTuple::setPointer): Deleted. (WTF::CompactPointerTuple::type const): Deleted. (WTF::CompactPointerTuple::setType): Deleted. * wtf/CompilationThread.h: (WTF::CompilationScope::CompilationScope): Deleted. (WTF::CompilationScope::~CompilationScope): Deleted. (WTF::CompilationScope::leaveEarly): Deleted. * wtf/CompletionHandler.h: (WTF::CompletionHandler<Out): (WTF::Detail::CallableWrapper<CompletionHandler<Out): (WTF::CompletionHandlerCallingScope::CompletionHandlerCallingScope): Deleted. (WTF::CompletionHandlerCallingScope::~CompletionHandlerCallingScope): Deleted. (WTF::CompletionHandlerCallingScope::CompletionHandler<void): Deleted. * wtf/ConcurrentBuffer.h: (WTF::ConcurrentBuffer::ConcurrentBuffer): Deleted. (WTF::ConcurrentBuffer::~ConcurrentBuffer): Deleted. (WTF::ConcurrentBuffer::growExact): Deleted. (WTF::ConcurrentBuffer::grow): Deleted. (WTF::ConcurrentBuffer::array const): Deleted. (WTF::ConcurrentBuffer::operator[]): Deleted. (WTF::ConcurrentBuffer::operator[] const): Deleted. (WTF::ConcurrentBuffer::createArray): Deleted. * wtf/ConcurrentPtrHashSet.h: (WTF::ConcurrentPtrHashSet::contains): Deleted. (WTF::ConcurrentPtrHashSet::add): Deleted. (WTF::ConcurrentPtrHashSet::size const): Deleted. (WTF::ConcurrentPtrHashSet::Table::maxLoad const): Deleted. (WTF::ConcurrentPtrHashSet::hash): Deleted. (WTF::ConcurrentPtrHashSet::cast): Deleted. (WTF::ConcurrentPtrHashSet::containsImpl const): Deleted. (WTF::ConcurrentPtrHashSet::addImpl): Deleted. * wtf/ConcurrentVector.h: (WTF::ConcurrentVector::~ConcurrentVector): Deleted. (WTF::ConcurrentVector::size const): Deleted. (WTF::ConcurrentVector::isEmpty const): Deleted. (WTF::ConcurrentVector::at): Deleted. (WTF::ConcurrentVector::at const): Deleted. (WTF::ConcurrentVector::operator[]): Deleted. (WTF::ConcurrentVector::operator[] const): Deleted. (WTF::ConcurrentVector::first): Deleted. (WTF::ConcurrentVector::first const): Deleted. (WTF::ConcurrentVector::last): Deleted. (WTF::ConcurrentVector::last const): Deleted. (WTF::ConcurrentVector::takeLast): Deleted. (WTF::ConcurrentVector::append): Deleted. (WTF::ConcurrentVector::alloc): Deleted. (WTF::ConcurrentVector::removeLast): Deleted. (WTF::ConcurrentVector::grow): Deleted. (WTF::ConcurrentVector::begin): Deleted. (WTF::ConcurrentVector::end): Deleted. (WTF::ConcurrentVector::segmentExistsFor): Deleted. (WTF::ConcurrentVector::segmentFor): Deleted. (WTF::ConcurrentVector::subscriptFor): Deleted. (WTF::ConcurrentVector::ensureSegmentsFor): Deleted. (WTF::ConcurrentVector::ensureSegment): Deleted. (WTF::ConcurrentVector::allocateSegment): Deleted. * wtf/Condition.h: (WTF::Condition::waitUntil): Deleted. (WTF::Condition::waitFor): Deleted. (WTF::Condition::wait): Deleted. (WTF::Condition::notifyOne): Deleted. (WTF::Condition::notifyAll): Deleted. * wtf/CountingLock.h: (WTF::CountingLock::LockHooks::lockHook): Deleted. (WTF::CountingLock::LockHooks::unlockHook): Deleted. (WTF::CountingLock::LockHooks::parkHook): Deleted. (WTF::CountingLock::LockHooks::handoffHook): Deleted. (WTF::CountingLock::tryLock): Deleted. (WTF::CountingLock::lock): Deleted. (WTF::CountingLock::unlock): Deleted. (WTF::CountingLock::isHeld const): Deleted. (WTF::CountingLock::isLocked const): Deleted. (WTF::CountingLock::Count::operator bool const): Deleted. (WTF::CountingLock::Count::operator== const): Deleted. (WTF::CountingLock::Count::operator!= const): Deleted. (WTF::CountingLock::tryOptimisticRead): Deleted. (WTF::CountingLock::validate): Deleted. (WTF::CountingLock::doOptimizedRead): Deleted. (WTF::CountingLock::tryOptimisticFencelessRead): Deleted. (WTF::CountingLock::fencelessValidate): Deleted. (WTF::CountingLock::doOptimizedFencelessRead): Deleted. (WTF::CountingLock::getCount): Deleted. * wtf/CrossThreadQueue.h: * wtf/CrossThreadTask.h: * wtf/CryptographicallyRandomNumber.cpp: * wtf/DataMutex.h: * wtf/DateMath.h: * wtf/Deque.h: (WTF::Deque::size const): Deleted. (WTF::Deque::isEmpty const): Deleted. (WTF::Deque::begin): Deleted. (WTF::Deque::end): Deleted. (WTF::Deque::begin const): Deleted. (WTF::Deque::end const): Deleted. (WTF::Deque::rbegin): Deleted. (WTF::Deque::rend): Deleted. (WTF::Deque::rbegin const): Deleted. (WTF::Deque::rend const): Deleted. (WTF::Deque::first): Deleted. (WTF::Deque::first const): Deleted. (WTF::Deque::last): Deleted. (WTF::Deque::last const): Deleted. (WTF::Deque::append): Deleted. * wtf/Dominators.h: * wtf/DoublyLinkedList.h: * wtf/Expected.h: * wtf/FastBitVector.h: * wtf/FileMetadata.h: * wtf/FileSystem.h: * wtf/GraphNodeWorklist.h: * wtf/GregorianDateTime.h: (WTF::GregorianDateTime::GregorianDateTime): Deleted. (WTF::GregorianDateTime::year const): Deleted. (WTF::GregorianDateTime::month const): Deleted. (WTF::GregorianDateTime::yearDay const): Deleted. (WTF::GregorianDateTime::monthDay const): Deleted. (WTF::GregorianDateTime::weekDay const): Deleted. (WTF::GregorianDateTime::hour const): Deleted. (WTF::GregorianDateTime::minute const): Deleted. (WTF::GregorianDateTime::second const): Deleted. (WTF::GregorianDateTime::utcOffset const): Deleted. (WTF::GregorianDateTime::isDST const): Deleted. (WTF::GregorianDateTime::setYear): Deleted. (WTF::GregorianDateTime::setMonth): Deleted. (WTF::GregorianDateTime::setYearDay): Deleted. (WTF::GregorianDateTime::setMonthDay): Deleted. (WTF::GregorianDateTime::setWeekDay): Deleted. (WTF::GregorianDateTime::setHour): Deleted. (WTF::GregorianDateTime::setMinute): Deleted. (WTF::GregorianDateTime::setSecond): Deleted. (WTF::GregorianDateTime::setUtcOffset): Deleted. (WTF::GregorianDateTime::setIsDST): Deleted. (WTF::GregorianDateTime::operator tm const): Deleted. (WTF::GregorianDateTime::copyFrom): Deleted. * wtf/HashTable.h: * wtf/Hasher.h: * wtf/HexNumber.h: * wtf/Indenter.h: * wtf/IndexMap.h: * wtf/IndexSet.h: * wtf/IndexSparseSet.h: * wtf/IndexedContainerIterator.h: * wtf/Insertion.h: * wtf/IteratorAdaptors.h: * wtf/IteratorRange.h: * wtf/KeyValuePair.h: * wtf/ListHashSet.h: (WTF::ListHashSet::begin): Deleted. (WTF::ListHashSet::end): Deleted. (WTF::ListHashSet::begin const): Deleted. (WTF::ListHashSet::end const): Deleted. (WTF::ListHashSet::random): Deleted. (WTF::ListHashSet::random const): Deleted. (WTF::ListHashSet::rbegin): Deleted. (WTF::ListHashSet::rend): Deleted. (WTF::ListHashSet::rbegin const): Deleted. (WTF::ListHashSet::rend const): Deleted. * wtf/Liveness.h: * wtf/LocklessBag.h: (WTF::LocklessBag::LocklessBag): Deleted. (WTF::LocklessBag::add): Deleted. (WTF::LocklessBag::iterate): Deleted. (WTF::LocklessBag::consumeAll): Deleted. (WTF::LocklessBag::consumeAllWithNode): Deleted. (WTF::LocklessBag::~LocklessBag): Deleted. * wtf/LoggingHashID.h: * wtf/MD5.h: * wtf/MachSendRight.h: * wtf/MainThreadData.h: * wtf/Markable.h: * wtf/MediaTime.h: * wtf/MemoryPressureHandler.h: * wtf/MessageQueue.h: (WTF::MessageQueue::MessageQueue): Deleted. * wtf/MetaAllocator.h: * wtf/MonotonicTime.h: (WTF::MonotonicTime::MonotonicTime): Deleted. (WTF::MonotonicTime::fromRawSeconds): Deleted. (WTF::MonotonicTime::infinity): Deleted. (WTF::MonotonicTime::nan): Deleted. (WTF::MonotonicTime::secondsSinceEpoch const): Deleted. (WTF::MonotonicTime::approximateMonotonicTime const): Deleted. (WTF::MonotonicTime::operator bool const): Deleted. (WTF::MonotonicTime::operator+ const): Deleted. (WTF::MonotonicTime::operator- const): Deleted. (WTF::MonotonicTime::operator% const): Deleted. (WTF::MonotonicTime::operator+=): Deleted. (WTF::MonotonicTime::operator-=): Deleted. (WTF::MonotonicTime::operator== const): Deleted. (WTF::MonotonicTime::operator!= const): Deleted. (WTF::MonotonicTime::operator< const): Deleted. (WTF::MonotonicTime::operator> const): Deleted. (WTF::MonotonicTime::operator<= const): Deleted. (WTF::MonotonicTime::operator>= const): Deleted. (WTF::MonotonicTime::isolatedCopy const): Deleted. (WTF::MonotonicTime::encode const): Deleted. (WTF::MonotonicTime::decode): Deleted. * wtf/NaturalLoops.h: * wtf/NoLock.h: * wtf/OSAllocator.h: * wtf/OptionSet.h: * wtf/Optional.h: * wtf/OrderMaker.h: * wtf/Packed.h: (WTF::alignof): * wtf/PackedIntVector.h: (WTF::PackedIntVector::PackedIntVector): Deleted. (WTF::PackedIntVector::operator=): Deleted. (WTF::PackedIntVector::size const): Deleted. (WTF::PackedIntVector::ensureSize): Deleted. (WTF::PackedIntVector::resize): Deleted. (WTF::PackedIntVector::clearAll): Deleted. (WTF::PackedIntVector::get const): Deleted. (WTF::PackedIntVector::set): Deleted. (WTF::PackedIntVector::mask): Deleted. * wtf/PageBlock.h: * wtf/ParallelJobsOpenMP.h: * wtf/ParkingLot.h: * wtf/PriorityQueue.h: (WTF::PriorityQueue::size const): Deleted. (WTF::PriorityQueue::isEmpty const): Deleted. (WTF::PriorityQueue::enqueue): Deleted. (WTF::PriorityQueue::peek const): Deleted. (WTF::PriorityQueue::dequeue): Deleted. (WTF::PriorityQueue::decreaseKey): Deleted. (WTF::PriorityQueue::increaseKey): Deleted. (WTF::PriorityQueue::begin const): Deleted. (WTF::PriorityQueue::end const): Deleted. (WTF::PriorityQueue::isValidHeap const): Deleted. (WTF::PriorityQueue::parentOf): Deleted. (WTF::PriorityQueue::leftChildOf): Deleted. (WTF::PriorityQueue::rightChildOf): Deleted. (WTF::PriorityQueue::siftUp): Deleted. (WTF::PriorityQueue::siftDown): Deleted. * wtf/RandomDevice.h: * wtf/Range.h: * wtf/RangeSet.h: (WTF::RangeSet::RangeSet): Deleted. (WTF::RangeSet::~RangeSet): Deleted. (WTF::RangeSet::add): Deleted. (WTF::RangeSet::contains const): Deleted. (WTF::RangeSet::overlaps const): Deleted. (WTF::RangeSet::clear): Deleted. (WTF::RangeSet::dump const): Deleted. (WTF::RangeSet::dumpRaw const): Deleted. (WTF::RangeSet::begin const): Deleted. (WTF::RangeSet::end const): Deleted. (WTF::RangeSet::addAll): Deleted. (WTF::RangeSet::compact): Deleted. (WTF::RangeSet::overlapsNonEmpty): Deleted. (WTF::RangeSet::subsumesNonEmpty): Deleted. (WTF::RangeSet::findRange const): Deleted. * wtf/RecursableLambda.h: * wtf/RedBlackTree.h: (WTF::RedBlackTree::Node::successor const): Deleted. (WTF::RedBlackTree::Node::predecessor const): Deleted. (WTF::RedBlackTree::Node::successor): Deleted. (WTF::RedBlackTree::Node::predecessor): Deleted. (WTF::RedBlackTree::Node::reset): Deleted. (WTF::RedBlackTree::Node::parent const): Deleted. (WTF::RedBlackTree::Node::setParent): Deleted. (WTF::RedBlackTree::Node::left const): Deleted. (WTF::RedBlackTree::Node::setLeft): Deleted. (WTF::RedBlackTree::Node::right const): Deleted. (WTF::RedBlackTree::Node::setRight): Deleted. (WTF::RedBlackTree::Node::color const): Deleted. (WTF::RedBlackTree::Node::setColor): Deleted. (WTF::RedBlackTree::RedBlackTree): Deleted. (WTF::RedBlackTree::insert): Deleted. (WTF::RedBlackTree::remove): Deleted. (WTF::RedBlackTree::findExact const): Deleted. (WTF::RedBlackTree::findLeastGreaterThanOrEqual const): Deleted. (WTF::RedBlackTree::findGreatestLessThanOrEqual const): Deleted. (WTF::RedBlackTree::first const): Deleted. (WTF::RedBlackTree::last const): Deleted. (WTF::RedBlackTree::size): Deleted. (WTF::RedBlackTree::isEmpty): Deleted. (WTF::RedBlackTree::treeMinimum): Deleted. (WTF::RedBlackTree::treeMaximum): Deleted. (WTF::RedBlackTree::treeInsert): Deleted. (WTF::RedBlackTree::leftRotate): Deleted. (WTF::RedBlackTree::rightRotate): Deleted. (WTF::RedBlackTree::removeFixup): Deleted. * wtf/ResourceUsage.h: * wtf/RunLoop.cpp: * wtf/RunLoopTimer.h: * wtf/SHA1.h: * wtf/Seconds.h: (WTF::Seconds::Seconds): Deleted. (WTF::Seconds::value const): Deleted. (WTF::Seconds::minutes const): Deleted. (WTF::Seconds::seconds const): Deleted. (WTF::Seconds::milliseconds const): Deleted. (WTF::Seconds::microseconds const): Deleted. (WTF::Seconds::nanoseconds const): Deleted. (WTF::Seconds::minutesAs const): Deleted. (WTF::Seconds::secondsAs const): Deleted. (WTF::Seconds::millisecondsAs const): Deleted. (WTF::Seconds::microsecondsAs const): Deleted. (WTF::Seconds::nanosecondsAs const): Deleted. (WTF::Seconds::fromMinutes): Deleted. (WTF::Seconds::fromHours): Deleted. (WTF::Seconds::fromMilliseconds): Deleted. (WTF::Seconds::fromMicroseconds): Deleted. (WTF::Seconds::fromNanoseconds): Deleted. (WTF::Seconds::infinity): Deleted. (WTF::Seconds::nan): Deleted. (WTF::Seconds::operator bool const): Deleted. (WTF::Seconds::operator+ const): Deleted. (WTF::Seconds::operator- const): Deleted. (WTF::Seconds::operator* const): Deleted. (WTF::Seconds::operator/ const): Deleted. (WTF::Seconds::operator% const): Deleted. (WTF::Seconds::operator+=): Deleted. (WTF::Seconds::operator-=): Deleted. (WTF::Seconds::operator*=): Deleted. (WTF::Seconds::operator/=): Deleted. (WTF::Seconds::operator%=): Deleted. (WTF::Seconds::operator== const): Deleted. (WTF::Seconds::operator!= const): Deleted. (WTF::Seconds::operator< const): Deleted. (WTF::Seconds::operator> const): Deleted. (WTF::Seconds::operator<= const): Deleted. (WTF::Seconds::operator>= const): Deleted. (WTF::Seconds::isolatedCopy const): Deleted. (WTF::Seconds::encode const): Deleted. (WTF::Seconds::decode): Deleted. * wtf/SegmentedVector.h: (WTF::SegmentedVector::~SegmentedVector): Deleted. (WTF::SegmentedVector::size const): Deleted. (WTF::SegmentedVector::isEmpty const): Deleted. (WTF::SegmentedVector::at): Deleted. (WTF::SegmentedVector::at const): Deleted. (WTF::SegmentedVector::operator[]): Deleted. (WTF::SegmentedVector::operator[] const): Deleted. (WTF::SegmentedVector::first): Deleted. (WTF::SegmentedVector::first const): Deleted. (WTF::SegmentedVector::last): Deleted. (WTF::SegmentedVector::last const): Deleted. (WTF::SegmentedVector::takeLast): Deleted. (WTF::SegmentedVector::append): Deleted. (WTF::SegmentedVector::alloc): Deleted. (WTF::SegmentedVector::removeLast): Deleted. (WTF::SegmentedVector::grow): Deleted. (WTF::SegmentedVector::clear): Deleted. (WTF::SegmentedVector::begin): Deleted. (WTF::SegmentedVector::end): Deleted. (WTF::SegmentedVector::shrinkToFit): Deleted. (WTF::SegmentedVector::deleteAllSegments): Deleted. (WTF::SegmentedVector::segmentExistsFor): Deleted. (WTF::SegmentedVector::segmentFor): Deleted. (WTF::SegmentedVector::subscriptFor): Deleted. (WTF::SegmentedVector::ensureSegmentsFor): Deleted. (WTF::SegmentedVector::ensureSegment): Deleted. (WTF::SegmentedVector::allocateSegment): Deleted. * wtf/SetForScope.h: * wtf/SingleRootGraph.h: * wtf/SinglyLinkedList.h: * wtf/SmallPtrSet.h: * wtf/SpanningTree.h: * wtf/Spectrum.h: * wtf/StackBounds.h: * wtf/StackShot.h: * wtf/StackShotProfiler.h: * wtf/StackStats.h: * wtf/StackTrace.h: * wtf/StreamBuffer.h: * wtf/SynchronizedFixedQueue.h: (WTF::SynchronizedFixedQueue::create): Deleted. (WTF::SynchronizedFixedQueue::open): Deleted. (WTF::SynchronizedFixedQueue::close): Deleted. (WTF::SynchronizedFixedQueue::isOpen): Deleted. (WTF::SynchronizedFixedQueue::enqueue): Deleted. (WTF::SynchronizedFixedQueue::dequeue): Deleted. (WTF::SynchronizedFixedQueue::SynchronizedFixedQueue): Deleted. * wtf/SystemTracing.h: * wtf/ThreadGroup.h: (WTF::ThreadGroup::create): Deleted. (WTF::ThreadGroup::threads const): Deleted. (WTF::ThreadGroup::getLock): Deleted. (WTF::ThreadGroup::weakFromThis): Deleted. * wtf/ThreadSpecific.h: * wtf/ThreadingPrimitives.h: (WTF::Mutex::impl): Deleted. * wtf/TimeWithDynamicClockType.h: (WTF::TimeWithDynamicClockType::TimeWithDynamicClockType): Deleted. (WTF::TimeWithDynamicClockType::fromRawSeconds): Deleted. (WTF::TimeWithDynamicClockType::secondsSinceEpoch const): Deleted. (WTF::TimeWithDynamicClockType::clockType const): Deleted. (WTF::TimeWithDynamicClockType::withSameClockAndRawSeconds const): Deleted. (WTF::TimeWithDynamicClockType::operator bool const): Deleted. (WTF::TimeWithDynamicClockType::operator+ const): Deleted. (WTF::TimeWithDynamicClockType::operator- const): Deleted. (WTF::TimeWithDynamicClockType::operator+=): Deleted. (WTF::TimeWithDynamicClockType::operator-=): Deleted. (WTF::TimeWithDynamicClockType::operator== const): Deleted. (WTF::TimeWithDynamicClockType::operator!= const): Deleted. * wtf/TimingScope.h: * wtf/TinyLRUCache.h: * wtf/TinyPtrSet.h: * wtf/URLParser.cpp: * wtf/URLParser.h: * wtf/Unexpected.h: * wtf/Variant.h: * wtf/WTFSemaphore.h: (WTF::Semaphore::Semaphore): Deleted. (WTF::Semaphore::signal): Deleted. (WTF::Semaphore::waitUntil): Deleted. (WTF::Semaphore::waitFor): Deleted. (WTF::Semaphore::wait): Deleted. * wtf/WallTime.h: (WTF::WallTime::WallTime): Deleted. (WTF::WallTime::fromRawSeconds): Deleted. (WTF::WallTime::infinity): Deleted. (WTF::WallTime::nan): Deleted. (WTF::WallTime::secondsSinceEpoch const): Deleted. (WTF::WallTime::approximateWallTime const): Deleted. (WTF::WallTime::operator bool const): Deleted. (WTF::WallTime::operator+ const): Deleted. (WTF::WallTime::operator- const): Deleted. (WTF::WallTime::operator+=): Deleted. (WTF::WallTime::operator-=): Deleted. (WTF::WallTime::operator== const): Deleted. (WTF::WallTime::operator!= const): Deleted. (WTF::WallTime::operator< const): Deleted. (WTF::WallTime::operator> const): Deleted. (WTF::WallTime::operator<= const): Deleted. (WTF::WallTime::operator>= const): Deleted. (WTF::WallTime::isolatedCopy const): Deleted. * wtf/WeakHashSet.h: (WTF::WeakHashSet::WeakHashSetConstIterator::WeakHashSetConstIterator): Deleted. (WTF::WeakHashSet::WeakHashSetConstIterator::get const): Deleted. (WTF::WeakHashSet::WeakHashSetConstIterator::operator* const): Deleted. (WTF::WeakHashSet::WeakHashSetConstIterator::operator-> const): Deleted. (WTF::WeakHashSet::WeakHashSetConstIterator::operator++): Deleted. (WTF::WeakHashSet::WeakHashSetConstIterator::skipEmptyBuckets): Deleted. (WTF::WeakHashSet::WeakHashSetConstIterator::operator== const): Deleted. (WTF::WeakHashSet::WeakHashSetConstIterator::operator!= const): Deleted. (WTF::WeakHashSet::WeakHashSet): Deleted. (WTF::WeakHashSet::begin const): Deleted. (WTF::WeakHashSet::end const): Deleted. (WTF::WeakHashSet::add): Deleted. (WTF::WeakHashSet::remove): Deleted. (WTF::WeakHashSet::contains const): Deleted. (WTF::WeakHashSet::capacity const): Deleted. (WTF::WeakHashSet::computesEmpty const): Deleted. (WTF::WeakHashSet::hasNullReferences const): Deleted. (WTF::WeakHashSet::computeSize const): Deleted. (WTF::WeakHashSet::checkConsistency const): Deleted. * wtf/WeakRandom.h: (WTF::WeakRandom::WeakRandom): Deleted. (WTF::WeakRandom::setSeed): Deleted. (WTF::WeakRandom::seed const): Deleted. (WTF::WeakRandom::get): Deleted. (WTF::WeakRandom::getUint32): Deleted. (WTF::WeakRandom::lowOffset): Deleted. (WTF::WeakRandom::highOffset): Deleted. (WTF::WeakRandom::nextState): Deleted. (WTF::WeakRandom::generate): Deleted. (WTF::WeakRandom::advance): Deleted. * wtf/WordLock.h: (WTF::WordLock::lock): Deleted. (WTF::WordLock::unlock): Deleted. (WTF::WordLock::isHeld const): Deleted. (WTF::WordLock::isLocked const): Deleted. (WTF::WordLock::isFullyReset const): Deleted. * wtf/generic/MainThreadGeneric.cpp: * wtf/glib/GMutexLocker.h: * wtf/linux/CurrentProcessMemoryStatus.h: * wtf/posix/ThreadingPOSIX.cpp: (WTF::Semaphore::Semaphore): Deleted. (WTF::Semaphore::~Semaphore): Deleted. (WTF::Semaphore::wait): Deleted. (WTF::Semaphore::post): Deleted. * wtf/text/ASCIILiteral.h: (WTF::ASCIILiteral::operator const char* const): Deleted. (WTF::ASCIILiteral::fromLiteralUnsafe): Deleted. (WTF::ASCIILiteral::null): Deleted. (WTF::ASCIILiteral::characters const): Deleted. (WTF::ASCIILiteral::ASCIILiteral): Deleted. * wtf/text/AtomString.h: (WTF::AtomString::operator=): Deleted. (WTF::AtomString::isHashTableDeletedValue const): Deleted. (WTF::AtomString::existingHash const): Deleted. (WTF::AtomString::operator const String& const): Deleted. (WTF::AtomString::string const): Deleted. (WTF::AtomString::impl const): Deleted. (WTF::AtomString::is8Bit const): Deleted. (WTF::AtomString::characters8 const): Deleted. (WTF::AtomString::characters16 const): Deleted. (WTF::AtomString::length const): Deleted. (WTF::AtomString::operator[] const): Deleted. (WTF::AtomString::contains const): Deleted. (WTF::AtomString::containsIgnoringASCIICase const): Deleted. (WTF::AtomString::find const): Deleted. (WTF::AtomString::findIgnoringASCIICase const): Deleted. (WTF::AtomString::startsWith const): Deleted. (WTF::AtomString::startsWithIgnoringASCIICase const): Deleted. (WTF::AtomString::endsWith const): Deleted. (WTF::AtomString::endsWithIgnoringASCIICase const): Deleted. (WTF::AtomString::toInt const): Deleted. (WTF::AtomString::toDouble const): Deleted. (WTF::AtomString::toFloat const): Deleted. (WTF::AtomString::percentage const): Deleted. (WTF::AtomString::isNull const): Deleted. (WTF::AtomString::isEmpty const): Deleted. (WTF::AtomString::operator NSString * const): Deleted. * wtf/text/AtomStringImpl.h: (WTF::AtomStringImpl::lookUp): Deleted. (WTF::AtomStringImpl::add): Deleted. (WTF::AtomStringImpl::addWithStringTableProvider): Deleted. * wtf/text/CString.h: (WTF::CStringBuffer::data): Deleted. (WTF::CStringBuffer::length const): Deleted. (WTF::CStringBuffer::CStringBuffer): Deleted. (WTF::CStringBuffer::mutableData): Deleted. (WTF::CString::CString): Deleted. (WTF::CString::data const): Deleted. (WTF::CString::length const): Deleted. (WTF::CString::isNull const): Deleted. (WTF::CString::buffer const): Deleted. (WTF::CString::isHashTableDeletedValue const): Deleted. * wtf/text/ExternalStringImpl.h: (WTF::ExternalStringImpl::freeExternalBuffer): Deleted. * wtf/text/LineBreakIteratorPoolICU.h: * wtf/text/NullTextBreakIterator.h: * wtf/text/OrdinalNumber.h: * wtf/text/StringBuffer.h: * wtf/text/StringBuilder.h: * wtf/text/StringConcatenateNumbers.h: * wtf/text/StringHasher.h: * wtf/text/StringImpl.h: * wtf/text/StringView.cpp: * wtf/text/StringView.h: (WTF::StringView::left const): Deleted. (WTF::StringView::right const): Deleted. (WTF::StringView::underlyingStringIsValid const): Deleted. (WTF::StringView::setUnderlyingString): Deleted. * wtf/text/SymbolImpl.h: (WTF::SymbolImpl::StaticSymbolImpl::StaticSymbolImpl): Deleted. (WTF::SymbolImpl::StaticSymbolImpl::operator SymbolImpl&): Deleted. (WTF::PrivateSymbolImpl::PrivateSymbolImpl): Deleted. (WTF::RegisteredSymbolImpl::symbolRegistry const): Deleted. (WTF::RegisteredSymbolImpl::clearSymbolRegistry): Deleted. (WTF::RegisteredSymbolImpl::RegisteredSymbolImpl): Deleted. * wtf/text/SymbolRegistry.h: * wtf/text/TextBreakIterator.h: * wtf/text/TextPosition.h: * wtf/text/TextStream.h: * wtf/text/WTFString.h: (WTF::String::swap): Deleted. (WTF::String::adopt): Deleted. (WTF::String::isNull const): Deleted. (WTF::String::isEmpty const): Deleted. (WTF::String::impl const): Deleted. (WTF::String::releaseImpl): Deleted. (WTF::String::length const): Deleted. (WTF::String::characters8 const): Deleted. (WTF::String::characters16 const): Deleted. (WTF::String::is8Bit const): Deleted. (WTF::String::sizeInBytes const): Deleted. (WTF::String::operator[] const): Deleted. (WTF::String::find const): Deleted. (WTF::String::findIgnoringASCIICase const): Deleted. (WTF::String::reverseFind const): Deleted. (WTF::String::contains const): Deleted. (WTF::String::containsIgnoringASCIICase const): Deleted. (WTF::String::startsWith const): Deleted. (WTF::String::startsWithIgnoringASCIICase const): Deleted. (WTF::String::hasInfixStartingAt const): Deleted. (WTF::String::endsWith const): Deleted. (WTF::String::endsWithIgnoringASCIICase const): Deleted. (WTF::String::hasInfixEndingAt const): Deleted. (WTF::String::append): Deleted. (WTF::String::left const): Deleted. (WTF::String::right const): Deleted. (WTF::String::createUninitialized): Deleted. (WTF::String::fromUTF8WithLatin1Fallback): Deleted. (WTF::String::isAllASCII const): Deleted. (WTF::String::isAllLatin1 const): Deleted. (WTF::String::isSpecialCharacter const): Deleted. (WTF::String::isHashTableDeletedValue const): Deleted. (WTF::String::hash const): Deleted. (WTF::String::existingHash const): Deleted. * wtf/text/cf/TextBreakIteratorCF.h: * wtf/text/icu/TextBreakIteratorICU.h: * wtf/text/icu/UTextProviderLatin1.h: * wtf/threads/BinarySemaphore.h: (WTF::BinarySemaphore::waitFor): Deleted. (WTF::BinarySemaphore::wait): Deleted. * wtf/unicode/Collator.h: * wtf/win/GDIObject.h: * wtf/win/PathWalker.h: * wtf/win/Win32Handle.h: Canonical link: https://commits.webkit.org/214396@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248546 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-08-12 20:57:15 +00:00
WTF_MAKE_STRUCT_FAST_ALLOCATED;
Dominators should be factored out of the DFG https://bugs.webkit.org/show_bug.cgi?id=150764 Reviewed by Geoffrey Garen. Source/JavaScriptCore: Factored DFGDominators.h/DFGDominators.cpp into WTF. To do this, I made two changes to the DFG: 1) DFG now has a CFG abstraction called DFG::CFG. The cool thing about this is that in the future if we wanted to support inverted dominators, we could do it by just creating a DFG::BackwardCFG. 2) Got rid of DFG::Analysis. From now on, an Analysis being invalidated is expressed by the DFG::Graph having a null pointer for that analysis. When we "run" the analysis, we just instantiate it. This makes it much more natural to integrate WTF::Dominators into the DFG. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * dfg/DFGAnalysis.h: Removed. * dfg/DFGCFG.h: Added. (JSC::DFG::CFG::CFG): (JSC::DFG::CFG::root): (JSC::DFG::CFG::newMap<T>): (JSC::DFG::CFG::successors): (JSC::DFG::CFG::predecessors): (JSC::DFG::CFG::index): (JSC::DFG::CFG::node): (JSC::DFG::CFG::numNodes): (JSC::DFG::CFG::dump): * dfg/DFGCSEPhase.cpp: * dfg/DFGDisassembler.cpp: (JSC::DFG::Disassembler::createDumpList): * dfg/DFGDominators.cpp: Removed. * dfg/DFGDominators.h: (JSC::DFG::Dominators::Dominators): (JSC::DFG::Dominators::strictlyDominates): Deleted. (JSC::DFG::Dominators::dominates): Deleted. (JSC::DFG::Dominators::immediateDominatorOf): Deleted. (JSC::DFG::Dominators::forAllStrictDominatorsOf): Deleted. (JSC::DFG::Dominators::forAllDominatorsOf): Deleted. (JSC::DFG::Dominators::forAllBlocksStrictlyDominatedBy): Deleted. (JSC::DFG::Dominators::forAllBlocksDominatedBy): Deleted. (JSC::DFG::Dominators::forAllBlocksInDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInIteratedDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInPrunedIteratedDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInDominanceFrontierOfImpl): Deleted. (JSC::DFG::Dominators::forAllBlocksInIteratedDominanceFrontierOfImpl): Deleted. (JSC::DFG::Dominators::BlockData::BlockData): Deleted. * dfg/DFGEdgeDominates.h: (JSC::DFG::EdgeDominates::operator()): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::Graph): (JSC::DFG::Graph::dumpBlockHeader): (JSC::DFG::Graph::invalidateCFG): (JSC::DFG::Graph::substituteGetLocal): (JSC::DFG::Graph::handleAssertionFailure): (JSC::DFG::Graph::ensureDominators): (JSC::DFG::Graph::ensurePrePostNumbering): (JSC::DFG::Graph::ensureNaturalLoops): (JSC::DFG::Graph::valueProfileFor): * dfg/DFGGraph.h: (JSC::DFG::Graph::hasDebuggerEnabled): * dfg/DFGLICMPhase.cpp: (JSC::DFG::LICMPhase::run): (JSC::DFG::LICMPhase::attemptHoist): * dfg/DFGLoopPreHeaderCreationPhase.cpp: (JSC::DFG::createPreHeader): (JSC::DFG::LoopPreHeaderCreationPhase::run): * dfg/DFGNaturalLoops.cpp: (JSC::DFG::NaturalLoop::dump): (JSC::DFG::NaturalLoops::NaturalLoops): (JSC::DFG::NaturalLoops::~NaturalLoops): (JSC::DFG::NaturalLoops::loopsOf): (JSC::DFG::NaturalLoops::computeDependencies): Deleted. (JSC::DFG::NaturalLoops::compute): Deleted. * dfg/DFGNaturalLoops.h: (JSC::DFG::NaturalLoops::numLoops): * dfg/DFGNode.h: (JSC::DFG::Node::SuccessorsIterable::end): (JSC::DFG::Node::SuccessorsIterable::size): (JSC::DFG::Node::SuccessorsIterable::at): (JSC::DFG::Node::SuccessorsIterable::operator[]): * dfg/DFGOSREntrypointCreationPhase.cpp: (JSC::DFG::OSREntrypointCreationPhase::run): * dfg/DFGObjectAllocationSinkingPhase.cpp: * dfg/DFGPlan.cpp: (JSC::DFG::Plan::compileInThreadImpl): * dfg/DFGPrePostNumbering.cpp: (JSC::DFG::PrePostNumbering::PrePostNumbering): (JSC::DFG::PrePostNumbering::~PrePostNumbering): (JSC::DFG::PrePostNumbering::compute): Deleted. * dfg/DFGPrePostNumbering.h: (JSC::DFG::PrePostNumbering::preNumber): (JSC::DFG::PrePostNumbering::postNumber): * dfg/DFGPutStackSinkingPhase.cpp: * dfg/DFGSSACalculator.cpp: (JSC::DFG::SSACalculator::nonLocalReachingDef): (JSC::DFG::SSACalculator::reachingDefAtTail): * dfg/DFGSSACalculator.h: (JSC::DFG::SSACalculator::computePhis): * dfg/DFGSSAConversionPhase.cpp: (JSC::DFG::SSAConversionPhase::run): * ftl/FTLLink.cpp: (JSC::FTL::link): * ftl/FTLLowerDFGToLLVM.cpp: (JSC::FTL::DFG::LowerDFGToLLVM::lower): (JSC::FTL::DFG::LowerDFGToLLVM::safelyInvalidateAfterTermination): (JSC::FTL::DFG::LowerDFGToLLVM::isValid): Source/WTF: This takes what used to be DFGDominators.h/DFGDominators.cpp and turns it into a generic algorithm that can take any abstract graph. The idea is that you create Dominators<CFG> and pass it a CFG object, which defines the types of graph nodes and methods for getting successors, predecessors, etc. The DFG now defines a class called CFG, which is a wrapper for DFG::Graph that conforms to the thing that wtf/Dominators.h expects. When doing things to graphs, it's common to refer to the things in the graph as "nodes". Because I intend to reuse the CFG abstraction with many graph algorithms, that abstraction uses the term "node" to refer to a DFG basic block. But in Dominators, the method and variable names still use "block". This is because although Dominators are applicable to any kind of directed graph, it's super unlikely that we will ever use them for anything but compilers. Indeed, the only reason why I'm factoring them out of the DFG is so that I can use them with B3 and Air. This has the nice side effect that a user of WTF::Dominators<JSC::DFG::CFG> will see familiar terminology like "blocksStrictlyDominatedBy(...)" instead of "nodesStrictlyDominatedBy(...)", which would be super confusing. Overall, wtf/Dominators.h is a combination of what used to be in DFGDominators.h, DFGDominators.cpp, DFGNaiveDominators.h, and DFGNaiveDominators.cpp. I only changed code when I had to in order to make it generic. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/Dominators.h: Added. (WTF::Dominators::Dominators): (WTF::Dominators::compute): (WTF::Dominators::strictlyDominates): (WTF::Dominators::dominates): (WTF::Dominators::immediateDominatorOf): (WTF::Dominators::forAllStrictDominatorsOf): (WTF::Dominators::forAllDominatorsOf): (WTF::Dominators::forAllBlocksStrictlyDominatedBy): (WTF::Dominators::forAllBlocksDominatedBy): (WTF::Dominators::strictDominatorsOf): (WTF::Dominators::dominatorsOf): (WTF::Dominators::blocksStrictlyDominatedBy): (WTF::Dominators::blocksDominatedBy): (WTF::Dominators::forAllBlocksInDominanceFrontierOf): (WTF::Dominators::dominanceFrontierOf): (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOf): (WTF::Dominators::forAllBlocksInPrunedIteratedDominanceFrontierOf): (WTF::Dominators::iteratedDominanceFrontierOf): (WTF::Dominators::dump): (WTF::Dominators::LengauerTarjan::LengauerTarjan): (WTF::Dominators::LengauerTarjan::compute): (WTF::Dominators::LengauerTarjan::immediateDominator): (WTF::Dominators::LengauerTarjan::computeDepthFirstPreNumbering): (WTF::Dominators::LengauerTarjan::computeSemiDominatorsAndImplicitImmediateDominators): (WTF::Dominators::LengauerTarjan::computeExplicitImmediateDominators): (WTF::Dominators::LengauerTarjan::link): (WTF::Dominators::LengauerTarjan::eval): (WTF::Dominators::LengauerTarjan::compress): (WTF::Dominators::LengauerTarjan::BlockData::BlockData): (WTF::Dominators::NaiveDominators::NaiveDominators): (WTF::Dominators::NaiveDominators::dominates): (WTF::Dominators::NaiveDominators::dump): (WTF::Dominators::NaiveDominators::pruneDominators): (WTF::Dominators::ValidationContext::ValidationContext): (WTF::Dominators::ValidationContext::reportError): (WTF::Dominators::ValidationContext::handleErrors): (WTF::Dominators::naiveDominates): (WTF::Dominators::forAllBlocksInDominanceFrontierOfImpl): (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOfImpl): (WTF::Dominators::BlockData::BlockData): Canonical link: https://commits.webkit.org/168962@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@191870 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-11-02 00:48:03 +00:00
BlockData()
: parent(nullptr)
, preNumber(UINT_MAX)
, semiNumber(UINT_MAX)
, ancestor(nullptr)
, label(nullptr)
, dom(nullptr)
{
}
typename Graph::Node parent;
unsigned preNumber;
unsigned semiNumber;
typename Graph::Node ancestor;
typename Graph::Node label;
Vector<typename Graph::Node> bucket;
typename Graph::Node dom;
};
Graph& m_graph;
typename Graph::template Map<BlockData> m_data;
Vector<typename Graph::Node> m_blockByPreNumber;
};
class NaiveDominators {
[WTF][JSC] Make JSC and WTF aggressively-fast-malloced https://bugs.webkit.org/show_bug.cgi?id=200611 Reviewed by Saam Barati. Source/JavaScriptCore: This patch aggressively puts many classes into FastMalloc. In JSC side, we grep `std::make_unique` etc. to find potentially system-malloc-allocated classes. After this patch, all the JSC related allocations in JetStream2 cli is done from bmalloc. In the future, it would be nice that we add `WTF::makeUnique<T>` helper function and throw a compile error if `T` is not FastMalloc annotated[1]. Putting WebKit classes in FastMalloc has many benefits. 1. Simply, it is fast. 2. vmmap can tell the amount of memory used for WebKit. 3. bmalloc can isolate WebKit memory allocation from the rest of the world. This is useful since we can know more about what component is corrupting the memory from the memory corruption crash. [1]: https://bugs.webkit.org/show_bug.cgi?id=200620 * API/ObjCCallbackFunction.mm: * assembler/AbstractMacroAssembler.h: * b3/B3PhiChildren.h: * b3/air/AirAllocateRegistersAndStackAndGenerateCode.h: * b3/air/AirDisassembler.h: * bytecode/AccessCaseSnippetParams.h: * bytecode/CallVariant.h: * bytecode/DeferredSourceDump.h: * bytecode/ExecutionCounter.h: * bytecode/GetByIdStatus.h: * bytecode/GetByIdVariant.h: * bytecode/InByIdStatus.h: * bytecode/InByIdVariant.h: * bytecode/InstanceOfStatus.h: * bytecode/InstanceOfVariant.h: * bytecode/PutByIdStatus.h: * bytecode/PutByIdVariant.h: * bytecode/ValueProfile.h: * dfg/DFGAbstractInterpreter.h: * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::newVariableAccessData): * dfg/DFGFlowIndexing.h: * dfg/DFGFlowMap.h: * dfg/DFGLiveCatchVariablePreservationPhase.cpp: (JSC::DFG::LiveCatchVariablePreservationPhase::newVariableAccessData): * dfg/DFGMaximalFlushInsertionPhase.cpp: (JSC::DFG::MaximalFlushInsertionPhase::newVariableAccessData): * dfg/DFGOSRExit.h: * dfg/DFGSpeculativeJIT.h: * dfg/DFGVariableAccessData.h: * disassembler/ARM64/A64DOpcode.h: * inspector/remote/socket/RemoteInspectorMessageParser.h: * inspector/remote/socket/RemoteInspectorSocket.h: * inspector/remote/socket/RemoteInspectorSocketEndpoint.h: * jit/PCToCodeOriginMap.h: * runtime/BasicBlockLocation.h: * runtime/DoublePredictionFuzzerAgent.h: * runtime/JSRunLoopTimer.h: * runtime/PromiseDeferredTimer.h: (JSC::PromiseDeferredTimer::create): PromiseDeferredTimer should be allocated as `Ref<>` instead of `std::unique_ptr` since it is inheriting ThreadSafeRefCounted<>. Holding such a class with std::unique_ptr could lead to potentially dangerous operations (like, someone holds it with Ref<> while it is deleted by std::unique_ptr<>). * runtime/RandomizingFuzzerAgent.h: * runtime/SymbolTable.h: * runtime/VM.cpp: (JSC::VM::VM): * runtime/VM.h: * tools/JSDollarVM.cpp: * tools/SigillCrashAnalyzer.cpp: * wasm/WasmFormat.h: * wasm/WasmMemory.cpp: * wasm/WasmSignature.h: * yarr/YarrJIT.h: Source/WebCore: Changed the accessor since we changed std::unique_ptr to Ref for this field. No behavior change. * bindings/js/WorkerScriptController.cpp: (WebCore::WorkerScriptController::addTimerSetNotification): (WebCore::WorkerScriptController::removeTimerSetNotification): Source/WTF: WTF has many data structures, in particular, containers. And these containers can be allocated like `std::make_unique<Container>()`. Without WTF_MAKE_FAST_ALLOCATED, this container itself is allocated from the system malloc. This patch attaches WTF_MAKE_FAST_ALLOCATED more aggressively not to allocate them from the system malloc. And we add some `final` to containers and classes that would be never inherited. * wtf/Assertions.cpp: * wtf/Atomics.h: * wtf/AutodrainedPool.h: * wtf/Bag.h: (WTF::Bag::Bag): Deleted. (WTF::Bag::~Bag): Deleted. (WTF::Bag::clear): Deleted. (WTF::Bag::add): Deleted. (WTF::Bag::iterator::iterator): Deleted. (WTF::Bag::iterator::operator! const): Deleted. (WTF::Bag::iterator::operator* const): Deleted. (WTF::Bag::iterator::operator++): Deleted. (WTF::Bag::iterator::operator== const): Deleted. (WTF::Bag::iterator::operator!= const): Deleted. (WTF::Bag::begin): Deleted. (WTF::Bag::begin const): Deleted. (WTF::Bag::end const): Deleted. (WTF::Bag::isEmpty const): Deleted. (WTF::Bag::unwrappedHead const): Deleted. * wtf/BitVector.h: (WTF::BitVector::BitVector): Deleted. (WTF::BitVector::~BitVector): Deleted. (WTF::BitVector::operator=): Deleted. (WTF::BitVector::size const): Deleted. (WTF::BitVector::ensureSize): Deleted. (WTF::BitVector::quickGet const): Deleted. (WTF::BitVector::quickSet): Deleted. (WTF::BitVector::quickClear): Deleted. (WTF::BitVector::get const): Deleted. (WTF::BitVector::contains const): Deleted. (WTF::BitVector::set): Deleted. (WTF::BitVector::add): Deleted. (WTF::BitVector::ensureSizeAndSet): Deleted. (WTF::BitVector::clear): Deleted. (WTF::BitVector::remove): Deleted. (WTF::BitVector::merge): Deleted. (WTF::BitVector::filter): Deleted. (WTF::BitVector::exclude): Deleted. (WTF::BitVector::bitCount const): Deleted. (WTF::BitVector::isEmpty const): Deleted. (WTF::BitVector::findBit const): Deleted. (WTF::BitVector::isEmptyValue const): Deleted. (WTF::BitVector::isDeletedValue const): Deleted. (WTF::BitVector::isEmptyOrDeletedValue const): Deleted. (WTF::BitVector::operator== const): Deleted. (WTF::BitVector::hash const): Deleted. (WTF::BitVector::iterator::iterator): Deleted. (WTF::BitVector::iterator::operator* const): Deleted. (WTF::BitVector::iterator::operator++): Deleted. (WTF::BitVector::iterator::isAtEnd const): Deleted. (WTF::BitVector::iterator::operator== const): Deleted. (WTF::BitVector::iterator::operator!= const): Deleted. (WTF::BitVector::begin const): Deleted. (WTF::BitVector::end const): Deleted. (WTF::BitVector::bitsInPointer): Deleted. (WTF::BitVector::maxInlineBits): Deleted. (WTF::BitVector::byteCount): Deleted. (WTF::BitVector::makeInlineBits): Deleted. (WTF::BitVector::cleanseInlineBits): Deleted. (WTF::BitVector::bitCount): Deleted. (WTF::BitVector::findBitFast const): Deleted. (WTF::BitVector::findBitSimple const): Deleted. (WTF::BitVector::OutOfLineBits::numBits const): Deleted. (WTF::BitVector::OutOfLineBits::numWords const): Deleted. (WTF::BitVector::OutOfLineBits::bits): Deleted. (WTF::BitVector::OutOfLineBits::bits const): Deleted. (WTF::BitVector::OutOfLineBits::OutOfLineBits): Deleted. (WTF::BitVector::isInline const): Deleted. (WTF::BitVector::outOfLineBits const): Deleted. (WTF::BitVector::outOfLineBits): Deleted. (WTF::BitVector::bits): Deleted. (WTF::BitVector::bits const): Deleted. * wtf/Bitmap.h: (WTF::Bitmap::size): Deleted. (WTF::Bitmap::iterator::iterator): Deleted. (WTF::Bitmap::iterator::operator* const): Deleted. (WTF::Bitmap::iterator::operator++): Deleted. (WTF::Bitmap::iterator::operator== const): Deleted. (WTF::Bitmap::iterator::operator!= const): Deleted. (WTF::Bitmap::begin const): Deleted. (WTF::Bitmap::end const): Deleted. * wtf/Box.h: * wtf/BumpPointerAllocator.h: * wtf/CPUTime.h: * wtf/CheckedBoolean.h: * wtf/CommaPrinter.h: (WTF::CommaPrinter::CommaPrinter): Deleted. (WTF::CommaPrinter::dump const): Deleted. (WTF::CommaPrinter::didPrint const): Deleted. * wtf/CompactPointerTuple.h: (WTF::CompactPointerTuple::encodeType): Deleted. (WTF::CompactPointerTuple::decodeType): Deleted. (WTF::CompactPointerTuple::CompactPointerTuple): Deleted. (WTF::CompactPointerTuple::pointer const): Deleted. (WTF::CompactPointerTuple::setPointer): Deleted. (WTF::CompactPointerTuple::type const): Deleted. (WTF::CompactPointerTuple::setType): Deleted. * wtf/CompilationThread.h: (WTF::CompilationScope::CompilationScope): Deleted. (WTF::CompilationScope::~CompilationScope): Deleted. (WTF::CompilationScope::leaveEarly): Deleted. * wtf/CompletionHandler.h: (WTF::CompletionHandler<Out): (WTF::Detail::CallableWrapper<CompletionHandler<Out): (WTF::CompletionHandlerCallingScope::CompletionHandlerCallingScope): Deleted. (WTF::CompletionHandlerCallingScope::~CompletionHandlerCallingScope): Deleted. (WTF::CompletionHandlerCallingScope::CompletionHandler<void): Deleted. * wtf/ConcurrentBuffer.h: (WTF::ConcurrentBuffer::ConcurrentBuffer): Deleted. (WTF::ConcurrentBuffer::~ConcurrentBuffer): Deleted. (WTF::ConcurrentBuffer::growExact): Deleted. (WTF::ConcurrentBuffer::grow): Deleted. (WTF::ConcurrentBuffer::array const): Deleted. (WTF::ConcurrentBuffer::operator[]): Deleted. (WTF::ConcurrentBuffer::operator[] const): Deleted. (WTF::ConcurrentBuffer::createArray): Deleted. * wtf/ConcurrentPtrHashSet.h: (WTF::ConcurrentPtrHashSet::contains): Deleted. (WTF::ConcurrentPtrHashSet::add): Deleted. (WTF::ConcurrentPtrHashSet::size const): Deleted. (WTF::ConcurrentPtrHashSet::Table::maxLoad const): Deleted. (WTF::ConcurrentPtrHashSet::hash): Deleted. (WTF::ConcurrentPtrHashSet::cast): Deleted. (WTF::ConcurrentPtrHashSet::containsImpl const): Deleted. (WTF::ConcurrentPtrHashSet::addImpl): Deleted. * wtf/ConcurrentVector.h: (WTF::ConcurrentVector::~ConcurrentVector): Deleted. (WTF::ConcurrentVector::size const): Deleted. (WTF::ConcurrentVector::isEmpty const): Deleted. (WTF::ConcurrentVector::at): Deleted. (WTF::ConcurrentVector::at const): Deleted. (WTF::ConcurrentVector::operator[]): Deleted. (WTF::ConcurrentVector::operator[] const): Deleted. (WTF::ConcurrentVector::first): Deleted. (WTF::ConcurrentVector::first const): Deleted. (WTF::ConcurrentVector::last): Deleted. (WTF::ConcurrentVector::last const): Deleted. (WTF::ConcurrentVector::takeLast): Deleted. (WTF::ConcurrentVector::append): Deleted. (WTF::ConcurrentVector::alloc): Deleted. (WTF::ConcurrentVector::removeLast): Deleted. (WTF::ConcurrentVector::grow): Deleted. (WTF::ConcurrentVector::begin): Deleted. (WTF::ConcurrentVector::end): Deleted. (WTF::ConcurrentVector::segmentExistsFor): Deleted. (WTF::ConcurrentVector::segmentFor): Deleted. (WTF::ConcurrentVector::subscriptFor): Deleted. (WTF::ConcurrentVector::ensureSegmentsFor): Deleted. (WTF::ConcurrentVector::ensureSegment): Deleted. (WTF::ConcurrentVector::allocateSegment): Deleted. * wtf/Condition.h: (WTF::Condition::waitUntil): Deleted. (WTF::Condition::waitFor): Deleted. (WTF::Condition::wait): Deleted. (WTF::Condition::notifyOne): Deleted. (WTF::Condition::notifyAll): Deleted. * wtf/CountingLock.h: (WTF::CountingLock::LockHooks::lockHook): Deleted. (WTF::CountingLock::LockHooks::unlockHook): Deleted. (WTF::CountingLock::LockHooks::parkHook): Deleted. (WTF::CountingLock::LockHooks::handoffHook): Deleted. (WTF::CountingLock::tryLock): Deleted. (WTF::CountingLock::lock): Deleted. (WTF::CountingLock::unlock): Deleted. (WTF::CountingLock::isHeld const): Deleted. (WTF::CountingLock::isLocked const): Deleted. (WTF::CountingLock::Count::operator bool const): Deleted. (WTF::CountingLock::Count::operator== const): Deleted. (WTF::CountingLock::Count::operator!= const): Deleted. (WTF::CountingLock::tryOptimisticRead): Deleted. (WTF::CountingLock::validate): Deleted. (WTF::CountingLock::doOptimizedRead): Deleted. (WTF::CountingLock::tryOptimisticFencelessRead): Deleted. (WTF::CountingLock::fencelessValidate): Deleted. (WTF::CountingLock::doOptimizedFencelessRead): Deleted. (WTF::CountingLock::getCount): Deleted. * wtf/CrossThreadQueue.h: * wtf/CrossThreadTask.h: * wtf/CryptographicallyRandomNumber.cpp: * wtf/DataMutex.h: * wtf/DateMath.h: * wtf/Deque.h: (WTF::Deque::size const): Deleted. (WTF::Deque::isEmpty const): Deleted. (WTF::Deque::begin): Deleted. (WTF::Deque::end): Deleted. (WTF::Deque::begin const): Deleted. (WTF::Deque::end const): Deleted. (WTF::Deque::rbegin): Deleted. (WTF::Deque::rend): Deleted. (WTF::Deque::rbegin const): Deleted. (WTF::Deque::rend const): Deleted. (WTF::Deque::first): Deleted. (WTF::Deque::first const): Deleted. (WTF::Deque::last): Deleted. (WTF::Deque::last const): Deleted. (WTF::Deque::append): Deleted. * wtf/Dominators.h: * wtf/DoublyLinkedList.h: * wtf/Expected.h: * wtf/FastBitVector.h: * wtf/FileMetadata.h: * wtf/FileSystem.h: * wtf/GraphNodeWorklist.h: * wtf/GregorianDateTime.h: (WTF::GregorianDateTime::GregorianDateTime): Deleted. (WTF::GregorianDateTime::year const): Deleted. (WTF::GregorianDateTime::month const): Deleted. (WTF::GregorianDateTime::yearDay const): Deleted. (WTF::GregorianDateTime::monthDay const): Deleted. (WTF::GregorianDateTime::weekDay const): Deleted. (WTF::GregorianDateTime::hour const): Deleted. (WTF::GregorianDateTime::minute const): Deleted. (WTF::GregorianDateTime::second const): Deleted. (WTF::GregorianDateTime::utcOffset const): Deleted. (WTF::GregorianDateTime::isDST const): Deleted. (WTF::GregorianDateTime::setYear): Deleted. (WTF::GregorianDateTime::setMonth): Deleted. (WTF::GregorianDateTime::setYearDay): Deleted. (WTF::GregorianDateTime::setMonthDay): Deleted. (WTF::GregorianDateTime::setWeekDay): Deleted. (WTF::GregorianDateTime::setHour): Deleted. (WTF::GregorianDateTime::setMinute): Deleted. (WTF::GregorianDateTime::setSecond): Deleted. (WTF::GregorianDateTime::setUtcOffset): Deleted. (WTF::GregorianDateTime::setIsDST): Deleted. (WTF::GregorianDateTime::operator tm const): Deleted. (WTF::GregorianDateTime::copyFrom): Deleted. * wtf/HashTable.h: * wtf/Hasher.h: * wtf/HexNumber.h: * wtf/Indenter.h: * wtf/IndexMap.h: * wtf/IndexSet.h: * wtf/IndexSparseSet.h: * wtf/IndexedContainerIterator.h: * wtf/Insertion.h: * wtf/IteratorAdaptors.h: * wtf/IteratorRange.h: * wtf/KeyValuePair.h: * wtf/ListHashSet.h: (WTF::ListHashSet::begin): Deleted. (WTF::ListHashSet::end): Deleted. (WTF::ListHashSet::begin const): Deleted. (WTF::ListHashSet::end const): Deleted. (WTF::ListHashSet::random): Deleted. (WTF::ListHashSet::random const): Deleted. (WTF::ListHashSet::rbegin): Deleted. (WTF::ListHashSet::rend): Deleted. (WTF::ListHashSet::rbegin const): Deleted. (WTF::ListHashSet::rend const): Deleted. * wtf/Liveness.h: * wtf/LocklessBag.h: (WTF::LocklessBag::LocklessBag): Deleted. (WTF::LocklessBag::add): Deleted. (WTF::LocklessBag::iterate): Deleted. (WTF::LocklessBag::consumeAll): Deleted. (WTF::LocklessBag::consumeAllWithNode): Deleted. (WTF::LocklessBag::~LocklessBag): Deleted. * wtf/LoggingHashID.h: * wtf/MD5.h: * wtf/MachSendRight.h: * wtf/MainThreadData.h: * wtf/Markable.h: * wtf/MediaTime.h: * wtf/MemoryPressureHandler.h: * wtf/MessageQueue.h: (WTF::MessageQueue::MessageQueue): Deleted. * wtf/MetaAllocator.h: * wtf/MonotonicTime.h: (WTF::MonotonicTime::MonotonicTime): Deleted. (WTF::MonotonicTime::fromRawSeconds): Deleted. (WTF::MonotonicTime::infinity): Deleted. (WTF::MonotonicTime::nan): Deleted. (WTF::MonotonicTime::secondsSinceEpoch const): Deleted. (WTF::MonotonicTime::approximateMonotonicTime const): Deleted. (WTF::MonotonicTime::operator bool const): Deleted. (WTF::MonotonicTime::operator+ const): Deleted. (WTF::MonotonicTime::operator- const): Deleted. (WTF::MonotonicTime::operator% const): Deleted. (WTF::MonotonicTime::operator+=): Deleted. (WTF::MonotonicTime::operator-=): Deleted. (WTF::MonotonicTime::operator== const): Deleted. (WTF::MonotonicTime::operator!= const): Deleted. (WTF::MonotonicTime::operator< const): Deleted. (WTF::MonotonicTime::operator> const): Deleted. (WTF::MonotonicTime::operator<= const): Deleted. (WTF::MonotonicTime::operator>= const): Deleted. (WTF::MonotonicTime::isolatedCopy const): Deleted. (WTF::MonotonicTime::encode const): Deleted. (WTF::MonotonicTime::decode): Deleted. * wtf/NaturalLoops.h: * wtf/NoLock.h: * wtf/OSAllocator.h: * wtf/OptionSet.h: * wtf/Optional.h: * wtf/OrderMaker.h: * wtf/Packed.h: (WTF::alignof): * wtf/PackedIntVector.h: (WTF::PackedIntVector::PackedIntVector): Deleted. (WTF::PackedIntVector::operator=): Deleted. (WTF::PackedIntVector::size const): Deleted. (WTF::PackedIntVector::ensureSize): Deleted. (WTF::PackedIntVector::resize): Deleted. (WTF::PackedIntVector::clearAll): Deleted. (WTF::PackedIntVector::get const): Deleted. (WTF::PackedIntVector::set): Deleted. (WTF::PackedIntVector::mask): Deleted. * wtf/PageBlock.h: * wtf/ParallelJobsOpenMP.h: * wtf/ParkingLot.h: * wtf/PriorityQueue.h: (WTF::PriorityQueue::size const): Deleted. (WTF::PriorityQueue::isEmpty const): Deleted. (WTF::PriorityQueue::enqueue): Deleted. (WTF::PriorityQueue::peek const): Deleted. (WTF::PriorityQueue::dequeue): Deleted. (WTF::PriorityQueue::decreaseKey): Deleted. (WTF::PriorityQueue::increaseKey): Deleted. (WTF::PriorityQueue::begin const): Deleted. (WTF::PriorityQueue::end const): Deleted. (WTF::PriorityQueue::isValidHeap const): Deleted. (WTF::PriorityQueue::parentOf): Deleted. (WTF::PriorityQueue::leftChildOf): Deleted. (WTF::PriorityQueue::rightChildOf): Deleted. (WTF::PriorityQueue::siftUp): Deleted. (WTF::PriorityQueue::siftDown): Deleted. * wtf/RandomDevice.h: * wtf/Range.h: * wtf/RangeSet.h: (WTF::RangeSet::RangeSet): Deleted. (WTF::RangeSet::~RangeSet): Deleted. (WTF::RangeSet::add): Deleted. (WTF::RangeSet::contains const): Deleted. (WTF::RangeSet::overlaps const): Deleted. (WTF::RangeSet::clear): Deleted. (WTF::RangeSet::dump const): Deleted. (WTF::RangeSet::dumpRaw const): Deleted. (WTF::RangeSet::begin const): Deleted. (WTF::RangeSet::end const): Deleted. (WTF::RangeSet::addAll): Deleted. (WTF::RangeSet::compact): Deleted. (WTF::RangeSet::overlapsNonEmpty): Deleted. (WTF::RangeSet::subsumesNonEmpty): Deleted. (WTF::RangeSet::findRange const): Deleted. * wtf/RecursableLambda.h: * wtf/RedBlackTree.h: (WTF::RedBlackTree::Node::successor const): Deleted. (WTF::RedBlackTree::Node::predecessor const): Deleted. (WTF::RedBlackTree::Node::successor): Deleted. (WTF::RedBlackTree::Node::predecessor): Deleted. (WTF::RedBlackTree::Node::reset): Deleted. (WTF::RedBlackTree::Node::parent const): Deleted. (WTF::RedBlackTree::Node::setParent): Deleted. (WTF::RedBlackTree::Node::left const): Deleted. (WTF::RedBlackTree::Node::setLeft): Deleted. (WTF::RedBlackTree::Node::right const): Deleted. (WTF::RedBlackTree::Node::setRight): Deleted. (WTF::RedBlackTree::Node::color const): Deleted. (WTF::RedBlackTree::Node::setColor): Deleted. (WTF::RedBlackTree::RedBlackTree): Deleted. (WTF::RedBlackTree::insert): Deleted. (WTF::RedBlackTree::remove): Deleted. (WTF::RedBlackTree::findExact const): Deleted. (WTF::RedBlackTree::findLeastGreaterThanOrEqual const): Deleted. (WTF::RedBlackTree::findGreatestLessThanOrEqual const): Deleted. (WTF::RedBlackTree::first const): Deleted. (WTF::RedBlackTree::last const): Deleted. (WTF::RedBlackTree::size): Deleted. (WTF::RedBlackTree::isEmpty): Deleted. (WTF::RedBlackTree::treeMinimum): Deleted. (WTF::RedBlackTree::treeMaximum): Deleted. (WTF::RedBlackTree::treeInsert): Deleted. (WTF::RedBlackTree::leftRotate): Deleted. (WTF::RedBlackTree::rightRotate): Deleted. (WTF::RedBlackTree::removeFixup): Deleted. * wtf/ResourceUsage.h: * wtf/RunLoop.cpp: * wtf/RunLoopTimer.h: * wtf/SHA1.h: * wtf/Seconds.h: (WTF::Seconds::Seconds): Deleted. (WTF::Seconds::value const): Deleted. (WTF::Seconds::minutes const): Deleted. (WTF::Seconds::seconds const): Deleted. (WTF::Seconds::milliseconds const): Deleted. (WTF::Seconds::microseconds const): Deleted. (WTF::Seconds::nanoseconds const): Deleted. (WTF::Seconds::minutesAs const): Deleted. (WTF::Seconds::secondsAs const): Deleted. (WTF::Seconds::millisecondsAs const): Deleted. (WTF::Seconds::microsecondsAs const): Deleted. (WTF::Seconds::nanosecondsAs const): Deleted. (WTF::Seconds::fromMinutes): Deleted. (WTF::Seconds::fromHours): Deleted. (WTF::Seconds::fromMilliseconds): Deleted. (WTF::Seconds::fromMicroseconds): Deleted. (WTF::Seconds::fromNanoseconds): Deleted. (WTF::Seconds::infinity): Deleted. (WTF::Seconds::nan): Deleted. (WTF::Seconds::operator bool const): Deleted. (WTF::Seconds::operator+ const): Deleted. (WTF::Seconds::operator- const): Deleted. (WTF::Seconds::operator* const): Deleted. (WTF::Seconds::operator/ const): Deleted. (WTF::Seconds::operator% const): Deleted. (WTF::Seconds::operator+=): Deleted. (WTF::Seconds::operator-=): Deleted. (WTF::Seconds::operator*=): Deleted. (WTF::Seconds::operator/=): Deleted. (WTF::Seconds::operator%=): Deleted. (WTF::Seconds::operator== const): Deleted. (WTF::Seconds::operator!= const): Deleted. (WTF::Seconds::operator< const): Deleted. (WTF::Seconds::operator> const): Deleted. (WTF::Seconds::operator<= const): Deleted. (WTF::Seconds::operator>= const): Deleted. (WTF::Seconds::isolatedCopy const): Deleted. (WTF::Seconds::encode const): Deleted. (WTF::Seconds::decode): Deleted. * wtf/SegmentedVector.h: (WTF::SegmentedVector::~SegmentedVector): Deleted. (WTF::SegmentedVector::size const): Deleted. (WTF::SegmentedVector::isEmpty const): Deleted. (WTF::SegmentedVector::at): Deleted. (WTF::SegmentedVector::at const): Deleted. (WTF::SegmentedVector::operator[]): Deleted. (WTF::SegmentedVector::operator[] const): Deleted. (WTF::SegmentedVector::first): Deleted. (WTF::SegmentedVector::first const): Deleted. (WTF::SegmentedVector::last): Deleted. (WTF::SegmentedVector::last const): Deleted. (WTF::SegmentedVector::takeLast): Deleted. (WTF::SegmentedVector::append): Deleted. (WTF::SegmentedVector::alloc): Deleted. (WTF::SegmentedVector::removeLast): Deleted. (WTF::SegmentedVector::grow): Deleted. (WTF::SegmentedVector::clear): Deleted. (WTF::SegmentedVector::begin): Deleted. (WTF::SegmentedVector::end): Deleted. (WTF::SegmentedVector::shrinkToFit): Deleted. (WTF::SegmentedVector::deleteAllSegments): Deleted. (WTF::SegmentedVector::segmentExistsFor): Deleted. (WTF::SegmentedVector::segmentFor): Deleted. (WTF::SegmentedVector::subscriptFor): Deleted. (WTF::SegmentedVector::ensureSegmentsFor): Deleted. (WTF::SegmentedVector::ensureSegment): Deleted. (WTF::SegmentedVector::allocateSegment): Deleted. * wtf/SetForScope.h: * wtf/SingleRootGraph.h: * wtf/SinglyLinkedList.h: * wtf/SmallPtrSet.h: * wtf/SpanningTree.h: * wtf/Spectrum.h: * wtf/StackBounds.h: * wtf/StackShot.h: * wtf/StackShotProfiler.h: * wtf/StackStats.h: * wtf/StackTrace.h: * wtf/StreamBuffer.h: * wtf/SynchronizedFixedQueue.h: (WTF::SynchronizedFixedQueue::create): Deleted. (WTF::SynchronizedFixedQueue::open): Deleted. (WTF::SynchronizedFixedQueue::close): Deleted. (WTF::SynchronizedFixedQueue::isOpen): Deleted. (WTF::SynchronizedFixedQueue::enqueue): Deleted. (WTF::SynchronizedFixedQueue::dequeue): Deleted. (WTF::SynchronizedFixedQueue::SynchronizedFixedQueue): Deleted. * wtf/SystemTracing.h: * wtf/ThreadGroup.h: (WTF::ThreadGroup::create): Deleted. (WTF::ThreadGroup::threads const): Deleted. (WTF::ThreadGroup::getLock): Deleted. (WTF::ThreadGroup::weakFromThis): Deleted. * wtf/ThreadSpecific.h: * wtf/ThreadingPrimitives.h: (WTF::Mutex::impl): Deleted. * wtf/TimeWithDynamicClockType.h: (WTF::TimeWithDynamicClockType::TimeWithDynamicClockType): Deleted. (WTF::TimeWithDynamicClockType::fromRawSeconds): Deleted. (WTF::TimeWithDynamicClockType::secondsSinceEpoch const): Deleted. (WTF::TimeWithDynamicClockType::clockType const): Deleted. (WTF::TimeWithDynamicClockType::withSameClockAndRawSeconds const): Deleted. (WTF::TimeWithDynamicClockType::operator bool const): Deleted. (WTF::TimeWithDynamicClockType::operator+ const): Deleted. (WTF::TimeWithDynamicClockType::operator- const): Deleted. (WTF::TimeWithDynamicClockType::operator+=): Deleted. (WTF::TimeWithDynamicClockType::operator-=): Deleted. (WTF::TimeWithDynamicClockType::operator== const): Deleted. (WTF::TimeWithDynamicClockType::operator!= const): Deleted. * wtf/TimingScope.h: * wtf/TinyLRUCache.h: * wtf/TinyPtrSet.h: * wtf/URLParser.cpp: * wtf/URLParser.h: * wtf/Unexpected.h: * wtf/Variant.h: * wtf/WTFSemaphore.h: (WTF::Semaphore::Semaphore): Deleted. (WTF::Semaphore::signal): Deleted. (WTF::Semaphore::waitUntil): Deleted. (WTF::Semaphore::waitFor): Deleted. (WTF::Semaphore::wait): Deleted. * wtf/WallTime.h: (WTF::WallTime::WallTime): Deleted. (WTF::WallTime::fromRawSeconds): Deleted. (WTF::WallTime::infinity): Deleted. (WTF::WallTime::nan): Deleted. (WTF::WallTime::secondsSinceEpoch const): Deleted. (WTF::WallTime::approximateWallTime const): Deleted. (WTF::WallTime::operator bool const): Deleted. (WTF::WallTime::operator+ const): Deleted. (WTF::WallTime::operator- const): Deleted. (WTF::WallTime::operator+=): Deleted. (WTF::WallTime::operator-=): Deleted. (WTF::WallTime::operator== const): Deleted. (WTF::WallTime::operator!= const): Deleted. (WTF::WallTime::operator< const): Deleted. (WTF::WallTime::operator> const): Deleted. (WTF::WallTime::operator<= const): Deleted. (WTF::WallTime::operator>= const): Deleted. (WTF::WallTime::isolatedCopy const): Deleted. * wtf/WeakHashSet.h: (WTF::WeakHashSet::WeakHashSetConstIterator::WeakHashSetConstIterator): Deleted. (WTF::WeakHashSet::WeakHashSetConstIterator::get const): Deleted. (WTF::WeakHashSet::WeakHashSetConstIterator::operator* const): Deleted. (WTF::WeakHashSet::WeakHashSetConstIterator::operator-> const): Deleted. (WTF::WeakHashSet::WeakHashSetConstIterator::operator++): Deleted. (WTF::WeakHashSet::WeakHashSetConstIterator::skipEmptyBuckets): Deleted. (WTF::WeakHashSet::WeakHashSetConstIterator::operator== const): Deleted. (WTF::WeakHashSet::WeakHashSetConstIterator::operator!= const): Deleted. (WTF::WeakHashSet::WeakHashSet): Deleted. (WTF::WeakHashSet::begin const): Deleted. (WTF::WeakHashSet::end const): Deleted. (WTF::WeakHashSet::add): Deleted. (WTF::WeakHashSet::remove): Deleted. (WTF::WeakHashSet::contains const): Deleted. (WTF::WeakHashSet::capacity const): Deleted. (WTF::WeakHashSet::computesEmpty const): Deleted. (WTF::WeakHashSet::hasNullReferences const): Deleted. (WTF::WeakHashSet::computeSize const): Deleted. (WTF::WeakHashSet::checkConsistency const): Deleted. * wtf/WeakRandom.h: (WTF::WeakRandom::WeakRandom): Deleted. (WTF::WeakRandom::setSeed): Deleted. (WTF::WeakRandom::seed const): Deleted. (WTF::WeakRandom::get): Deleted. (WTF::WeakRandom::getUint32): Deleted. (WTF::WeakRandom::lowOffset): Deleted. (WTF::WeakRandom::highOffset): Deleted. (WTF::WeakRandom::nextState): Deleted. (WTF::WeakRandom::generate): Deleted. (WTF::WeakRandom::advance): Deleted. * wtf/WordLock.h: (WTF::WordLock::lock): Deleted. (WTF::WordLock::unlock): Deleted. (WTF::WordLock::isHeld const): Deleted. (WTF::WordLock::isLocked const): Deleted. (WTF::WordLock::isFullyReset const): Deleted. * wtf/generic/MainThreadGeneric.cpp: * wtf/glib/GMutexLocker.h: * wtf/linux/CurrentProcessMemoryStatus.h: * wtf/posix/ThreadingPOSIX.cpp: (WTF::Semaphore::Semaphore): Deleted. (WTF::Semaphore::~Semaphore): Deleted. (WTF::Semaphore::wait): Deleted. (WTF::Semaphore::post): Deleted. * wtf/text/ASCIILiteral.h: (WTF::ASCIILiteral::operator const char* const): Deleted. (WTF::ASCIILiteral::fromLiteralUnsafe): Deleted. (WTF::ASCIILiteral::null): Deleted. (WTF::ASCIILiteral::characters const): Deleted. (WTF::ASCIILiteral::ASCIILiteral): Deleted. * wtf/text/AtomString.h: (WTF::AtomString::operator=): Deleted. (WTF::AtomString::isHashTableDeletedValue const): Deleted. (WTF::AtomString::existingHash const): Deleted. (WTF::AtomString::operator const String& const): Deleted. (WTF::AtomString::string const): Deleted. (WTF::AtomString::impl const): Deleted. (WTF::AtomString::is8Bit const): Deleted. (WTF::AtomString::characters8 const): Deleted. (WTF::AtomString::characters16 const): Deleted. (WTF::AtomString::length const): Deleted. (WTF::AtomString::operator[] const): Deleted. (WTF::AtomString::contains const): Deleted. (WTF::AtomString::containsIgnoringASCIICase const): Deleted. (WTF::AtomString::find const): Deleted. (WTF::AtomString::findIgnoringASCIICase const): Deleted. (WTF::AtomString::startsWith const): Deleted. (WTF::AtomString::startsWithIgnoringASCIICase const): Deleted. (WTF::AtomString::endsWith const): Deleted. (WTF::AtomString::endsWithIgnoringASCIICase const): Deleted. (WTF::AtomString::toInt const): Deleted. (WTF::AtomString::toDouble const): Deleted. (WTF::AtomString::toFloat const): Deleted. (WTF::AtomString::percentage const): Deleted. (WTF::AtomString::isNull const): Deleted. (WTF::AtomString::isEmpty const): Deleted. (WTF::AtomString::operator NSString * const): Deleted. * wtf/text/AtomStringImpl.h: (WTF::AtomStringImpl::lookUp): Deleted. (WTF::AtomStringImpl::add): Deleted. (WTF::AtomStringImpl::addWithStringTableProvider): Deleted. * wtf/text/CString.h: (WTF::CStringBuffer::data): Deleted. (WTF::CStringBuffer::length const): Deleted. (WTF::CStringBuffer::CStringBuffer): Deleted. (WTF::CStringBuffer::mutableData): Deleted. (WTF::CString::CString): Deleted. (WTF::CString::data const): Deleted. (WTF::CString::length const): Deleted. (WTF::CString::isNull const): Deleted. (WTF::CString::buffer const): Deleted. (WTF::CString::isHashTableDeletedValue const): Deleted. * wtf/text/ExternalStringImpl.h: (WTF::ExternalStringImpl::freeExternalBuffer): Deleted. * wtf/text/LineBreakIteratorPoolICU.h: * wtf/text/NullTextBreakIterator.h: * wtf/text/OrdinalNumber.h: * wtf/text/StringBuffer.h: * wtf/text/StringBuilder.h: * wtf/text/StringConcatenateNumbers.h: * wtf/text/StringHasher.h: * wtf/text/StringImpl.h: * wtf/text/StringView.cpp: * wtf/text/StringView.h: (WTF::StringView::left const): Deleted. (WTF::StringView::right const): Deleted. (WTF::StringView::underlyingStringIsValid const): Deleted. (WTF::StringView::setUnderlyingString): Deleted. * wtf/text/SymbolImpl.h: (WTF::SymbolImpl::StaticSymbolImpl::StaticSymbolImpl): Deleted. (WTF::SymbolImpl::StaticSymbolImpl::operator SymbolImpl&): Deleted. (WTF::PrivateSymbolImpl::PrivateSymbolImpl): Deleted. (WTF::RegisteredSymbolImpl::symbolRegistry const): Deleted. (WTF::RegisteredSymbolImpl::clearSymbolRegistry): Deleted. (WTF::RegisteredSymbolImpl::RegisteredSymbolImpl): Deleted. * wtf/text/SymbolRegistry.h: * wtf/text/TextBreakIterator.h: * wtf/text/TextPosition.h: * wtf/text/TextStream.h: * wtf/text/WTFString.h: (WTF::String::swap): Deleted. (WTF::String::adopt): Deleted. (WTF::String::isNull const): Deleted. (WTF::String::isEmpty const): Deleted. (WTF::String::impl const): Deleted. (WTF::String::releaseImpl): Deleted. (WTF::String::length const): Deleted. (WTF::String::characters8 const): Deleted. (WTF::String::characters16 const): Deleted. (WTF::String::is8Bit const): Deleted. (WTF::String::sizeInBytes const): Deleted. (WTF::String::operator[] const): Deleted. (WTF::String::find const): Deleted. (WTF::String::findIgnoringASCIICase const): Deleted. (WTF::String::reverseFind const): Deleted. (WTF::String::contains const): Deleted. (WTF::String::containsIgnoringASCIICase const): Deleted. (WTF::String::startsWith const): Deleted. (WTF::String::startsWithIgnoringASCIICase const): Deleted. (WTF::String::hasInfixStartingAt const): Deleted. (WTF::String::endsWith const): Deleted. (WTF::String::endsWithIgnoringASCIICase const): Deleted. (WTF::String::hasInfixEndingAt const): Deleted. (WTF::String::append): Deleted. (WTF::String::left const): Deleted. (WTF::String::right const): Deleted. (WTF::String::createUninitialized): Deleted. (WTF::String::fromUTF8WithLatin1Fallback): Deleted. (WTF::String::isAllASCII const): Deleted. (WTF::String::isAllLatin1 const): Deleted. (WTF::String::isSpecialCharacter const): Deleted. (WTF::String::isHashTableDeletedValue const): Deleted. (WTF::String::hash const): Deleted. (WTF::String::existingHash const): Deleted. * wtf/text/cf/TextBreakIteratorCF.h: * wtf/text/icu/TextBreakIteratorICU.h: * wtf/text/icu/UTextProviderLatin1.h: * wtf/threads/BinarySemaphore.h: (WTF::BinarySemaphore::waitFor): Deleted. (WTF::BinarySemaphore::wait): Deleted. * wtf/unicode/Collator.h: * wtf/win/GDIObject.h: * wtf/win/PathWalker.h: * wtf/win/Win32Handle.h: Canonical link: https://commits.webkit.org/214396@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248546 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-08-12 20:57:15 +00:00
WTF_MAKE_FAST_ALLOCATED;
Dominators should be factored out of the DFG https://bugs.webkit.org/show_bug.cgi?id=150764 Reviewed by Geoffrey Garen. Source/JavaScriptCore: Factored DFGDominators.h/DFGDominators.cpp into WTF. To do this, I made two changes to the DFG: 1) DFG now has a CFG abstraction called DFG::CFG. The cool thing about this is that in the future if we wanted to support inverted dominators, we could do it by just creating a DFG::BackwardCFG. 2) Got rid of DFG::Analysis. From now on, an Analysis being invalidated is expressed by the DFG::Graph having a null pointer for that analysis. When we "run" the analysis, we just instantiate it. This makes it much more natural to integrate WTF::Dominators into the DFG. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * dfg/DFGAnalysis.h: Removed. * dfg/DFGCFG.h: Added. (JSC::DFG::CFG::CFG): (JSC::DFG::CFG::root): (JSC::DFG::CFG::newMap<T>): (JSC::DFG::CFG::successors): (JSC::DFG::CFG::predecessors): (JSC::DFG::CFG::index): (JSC::DFG::CFG::node): (JSC::DFG::CFG::numNodes): (JSC::DFG::CFG::dump): * dfg/DFGCSEPhase.cpp: * dfg/DFGDisassembler.cpp: (JSC::DFG::Disassembler::createDumpList): * dfg/DFGDominators.cpp: Removed. * dfg/DFGDominators.h: (JSC::DFG::Dominators::Dominators): (JSC::DFG::Dominators::strictlyDominates): Deleted. (JSC::DFG::Dominators::dominates): Deleted. (JSC::DFG::Dominators::immediateDominatorOf): Deleted. (JSC::DFG::Dominators::forAllStrictDominatorsOf): Deleted. (JSC::DFG::Dominators::forAllDominatorsOf): Deleted. (JSC::DFG::Dominators::forAllBlocksStrictlyDominatedBy): Deleted. (JSC::DFG::Dominators::forAllBlocksDominatedBy): Deleted. (JSC::DFG::Dominators::forAllBlocksInDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInIteratedDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInPrunedIteratedDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInDominanceFrontierOfImpl): Deleted. (JSC::DFG::Dominators::forAllBlocksInIteratedDominanceFrontierOfImpl): Deleted. (JSC::DFG::Dominators::BlockData::BlockData): Deleted. * dfg/DFGEdgeDominates.h: (JSC::DFG::EdgeDominates::operator()): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::Graph): (JSC::DFG::Graph::dumpBlockHeader): (JSC::DFG::Graph::invalidateCFG): (JSC::DFG::Graph::substituteGetLocal): (JSC::DFG::Graph::handleAssertionFailure): (JSC::DFG::Graph::ensureDominators): (JSC::DFG::Graph::ensurePrePostNumbering): (JSC::DFG::Graph::ensureNaturalLoops): (JSC::DFG::Graph::valueProfileFor): * dfg/DFGGraph.h: (JSC::DFG::Graph::hasDebuggerEnabled): * dfg/DFGLICMPhase.cpp: (JSC::DFG::LICMPhase::run): (JSC::DFG::LICMPhase::attemptHoist): * dfg/DFGLoopPreHeaderCreationPhase.cpp: (JSC::DFG::createPreHeader): (JSC::DFG::LoopPreHeaderCreationPhase::run): * dfg/DFGNaturalLoops.cpp: (JSC::DFG::NaturalLoop::dump): (JSC::DFG::NaturalLoops::NaturalLoops): (JSC::DFG::NaturalLoops::~NaturalLoops): (JSC::DFG::NaturalLoops::loopsOf): (JSC::DFG::NaturalLoops::computeDependencies): Deleted. (JSC::DFG::NaturalLoops::compute): Deleted. * dfg/DFGNaturalLoops.h: (JSC::DFG::NaturalLoops::numLoops): * dfg/DFGNode.h: (JSC::DFG::Node::SuccessorsIterable::end): (JSC::DFG::Node::SuccessorsIterable::size): (JSC::DFG::Node::SuccessorsIterable::at): (JSC::DFG::Node::SuccessorsIterable::operator[]): * dfg/DFGOSREntrypointCreationPhase.cpp: (JSC::DFG::OSREntrypointCreationPhase::run): * dfg/DFGObjectAllocationSinkingPhase.cpp: * dfg/DFGPlan.cpp: (JSC::DFG::Plan::compileInThreadImpl): * dfg/DFGPrePostNumbering.cpp: (JSC::DFG::PrePostNumbering::PrePostNumbering): (JSC::DFG::PrePostNumbering::~PrePostNumbering): (JSC::DFG::PrePostNumbering::compute): Deleted. * dfg/DFGPrePostNumbering.h: (JSC::DFG::PrePostNumbering::preNumber): (JSC::DFG::PrePostNumbering::postNumber): * dfg/DFGPutStackSinkingPhase.cpp: * dfg/DFGSSACalculator.cpp: (JSC::DFG::SSACalculator::nonLocalReachingDef): (JSC::DFG::SSACalculator::reachingDefAtTail): * dfg/DFGSSACalculator.h: (JSC::DFG::SSACalculator::computePhis): * dfg/DFGSSAConversionPhase.cpp: (JSC::DFG::SSAConversionPhase::run): * ftl/FTLLink.cpp: (JSC::FTL::link): * ftl/FTLLowerDFGToLLVM.cpp: (JSC::FTL::DFG::LowerDFGToLLVM::lower): (JSC::FTL::DFG::LowerDFGToLLVM::safelyInvalidateAfterTermination): (JSC::FTL::DFG::LowerDFGToLLVM::isValid): Source/WTF: This takes what used to be DFGDominators.h/DFGDominators.cpp and turns it into a generic algorithm that can take any abstract graph. The idea is that you create Dominators<CFG> and pass it a CFG object, which defines the types of graph nodes and methods for getting successors, predecessors, etc. The DFG now defines a class called CFG, which is a wrapper for DFG::Graph that conforms to the thing that wtf/Dominators.h expects. When doing things to graphs, it's common to refer to the things in the graph as "nodes". Because I intend to reuse the CFG abstraction with many graph algorithms, that abstraction uses the term "node" to refer to a DFG basic block. But in Dominators, the method and variable names still use "block". This is because although Dominators are applicable to any kind of directed graph, it's super unlikely that we will ever use them for anything but compilers. Indeed, the only reason why I'm factoring them out of the DFG is so that I can use them with B3 and Air. This has the nice side effect that a user of WTF::Dominators<JSC::DFG::CFG> will see familiar terminology like "blocksStrictlyDominatedBy(...)" instead of "nodesStrictlyDominatedBy(...)", which would be super confusing. Overall, wtf/Dominators.h is a combination of what used to be in DFGDominators.h, DFGDominators.cpp, DFGNaiveDominators.h, and DFGNaiveDominators.cpp. I only changed code when I had to in order to make it generic. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/Dominators.h: Added. (WTF::Dominators::Dominators): (WTF::Dominators::compute): (WTF::Dominators::strictlyDominates): (WTF::Dominators::dominates): (WTF::Dominators::immediateDominatorOf): (WTF::Dominators::forAllStrictDominatorsOf): (WTF::Dominators::forAllDominatorsOf): (WTF::Dominators::forAllBlocksStrictlyDominatedBy): (WTF::Dominators::forAllBlocksDominatedBy): (WTF::Dominators::strictDominatorsOf): (WTF::Dominators::dominatorsOf): (WTF::Dominators::blocksStrictlyDominatedBy): (WTF::Dominators::blocksDominatedBy): (WTF::Dominators::forAllBlocksInDominanceFrontierOf): (WTF::Dominators::dominanceFrontierOf): (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOf): (WTF::Dominators::forAllBlocksInPrunedIteratedDominanceFrontierOf): (WTF::Dominators::iteratedDominanceFrontierOf): (WTF::Dominators::dump): (WTF::Dominators::LengauerTarjan::LengauerTarjan): (WTF::Dominators::LengauerTarjan::compute): (WTF::Dominators::LengauerTarjan::immediateDominator): (WTF::Dominators::LengauerTarjan::computeDepthFirstPreNumbering): (WTF::Dominators::LengauerTarjan::computeSemiDominatorsAndImplicitImmediateDominators): (WTF::Dominators::LengauerTarjan::computeExplicitImmediateDominators): (WTF::Dominators::LengauerTarjan::link): (WTF::Dominators::LengauerTarjan::eval): (WTF::Dominators::LengauerTarjan::compress): (WTF::Dominators::LengauerTarjan::BlockData::BlockData): (WTF::Dominators::NaiveDominators::NaiveDominators): (WTF::Dominators::NaiveDominators::dominates): (WTF::Dominators::NaiveDominators::dump): (WTF::Dominators::NaiveDominators::pruneDominators): (WTF::Dominators::ValidationContext::ValidationContext): (WTF::Dominators::ValidationContext::reportError): (WTF::Dominators::ValidationContext::handleErrors): (WTF::Dominators::naiveDominates): (WTF::Dominators::forAllBlocksInDominanceFrontierOfImpl): (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOfImpl): (WTF::Dominators::BlockData::BlockData): Canonical link: https://commits.webkit.org/168962@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@191870 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-11-02 00:48:03 +00:00
public:
NaiveDominators(Graph& graph)
: m_graph(graph)
{
// This implements a naive dominator solver.
ASSERT(!graph.predecessors(graph.root()).size());
unsigned numBlocks = graph.numNodes();
// Allocate storage for the dense dominance matrix.
m_results.grow(numBlocks);
for (unsigned i = numBlocks; i--;)
m_results[i].resize(numBlocks);
m_scratch.resize(numBlocks);
// We know that the entry block is only dominated by itself.
m_results[0].clearAll();
FastBitVector should have efficient and easy-to-use vector-vector operations https://bugs.webkit.org/show_bug.cgi?id=161847 Reviewed by Saam Barati. Source/JavaScriptCore: Adapt existing users of FastBitVector to the new API. * bytecode/BytecodeLivenessAnalysis.cpp: (JSC::BytecodeLivenessAnalysis::computeKills): (JSC::BytecodeLivenessAnalysis::dumpResults): * bytecode/BytecodeLivenessAnalysisInlines.h: (JSC::operandThatIsNotAlwaysLiveIsLive): (JSC::BytecodeLivenessPropagation<DerivedAnalysis>::stepOverInstruction): (JSC::BytecodeLivenessPropagation<DerivedAnalysis>::runLivenessFixpoint): * bytecode/CodeBlock.cpp: (JSC::CodeBlock::validate): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::flushForTerminal): * dfg/DFGForAllKills.h: (JSC::DFG::forAllKilledOperands): * dfg/DFGGraph.h: (JSC::DFG::Graph::forAllLocalsLiveInBytecode): * dfg/DFGLiveCatchVariablePreservationPhase.cpp: (JSC::DFG::LiveCatchVariablePreservationPhase::willCatchException): (JSC::DFG::LiveCatchVariablePreservationPhase::handleBlock): * dfg/DFGNaturalLoops.cpp: (JSC::DFG::NaturalLoops::NaturalLoops): * dfg/DFGPlan.cpp: (JSC::DFG::Plan::cleanMustHandleValuesIfNecessary): Source/WTF: FastBitVector is a bitvector representation that supports manual dynamic resizing and is optimized for speed, not space. (BitVector supports automatic dynamic resizing and is optimized for space, while Bitmap is sized statically and is optimized for both speed and space.) This change greatly increases the power of FastBitVector. We will use these new powers for changing the JSC GC to use FastBitVectors to track sets of MarkedBlocks (bug 161581) instead of using a combination of Vectors and doubly-linked lists. This change splits FastBitVector into two parts: - A thing that manages the storage of a bitvector: a uint32_t array and a size_t numBits. We call this the word view. - A thing that takes some kind of abstract array of uint32_t's and does bitvector operations to it. We call this the FastBitVectorImpl. FastBitVectorImpl and word views are immutable. The FastBitVector class is a subclass of FastBitVectorImpl specialized on a word view that owns its words and has additional support for mutable operations. Doing this allows us to efficiently support things like this without any unnecessary memory allocation or copying: FastBitVector a, b, c; // Assume that there is code to initialize these. a &= b | ~c; Previously, this kind of operation would not be efficient, because "~c" would have to create a whole new FastBitVector. But now, it just returns a FastBitVectorImpl whose underlying word view bitnots (~) its words on the fly. Using template magic, this can get pretty complex. For example "b | ~c" returns a FastBitVectorImpl that wraps a word view whose implementation of WordView::word(size_t index) is something like: uint32_t word(size_t index) { return b.m_words.word(index) | ~c.m_words.word(index); } FastBitVectorImpl supports all of the fast bulk bitvector operations, like forEachSetBit(), bitCount(), etc. So, when you say "a &= b | ~c", the actual implementation is going to run these bit operations on word granularity directly over the storage inside a, b, c. The use of operator overloading is worth explaining a bit. Previously, FastBitVector avoided operator overloading. For example, the &= operation was called filter(). I think that this was a pretty good approach at the time. I tried using non-operator methods in this FastBitVector rewrite, but I found it very odd to say things like: a.filter(b.bitOr(c.bitNot())); I think that it's harder to see what is going on here, then using operators, because infix notation is always better. * WTF.xcodeproj/project.pbxproj: * wtf/BitVector.h: (WTF::BitVector::findBitInWord): Deleted. * wtf/CMakeLists.txt: * wtf/Dominators.h: (WTF::Dominators::NaiveDominators::NaiveDominators): (WTF::Dominators::NaiveDominators::dominates): (WTF::Dominators::NaiveDominators::pruneDominators): * wtf/FastBitVector.cpp: Removed. * wtf/FastBitVector.h: (WTF::fastBitVectorArrayLength): (WTF::FastBitVectorWordView::FastBitVectorWordView): (WTF::FastBitVectorWordView::numBits): (WTF::FastBitVectorWordView::word): (WTF::FastBitVectorWordOwner::FastBitVectorWordOwner): (WTF::FastBitVectorWordOwner::~FastBitVectorWordOwner): (WTF::FastBitVectorWordOwner::view): (WTF::FastBitVectorWordOwner::operator=): (WTF::FastBitVectorWordOwner::setAll): (WTF::FastBitVectorWordOwner::clearAll): (WTF::FastBitVectorWordOwner::set): (WTF::FastBitVectorWordOwner::numBits): (WTF::FastBitVectorWordOwner::arrayLength): (WTF::FastBitVectorWordOwner::resize): (WTF::FastBitVectorWordOwner::word): (WTF::FastBitVectorWordOwner::words): (WTF::FastBitVectorAndWords::FastBitVectorAndWords): (WTF::FastBitVectorAndWords::view): (WTF::FastBitVectorAndWords::numBits): (WTF::FastBitVectorAndWords::word): (WTF::FastBitVectorOrWords::FastBitVectorOrWords): (WTF::FastBitVectorOrWords::view): (WTF::FastBitVectorOrWords::numBits): (WTF::FastBitVectorOrWords::word): (WTF::FastBitVectorNotWords::FastBitVectorNotWords): (WTF::FastBitVectorNotWords::view): (WTF::FastBitVectorNotWords::numBits): (WTF::FastBitVectorNotWords::word): (WTF::FastBitVectorImpl::FastBitVectorImpl): (WTF::FastBitVectorImpl::numBits): (WTF::FastBitVectorImpl::size): (WTF::FastBitVectorImpl::arrayLength): (WTF::FastBitVectorImpl::operator==): (WTF::FastBitVectorImpl::operator!=): (WTF::FastBitVectorImpl::at): (WTF::FastBitVectorImpl::operator[]): (WTF::FastBitVectorImpl::bitCount): (WTF::FastBitVectorImpl::operator&): (WTF::FastBitVectorImpl::operator|): (WTF::FastBitVectorImpl::operator~): (WTF::FastBitVectorImpl::forEachSetBit): (WTF::FastBitVectorImpl::forEachClearBit): (WTF::FastBitVectorImpl::forEachBit): (WTF::FastBitVectorImpl::findBit): (WTF::FastBitVectorImpl::findSetBit): (WTF::FastBitVectorImpl::findClearBit): (WTF::FastBitVectorImpl::dump): (WTF::FastBitVectorImpl::atImpl): (WTF::FastBitVector::FastBitVector): (WTF::FastBitVector::operator=): (WTF::FastBitVector::resize): (WTF::FastBitVector::setAll): (WTF::FastBitVector::clearAll): (WTF::FastBitVector::setAndCheck): (WTF::FastBitVector::operator|=): (WTF::FastBitVector::operator&=): (WTF::FastBitVector::at): (WTF::FastBitVector::operator[]): (WTF::FastBitVector::BitReference::BitReference): (WTF::FastBitVector::BitReference::operator bool): (WTF::FastBitVector::BitReference::operator=): (WTF::FastBitVector::~FastBitVector): Deleted. (WTF::FastBitVector::numBits): Deleted. (WTF::FastBitVector::set): Deleted. (WTF::FastBitVector::equals): Deleted. (WTF::FastBitVector::merge): Deleted. (WTF::FastBitVector::filter): Deleted. (WTF::FastBitVector::exclude): Deleted. (WTF::FastBitVector::clear): Deleted. (WTF::FastBitVector::get): Deleted. (WTF::FastBitVector::bitCount): Deleted. (WTF::FastBitVector::forEachSetBit): Deleted. (WTF::FastBitVector::arrayLength): Deleted. * wtf/StdLibExtras.h: (WTF::findBitInWord): Canonical link: https://commits.webkit.org/180007@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205794 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-12 04:03:36 +00:00
m_results[0][0] = true;
Dominators should be factored out of the DFG https://bugs.webkit.org/show_bug.cgi?id=150764 Reviewed by Geoffrey Garen. Source/JavaScriptCore: Factored DFGDominators.h/DFGDominators.cpp into WTF. To do this, I made two changes to the DFG: 1) DFG now has a CFG abstraction called DFG::CFG. The cool thing about this is that in the future if we wanted to support inverted dominators, we could do it by just creating a DFG::BackwardCFG. 2) Got rid of DFG::Analysis. From now on, an Analysis being invalidated is expressed by the DFG::Graph having a null pointer for that analysis. When we "run" the analysis, we just instantiate it. This makes it much more natural to integrate WTF::Dominators into the DFG. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * dfg/DFGAnalysis.h: Removed. * dfg/DFGCFG.h: Added. (JSC::DFG::CFG::CFG): (JSC::DFG::CFG::root): (JSC::DFG::CFG::newMap<T>): (JSC::DFG::CFG::successors): (JSC::DFG::CFG::predecessors): (JSC::DFG::CFG::index): (JSC::DFG::CFG::node): (JSC::DFG::CFG::numNodes): (JSC::DFG::CFG::dump): * dfg/DFGCSEPhase.cpp: * dfg/DFGDisassembler.cpp: (JSC::DFG::Disassembler::createDumpList): * dfg/DFGDominators.cpp: Removed. * dfg/DFGDominators.h: (JSC::DFG::Dominators::Dominators): (JSC::DFG::Dominators::strictlyDominates): Deleted. (JSC::DFG::Dominators::dominates): Deleted. (JSC::DFG::Dominators::immediateDominatorOf): Deleted. (JSC::DFG::Dominators::forAllStrictDominatorsOf): Deleted. (JSC::DFG::Dominators::forAllDominatorsOf): Deleted. (JSC::DFG::Dominators::forAllBlocksStrictlyDominatedBy): Deleted. (JSC::DFG::Dominators::forAllBlocksDominatedBy): Deleted. (JSC::DFG::Dominators::forAllBlocksInDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInIteratedDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInPrunedIteratedDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInDominanceFrontierOfImpl): Deleted. (JSC::DFG::Dominators::forAllBlocksInIteratedDominanceFrontierOfImpl): Deleted. (JSC::DFG::Dominators::BlockData::BlockData): Deleted. * dfg/DFGEdgeDominates.h: (JSC::DFG::EdgeDominates::operator()): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::Graph): (JSC::DFG::Graph::dumpBlockHeader): (JSC::DFG::Graph::invalidateCFG): (JSC::DFG::Graph::substituteGetLocal): (JSC::DFG::Graph::handleAssertionFailure): (JSC::DFG::Graph::ensureDominators): (JSC::DFG::Graph::ensurePrePostNumbering): (JSC::DFG::Graph::ensureNaturalLoops): (JSC::DFG::Graph::valueProfileFor): * dfg/DFGGraph.h: (JSC::DFG::Graph::hasDebuggerEnabled): * dfg/DFGLICMPhase.cpp: (JSC::DFG::LICMPhase::run): (JSC::DFG::LICMPhase::attemptHoist): * dfg/DFGLoopPreHeaderCreationPhase.cpp: (JSC::DFG::createPreHeader): (JSC::DFG::LoopPreHeaderCreationPhase::run): * dfg/DFGNaturalLoops.cpp: (JSC::DFG::NaturalLoop::dump): (JSC::DFG::NaturalLoops::NaturalLoops): (JSC::DFG::NaturalLoops::~NaturalLoops): (JSC::DFG::NaturalLoops::loopsOf): (JSC::DFG::NaturalLoops::computeDependencies): Deleted. (JSC::DFG::NaturalLoops::compute): Deleted. * dfg/DFGNaturalLoops.h: (JSC::DFG::NaturalLoops::numLoops): * dfg/DFGNode.h: (JSC::DFG::Node::SuccessorsIterable::end): (JSC::DFG::Node::SuccessorsIterable::size): (JSC::DFG::Node::SuccessorsIterable::at): (JSC::DFG::Node::SuccessorsIterable::operator[]): * dfg/DFGOSREntrypointCreationPhase.cpp: (JSC::DFG::OSREntrypointCreationPhase::run): * dfg/DFGObjectAllocationSinkingPhase.cpp: * dfg/DFGPlan.cpp: (JSC::DFG::Plan::compileInThreadImpl): * dfg/DFGPrePostNumbering.cpp: (JSC::DFG::PrePostNumbering::PrePostNumbering): (JSC::DFG::PrePostNumbering::~PrePostNumbering): (JSC::DFG::PrePostNumbering::compute): Deleted. * dfg/DFGPrePostNumbering.h: (JSC::DFG::PrePostNumbering::preNumber): (JSC::DFG::PrePostNumbering::postNumber): * dfg/DFGPutStackSinkingPhase.cpp: * dfg/DFGSSACalculator.cpp: (JSC::DFG::SSACalculator::nonLocalReachingDef): (JSC::DFG::SSACalculator::reachingDefAtTail): * dfg/DFGSSACalculator.h: (JSC::DFG::SSACalculator::computePhis): * dfg/DFGSSAConversionPhase.cpp: (JSC::DFG::SSAConversionPhase::run): * ftl/FTLLink.cpp: (JSC::FTL::link): * ftl/FTLLowerDFGToLLVM.cpp: (JSC::FTL::DFG::LowerDFGToLLVM::lower): (JSC::FTL::DFG::LowerDFGToLLVM::safelyInvalidateAfterTermination): (JSC::FTL::DFG::LowerDFGToLLVM::isValid): Source/WTF: This takes what used to be DFGDominators.h/DFGDominators.cpp and turns it into a generic algorithm that can take any abstract graph. The idea is that you create Dominators<CFG> and pass it a CFG object, which defines the types of graph nodes and methods for getting successors, predecessors, etc. The DFG now defines a class called CFG, which is a wrapper for DFG::Graph that conforms to the thing that wtf/Dominators.h expects. When doing things to graphs, it's common to refer to the things in the graph as "nodes". Because I intend to reuse the CFG abstraction with many graph algorithms, that abstraction uses the term "node" to refer to a DFG basic block. But in Dominators, the method and variable names still use "block". This is because although Dominators are applicable to any kind of directed graph, it's super unlikely that we will ever use them for anything but compilers. Indeed, the only reason why I'm factoring them out of the DFG is so that I can use them with B3 and Air. This has the nice side effect that a user of WTF::Dominators<JSC::DFG::CFG> will see familiar terminology like "blocksStrictlyDominatedBy(...)" instead of "nodesStrictlyDominatedBy(...)", which would be super confusing. Overall, wtf/Dominators.h is a combination of what used to be in DFGDominators.h, DFGDominators.cpp, DFGNaiveDominators.h, and DFGNaiveDominators.cpp. I only changed code when I had to in order to make it generic. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/Dominators.h: Added. (WTF::Dominators::Dominators): (WTF::Dominators::compute): (WTF::Dominators::strictlyDominates): (WTF::Dominators::dominates): (WTF::Dominators::immediateDominatorOf): (WTF::Dominators::forAllStrictDominatorsOf): (WTF::Dominators::forAllDominatorsOf): (WTF::Dominators::forAllBlocksStrictlyDominatedBy): (WTF::Dominators::forAllBlocksDominatedBy): (WTF::Dominators::strictDominatorsOf): (WTF::Dominators::dominatorsOf): (WTF::Dominators::blocksStrictlyDominatedBy): (WTF::Dominators::blocksDominatedBy): (WTF::Dominators::forAllBlocksInDominanceFrontierOf): (WTF::Dominators::dominanceFrontierOf): (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOf): (WTF::Dominators::forAllBlocksInPrunedIteratedDominanceFrontierOf): (WTF::Dominators::iteratedDominanceFrontierOf): (WTF::Dominators::dump): (WTF::Dominators::LengauerTarjan::LengauerTarjan): (WTF::Dominators::LengauerTarjan::compute): (WTF::Dominators::LengauerTarjan::immediateDominator): (WTF::Dominators::LengauerTarjan::computeDepthFirstPreNumbering): (WTF::Dominators::LengauerTarjan::computeSemiDominatorsAndImplicitImmediateDominators): (WTF::Dominators::LengauerTarjan::computeExplicitImmediateDominators): (WTF::Dominators::LengauerTarjan::link): (WTF::Dominators::LengauerTarjan::eval): (WTF::Dominators::LengauerTarjan::compress): (WTF::Dominators::LengauerTarjan::BlockData::BlockData): (WTF::Dominators::NaiveDominators::NaiveDominators): (WTF::Dominators::NaiveDominators::dominates): (WTF::Dominators::NaiveDominators::dump): (WTF::Dominators::NaiveDominators::pruneDominators): (WTF::Dominators::ValidationContext::ValidationContext): (WTF::Dominators::ValidationContext::reportError): (WTF::Dominators::ValidationContext::handleErrors): (WTF::Dominators::naiveDominates): (WTF::Dominators::forAllBlocksInDominanceFrontierOfImpl): (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOfImpl): (WTF::Dominators::BlockData::BlockData): Canonical link: https://commits.webkit.org/168962@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@191870 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-11-02 00:48:03 +00:00
// Find all of the valid blocks.
m_scratch.clearAll();
for (unsigned i = numBlocks; i--;) {
if (!graph.node(i))
continue;
FastBitVector should have efficient and easy-to-use vector-vector operations https://bugs.webkit.org/show_bug.cgi?id=161847 Reviewed by Saam Barati. Source/JavaScriptCore: Adapt existing users of FastBitVector to the new API. * bytecode/BytecodeLivenessAnalysis.cpp: (JSC::BytecodeLivenessAnalysis::computeKills): (JSC::BytecodeLivenessAnalysis::dumpResults): * bytecode/BytecodeLivenessAnalysisInlines.h: (JSC::operandThatIsNotAlwaysLiveIsLive): (JSC::BytecodeLivenessPropagation<DerivedAnalysis>::stepOverInstruction): (JSC::BytecodeLivenessPropagation<DerivedAnalysis>::runLivenessFixpoint): * bytecode/CodeBlock.cpp: (JSC::CodeBlock::validate): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::flushForTerminal): * dfg/DFGForAllKills.h: (JSC::DFG::forAllKilledOperands): * dfg/DFGGraph.h: (JSC::DFG::Graph::forAllLocalsLiveInBytecode): * dfg/DFGLiveCatchVariablePreservationPhase.cpp: (JSC::DFG::LiveCatchVariablePreservationPhase::willCatchException): (JSC::DFG::LiveCatchVariablePreservationPhase::handleBlock): * dfg/DFGNaturalLoops.cpp: (JSC::DFG::NaturalLoops::NaturalLoops): * dfg/DFGPlan.cpp: (JSC::DFG::Plan::cleanMustHandleValuesIfNecessary): Source/WTF: FastBitVector is a bitvector representation that supports manual dynamic resizing and is optimized for speed, not space. (BitVector supports automatic dynamic resizing and is optimized for space, while Bitmap is sized statically and is optimized for both speed and space.) This change greatly increases the power of FastBitVector. We will use these new powers for changing the JSC GC to use FastBitVectors to track sets of MarkedBlocks (bug 161581) instead of using a combination of Vectors and doubly-linked lists. This change splits FastBitVector into two parts: - A thing that manages the storage of a bitvector: a uint32_t array and a size_t numBits. We call this the word view. - A thing that takes some kind of abstract array of uint32_t's and does bitvector operations to it. We call this the FastBitVectorImpl. FastBitVectorImpl and word views are immutable. The FastBitVector class is a subclass of FastBitVectorImpl specialized on a word view that owns its words and has additional support for mutable operations. Doing this allows us to efficiently support things like this without any unnecessary memory allocation or copying: FastBitVector a, b, c; // Assume that there is code to initialize these. a &= b | ~c; Previously, this kind of operation would not be efficient, because "~c" would have to create a whole new FastBitVector. But now, it just returns a FastBitVectorImpl whose underlying word view bitnots (~) its words on the fly. Using template magic, this can get pretty complex. For example "b | ~c" returns a FastBitVectorImpl that wraps a word view whose implementation of WordView::word(size_t index) is something like: uint32_t word(size_t index) { return b.m_words.word(index) | ~c.m_words.word(index); } FastBitVectorImpl supports all of the fast bulk bitvector operations, like forEachSetBit(), bitCount(), etc. So, when you say "a &= b | ~c", the actual implementation is going to run these bit operations on word granularity directly over the storage inside a, b, c. The use of operator overloading is worth explaining a bit. Previously, FastBitVector avoided operator overloading. For example, the &= operation was called filter(). I think that this was a pretty good approach at the time. I tried using non-operator methods in this FastBitVector rewrite, but I found it very odd to say things like: a.filter(b.bitOr(c.bitNot())); I think that it's harder to see what is going on here, then using operators, because infix notation is always better. * WTF.xcodeproj/project.pbxproj: * wtf/BitVector.h: (WTF::BitVector::findBitInWord): Deleted. * wtf/CMakeLists.txt: * wtf/Dominators.h: (WTF::Dominators::NaiveDominators::NaiveDominators): (WTF::Dominators::NaiveDominators::dominates): (WTF::Dominators::NaiveDominators::pruneDominators): * wtf/FastBitVector.cpp: Removed. * wtf/FastBitVector.h: (WTF::fastBitVectorArrayLength): (WTF::FastBitVectorWordView::FastBitVectorWordView): (WTF::FastBitVectorWordView::numBits): (WTF::FastBitVectorWordView::word): (WTF::FastBitVectorWordOwner::FastBitVectorWordOwner): (WTF::FastBitVectorWordOwner::~FastBitVectorWordOwner): (WTF::FastBitVectorWordOwner::view): (WTF::FastBitVectorWordOwner::operator=): (WTF::FastBitVectorWordOwner::setAll): (WTF::FastBitVectorWordOwner::clearAll): (WTF::FastBitVectorWordOwner::set): (WTF::FastBitVectorWordOwner::numBits): (WTF::FastBitVectorWordOwner::arrayLength): (WTF::FastBitVectorWordOwner::resize): (WTF::FastBitVectorWordOwner::word): (WTF::FastBitVectorWordOwner::words): (WTF::FastBitVectorAndWords::FastBitVectorAndWords): (WTF::FastBitVectorAndWords::view): (WTF::FastBitVectorAndWords::numBits): (WTF::FastBitVectorAndWords::word): (WTF::FastBitVectorOrWords::FastBitVectorOrWords): (WTF::FastBitVectorOrWords::view): (WTF::FastBitVectorOrWords::numBits): (WTF::FastBitVectorOrWords::word): (WTF::FastBitVectorNotWords::FastBitVectorNotWords): (WTF::FastBitVectorNotWords::view): (WTF::FastBitVectorNotWords::numBits): (WTF::FastBitVectorNotWords::word): (WTF::FastBitVectorImpl::FastBitVectorImpl): (WTF::FastBitVectorImpl::numBits): (WTF::FastBitVectorImpl::size): (WTF::FastBitVectorImpl::arrayLength): (WTF::FastBitVectorImpl::operator==): (WTF::FastBitVectorImpl::operator!=): (WTF::FastBitVectorImpl::at): (WTF::FastBitVectorImpl::operator[]): (WTF::FastBitVectorImpl::bitCount): (WTF::FastBitVectorImpl::operator&): (WTF::FastBitVectorImpl::operator|): (WTF::FastBitVectorImpl::operator~): (WTF::FastBitVectorImpl::forEachSetBit): (WTF::FastBitVectorImpl::forEachClearBit): (WTF::FastBitVectorImpl::forEachBit): (WTF::FastBitVectorImpl::findBit): (WTF::FastBitVectorImpl::findSetBit): (WTF::FastBitVectorImpl::findClearBit): (WTF::FastBitVectorImpl::dump): (WTF::FastBitVectorImpl::atImpl): (WTF::FastBitVector::FastBitVector): (WTF::FastBitVector::operator=): (WTF::FastBitVector::resize): (WTF::FastBitVector::setAll): (WTF::FastBitVector::clearAll): (WTF::FastBitVector::setAndCheck): (WTF::FastBitVector::operator|=): (WTF::FastBitVector::operator&=): (WTF::FastBitVector::at): (WTF::FastBitVector::operator[]): (WTF::FastBitVector::BitReference::BitReference): (WTF::FastBitVector::BitReference::operator bool): (WTF::FastBitVector::BitReference::operator=): (WTF::FastBitVector::~FastBitVector): Deleted. (WTF::FastBitVector::numBits): Deleted. (WTF::FastBitVector::set): Deleted. (WTF::FastBitVector::equals): Deleted. (WTF::FastBitVector::merge): Deleted. (WTF::FastBitVector::filter): Deleted. (WTF::FastBitVector::exclude): Deleted. (WTF::FastBitVector::clear): Deleted. (WTF::FastBitVector::get): Deleted. (WTF::FastBitVector::bitCount): Deleted. (WTF::FastBitVector::forEachSetBit): Deleted. (WTF::FastBitVector::arrayLength): Deleted. * wtf/StdLibExtras.h: (WTF::findBitInWord): Canonical link: https://commits.webkit.org/180007@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205794 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-12 04:03:36 +00:00
m_scratch[i] = true;
Dominators should be factored out of the DFG https://bugs.webkit.org/show_bug.cgi?id=150764 Reviewed by Geoffrey Garen. Source/JavaScriptCore: Factored DFGDominators.h/DFGDominators.cpp into WTF. To do this, I made two changes to the DFG: 1) DFG now has a CFG abstraction called DFG::CFG. The cool thing about this is that in the future if we wanted to support inverted dominators, we could do it by just creating a DFG::BackwardCFG. 2) Got rid of DFG::Analysis. From now on, an Analysis being invalidated is expressed by the DFG::Graph having a null pointer for that analysis. When we "run" the analysis, we just instantiate it. This makes it much more natural to integrate WTF::Dominators into the DFG. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * dfg/DFGAnalysis.h: Removed. * dfg/DFGCFG.h: Added. (JSC::DFG::CFG::CFG): (JSC::DFG::CFG::root): (JSC::DFG::CFG::newMap<T>): (JSC::DFG::CFG::successors): (JSC::DFG::CFG::predecessors): (JSC::DFG::CFG::index): (JSC::DFG::CFG::node): (JSC::DFG::CFG::numNodes): (JSC::DFG::CFG::dump): * dfg/DFGCSEPhase.cpp: * dfg/DFGDisassembler.cpp: (JSC::DFG::Disassembler::createDumpList): * dfg/DFGDominators.cpp: Removed. * dfg/DFGDominators.h: (JSC::DFG::Dominators::Dominators): (JSC::DFG::Dominators::strictlyDominates): Deleted. (JSC::DFG::Dominators::dominates): Deleted. (JSC::DFG::Dominators::immediateDominatorOf): Deleted. (JSC::DFG::Dominators::forAllStrictDominatorsOf): Deleted. (JSC::DFG::Dominators::forAllDominatorsOf): Deleted. (JSC::DFG::Dominators::forAllBlocksStrictlyDominatedBy): Deleted. (JSC::DFG::Dominators::forAllBlocksDominatedBy): Deleted. (JSC::DFG::Dominators::forAllBlocksInDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInIteratedDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInPrunedIteratedDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInDominanceFrontierOfImpl): Deleted. (JSC::DFG::Dominators::forAllBlocksInIteratedDominanceFrontierOfImpl): Deleted. (JSC::DFG::Dominators::BlockData::BlockData): Deleted. * dfg/DFGEdgeDominates.h: (JSC::DFG::EdgeDominates::operator()): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::Graph): (JSC::DFG::Graph::dumpBlockHeader): (JSC::DFG::Graph::invalidateCFG): (JSC::DFG::Graph::substituteGetLocal): (JSC::DFG::Graph::handleAssertionFailure): (JSC::DFG::Graph::ensureDominators): (JSC::DFG::Graph::ensurePrePostNumbering): (JSC::DFG::Graph::ensureNaturalLoops): (JSC::DFG::Graph::valueProfileFor): * dfg/DFGGraph.h: (JSC::DFG::Graph::hasDebuggerEnabled): * dfg/DFGLICMPhase.cpp: (JSC::DFG::LICMPhase::run): (JSC::DFG::LICMPhase::attemptHoist): * dfg/DFGLoopPreHeaderCreationPhase.cpp: (JSC::DFG::createPreHeader): (JSC::DFG::LoopPreHeaderCreationPhase::run): * dfg/DFGNaturalLoops.cpp: (JSC::DFG::NaturalLoop::dump): (JSC::DFG::NaturalLoops::NaturalLoops): (JSC::DFG::NaturalLoops::~NaturalLoops): (JSC::DFG::NaturalLoops::loopsOf): (JSC::DFG::NaturalLoops::computeDependencies): Deleted. (JSC::DFG::NaturalLoops::compute): Deleted. * dfg/DFGNaturalLoops.h: (JSC::DFG::NaturalLoops::numLoops): * dfg/DFGNode.h: (JSC::DFG::Node::SuccessorsIterable::end): (JSC::DFG::Node::SuccessorsIterable::size): (JSC::DFG::Node::SuccessorsIterable::at): (JSC::DFG::Node::SuccessorsIterable::operator[]): * dfg/DFGOSREntrypointCreationPhase.cpp: (JSC::DFG::OSREntrypointCreationPhase::run): * dfg/DFGObjectAllocationSinkingPhase.cpp: * dfg/DFGPlan.cpp: (JSC::DFG::Plan::compileInThreadImpl): * dfg/DFGPrePostNumbering.cpp: (JSC::DFG::PrePostNumbering::PrePostNumbering): (JSC::DFG::PrePostNumbering::~PrePostNumbering): (JSC::DFG::PrePostNumbering::compute): Deleted. * dfg/DFGPrePostNumbering.h: (JSC::DFG::PrePostNumbering::preNumber): (JSC::DFG::PrePostNumbering::postNumber): * dfg/DFGPutStackSinkingPhase.cpp: * dfg/DFGSSACalculator.cpp: (JSC::DFG::SSACalculator::nonLocalReachingDef): (JSC::DFG::SSACalculator::reachingDefAtTail): * dfg/DFGSSACalculator.h: (JSC::DFG::SSACalculator::computePhis): * dfg/DFGSSAConversionPhase.cpp: (JSC::DFG::SSAConversionPhase::run): * ftl/FTLLink.cpp: (JSC::FTL::link): * ftl/FTLLowerDFGToLLVM.cpp: (JSC::FTL::DFG::LowerDFGToLLVM::lower): (JSC::FTL::DFG::LowerDFGToLLVM::safelyInvalidateAfterTermination): (JSC::FTL::DFG::LowerDFGToLLVM::isValid): Source/WTF: This takes what used to be DFGDominators.h/DFGDominators.cpp and turns it into a generic algorithm that can take any abstract graph. The idea is that you create Dominators<CFG> and pass it a CFG object, which defines the types of graph nodes and methods for getting successors, predecessors, etc. The DFG now defines a class called CFG, which is a wrapper for DFG::Graph that conforms to the thing that wtf/Dominators.h expects. When doing things to graphs, it's common to refer to the things in the graph as "nodes". Because I intend to reuse the CFG abstraction with many graph algorithms, that abstraction uses the term "node" to refer to a DFG basic block. But in Dominators, the method and variable names still use "block". This is because although Dominators are applicable to any kind of directed graph, it's super unlikely that we will ever use them for anything but compilers. Indeed, the only reason why I'm factoring them out of the DFG is so that I can use them with B3 and Air. This has the nice side effect that a user of WTF::Dominators<JSC::DFG::CFG> will see familiar terminology like "blocksStrictlyDominatedBy(...)" instead of "nodesStrictlyDominatedBy(...)", which would be super confusing. Overall, wtf/Dominators.h is a combination of what used to be in DFGDominators.h, DFGDominators.cpp, DFGNaiveDominators.h, and DFGNaiveDominators.cpp. I only changed code when I had to in order to make it generic. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/Dominators.h: Added. (WTF::Dominators::Dominators): (WTF::Dominators::compute): (WTF::Dominators::strictlyDominates): (WTF::Dominators::dominates): (WTF::Dominators::immediateDominatorOf): (WTF::Dominators::forAllStrictDominatorsOf): (WTF::Dominators::forAllDominatorsOf): (WTF::Dominators::forAllBlocksStrictlyDominatedBy): (WTF::Dominators::forAllBlocksDominatedBy): (WTF::Dominators::strictDominatorsOf): (WTF::Dominators::dominatorsOf): (WTF::Dominators::blocksStrictlyDominatedBy): (WTF::Dominators::blocksDominatedBy): (WTF::Dominators::forAllBlocksInDominanceFrontierOf): (WTF::Dominators::dominanceFrontierOf): (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOf): (WTF::Dominators::forAllBlocksInPrunedIteratedDominanceFrontierOf): (WTF::Dominators::iteratedDominanceFrontierOf): (WTF::Dominators::dump): (WTF::Dominators::LengauerTarjan::LengauerTarjan): (WTF::Dominators::LengauerTarjan::compute): (WTF::Dominators::LengauerTarjan::immediateDominator): (WTF::Dominators::LengauerTarjan::computeDepthFirstPreNumbering): (WTF::Dominators::LengauerTarjan::computeSemiDominatorsAndImplicitImmediateDominators): (WTF::Dominators::LengauerTarjan::computeExplicitImmediateDominators): (WTF::Dominators::LengauerTarjan::link): (WTF::Dominators::LengauerTarjan::eval): (WTF::Dominators::LengauerTarjan::compress): (WTF::Dominators::LengauerTarjan::BlockData::BlockData): (WTF::Dominators::NaiveDominators::NaiveDominators): (WTF::Dominators::NaiveDominators::dominates): (WTF::Dominators::NaiveDominators::dump): (WTF::Dominators::NaiveDominators::pruneDominators): (WTF::Dominators::ValidationContext::ValidationContext): (WTF::Dominators::ValidationContext::reportError): (WTF::Dominators::ValidationContext::handleErrors): (WTF::Dominators::naiveDominates): (WTF::Dominators::forAllBlocksInDominanceFrontierOfImpl): (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOfImpl): (WTF::Dominators::BlockData::BlockData): Canonical link: https://commits.webkit.org/168962@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@191870 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-11-02 00:48:03 +00:00
}
// Mark all nodes as dominated by everything.
for (unsigned i = numBlocks; i-- > 1;) {
if (!graph.node(i) || !graph.predecessors(graph.node(i)).size())
m_results[i].clearAll();
else
FastBitVector should have efficient and easy-to-use vector-vector operations https://bugs.webkit.org/show_bug.cgi?id=161847 Reviewed by Saam Barati. Source/JavaScriptCore: Adapt existing users of FastBitVector to the new API. * bytecode/BytecodeLivenessAnalysis.cpp: (JSC::BytecodeLivenessAnalysis::computeKills): (JSC::BytecodeLivenessAnalysis::dumpResults): * bytecode/BytecodeLivenessAnalysisInlines.h: (JSC::operandThatIsNotAlwaysLiveIsLive): (JSC::BytecodeLivenessPropagation<DerivedAnalysis>::stepOverInstruction): (JSC::BytecodeLivenessPropagation<DerivedAnalysis>::runLivenessFixpoint): * bytecode/CodeBlock.cpp: (JSC::CodeBlock::validate): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::flushForTerminal): * dfg/DFGForAllKills.h: (JSC::DFG::forAllKilledOperands): * dfg/DFGGraph.h: (JSC::DFG::Graph::forAllLocalsLiveInBytecode): * dfg/DFGLiveCatchVariablePreservationPhase.cpp: (JSC::DFG::LiveCatchVariablePreservationPhase::willCatchException): (JSC::DFG::LiveCatchVariablePreservationPhase::handleBlock): * dfg/DFGNaturalLoops.cpp: (JSC::DFG::NaturalLoops::NaturalLoops): * dfg/DFGPlan.cpp: (JSC::DFG::Plan::cleanMustHandleValuesIfNecessary): Source/WTF: FastBitVector is a bitvector representation that supports manual dynamic resizing and is optimized for speed, not space. (BitVector supports automatic dynamic resizing and is optimized for space, while Bitmap is sized statically and is optimized for both speed and space.) This change greatly increases the power of FastBitVector. We will use these new powers for changing the JSC GC to use FastBitVectors to track sets of MarkedBlocks (bug 161581) instead of using a combination of Vectors and doubly-linked lists. This change splits FastBitVector into two parts: - A thing that manages the storage of a bitvector: a uint32_t array and a size_t numBits. We call this the word view. - A thing that takes some kind of abstract array of uint32_t's and does bitvector operations to it. We call this the FastBitVectorImpl. FastBitVectorImpl and word views are immutable. The FastBitVector class is a subclass of FastBitVectorImpl specialized on a word view that owns its words and has additional support for mutable operations. Doing this allows us to efficiently support things like this without any unnecessary memory allocation or copying: FastBitVector a, b, c; // Assume that there is code to initialize these. a &= b | ~c; Previously, this kind of operation would not be efficient, because "~c" would have to create a whole new FastBitVector. But now, it just returns a FastBitVectorImpl whose underlying word view bitnots (~) its words on the fly. Using template magic, this can get pretty complex. For example "b | ~c" returns a FastBitVectorImpl that wraps a word view whose implementation of WordView::word(size_t index) is something like: uint32_t word(size_t index) { return b.m_words.word(index) | ~c.m_words.word(index); } FastBitVectorImpl supports all of the fast bulk bitvector operations, like forEachSetBit(), bitCount(), etc. So, when you say "a &= b | ~c", the actual implementation is going to run these bit operations on word granularity directly over the storage inside a, b, c. The use of operator overloading is worth explaining a bit. Previously, FastBitVector avoided operator overloading. For example, the &= operation was called filter(). I think that this was a pretty good approach at the time. I tried using non-operator methods in this FastBitVector rewrite, but I found it very odd to say things like: a.filter(b.bitOr(c.bitNot())); I think that it's harder to see what is going on here, then using operators, because infix notation is always better. * WTF.xcodeproj/project.pbxproj: * wtf/BitVector.h: (WTF::BitVector::findBitInWord): Deleted. * wtf/CMakeLists.txt: * wtf/Dominators.h: (WTF::Dominators::NaiveDominators::NaiveDominators): (WTF::Dominators::NaiveDominators::dominates): (WTF::Dominators::NaiveDominators::pruneDominators): * wtf/FastBitVector.cpp: Removed. * wtf/FastBitVector.h: (WTF::fastBitVectorArrayLength): (WTF::FastBitVectorWordView::FastBitVectorWordView): (WTF::FastBitVectorWordView::numBits): (WTF::FastBitVectorWordView::word): (WTF::FastBitVectorWordOwner::FastBitVectorWordOwner): (WTF::FastBitVectorWordOwner::~FastBitVectorWordOwner): (WTF::FastBitVectorWordOwner::view): (WTF::FastBitVectorWordOwner::operator=): (WTF::FastBitVectorWordOwner::setAll): (WTF::FastBitVectorWordOwner::clearAll): (WTF::FastBitVectorWordOwner::set): (WTF::FastBitVectorWordOwner::numBits): (WTF::FastBitVectorWordOwner::arrayLength): (WTF::FastBitVectorWordOwner::resize): (WTF::FastBitVectorWordOwner::word): (WTF::FastBitVectorWordOwner::words): (WTF::FastBitVectorAndWords::FastBitVectorAndWords): (WTF::FastBitVectorAndWords::view): (WTF::FastBitVectorAndWords::numBits): (WTF::FastBitVectorAndWords::word): (WTF::FastBitVectorOrWords::FastBitVectorOrWords): (WTF::FastBitVectorOrWords::view): (WTF::FastBitVectorOrWords::numBits): (WTF::FastBitVectorOrWords::word): (WTF::FastBitVectorNotWords::FastBitVectorNotWords): (WTF::FastBitVectorNotWords::view): (WTF::FastBitVectorNotWords::numBits): (WTF::FastBitVectorNotWords::word): (WTF::FastBitVectorImpl::FastBitVectorImpl): (WTF::FastBitVectorImpl::numBits): (WTF::FastBitVectorImpl::size): (WTF::FastBitVectorImpl::arrayLength): (WTF::FastBitVectorImpl::operator==): (WTF::FastBitVectorImpl::operator!=): (WTF::FastBitVectorImpl::at): (WTF::FastBitVectorImpl::operator[]): (WTF::FastBitVectorImpl::bitCount): (WTF::FastBitVectorImpl::operator&): (WTF::FastBitVectorImpl::operator|): (WTF::FastBitVectorImpl::operator~): (WTF::FastBitVectorImpl::forEachSetBit): (WTF::FastBitVectorImpl::forEachClearBit): (WTF::FastBitVectorImpl::forEachBit): (WTF::FastBitVectorImpl::findBit): (WTF::FastBitVectorImpl::findSetBit): (WTF::FastBitVectorImpl::findClearBit): (WTF::FastBitVectorImpl::dump): (WTF::FastBitVectorImpl::atImpl): (WTF::FastBitVector::FastBitVector): (WTF::FastBitVector::operator=): (WTF::FastBitVector::resize): (WTF::FastBitVector::setAll): (WTF::FastBitVector::clearAll): (WTF::FastBitVector::setAndCheck): (WTF::FastBitVector::operator|=): (WTF::FastBitVector::operator&=): (WTF::FastBitVector::at): (WTF::FastBitVector::operator[]): (WTF::FastBitVector::BitReference::BitReference): (WTF::FastBitVector::BitReference::operator bool): (WTF::FastBitVector::BitReference::operator=): (WTF::FastBitVector::~FastBitVector): Deleted. (WTF::FastBitVector::numBits): Deleted. (WTF::FastBitVector::set): Deleted. (WTF::FastBitVector::equals): Deleted. (WTF::FastBitVector::merge): Deleted. (WTF::FastBitVector::filter): Deleted. (WTF::FastBitVector::exclude): Deleted. (WTF::FastBitVector::clear): Deleted. (WTF::FastBitVector::get): Deleted. (WTF::FastBitVector::bitCount): Deleted. (WTF::FastBitVector::forEachSetBit): Deleted. (WTF::FastBitVector::arrayLength): Deleted. * wtf/StdLibExtras.h: (WTF::findBitInWord): Canonical link: https://commits.webkit.org/180007@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205794 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-12 04:03:36 +00:00
m_results[i] = m_scratch;
Dominators should be factored out of the DFG https://bugs.webkit.org/show_bug.cgi?id=150764 Reviewed by Geoffrey Garen. Source/JavaScriptCore: Factored DFGDominators.h/DFGDominators.cpp into WTF. To do this, I made two changes to the DFG: 1) DFG now has a CFG abstraction called DFG::CFG. The cool thing about this is that in the future if we wanted to support inverted dominators, we could do it by just creating a DFG::BackwardCFG. 2) Got rid of DFG::Analysis. From now on, an Analysis being invalidated is expressed by the DFG::Graph having a null pointer for that analysis. When we "run" the analysis, we just instantiate it. This makes it much more natural to integrate WTF::Dominators into the DFG. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * dfg/DFGAnalysis.h: Removed. * dfg/DFGCFG.h: Added. (JSC::DFG::CFG::CFG): (JSC::DFG::CFG::root): (JSC::DFG::CFG::newMap<T>): (JSC::DFG::CFG::successors): (JSC::DFG::CFG::predecessors): (JSC::DFG::CFG::index): (JSC::DFG::CFG::node): (JSC::DFG::CFG::numNodes): (JSC::DFG::CFG::dump): * dfg/DFGCSEPhase.cpp: * dfg/DFGDisassembler.cpp: (JSC::DFG::Disassembler::createDumpList): * dfg/DFGDominators.cpp: Removed. * dfg/DFGDominators.h: (JSC::DFG::Dominators::Dominators): (JSC::DFG::Dominators::strictlyDominates): Deleted. (JSC::DFG::Dominators::dominates): Deleted. (JSC::DFG::Dominators::immediateDominatorOf): Deleted. (JSC::DFG::Dominators::forAllStrictDominatorsOf): Deleted. (JSC::DFG::Dominators::forAllDominatorsOf): Deleted. (JSC::DFG::Dominators::forAllBlocksStrictlyDominatedBy): Deleted. (JSC::DFG::Dominators::forAllBlocksDominatedBy): Deleted. (JSC::DFG::Dominators::forAllBlocksInDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInIteratedDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInPrunedIteratedDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInDominanceFrontierOfImpl): Deleted. (JSC::DFG::Dominators::forAllBlocksInIteratedDominanceFrontierOfImpl): Deleted. (JSC::DFG::Dominators::BlockData::BlockData): Deleted. * dfg/DFGEdgeDominates.h: (JSC::DFG::EdgeDominates::operator()): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::Graph): (JSC::DFG::Graph::dumpBlockHeader): (JSC::DFG::Graph::invalidateCFG): (JSC::DFG::Graph::substituteGetLocal): (JSC::DFG::Graph::handleAssertionFailure): (JSC::DFG::Graph::ensureDominators): (JSC::DFG::Graph::ensurePrePostNumbering): (JSC::DFG::Graph::ensureNaturalLoops): (JSC::DFG::Graph::valueProfileFor): * dfg/DFGGraph.h: (JSC::DFG::Graph::hasDebuggerEnabled): * dfg/DFGLICMPhase.cpp: (JSC::DFG::LICMPhase::run): (JSC::DFG::LICMPhase::attemptHoist): * dfg/DFGLoopPreHeaderCreationPhase.cpp: (JSC::DFG::createPreHeader): (JSC::DFG::LoopPreHeaderCreationPhase::run): * dfg/DFGNaturalLoops.cpp: (JSC::DFG::NaturalLoop::dump): (JSC::DFG::NaturalLoops::NaturalLoops): (JSC::DFG::NaturalLoops::~NaturalLoops): (JSC::DFG::NaturalLoops::loopsOf): (JSC::DFG::NaturalLoops::computeDependencies): Deleted. (JSC::DFG::NaturalLoops::compute): Deleted. * dfg/DFGNaturalLoops.h: (JSC::DFG::NaturalLoops::numLoops): * dfg/DFGNode.h: (JSC::DFG::Node::SuccessorsIterable::end): (JSC::DFG::Node::SuccessorsIterable::size): (JSC::DFG::Node::SuccessorsIterable::at): (JSC::DFG::Node::SuccessorsIterable::operator[]): * dfg/DFGOSREntrypointCreationPhase.cpp: (JSC::DFG::OSREntrypointCreationPhase::run): * dfg/DFGObjectAllocationSinkingPhase.cpp: * dfg/DFGPlan.cpp: (JSC::DFG::Plan::compileInThreadImpl): * dfg/DFGPrePostNumbering.cpp: (JSC::DFG::PrePostNumbering::PrePostNumbering): (JSC::DFG::PrePostNumbering::~PrePostNumbering): (JSC::DFG::PrePostNumbering::compute): Deleted. * dfg/DFGPrePostNumbering.h: (JSC::DFG::PrePostNumbering::preNumber): (JSC::DFG::PrePostNumbering::postNumber): * dfg/DFGPutStackSinkingPhase.cpp: * dfg/DFGSSACalculator.cpp: (JSC::DFG::SSACalculator::nonLocalReachingDef): (JSC::DFG::SSACalculator::reachingDefAtTail): * dfg/DFGSSACalculator.h: (JSC::DFG::SSACalculator::computePhis): * dfg/DFGSSAConversionPhase.cpp: (JSC::DFG::SSAConversionPhase::run): * ftl/FTLLink.cpp: (JSC::FTL::link): * ftl/FTLLowerDFGToLLVM.cpp: (JSC::FTL::DFG::LowerDFGToLLVM::lower): (JSC::FTL::DFG::LowerDFGToLLVM::safelyInvalidateAfterTermination): (JSC::FTL::DFG::LowerDFGToLLVM::isValid): Source/WTF: This takes what used to be DFGDominators.h/DFGDominators.cpp and turns it into a generic algorithm that can take any abstract graph. The idea is that you create Dominators<CFG> and pass it a CFG object, which defines the types of graph nodes and methods for getting successors, predecessors, etc. The DFG now defines a class called CFG, which is a wrapper for DFG::Graph that conforms to the thing that wtf/Dominators.h expects. When doing things to graphs, it's common to refer to the things in the graph as "nodes". Because I intend to reuse the CFG abstraction with many graph algorithms, that abstraction uses the term "node" to refer to a DFG basic block. But in Dominators, the method and variable names still use "block". This is because although Dominators are applicable to any kind of directed graph, it's super unlikely that we will ever use them for anything but compilers. Indeed, the only reason why I'm factoring them out of the DFG is so that I can use them with B3 and Air. This has the nice side effect that a user of WTF::Dominators<JSC::DFG::CFG> will see familiar terminology like "blocksStrictlyDominatedBy(...)" instead of "nodesStrictlyDominatedBy(...)", which would be super confusing. Overall, wtf/Dominators.h is a combination of what used to be in DFGDominators.h, DFGDominators.cpp, DFGNaiveDominators.h, and DFGNaiveDominators.cpp. I only changed code when I had to in order to make it generic. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/Dominators.h: Added. (WTF::Dominators::Dominators): (WTF::Dominators::compute): (WTF::Dominators::strictlyDominates): (WTF::Dominators::dominates): (WTF::Dominators::immediateDominatorOf): (WTF::Dominators::forAllStrictDominatorsOf): (WTF::Dominators::forAllDominatorsOf): (WTF::Dominators::forAllBlocksStrictlyDominatedBy): (WTF::Dominators::forAllBlocksDominatedBy): (WTF::Dominators::strictDominatorsOf): (WTF::Dominators::dominatorsOf): (WTF::Dominators::blocksStrictlyDominatedBy): (WTF::Dominators::blocksDominatedBy): (WTF::Dominators::forAllBlocksInDominanceFrontierOf): (WTF::Dominators::dominanceFrontierOf): (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOf): (WTF::Dominators::forAllBlocksInPrunedIteratedDominanceFrontierOf): (WTF::Dominators::iteratedDominanceFrontierOf): (WTF::Dominators::dump): (WTF::Dominators::LengauerTarjan::LengauerTarjan): (WTF::Dominators::LengauerTarjan::compute): (WTF::Dominators::LengauerTarjan::immediateDominator): (WTF::Dominators::LengauerTarjan::computeDepthFirstPreNumbering): (WTF::Dominators::LengauerTarjan::computeSemiDominatorsAndImplicitImmediateDominators): (WTF::Dominators::LengauerTarjan::computeExplicitImmediateDominators): (WTF::Dominators::LengauerTarjan::link): (WTF::Dominators::LengauerTarjan::eval): (WTF::Dominators::LengauerTarjan::compress): (WTF::Dominators::LengauerTarjan::BlockData::BlockData): (WTF::Dominators::NaiveDominators::NaiveDominators): (WTF::Dominators::NaiveDominators::dominates): (WTF::Dominators::NaiveDominators::dump): (WTF::Dominators::NaiveDominators::pruneDominators): (WTF::Dominators::ValidationContext::ValidationContext): (WTF::Dominators::ValidationContext::reportError): (WTF::Dominators::ValidationContext::handleErrors): (WTF::Dominators::naiveDominates): (WTF::Dominators::forAllBlocksInDominanceFrontierOfImpl): (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOfImpl): (WTF::Dominators::BlockData::BlockData): Canonical link: https://commits.webkit.org/168962@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@191870 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-11-02 00:48:03 +00:00
}
// Iteratively eliminate nodes that are not dominator.
bool changed;
do {
changed = false;
// Prune dominators in all non entry blocks: forward scan.
for (unsigned i = 1; i < numBlocks; ++i)
changed |= pruneDominators(i);
if (!changed)
break;
// Prune dominators in all non entry blocks: backward scan.
changed = false;
for (unsigned i = numBlocks; i-- > 1;)
changed |= pruneDominators(i);
} while (changed);
}
bool dominates(unsigned from, unsigned to) const
{
FastBitVector should have efficient and easy-to-use vector-vector operations https://bugs.webkit.org/show_bug.cgi?id=161847 Reviewed by Saam Barati. Source/JavaScriptCore: Adapt existing users of FastBitVector to the new API. * bytecode/BytecodeLivenessAnalysis.cpp: (JSC::BytecodeLivenessAnalysis::computeKills): (JSC::BytecodeLivenessAnalysis::dumpResults): * bytecode/BytecodeLivenessAnalysisInlines.h: (JSC::operandThatIsNotAlwaysLiveIsLive): (JSC::BytecodeLivenessPropagation<DerivedAnalysis>::stepOverInstruction): (JSC::BytecodeLivenessPropagation<DerivedAnalysis>::runLivenessFixpoint): * bytecode/CodeBlock.cpp: (JSC::CodeBlock::validate): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::flushForTerminal): * dfg/DFGForAllKills.h: (JSC::DFG::forAllKilledOperands): * dfg/DFGGraph.h: (JSC::DFG::Graph::forAllLocalsLiveInBytecode): * dfg/DFGLiveCatchVariablePreservationPhase.cpp: (JSC::DFG::LiveCatchVariablePreservationPhase::willCatchException): (JSC::DFG::LiveCatchVariablePreservationPhase::handleBlock): * dfg/DFGNaturalLoops.cpp: (JSC::DFG::NaturalLoops::NaturalLoops): * dfg/DFGPlan.cpp: (JSC::DFG::Plan::cleanMustHandleValuesIfNecessary): Source/WTF: FastBitVector is a bitvector representation that supports manual dynamic resizing and is optimized for speed, not space. (BitVector supports automatic dynamic resizing and is optimized for space, while Bitmap is sized statically and is optimized for both speed and space.) This change greatly increases the power of FastBitVector. We will use these new powers for changing the JSC GC to use FastBitVectors to track sets of MarkedBlocks (bug 161581) instead of using a combination of Vectors and doubly-linked lists. This change splits FastBitVector into two parts: - A thing that manages the storage of a bitvector: a uint32_t array and a size_t numBits. We call this the word view. - A thing that takes some kind of abstract array of uint32_t's and does bitvector operations to it. We call this the FastBitVectorImpl. FastBitVectorImpl and word views are immutable. The FastBitVector class is a subclass of FastBitVectorImpl specialized on a word view that owns its words and has additional support for mutable operations. Doing this allows us to efficiently support things like this without any unnecessary memory allocation or copying: FastBitVector a, b, c; // Assume that there is code to initialize these. a &= b | ~c; Previously, this kind of operation would not be efficient, because "~c" would have to create a whole new FastBitVector. But now, it just returns a FastBitVectorImpl whose underlying word view bitnots (~) its words on the fly. Using template magic, this can get pretty complex. For example "b | ~c" returns a FastBitVectorImpl that wraps a word view whose implementation of WordView::word(size_t index) is something like: uint32_t word(size_t index) { return b.m_words.word(index) | ~c.m_words.word(index); } FastBitVectorImpl supports all of the fast bulk bitvector operations, like forEachSetBit(), bitCount(), etc. So, when you say "a &= b | ~c", the actual implementation is going to run these bit operations on word granularity directly over the storage inside a, b, c. The use of operator overloading is worth explaining a bit. Previously, FastBitVector avoided operator overloading. For example, the &= operation was called filter(). I think that this was a pretty good approach at the time. I tried using non-operator methods in this FastBitVector rewrite, but I found it very odd to say things like: a.filter(b.bitOr(c.bitNot())); I think that it's harder to see what is going on here, then using operators, because infix notation is always better. * WTF.xcodeproj/project.pbxproj: * wtf/BitVector.h: (WTF::BitVector::findBitInWord): Deleted. * wtf/CMakeLists.txt: * wtf/Dominators.h: (WTF::Dominators::NaiveDominators::NaiveDominators): (WTF::Dominators::NaiveDominators::dominates): (WTF::Dominators::NaiveDominators::pruneDominators): * wtf/FastBitVector.cpp: Removed. * wtf/FastBitVector.h: (WTF::fastBitVectorArrayLength): (WTF::FastBitVectorWordView::FastBitVectorWordView): (WTF::FastBitVectorWordView::numBits): (WTF::FastBitVectorWordView::word): (WTF::FastBitVectorWordOwner::FastBitVectorWordOwner): (WTF::FastBitVectorWordOwner::~FastBitVectorWordOwner): (WTF::FastBitVectorWordOwner::view): (WTF::FastBitVectorWordOwner::operator=): (WTF::FastBitVectorWordOwner::setAll): (WTF::FastBitVectorWordOwner::clearAll): (WTF::FastBitVectorWordOwner::set): (WTF::FastBitVectorWordOwner::numBits): (WTF::FastBitVectorWordOwner::arrayLength): (WTF::FastBitVectorWordOwner::resize): (WTF::FastBitVectorWordOwner::word): (WTF::FastBitVectorWordOwner::words): (WTF::FastBitVectorAndWords::FastBitVectorAndWords): (WTF::FastBitVectorAndWords::view): (WTF::FastBitVectorAndWords::numBits): (WTF::FastBitVectorAndWords::word): (WTF::FastBitVectorOrWords::FastBitVectorOrWords): (WTF::FastBitVectorOrWords::view): (WTF::FastBitVectorOrWords::numBits): (WTF::FastBitVectorOrWords::word): (WTF::FastBitVectorNotWords::FastBitVectorNotWords): (WTF::FastBitVectorNotWords::view): (WTF::FastBitVectorNotWords::numBits): (WTF::FastBitVectorNotWords::word): (WTF::FastBitVectorImpl::FastBitVectorImpl): (WTF::FastBitVectorImpl::numBits): (WTF::FastBitVectorImpl::size): (WTF::FastBitVectorImpl::arrayLength): (WTF::FastBitVectorImpl::operator==): (WTF::FastBitVectorImpl::operator!=): (WTF::FastBitVectorImpl::at): (WTF::FastBitVectorImpl::operator[]): (WTF::FastBitVectorImpl::bitCount): (WTF::FastBitVectorImpl::operator&): (WTF::FastBitVectorImpl::operator|): (WTF::FastBitVectorImpl::operator~): (WTF::FastBitVectorImpl::forEachSetBit): (WTF::FastBitVectorImpl::forEachClearBit): (WTF::FastBitVectorImpl::forEachBit): (WTF::FastBitVectorImpl::findBit): (WTF::FastBitVectorImpl::findSetBit): (WTF::FastBitVectorImpl::findClearBit): (WTF::FastBitVectorImpl::dump): (WTF::FastBitVectorImpl::atImpl): (WTF::FastBitVector::FastBitVector): (WTF::FastBitVector::operator=): (WTF::FastBitVector::resize): (WTF::FastBitVector::setAll): (WTF::FastBitVector::clearAll): (WTF::FastBitVector::setAndCheck): (WTF::FastBitVector::operator|=): (WTF::FastBitVector::operator&=): (WTF::FastBitVector::at): (WTF::FastBitVector::operator[]): (WTF::FastBitVector::BitReference::BitReference): (WTF::FastBitVector::BitReference::operator bool): (WTF::FastBitVector::BitReference::operator=): (WTF::FastBitVector::~FastBitVector): Deleted. (WTF::FastBitVector::numBits): Deleted. (WTF::FastBitVector::set): Deleted. (WTF::FastBitVector::equals): Deleted. (WTF::FastBitVector::merge): Deleted. (WTF::FastBitVector::filter): Deleted. (WTF::FastBitVector::exclude): Deleted. (WTF::FastBitVector::clear): Deleted. (WTF::FastBitVector::get): Deleted. (WTF::FastBitVector::bitCount): Deleted. (WTF::FastBitVector::forEachSetBit): Deleted. (WTF::FastBitVector::arrayLength): Deleted. * wtf/StdLibExtras.h: (WTF::findBitInWord): Canonical link: https://commits.webkit.org/180007@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205794 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-12 04:03:36 +00:00
return m_results[to][from];
Dominators should be factored out of the DFG https://bugs.webkit.org/show_bug.cgi?id=150764 Reviewed by Geoffrey Garen. Source/JavaScriptCore: Factored DFGDominators.h/DFGDominators.cpp into WTF. To do this, I made two changes to the DFG: 1) DFG now has a CFG abstraction called DFG::CFG. The cool thing about this is that in the future if we wanted to support inverted dominators, we could do it by just creating a DFG::BackwardCFG. 2) Got rid of DFG::Analysis. From now on, an Analysis being invalidated is expressed by the DFG::Graph having a null pointer for that analysis. When we "run" the analysis, we just instantiate it. This makes it much more natural to integrate WTF::Dominators into the DFG. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * dfg/DFGAnalysis.h: Removed. * dfg/DFGCFG.h: Added. (JSC::DFG::CFG::CFG): (JSC::DFG::CFG::root): (JSC::DFG::CFG::newMap<T>): (JSC::DFG::CFG::successors): (JSC::DFG::CFG::predecessors): (JSC::DFG::CFG::index): (JSC::DFG::CFG::node): (JSC::DFG::CFG::numNodes): (JSC::DFG::CFG::dump): * dfg/DFGCSEPhase.cpp: * dfg/DFGDisassembler.cpp: (JSC::DFG::Disassembler::createDumpList): * dfg/DFGDominators.cpp: Removed. * dfg/DFGDominators.h: (JSC::DFG::Dominators::Dominators): (JSC::DFG::Dominators::strictlyDominates): Deleted. (JSC::DFG::Dominators::dominates): Deleted. (JSC::DFG::Dominators::immediateDominatorOf): Deleted. (JSC::DFG::Dominators::forAllStrictDominatorsOf): Deleted. (JSC::DFG::Dominators::forAllDominatorsOf): Deleted. (JSC::DFG::Dominators::forAllBlocksStrictlyDominatedBy): Deleted. (JSC::DFG::Dominators::forAllBlocksDominatedBy): Deleted. (JSC::DFG::Dominators::forAllBlocksInDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInIteratedDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInPrunedIteratedDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInDominanceFrontierOfImpl): Deleted. (JSC::DFG::Dominators::forAllBlocksInIteratedDominanceFrontierOfImpl): Deleted. (JSC::DFG::Dominators::BlockData::BlockData): Deleted. * dfg/DFGEdgeDominates.h: (JSC::DFG::EdgeDominates::operator()): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::Graph): (JSC::DFG::Graph::dumpBlockHeader): (JSC::DFG::Graph::invalidateCFG): (JSC::DFG::Graph::substituteGetLocal): (JSC::DFG::Graph::handleAssertionFailure): (JSC::DFG::Graph::ensureDominators): (JSC::DFG::Graph::ensurePrePostNumbering): (JSC::DFG::Graph::ensureNaturalLoops): (JSC::DFG::Graph::valueProfileFor): * dfg/DFGGraph.h: (JSC::DFG::Graph::hasDebuggerEnabled): * dfg/DFGLICMPhase.cpp: (JSC::DFG::LICMPhase::run): (JSC::DFG::LICMPhase::attemptHoist): * dfg/DFGLoopPreHeaderCreationPhase.cpp: (JSC::DFG::createPreHeader): (JSC::DFG::LoopPreHeaderCreationPhase::run): * dfg/DFGNaturalLoops.cpp: (JSC::DFG::NaturalLoop::dump): (JSC::DFG::NaturalLoops::NaturalLoops): (JSC::DFG::NaturalLoops::~NaturalLoops): (JSC::DFG::NaturalLoops::loopsOf): (JSC::DFG::NaturalLoops::computeDependencies): Deleted. (JSC::DFG::NaturalLoops::compute): Deleted. * dfg/DFGNaturalLoops.h: (JSC::DFG::NaturalLoops::numLoops): * dfg/DFGNode.h: (JSC::DFG::Node::SuccessorsIterable::end): (JSC::DFG::Node::SuccessorsIterable::size): (JSC::DFG::Node::SuccessorsIterable::at): (JSC::DFG::Node::SuccessorsIterable::operator[]): * dfg/DFGOSREntrypointCreationPhase.cpp: (JSC::DFG::OSREntrypointCreationPhase::run): * dfg/DFGObjectAllocationSinkingPhase.cpp: * dfg/DFGPlan.cpp: (JSC::DFG::Plan::compileInThreadImpl): * dfg/DFGPrePostNumbering.cpp: (JSC::DFG::PrePostNumbering::PrePostNumbering): (JSC::DFG::PrePostNumbering::~PrePostNumbering): (JSC::DFG::PrePostNumbering::compute): Deleted. * dfg/DFGPrePostNumbering.h: (JSC::DFG::PrePostNumbering::preNumber): (JSC::DFG::PrePostNumbering::postNumber): * dfg/DFGPutStackSinkingPhase.cpp: * dfg/DFGSSACalculator.cpp: (JSC::DFG::SSACalculator::nonLocalReachingDef): (JSC::DFG::SSACalculator::reachingDefAtTail): * dfg/DFGSSACalculator.h: (JSC::DFG::SSACalculator::computePhis): * dfg/DFGSSAConversionPhase.cpp: (JSC::DFG::SSAConversionPhase::run): * ftl/FTLLink.cpp: (JSC::FTL::link): * ftl/FTLLowerDFGToLLVM.cpp: (JSC::FTL::DFG::LowerDFGToLLVM::lower): (JSC::FTL::DFG::LowerDFGToLLVM::safelyInvalidateAfterTermination): (JSC::FTL::DFG::LowerDFGToLLVM::isValid): Source/WTF: This takes what used to be DFGDominators.h/DFGDominators.cpp and turns it into a generic algorithm that can take any abstract graph. The idea is that you create Dominators<CFG> and pass it a CFG object, which defines the types of graph nodes and methods for getting successors, predecessors, etc. The DFG now defines a class called CFG, which is a wrapper for DFG::Graph that conforms to the thing that wtf/Dominators.h expects. When doing things to graphs, it's common to refer to the things in the graph as "nodes". Because I intend to reuse the CFG abstraction with many graph algorithms, that abstraction uses the term "node" to refer to a DFG basic block. But in Dominators, the method and variable names still use "block". This is because although Dominators are applicable to any kind of directed graph, it's super unlikely that we will ever use them for anything but compilers. Indeed, the only reason why I'm factoring them out of the DFG is so that I can use them with B3 and Air. This has the nice side effect that a user of WTF::Dominators<JSC::DFG::CFG> will see familiar terminology like "blocksStrictlyDominatedBy(...)" instead of "nodesStrictlyDominatedBy(...)", which would be super confusing. Overall, wtf/Dominators.h is a combination of what used to be in DFGDominators.h, DFGDominators.cpp, DFGNaiveDominators.h, and DFGNaiveDominators.cpp. I only changed code when I had to in order to make it generic. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/Dominators.h: Added. (WTF::Dominators::Dominators): (WTF::Dominators::compute): (WTF::Dominators::strictlyDominates): (WTF::Dominators::dominates): (WTF::Dominators::immediateDominatorOf): (WTF::Dominators::forAllStrictDominatorsOf): (WTF::Dominators::forAllDominatorsOf): (WTF::Dominators::forAllBlocksStrictlyDominatedBy): (WTF::Dominators::forAllBlocksDominatedBy): (WTF::Dominators::strictDominatorsOf): (WTF::Dominators::dominatorsOf): (WTF::Dominators::blocksStrictlyDominatedBy): (WTF::Dominators::blocksDominatedBy): (WTF::Dominators::forAllBlocksInDominanceFrontierOf): (WTF::Dominators::dominanceFrontierOf): (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOf): (WTF::Dominators::forAllBlocksInPrunedIteratedDominanceFrontierOf): (WTF::Dominators::iteratedDominanceFrontierOf): (WTF::Dominators::dump): (WTF::Dominators::LengauerTarjan::LengauerTarjan): (WTF::Dominators::LengauerTarjan::compute): (WTF::Dominators::LengauerTarjan::immediateDominator): (WTF::Dominators::LengauerTarjan::computeDepthFirstPreNumbering): (WTF::Dominators::LengauerTarjan::computeSemiDominatorsAndImplicitImmediateDominators): (WTF::Dominators::LengauerTarjan::computeExplicitImmediateDominators): (WTF::Dominators::LengauerTarjan::link): (WTF::Dominators::LengauerTarjan::eval): (WTF::Dominators::LengauerTarjan::compress): (WTF::Dominators::LengauerTarjan::BlockData::BlockData): (WTF::Dominators::NaiveDominators::NaiveDominators): (WTF::Dominators::NaiveDominators::dominates): (WTF::Dominators::NaiveDominators::dump): (WTF::Dominators::NaiveDominators::pruneDominators): (WTF::Dominators::ValidationContext::ValidationContext): (WTF::Dominators::ValidationContext::reportError): (WTF::Dominators::ValidationContext::handleErrors): (WTF::Dominators::naiveDominates): (WTF::Dominators::forAllBlocksInDominanceFrontierOfImpl): (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOfImpl): (WTF::Dominators::BlockData::BlockData): Canonical link: https://commits.webkit.org/168962@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@191870 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-11-02 00:48:03 +00:00
}
bool dominates(typename Graph::Node from, typename Graph::Node to) const
{
FTL B3 should be able to flag the tag constants as being super important so that B3 can hoist them and Air can force them into registers https://bugs.webkit.org/show_bug.cgi?id=151955 Reviewed by Geoffrey Garen. Source/JavaScriptCore: Taught B3 about the concept of "fast constants". A client of B3 can now tell B3 which constants are super important. B3 will not spill the constant in that case and will ensure that the constant is materialized only once: statically once, and dynamically once per procedure execution. The hoistFastConstants() algorithm in B3MoveConstants.cpp achieves this by first picking the lowest common dominator of all uses of each fast constant, and then picking the materialization point by finding the lowest dominator of that dominator that is tied for lowest block frequency. In practice, the second step ensures that this is the lowest point in the program that is not in a loop (i.e. executes no more than once dynamically per procedure invocation). Taught Air about the concept of "fast tmps". B3 tells Air that a tmp is fast if it is used to hold the materialization of a fast constant. IRC will use the lowest possible spill score for fast tmps. In practice, this ensures that fast constants are never spilled. Added a small snippet of code to FTL::LowerDFGToLLVM that makes both of the tag constants into fast constants. My hope is that this very brute-force heuristic is good enough that we don't have to think about constants for a while. Based on my experience with how LLVM's constant hoisting works out, the heuristic in this patch is going to be tough to beat. LLVM's constant hoisting does good things when it hoists the tags, and usually causes nothing but problems when it hoists anything else. This is because there is no way a low-level compiler to really understand how a constant materialization impacts some operation's contribution to the overall execution time of a procedure. But, in the FTL we know that constant materializations for type checks are a bummer because we are super comfortable placing type checks on the hottest of paths. So those are the last paths where extra instructions should be added by the compiler. On the other hand, all other large constant uses are on relatively cold paths, or paths that are already expensive for other reasons. For example, global variable accesses have to materialize a pointer to the global. But that's not really a big deal, since a load from a global involves first the load itself and then type checks on the result - so probably the constant materialization is just not interesting. A store to a global often involves a store barrier, so the constant materialization is really not interesting. This patch codifies this heuristic in a pact between Air, B3, and the FTL: FTL demands that B3 pin the two tags in registers, and B3 relays the demand to Air. * JavaScriptCore.xcodeproj/project.pbxproj: * b3/B3CFG.h: Added. (JSC::B3::CFG::CFG): (JSC::B3::CFG::root): (JSC::B3::CFG::newMap): (JSC::B3::CFG::successors): (JSC::B3::CFG::predecessors): (JSC::B3::CFG::index): (JSC::B3::CFG::node): (JSC::B3::CFG::numNodes): (JSC::B3::CFG::dump): * b3/B3Dominators.h: Added. (JSC::B3::Dominators::Dominators): * b3/B3IndexMap.h: (JSC::B3::IndexMap::resize): (JSC::B3::IndexMap::size): (JSC::B3::IndexMap::operator[]): * b3/B3LowerMacros.cpp: * b3/B3LowerToAir.cpp: (JSC::B3::Air::LowerToAir::tmp): * b3/B3MoveConstants.cpp: * b3/B3Opcode.h: (JSC::B3::constPtrOpcode): (JSC::B3::isConstant): * b3/B3Procedure.cpp: (JSC::B3::Procedure::Procedure): (JSC::B3::Procedure::resetReachability): (JSC::B3::Procedure::invalidateCFG): (JSC::B3::Procedure::dump): (JSC::B3::Procedure::deleteValue): (JSC::B3::Procedure::dominators): (JSC::B3::Procedure::addFastConstant): (JSC::B3::Procedure::isFastConstant): (JSC::B3::Procedure::addDataSection): * b3/B3Procedure.h: (JSC::B3::Procedure::size): (JSC::B3::Procedure::cfg): (JSC::B3::Procedure::setLastPhaseName): * b3/B3ReduceStrength.cpp: * b3/B3ValueInlines.h: (JSC::B3::Value::isConstant): (JSC::B3::Value::isInteger): * b3/B3ValueKey.h: (JSC::B3::ValueKey::canMaterialize): (JSC::B3::ValueKey::isConstant): * b3/air/AirCode.cpp: (JSC::B3::Air::Code::findNextBlock): (JSC::B3::Air::Code::addFastTmp): * b3/air/AirCode.h: (JSC::B3::Air::Code::specials): (JSC::B3::Air::Code::isFastTmp): (JSC::B3::Air::Code::setLastPhaseName): * b3/air/AirIteratedRegisterCoalescing.cpp: * dfg/DFGDominators.h: * dfg/DFGSSACalculator.cpp: * ftl/FTLLowerDFGToLLVM.cpp: (JSC::FTL::DFG::LowerDFGToLLVM::lower): Source/WTF: Remove some remaining DFG-specific snippets from Dominators. This used to be a non-template DFG class, and some time ago I hoisted it into WTF and made it generic. But since the only user of the class was the DFG, this class still had a handful of DFG-specific snippets that didn't compile when I started using it from B3. Also renamed immediateDominatorOf() to idom(). This is the sort of abbreviation that we wouldn't ordinarily want to have in WebKit. But WebKit does allow for abbreviations that are "more canonical". The term "idom" is definitely more canonical than "immediateDominatorOf". * wtf/Dominators.h: (WTF::Dominators::dominates): (WTF::Dominators::idom): (WTF::Dominators::forAllStrictDominatorsOf): (WTF::Dominators::NaiveDominators::dominates): (WTF::Dominators::NaiveDominators::dump): (WTF::Dominators::ValidationContext::handleErrors): Canonical link: https://commits.webkit.org/170119@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@193682 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-12-08 02:46:22 +00:00
return dominates(m_graph.index(from), m_graph.index(to));
Dominators should be factored out of the DFG https://bugs.webkit.org/show_bug.cgi?id=150764 Reviewed by Geoffrey Garen. Source/JavaScriptCore: Factored DFGDominators.h/DFGDominators.cpp into WTF. To do this, I made two changes to the DFG: 1) DFG now has a CFG abstraction called DFG::CFG. The cool thing about this is that in the future if we wanted to support inverted dominators, we could do it by just creating a DFG::BackwardCFG. 2) Got rid of DFG::Analysis. From now on, an Analysis being invalidated is expressed by the DFG::Graph having a null pointer for that analysis. When we "run" the analysis, we just instantiate it. This makes it much more natural to integrate WTF::Dominators into the DFG. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * dfg/DFGAnalysis.h: Removed. * dfg/DFGCFG.h: Added. (JSC::DFG::CFG::CFG): (JSC::DFG::CFG::root): (JSC::DFG::CFG::newMap<T>): (JSC::DFG::CFG::successors): (JSC::DFG::CFG::predecessors): (JSC::DFG::CFG::index): (JSC::DFG::CFG::node): (JSC::DFG::CFG::numNodes): (JSC::DFG::CFG::dump): * dfg/DFGCSEPhase.cpp: * dfg/DFGDisassembler.cpp: (JSC::DFG::Disassembler::createDumpList): * dfg/DFGDominators.cpp: Removed. * dfg/DFGDominators.h: (JSC::DFG::Dominators::Dominators): (JSC::DFG::Dominators::strictlyDominates): Deleted. (JSC::DFG::Dominators::dominates): Deleted. (JSC::DFG::Dominators::immediateDominatorOf): Deleted. (JSC::DFG::Dominators::forAllStrictDominatorsOf): Deleted. (JSC::DFG::Dominators::forAllDominatorsOf): Deleted. (JSC::DFG::Dominators::forAllBlocksStrictlyDominatedBy): Deleted. (JSC::DFG::Dominators::forAllBlocksDominatedBy): Deleted. (JSC::DFG::Dominators::forAllBlocksInDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInIteratedDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInPrunedIteratedDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInDominanceFrontierOfImpl): Deleted. (JSC::DFG::Dominators::forAllBlocksInIteratedDominanceFrontierOfImpl): Deleted. (JSC::DFG::Dominators::BlockData::BlockData): Deleted. * dfg/DFGEdgeDominates.h: (JSC::DFG::EdgeDominates::operator()): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::Graph): (JSC::DFG::Graph::dumpBlockHeader): (JSC::DFG::Graph::invalidateCFG): (JSC::DFG::Graph::substituteGetLocal): (JSC::DFG::Graph::handleAssertionFailure): (JSC::DFG::Graph::ensureDominators): (JSC::DFG::Graph::ensurePrePostNumbering): (JSC::DFG::Graph::ensureNaturalLoops): (JSC::DFG::Graph::valueProfileFor): * dfg/DFGGraph.h: (JSC::DFG::Graph::hasDebuggerEnabled): * dfg/DFGLICMPhase.cpp: (JSC::DFG::LICMPhase::run): (JSC::DFG::LICMPhase::attemptHoist): * dfg/DFGLoopPreHeaderCreationPhase.cpp: (JSC::DFG::createPreHeader): (JSC::DFG::LoopPreHeaderCreationPhase::run): * dfg/DFGNaturalLoops.cpp: (JSC::DFG::NaturalLoop::dump): (JSC::DFG::NaturalLoops::NaturalLoops): (JSC::DFG::NaturalLoops::~NaturalLoops): (JSC::DFG::NaturalLoops::loopsOf): (JSC::DFG::NaturalLoops::computeDependencies): Deleted. (JSC::DFG::NaturalLoops::compute): Deleted. * dfg/DFGNaturalLoops.h: (JSC::DFG::NaturalLoops::numLoops): * dfg/DFGNode.h: (JSC::DFG::Node::SuccessorsIterable::end): (JSC::DFG::Node::SuccessorsIterable::size): (JSC::DFG::Node::SuccessorsIterable::at): (JSC::DFG::Node::SuccessorsIterable::operator[]): * dfg/DFGOSREntrypointCreationPhase.cpp: (JSC::DFG::OSREntrypointCreationPhase::run): * dfg/DFGObjectAllocationSinkingPhase.cpp: * dfg/DFGPlan.cpp: (JSC::DFG::Plan::compileInThreadImpl): * dfg/DFGPrePostNumbering.cpp: (JSC::DFG::PrePostNumbering::PrePostNumbering): (JSC::DFG::PrePostNumbering::~PrePostNumbering): (JSC::DFG::PrePostNumbering::compute): Deleted. * dfg/DFGPrePostNumbering.h: (JSC::DFG::PrePostNumbering::preNumber): (JSC::DFG::PrePostNumbering::postNumber): * dfg/DFGPutStackSinkingPhase.cpp: * dfg/DFGSSACalculator.cpp: (JSC::DFG::SSACalculator::nonLocalReachingDef): (JSC::DFG::SSACalculator::reachingDefAtTail): * dfg/DFGSSACalculator.h: (JSC::DFG::SSACalculator::computePhis): * dfg/DFGSSAConversionPhase.cpp: (JSC::DFG::SSAConversionPhase::run): * ftl/FTLLink.cpp: (JSC::FTL::link): * ftl/FTLLowerDFGToLLVM.cpp: (JSC::FTL::DFG::LowerDFGToLLVM::lower): (JSC::FTL::DFG::LowerDFGToLLVM::safelyInvalidateAfterTermination): (JSC::FTL::DFG::LowerDFGToLLVM::isValid): Source/WTF: This takes what used to be DFGDominators.h/DFGDominators.cpp and turns it into a generic algorithm that can take any abstract graph. The idea is that you create Dominators<CFG> and pass it a CFG object, which defines the types of graph nodes and methods for getting successors, predecessors, etc. The DFG now defines a class called CFG, which is a wrapper for DFG::Graph that conforms to the thing that wtf/Dominators.h expects. When doing things to graphs, it's common to refer to the things in the graph as "nodes". Because I intend to reuse the CFG abstraction with many graph algorithms, that abstraction uses the term "node" to refer to a DFG basic block. But in Dominators, the method and variable names still use "block". This is because although Dominators are applicable to any kind of directed graph, it's super unlikely that we will ever use them for anything but compilers. Indeed, the only reason why I'm factoring them out of the DFG is so that I can use them with B3 and Air. This has the nice side effect that a user of WTF::Dominators<JSC::DFG::CFG> will see familiar terminology like "blocksStrictlyDominatedBy(...)" instead of "nodesStrictlyDominatedBy(...)", which would be super confusing. Overall, wtf/Dominators.h is a combination of what used to be in DFGDominators.h, DFGDominators.cpp, DFGNaiveDominators.h, and DFGNaiveDominators.cpp. I only changed code when I had to in order to make it generic. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/Dominators.h: Added. (WTF::Dominators::Dominators): (WTF::Dominators::compute): (WTF::Dominators::strictlyDominates): (WTF::Dominators::dominates): (WTF::Dominators::immediateDominatorOf): (WTF::Dominators::forAllStrictDominatorsOf): (WTF::Dominators::forAllDominatorsOf): (WTF::Dominators::forAllBlocksStrictlyDominatedBy): (WTF::Dominators::forAllBlocksDominatedBy): (WTF::Dominators::strictDominatorsOf): (WTF::Dominators::dominatorsOf): (WTF::Dominators::blocksStrictlyDominatedBy): (WTF::Dominators::blocksDominatedBy): (WTF::Dominators::forAllBlocksInDominanceFrontierOf): (WTF::Dominators::dominanceFrontierOf): (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOf): (WTF::Dominators::forAllBlocksInPrunedIteratedDominanceFrontierOf): (WTF::Dominators::iteratedDominanceFrontierOf): (WTF::Dominators::dump): (WTF::Dominators::LengauerTarjan::LengauerTarjan): (WTF::Dominators::LengauerTarjan::compute): (WTF::Dominators::LengauerTarjan::immediateDominator): (WTF::Dominators::LengauerTarjan::computeDepthFirstPreNumbering): (WTF::Dominators::LengauerTarjan::computeSemiDominatorsAndImplicitImmediateDominators): (WTF::Dominators::LengauerTarjan::computeExplicitImmediateDominators): (WTF::Dominators::LengauerTarjan::link): (WTF::Dominators::LengauerTarjan::eval): (WTF::Dominators::LengauerTarjan::compress): (WTF::Dominators::LengauerTarjan::BlockData::BlockData): (WTF::Dominators::NaiveDominators::NaiveDominators): (WTF::Dominators::NaiveDominators::dominates): (WTF::Dominators::NaiveDominators::dump): (WTF::Dominators::NaiveDominators::pruneDominators): (WTF::Dominators::ValidationContext::ValidationContext): (WTF::Dominators::ValidationContext::reportError): (WTF::Dominators::ValidationContext::handleErrors): (WTF::Dominators::naiveDominates): (WTF::Dominators::forAllBlocksInDominanceFrontierOfImpl): (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOfImpl): (WTF::Dominators::BlockData::BlockData): Canonical link: https://commits.webkit.org/168962@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@191870 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-11-02 00:48:03 +00:00
}
void dump(PrintStream& out) const
{
for (unsigned blockIndex = 0; blockIndex < m_graph.numNodes(); ++blockIndex) {
typename Graph::Node block = m_graph.node(blockIndex);
if (!block)
continue;
out.print(" Block ", m_graph.dump(block), ":");
for (unsigned otherIndex = 0; otherIndex < m_graph.numNodes(); ++otherIndex) {
if (!dominates(m_graph.index(block), otherIndex))
continue;
out.print(" ", m_graph.dump(m_graph.node(otherIndex)));
}
out.print("\n");
}
}
private:
bool pruneDominators(unsigned idx)
{
typename Graph::Node block = m_graph.node(idx);
if (!block || !m_graph.predecessors(block).size())
return false;
// Find the intersection of dom(preds).
FastBitVector should have efficient and easy-to-use vector-vector operations https://bugs.webkit.org/show_bug.cgi?id=161847 Reviewed by Saam Barati. Source/JavaScriptCore: Adapt existing users of FastBitVector to the new API. * bytecode/BytecodeLivenessAnalysis.cpp: (JSC::BytecodeLivenessAnalysis::computeKills): (JSC::BytecodeLivenessAnalysis::dumpResults): * bytecode/BytecodeLivenessAnalysisInlines.h: (JSC::operandThatIsNotAlwaysLiveIsLive): (JSC::BytecodeLivenessPropagation<DerivedAnalysis>::stepOverInstruction): (JSC::BytecodeLivenessPropagation<DerivedAnalysis>::runLivenessFixpoint): * bytecode/CodeBlock.cpp: (JSC::CodeBlock::validate): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::flushForTerminal): * dfg/DFGForAllKills.h: (JSC::DFG::forAllKilledOperands): * dfg/DFGGraph.h: (JSC::DFG::Graph::forAllLocalsLiveInBytecode): * dfg/DFGLiveCatchVariablePreservationPhase.cpp: (JSC::DFG::LiveCatchVariablePreservationPhase::willCatchException): (JSC::DFG::LiveCatchVariablePreservationPhase::handleBlock): * dfg/DFGNaturalLoops.cpp: (JSC::DFG::NaturalLoops::NaturalLoops): * dfg/DFGPlan.cpp: (JSC::DFG::Plan::cleanMustHandleValuesIfNecessary): Source/WTF: FastBitVector is a bitvector representation that supports manual dynamic resizing and is optimized for speed, not space. (BitVector supports automatic dynamic resizing and is optimized for space, while Bitmap is sized statically and is optimized for both speed and space.) This change greatly increases the power of FastBitVector. We will use these new powers for changing the JSC GC to use FastBitVectors to track sets of MarkedBlocks (bug 161581) instead of using a combination of Vectors and doubly-linked lists. This change splits FastBitVector into two parts: - A thing that manages the storage of a bitvector: a uint32_t array and a size_t numBits. We call this the word view. - A thing that takes some kind of abstract array of uint32_t's and does bitvector operations to it. We call this the FastBitVectorImpl. FastBitVectorImpl and word views are immutable. The FastBitVector class is a subclass of FastBitVectorImpl specialized on a word view that owns its words and has additional support for mutable operations. Doing this allows us to efficiently support things like this without any unnecessary memory allocation or copying: FastBitVector a, b, c; // Assume that there is code to initialize these. a &= b | ~c; Previously, this kind of operation would not be efficient, because "~c" would have to create a whole new FastBitVector. But now, it just returns a FastBitVectorImpl whose underlying word view bitnots (~) its words on the fly. Using template magic, this can get pretty complex. For example "b | ~c" returns a FastBitVectorImpl that wraps a word view whose implementation of WordView::word(size_t index) is something like: uint32_t word(size_t index) { return b.m_words.word(index) | ~c.m_words.word(index); } FastBitVectorImpl supports all of the fast bulk bitvector operations, like forEachSetBit(), bitCount(), etc. So, when you say "a &= b | ~c", the actual implementation is going to run these bit operations on word granularity directly over the storage inside a, b, c. The use of operator overloading is worth explaining a bit. Previously, FastBitVector avoided operator overloading. For example, the &= operation was called filter(). I think that this was a pretty good approach at the time. I tried using non-operator methods in this FastBitVector rewrite, but I found it very odd to say things like: a.filter(b.bitOr(c.bitNot())); I think that it's harder to see what is going on here, then using operators, because infix notation is always better. * WTF.xcodeproj/project.pbxproj: * wtf/BitVector.h: (WTF::BitVector::findBitInWord): Deleted. * wtf/CMakeLists.txt: * wtf/Dominators.h: (WTF::Dominators::NaiveDominators::NaiveDominators): (WTF::Dominators::NaiveDominators::dominates): (WTF::Dominators::NaiveDominators::pruneDominators): * wtf/FastBitVector.cpp: Removed. * wtf/FastBitVector.h: (WTF::fastBitVectorArrayLength): (WTF::FastBitVectorWordView::FastBitVectorWordView): (WTF::FastBitVectorWordView::numBits): (WTF::FastBitVectorWordView::word): (WTF::FastBitVectorWordOwner::FastBitVectorWordOwner): (WTF::FastBitVectorWordOwner::~FastBitVectorWordOwner): (WTF::FastBitVectorWordOwner::view): (WTF::FastBitVectorWordOwner::operator=): (WTF::FastBitVectorWordOwner::setAll): (WTF::FastBitVectorWordOwner::clearAll): (WTF::FastBitVectorWordOwner::set): (WTF::FastBitVectorWordOwner::numBits): (WTF::FastBitVectorWordOwner::arrayLength): (WTF::FastBitVectorWordOwner::resize): (WTF::FastBitVectorWordOwner::word): (WTF::FastBitVectorWordOwner::words): (WTF::FastBitVectorAndWords::FastBitVectorAndWords): (WTF::FastBitVectorAndWords::view): (WTF::FastBitVectorAndWords::numBits): (WTF::FastBitVectorAndWords::word): (WTF::FastBitVectorOrWords::FastBitVectorOrWords): (WTF::FastBitVectorOrWords::view): (WTF::FastBitVectorOrWords::numBits): (WTF::FastBitVectorOrWords::word): (WTF::FastBitVectorNotWords::FastBitVectorNotWords): (WTF::FastBitVectorNotWords::view): (WTF::FastBitVectorNotWords::numBits): (WTF::FastBitVectorNotWords::word): (WTF::FastBitVectorImpl::FastBitVectorImpl): (WTF::FastBitVectorImpl::numBits): (WTF::FastBitVectorImpl::size): (WTF::FastBitVectorImpl::arrayLength): (WTF::FastBitVectorImpl::operator==): (WTF::FastBitVectorImpl::operator!=): (WTF::FastBitVectorImpl::at): (WTF::FastBitVectorImpl::operator[]): (WTF::FastBitVectorImpl::bitCount): (WTF::FastBitVectorImpl::operator&): (WTF::FastBitVectorImpl::operator|): (WTF::FastBitVectorImpl::operator~): (WTF::FastBitVectorImpl::forEachSetBit): (WTF::FastBitVectorImpl::forEachClearBit): (WTF::FastBitVectorImpl::forEachBit): (WTF::FastBitVectorImpl::findBit): (WTF::FastBitVectorImpl::findSetBit): (WTF::FastBitVectorImpl::findClearBit): (WTF::FastBitVectorImpl::dump): (WTF::FastBitVectorImpl::atImpl): (WTF::FastBitVector::FastBitVector): (WTF::FastBitVector::operator=): (WTF::FastBitVector::resize): (WTF::FastBitVector::setAll): (WTF::FastBitVector::clearAll): (WTF::FastBitVector::setAndCheck): (WTF::FastBitVector::operator|=): (WTF::FastBitVector::operator&=): (WTF::FastBitVector::at): (WTF::FastBitVector::operator[]): (WTF::FastBitVector::BitReference::BitReference): (WTF::FastBitVector::BitReference::operator bool): (WTF::FastBitVector::BitReference::operator=): (WTF::FastBitVector::~FastBitVector): Deleted. (WTF::FastBitVector::numBits): Deleted. (WTF::FastBitVector::set): Deleted. (WTF::FastBitVector::equals): Deleted. (WTF::FastBitVector::merge): Deleted. (WTF::FastBitVector::filter): Deleted. (WTF::FastBitVector::exclude): Deleted. (WTF::FastBitVector::clear): Deleted. (WTF::FastBitVector::get): Deleted. (WTF::FastBitVector::bitCount): Deleted. (WTF::FastBitVector::forEachSetBit): Deleted. (WTF::FastBitVector::arrayLength): Deleted. * wtf/StdLibExtras.h: (WTF::findBitInWord): Canonical link: https://commits.webkit.org/180007@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205794 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-12 04:03:36 +00:00
m_scratch = m_results[m_graph.index(m_graph.predecessors(block)[0])];
Dominators should be factored out of the DFG https://bugs.webkit.org/show_bug.cgi?id=150764 Reviewed by Geoffrey Garen. Source/JavaScriptCore: Factored DFGDominators.h/DFGDominators.cpp into WTF. To do this, I made two changes to the DFG: 1) DFG now has a CFG abstraction called DFG::CFG. The cool thing about this is that in the future if we wanted to support inverted dominators, we could do it by just creating a DFG::BackwardCFG. 2) Got rid of DFG::Analysis. From now on, an Analysis being invalidated is expressed by the DFG::Graph having a null pointer for that analysis. When we "run" the analysis, we just instantiate it. This makes it much more natural to integrate WTF::Dominators into the DFG. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * dfg/DFGAnalysis.h: Removed. * dfg/DFGCFG.h: Added. (JSC::DFG::CFG::CFG): (JSC::DFG::CFG::root): (JSC::DFG::CFG::newMap<T>): (JSC::DFG::CFG::successors): (JSC::DFG::CFG::predecessors): (JSC::DFG::CFG::index): (JSC::DFG::CFG::node): (JSC::DFG::CFG::numNodes): (JSC::DFG::CFG::dump): * dfg/DFGCSEPhase.cpp: * dfg/DFGDisassembler.cpp: (JSC::DFG::Disassembler::createDumpList): * dfg/DFGDominators.cpp: Removed. * dfg/DFGDominators.h: (JSC::DFG::Dominators::Dominators): (JSC::DFG::Dominators::strictlyDominates): Deleted. (JSC::DFG::Dominators::dominates): Deleted. (JSC::DFG::Dominators::immediateDominatorOf): Deleted. (JSC::DFG::Dominators::forAllStrictDominatorsOf): Deleted. (JSC::DFG::Dominators::forAllDominatorsOf): Deleted. (JSC::DFG::Dominators::forAllBlocksStrictlyDominatedBy): Deleted. (JSC::DFG::Dominators::forAllBlocksDominatedBy): Deleted. (JSC::DFG::Dominators::forAllBlocksInDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInIteratedDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInPrunedIteratedDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInDominanceFrontierOfImpl): Deleted. (JSC::DFG::Dominators::forAllBlocksInIteratedDominanceFrontierOfImpl): Deleted. (JSC::DFG::Dominators::BlockData::BlockData): Deleted. * dfg/DFGEdgeDominates.h: (JSC::DFG::EdgeDominates::operator()): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::Graph): (JSC::DFG::Graph::dumpBlockHeader): (JSC::DFG::Graph::invalidateCFG): (JSC::DFG::Graph::substituteGetLocal): (JSC::DFG::Graph::handleAssertionFailure): (JSC::DFG::Graph::ensureDominators): (JSC::DFG::Graph::ensurePrePostNumbering): (JSC::DFG::Graph::ensureNaturalLoops): (JSC::DFG::Graph::valueProfileFor): * dfg/DFGGraph.h: (JSC::DFG::Graph::hasDebuggerEnabled): * dfg/DFGLICMPhase.cpp: (JSC::DFG::LICMPhase::run): (JSC::DFG::LICMPhase::attemptHoist): * dfg/DFGLoopPreHeaderCreationPhase.cpp: (JSC::DFG::createPreHeader): (JSC::DFG::LoopPreHeaderCreationPhase::run): * dfg/DFGNaturalLoops.cpp: (JSC::DFG::NaturalLoop::dump): (JSC::DFG::NaturalLoops::NaturalLoops): (JSC::DFG::NaturalLoops::~NaturalLoops): (JSC::DFG::NaturalLoops::loopsOf): (JSC::DFG::NaturalLoops::computeDependencies): Deleted. (JSC::DFG::NaturalLoops::compute): Deleted. * dfg/DFGNaturalLoops.h: (JSC::DFG::NaturalLoops::numLoops): * dfg/DFGNode.h: (JSC::DFG::Node::SuccessorsIterable::end): (JSC::DFG::Node::SuccessorsIterable::size): (JSC::DFG::Node::SuccessorsIterable::at): (JSC::DFG::Node::SuccessorsIterable::operator[]): * dfg/DFGOSREntrypointCreationPhase.cpp: (JSC::DFG::OSREntrypointCreationPhase::run): * dfg/DFGObjectAllocationSinkingPhase.cpp: * dfg/DFGPlan.cpp: (JSC::DFG::Plan::compileInThreadImpl): * dfg/DFGPrePostNumbering.cpp: (JSC::DFG::PrePostNumbering::PrePostNumbering): (JSC::DFG::PrePostNumbering::~PrePostNumbering): (JSC::DFG::PrePostNumbering::compute): Deleted. * dfg/DFGPrePostNumbering.h: (JSC::DFG::PrePostNumbering::preNumber): (JSC::DFG::PrePostNumbering::postNumber): * dfg/DFGPutStackSinkingPhase.cpp: * dfg/DFGSSACalculator.cpp: (JSC::DFG::SSACalculator::nonLocalReachingDef): (JSC::DFG::SSACalculator::reachingDefAtTail): * dfg/DFGSSACalculator.h: (JSC::DFG::SSACalculator::computePhis): * dfg/DFGSSAConversionPhase.cpp: (JSC::DFG::SSAConversionPhase::run): * ftl/FTLLink.cpp: (JSC::FTL::link): * ftl/FTLLowerDFGToLLVM.cpp: (JSC::FTL::DFG::LowerDFGToLLVM::lower): (JSC::FTL::DFG::LowerDFGToLLVM::safelyInvalidateAfterTermination): (JSC::FTL::DFG::LowerDFGToLLVM::isValid): Source/WTF: This takes what used to be DFGDominators.h/DFGDominators.cpp and turns it into a generic algorithm that can take any abstract graph. The idea is that you create Dominators<CFG> and pass it a CFG object, which defines the types of graph nodes and methods for getting successors, predecessors, etc. The DFG now defines a class called CFG, which is a wrapper for DFG::Graph that conforms to the thing that wtf/Dominators.h expects. When doing things to graphs, it's common to refer to the things in the graph as "nodes". Because I intend to reuse the CFG abstraction with many graph algorithms, that abstraction uses the term "node" to refer to a DFG basic block. But in Dominators, the method and variable names still use "block". This is because although Dominators are applicable to any kind of directed graph, it's super unlikely that we will ever use them for anything but compilers. Indeed, the only reason why I'm factoring them out of the DFG is so that I can use them with B3 and Air. This has the nice side effect that a user of WTF::Dominators<JSC::DFG::CFG> will see familiar terminology like "blocksStrictlyDominatedBy(...)" instead of "nodesStrictlyDominatedBy(...)", which would be super confusing. Overall, wtf/Dominators.h is a combination of what used to be in DFGDominators.h, DFGDominators.cpp, DFGNaiveDominators.h, and DFGNaiveDominators.cpp. I only changed code when I had to in order to make it generic. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/Dominators.h: Added. (WTF::Dominators::Dominators): (WTF::Dominators::compute): (WTF::Dominators::strictlyDominates): (WTF::Dominators::dominates): (WTF::Dominators::immediateDominatorOf): (WTF::Dominators::forAllStrictDominatorsOf): (WTF::Dominators::forAllDominatorsOf): (WTF::Dominators::forAllBlocksStrictlyDominatedBy): (WTF::Dominators::forAllBlocksDominatedBy): (WTF::Dominators::strictDominatorsOf): (WTF::Dominators::dominatorsOf): (WTF::Dominators::blocksStrictlyDominatedBy): (WTF::Dominators::blocksDominatedBy): (WTF::Dominators::forAllBlocksInDominanceFrontierOf): (WTF::Dominators::dominanceFrontierOf): (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOf): (WTF::Dominators::forAllBlocksInPrunedIteratedDominanceFrontierOf): (WTF::Dominators::iteratedDominanceFrontierOf): (WTF::Dominators::dump): (WTF::Dominators::LengauerTarjan::LengauerTarjan): (WTF::Dominators::LengauerTarjan::compute): (WTF::Dominators::LengauerTarjan::immediateDominator): (WTF::Dominators::LengauerTarjan::computeDepthFirstPreNumbering): (WTF::Dominators::LengauerTarjan::computeSemiDominatorsAndImplicitImmediateDominators): (WTF::Dominators::LengauerTarjan::computeExplicitImmediateDominators): (WTF::Dominators::LengauerTarjan::link): (WTF::Dominators::LengauerTarjan::eval): (WTF::Dominators::LengauerTarjan::compress): (WTF::Dominators::LengauerTarjan::BlockData::BlockData): (WTF::Dominators::NaiveDominators::NaiveDominators): (WTF::Dominators::NaiveDominators::dominates): (WTF::Dominators::NaiveDominators::dump): (WTF::Dominators::NaiveDominators::pruneDominators): (WTF::Dominators::ValidationContext::ValidationContext): (WTF::Dominators::ValidationContext::reportError): (WTF::Dominators::ValidationContext::handleErrors): (WTF::Dominators::naiveDominates): (WTF::Dominators::forAllBlocksInDominanceFrontierOfImpl): (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOfImpl): (WTF::Dominators::BlockData::BlockData): Canonical link: https://commits.webkit.org/168962@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@191870 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-11-02 00:48:03 +00:00
for (unsigned j = m_graph.predecessors(block).size(); j-- > 1;)
FastBitVector should have efficient and easy-to-use vector-vector operations https://bugs.webkit.org/show_bug.cgi?id=161847 Reviewed by Saam Barati. Source/JavaScriptCore: Adapt existing users of FastBitVector to the new API. * bytecode/BytecodeLivenessAnalysis.cpp: (JSC::BytecodeLivenessAnalysis::computeKills): (JSC::BytecodeLivenessAnalysis::dumpResults): * bytecode/BytecodeLivenessAnalysisInlines.h: (JSC::operandThatIsNotAlwaysLiveIsLive): (JSC::BytecodeLivenessPropagation<DerivedAnalysis>::stepOverInstruction): (JSC::BytecodeLivenessPropagation<DerivedAnalysis>::runLivenessFixpoint): * bytecode/CodeBlock.cpp: (JSC::CodeBlock::validate): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::flushForTerminal): * dfg/DFGForAllKills.h: (JSC::DFG::forAllKilledOperands): * dfg/DFGGraph.h: (JSC::DFG::Graph::forAllLocalsLiveInBytecode): * dfg/DFGLiveCatchVariablePreservationPhase.cpp: (JSC::DFG::LiveCatchVariablePreservationPhase::willCatchException): (JSC::DFG::LiveCatchVariablePreservationPhase::handleBlock): * dfg/DFGNaturalLoops.cpp: (JSC::DFG::NaturalLoops::NaturalLoops): * dfg/DFGPlan.cpp: (JSC::DFG::Plan::cleanMustHandleValuesIfNecessary): Source/WTF: FastBitVector is a bitvector representation that supports manual dynamic resizing and is optimized for speed, not space. (BitVector supports automatic dynamic resizing and is optimized for space, while Bitmap is sized statically and is optimized for both speed and space.) This change greatly increases the power of FastBitVector. We will use these new powers for changing the JSC GC to use FastBitVectors to track sets of MarkedBlocks (bug 161581) instead of using a combination of Vectors and doubly-linked lists. This change splits FastBitVector into two parts: - A thing that manages the storage of a bitvector: a uint32_t array and a size_t numBits. We call this the word view. - A thing that takes some kind of abstract array of uint32_t's and does bitvector operations to it. We call this the FastBitVectorImpl. FastBitVectorImpl and word views are immutable. The FastBitVector class is a subclass of FastBitVectorImpl specialized on a word view that owns its words and has additional support for mutable operations. Doing this allows us to efficiently support things like this without any unnecessary memory allocation or copying: FastBitVector a, b, c; // Assume that there is code to initialize these. a &= b | ~c; Previously, this kind of operation would not be efficient, because "~c" would have to create a whole new FastBitVector. But now, it just returns a FastBitVectorImpl whose underlying word view bitnots (~) its words on the fly. Using template magic, this can get pretty complex. For example "b | ~c" returns a FastBitVectorImpl that wraps a word view whose implementation of WordView::word(size_t index) is something like: uint32_t word(size_t index) { return b.m_words.word(index) | ~c.m_words.word(index); } FastBitVectorImpl supports all of the fast bulk bitvector operations, like forEachSetBit(), bitCount(), etc. So, when you say "a &= b | ~c", the actual implementation is going to run these bit operations on word granularity directly over the storage inside a, b, c. The use of operator overloading is worth explaining a bit. Previously, FastBitVector avoided operator overloading. For example, the &= operation was called filter(). I think that this was a pretty good approach at the time. I tried using non-operator methods in this FastBitVector rewrite, but I found it very odd to say things like: a.filter(b.bitOr(c.bitNot())); I think that it's harder to see what is going on here, then using operators, because infix notation is always better. * WTF.xcodeproj/project.pbxproj: * wtf/BitVector.h: (WTF::BitVector::findBitInWord): Deleted. * wtf/CMakeLists.txt: * wtf/Dominators.h: (WTF::Dominators::NaiveDominators::NaiveDominators): (WTF::Dominators::NaiveDominators::dominates): (WTF::Dominators::NaiveDominators::pruneDominators): * wtf/FastBitVector.cpp: Removed. * wtf/FastBitVector.h: (WTF::fastBitVectorArrayLength): (WTF::FastBitVectorWordView::FastBitVectorWordView): (WTF::FastBitVectorWordView::numBits): (WTF::FastBitVectorWordView::word): (WTF::FastBitVectorWordOwner::FastBitVectorWordOwner): (WTF::FastBitVectorWordOwner::~FastBitVectorWordOwner): (WTF::FastBitVectorWordOwner::view): (WTF::FastBitVectorWordOwner::operator=): (WTF::FastBitVectorWordOwner::setAll): (WTF::FastBitVectorWordOwner::clearAll): (WTF::FastBitVectorWordOwner::set): (WTF::FastBitVectorWordOwner::numBits): (WTF::FastBitVectorWordOwner::arrayLength): (WTF::FastBitVectorWordOwner::resize): (WTF::FastBitVectorWordOwner::word): (WTF::FastBitVectorWordOwner::words): (WTF::FastBitVectorAndWords::FastBitVectorAndWords): (WTF::FastBitVectorAndWords::view): (WTF::FastBitVectorAndWords::numBits): (WTF::FastBitVectorAndWords::word): (WTF::FastBitVectorOrWords::FastBitVectorOrWords): (WTF::FastBitVectorOrWords::view): (WTF::FastBitVectorOrWords::numBits): (WTF::FastBitVectorOrWords::word): (WTF::FastBitVectorNotWords::FastBitVectorNotWords): (WTF::FastBitVectorNotWords::view): (WTF::FastBitVectorNotWords::numBits): (WTF::FastBitVectorNotWords::word): (WTF::FastBitVectorImpl::FastBitVectorImpl): (WTF::FastBitVectorImpl::numBits): (WTF::FastBitVectorImpl::size): (WTF::FastBitVectorImpl::arrayLength): (WTF::FastBitVectorImpl::operator==): (WTF::FastBitVectorImpl::operator!=): (WTF::FastBitVectorImpl::at): (WTF::FastBitVectorImpl::operator[]): (WTF::FastBitVectorImpl::bitCount): (WTF::FastBitVectorImpl::operator&): (WTF::FastBitVectorImpl::operator|): (WTF::FastBitVectorImpl::operator~): (WTF::FastBitVectorImpl::forEachSetBit): (WTF::FastBitVectorImpl::forEachClearBit): (WTF::FastBitVectorImpl::forEachBit): (WTF::FastBitVectorImpl::findBit): (WTF::FastBitVectorImpl::findSetBit): (WTF::FastBitVectorImpl::findClearBit): (WTF::FastBitVectorImpl::dump): (WTF::FastBitVectorImpl::atImpl): (WTF::FastBitVector::FastBitVector): (WTF::FastBitVector::operator=): (WTF::FastBitVector::resize): (WTF::FastBitVector::setAll): (WTF::FastBitVector::clearAll): (WTF::FastBitVector::setAndCheck): (WTF::FastBitVector::operator|=): (WTF::FastBitVector::operator&=): (WTF::FastBitVector::at): (WTF::FastBitVector::operator[]): (WTF::FastBitVector::BitReference::BitReference): (WTF::FastBitVector::BitReference::operator bool): (WTF::FastBitVector::BitReference::operator=): (WTF::FastBitVector::~FastBitVector): Deleted. (WTF::FastBitVector::numBits): Deleted. (WTF::FastBitVector::set): Deleted. (WTF::FastBitVector::equals): Deleted. (WTF::FastBitVector::merge): Deleted. (WTF::FastBitVector::filter): Deleted. (WTF::FastBitVector::exclude): Deleted. (WTF::FastBitVector::clear): Deleted. (WTF::FastBitVector::get): Deleted. (WTF::FastBitVector::bitCount): Deleted. (WTF::FastBitVector::forEachSetBit): Deleted. (WTF::FastBitVector::arrayLength): Deleted. * wtf/StdLibExtras.h: (WTF::findBitInWord): Canonical link: https://commits.webkit.org/180007@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205794 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-12 04:03:36 +00:00
m_scratch &= m_results[m_graph.index(m_graph.predecessors(block)[j])];
Dominators should be factored out of the DFG https://bugs.webkit.org/show_bug.cgi?id=150764 Reviewed by Geoffrey Garen. Source/JavaScriptCore: Factored DFGDominators.h/DFGDominators.cpp into WTF. To do this, I made two changes to the DFG: 1) DFG now has a CFG abstraction called DFG::CFG. The cool thing about this is that in the future if we wanted to support inverted dominators, we could do it by just creating a DFG::BackwardCFG. 2) Got rid of DFG::Analysis. From now on, an Analysis being invalidated is expressed by the DFG::Graph having a null pointer for that analysis. When we "run" the analysis, we just instantiate it. This makes it much more natural to integrate WTF::Dominators into the DFG. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * dfg/DFGAnalysis.h: Removed. * dfg/DFGCFG.h: Added. (JSC::DFG::CFG::CFG): (JSC::DFG::CFG::root): (JSC::DFG::CFG::newMap<T>): (JSC::DFG::CFG::successors): (JSC::DFG::CFG::predecessors): (JSC::DFG::CFG::index): (JSC::DFG::CFG::node): (JSC::DFG::CFG::numNodes): (JSC::DFG::CFG::dump): * dfg/DFGCSEPhase.cpp: * dfg/DFGDisassembler.cpp: (JSC::DFG::Disassembler::createDumpList): * dfg/DFGDominators.cpp: Removed. * dfg/DFGDominators.h: (JSC::DFG::Dominators::Dominators): (JSC::DFG::Dominators::strictlyDominates): Deleted. (JSC::DFG::Dominators::dominates): Deleted. (JSC::DFG::Dominators::immediateDominatorOf): Deleted. (JSC::DFG::Dominators::forAllStrictDominatorsOf): Deleted. (JSC::DFG::Dominators::forAllDominatorsOf): Deleted. (JSC::DFG::Dominators::forAllBlocksStrictlyDominatedBy): Deleted. (JSC::DFG::Dominators::forAllBlocksDominatedBy): Deleted. (JSC::DFG::Dominators::forAllBlocksInDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInIteratedDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInPrunedIteratedDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInDominanceFrontierOfImpl): Deleted. (JSC::DFG::Dominators::forAllBlocksInIteratedDominanceFrontierOfImpl): Deleted. (JSC::DFG::Dominators::BlockData::BlockData): Deleted. * dfg/DFGEdgeDominates.h: (JSC::DFG::EdgeDominates::operator()): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::Graph): (JSC::DFG::Graph::dumpBlockHeader): (JSC::DFG::Graph::invalidateCFG): (JSC::DFG::Graph::substituteGetLocal): (JSC::DFG::Graph::handleAssertionFailure): (JSC::DFG::Graph::ensureDominators): (JSC::DFG::Graph::ensurePrePostNumbering): (JSC::DFG::Graph::ensureNaturalLoops): (JSC::DFG::Graph::valueProfileFor): * dfg/DFGGraph.h: (JSC::DFG::Graph::hasDebuggerEnabled): * dfg/DFGLICMPhase.cpp: (JSC::DFG::LICMPhase::run): (JSC::DFG::LICMPhase::attemptHoist): * dfg/DFGLoopPreHeaderCreationPhase.cpp: (JSC::DFG::createPreHeader): (JSC::DFG::LoopPreHeaderCreationPhase::run): * dfg/DFGNaturalLoops.cpp: (JSC::DFG::NaturalLoop::dump): (JSC::DFG::NaturalLoops::NaturalLoops): (JSC::DFG::NaturalLoops::~NaturalLoops): (JSC::DFG::NaturalLoops::loopsOf): (JSC::DFG::NaturalLoops::computeDependencies): Deleted. (JSC::DFG::NaturalLoops::compute): Deleted. * dfg/DFGNaturalLoops.h: (JSC::DFG::NaturalLoops::numLoops): * dfg/DFGNode.h: (JSC::DFG::Node::SuccessorsIterable::end): (JSC::DFG::Node::SuccessorsIterable::size): (JSC::DFG::Node::SuccessorsIterable::at): (JSC::DFG::Node::SuccessorsIterable::operator[]): * dfg/DFGOSREntrypointCreationPhase.cpp: (JSC::DFG::OSREntrypointCreationPhase::run): * dfg/DFGObjectAllocationSinkingPhase.cpp: * dfg/DFGPlan.cpp: (JSC::DFG::Plan::compileInThreadImpl): * dfg/DFGPrePostNumbering.cpp: (JSC::DFG::PrePostNumbering::PrePostNumbering): (JSC::DFG::PrePostNumbering::~PrePostNumbering): (JSC::DFG::PrePostNumbering::compute): Deleted. * dfg/DFGPrePostNumbering.h: (JSC::DFG::PrePostNumbering::preNumber): (JSC::DFG::PrePostNumbering::postNumber): * dfg/DFGPutStackSinkingPhase.cpp: * dfg/DFGSSACalculator.cpp: (JSC::DFG::SSACalculator::nonLocalReachingDef): (JSC::DFG::SSACalculator::reachingDefAtTail): * dfg/DFGSSACalculator.h: (JSC::DFG::SSACalculator::computePhis): * dfg/DFGSSAConversionPhase.cpp: (JSC::DFG::SSAConversionPhase::run): * ftl/FTLLink.cpp: (JSC::FTL::link): * ftl/FTLLowerDFGToLLVM.cpp: (JSC::FTL::DFG::LowerDFGToLLVM::lower): (JSC::FTL::DFG::LowerDFGToLLVM::safelyInvalidateAfterTermination): (JSC::FTL::DFG::LowerDFGToLLVM::isValid): Source/WTF: This takes what used to be DFGDominators.h/DFGDominators.cpp and turns it into a generic algorithm that can take any abstract graph. The idea is that you create Dominators<CFG> and pass it a CFG object, which defines the types of graph nodes and methods for getting successors, predecessors, etc. The DFG now defines a class called CFG, which is a wrapper for DFG::Graph that conforms to the thing that wtf/Dominators.h expects. When doing things to graphs, it's common to refer to the things in the graph as "nodes". Because I intend to reuse the CFG abstraction with many graph algorithms, that abstraction uses the term "node" to refer to a DFG basic block. But in Dominators, the method and variable names still use "block". This is because although Dominators are applicable to any kind of directed graph, it's super unlikely that we will ever use them for anything but compilers. Indeed, the only reason why I'm factoring them out of the DFG is so that I can use them with B3 and Air. This has the nice side effect that a user of WTF::Dominators<JSC::DFG::CFG> will see familiar terminology like "blocksStrictlyDominatedBy(...)" instead of "nodesStrictlyDominatedBy(...)", which would be super confusing. Overall, wtf/Dominators.h is a combination of what used to be in DFGDominators.h, DFGDominators.cpp, DFGNaiveDominators.h, and DFGNaiveDominators.cpp. I only changed code when I had to in order to make it generic. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/Dominators.h: Added. (WTF::Dominators::Dominators): (WTF::Dominators::compute): (WTF::Dominators::strictlyDominates): (WTF::Dominators::dominates): (WTF::Dominators::immediateDominatorOf): (WTF::Dominators::forAllStrictDominatorsOf): (WTF::Dominators::forAllDominatorsOf): (WTF::Dominators::forAllBlocksStrictlyDominatedBy): (WTF::Dominators::forAllBlocksDominatedBy): (WTF::Dominators::strictDominatorsOf): (WTF::Dominators::dominatorsOf): (WTF::Dominators::blocksStrictlyDominatedBy): (WTF::Dominators::blocksDominatedBy): (WTF::Dominators::forAllBlocksInDominanceFrontierOf): (WTF::Dominators::dominanceFrontierOf): (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOf): (WTF::Dominators::forAllBlocksInPrunedIteratedDominanceFrontierOf): (WTF::Dominators::iteratedDominanceFrontierOf): (WTF::Dominators::dump): (WTF::Dominators::LengauerTarjan::LengauerTarjan): (WTF::Dominators::LengauerTarjan::compute): (WTF::Dominators::LengauerTarjan::immediateDominator): (WTF::Dominators::LengauerTarjan::computeDepthFirstPreNumbering): (WTF::Dominators::LengauerTarjan::computeSemiDominatorsAndImplicitImmediateDominators): (WTF::Dominators::LengauerTarjan::computeExplicitImmediateDominators): (WTF::Dominators::LengauerTarjan::link): (WTF::Dominators::LengauerTarjan::eval): (WTF::Dominators::LengauerTarjan::compress): (WTF::Dominators::LengauerTarjan::BlockData::BlockData): (WTF::Dominators::NaiveDominators::NaiveDominators): (WTF::Dominators::NaiveDominators::dominates): (WTF::Dominators::NaiveDominators::dump): (WTF::Dominators::NaiveDominators::pruneDominators): (WTF::Dominators::ValidationContext::ValidationContext): (WTF::Dominators::ValidationContext::reportError): (WTF::Dominators::ValidationContext::handleErrors): (WTF::Dominators::naiveDominates): (WTF::Dominators::forAllBlocksInDominanceFrontierOfImpl): (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOfImpl): (WTF::Dominators::BlockData::BlockData): Canonical link: https://commits.webkit.org/168962@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@191870 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-11-02 00:48:03 +00:00
// The block is also dominated by itself.
FastBitVector should have efficient and easy-to-use vector-vector operations https://bugs.webkit.org/show_bug.cgi?id=161847 Reviewed by Saam Barati. Source/JavaScriptCore: Adapt existing users of FastBitVector to the new API. * bytecode/BytecodeLivenessAnalysis.cpp: (JSC::BytecodeLivenessAnalysis::computeKills): (JSC::BytecodeLivenessAnalysis::dumpResults): * bytecode/BytecodeLivenessAnalysisInlines.h: (JSC::operandThatIsNotAlwaysLiveIsLive): (JSC::BytecodeLivenessPropagation<DerivedAnalysis>::stepOverInstruction): (JSC::BytecodeLivenessPropagation<DerivedAnalysis>::runLivenessFixpoint): * bytecode/CodeBlock.cpp: (JSC::CodeBlock::validate): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::flushForTerminal): * dfg/DFGForAllKills.h: (JSC::DFG::forAllKilledOperands): * dfg/DFGGraph.h: (JSC::DFG::Graph::forAllLocalsLiveInBytecode): * dfg/DFGLiveCatchVariablePreservationPhase.cpp: (JSC::DFG::LiveCatchVariablePreservationPhase::willCatchException): (JSC::DFG::LiveCatchVariablePreservationPhase::handleBlock): * dfg/DFGNaturalLoops.cpp: (JSC::DFG::NaturalLoops::NaturalLoops): * dfg/DFGPlan.cpp: (JSC::DFG::Plan::cleanMustHandleValuesIfNecessary): Source/WTF: FastBitVector is a bitvector representation that supports manual dynamic resizing and is optimized for speed, not space. (BitVector supports automatic dynamic resizing and is optimized for space, while Bitmap is sized statically and is optimized for both speed and space.) This change greatly increases the power of FastBitVector. We will use these new powers for changing the JSC GC to use FastBitVectors to track sets of MarkedBlocks (bug 161581) instead of using a combination of Vectors and doubly-linked lists. This change splits FastBitVector into two parts: - A thing that manages the storage of a bitvector: a uint32_t array and a size_t numBits. We call this the word view. - A thing that takes some kind of abstract array of uint32_t's and does bitvector operations to it. We call this the FastBitVectorImpl. FastBitVectorImpl and word views are immutable. The FastBitVector class is a subclass of FastBitVectorImpl specialized on a word view that owns its words and has additional support for mutable operations. Doing this allows us to efficiently support things like this without any unnecessary memory allocation or copying: FastBitVector a, b, c; // Assume that there is code to initialize these. a &= b | ~c; Previously, this kind of operation would not be efficient, because "~c" would have to create a whole new FastBitVector. But now, it just returns a FastBitVectorImpl whose underlying word view bitnots (~) its words on the fly. Using template magic, this can get pretty complex. For example "b | ~c" returns a FastBitVectorImpl that wraps a word view whose implementation of WordView::word(size_t index) is something like: uint32_t word(size_t index) { return b.m_words.word(index) | ~c.m_words.word(index); } FastBitVectorImpl supports all of the fast bulk bitvector operations, like forEachSetBit(), bitCount(), etc. So, when you say "a &= b | ~c", the actual implementation is going to run these bit operations on word granularity directly over the storage inside a, b, c. The use of operator overloading is worth explaining a bit. Previously, FastBitVector avoided operator overloading. For example, the &= operation was called filter(). I think that this was a pretty good approach at the time. I tried using non-operator methods in this FastBitVector rewrite, but I found it very odd to say things like: a.filter(b.bitOr(c.bitNot())); I think that it's harder to see what is going on here, then using operators, because infix notation is always better. * WTF.xcodeproj/project.pbxproj: * wtf/BitVector.h: (WTF::BitVector::findBitInWord): Deleted. * wtf/CMakeLists.txt: * wtf/Dominators.h: (WTF::Dominators::NaiveDominators::NaiveDominators): (WTF::Dominators::NaiveDominators::dominates): (WTF::Dominators::NaiveDominators::pruneDominators): * wtf/FastBitVector.cpp: Removed. * wtf/FastBitVector.h: (WTF::fastBitVectorArrayLength): (WTF::FastBitVectorWordView::FastBitVectorWordView): (WTF::FastBitVectorWordView::numBits): (WTF::FastBitVectorWordView::word): (WTF::FastBitVectorWordOwner::FastBitVectorWordOwner): (WTF::FastBitVectorWordOwner::~FastBitVectorWordOwner): (WTF::FastBitVectorWordOwner::view): (WTF::FastBitVectorWordOwner::operator=): (WTF::FastBitVectorWordOwner::setAll): (WTF::FastBitVectorWordOwner::clearAll): (WTF::FastBitVectorWordOwner::set): (WTF::FastBitVectorWordOwner::numBits): (WTF::FastBitVectorWordOwner::arrayLength): (WTF::FastBitVectorWordOwner::resize): (WTF::FastBitVectorWordOwner::word): (WTF::FastBitVectorWordOwner::words): (WTF::FastBitVectorAndWords::FastBitVectorAndWords): (WTF::FastBitVectorAndWords::view): (WTF::FastBitVectorAndWords::numBits): (WTF::FastBitVectorAndWords::word): (WTF::FastBitVectorOrWords::FastBitVectorOrWords): (WTF::FastBitVectorOrWords::view): (WTF::FastBitVectorOrWords::numBits): (WTF::FastBitVectorOrWords::word): (WTF::FastBitVectorNotWords::FastBitVectorNotWords): (WTF::FastBitVectorNotWords::view): (WTF::FastBitVectorNotWords::numBits): (WTF::FastBitVectorNotWords::word): (WTF::FastBitVectorImpl::FastBitVectorImpl): (WTF::FastBitVectorImpl::numBits): (WTF::FastBitVectorImpl::size): (WTF::FastBitVectorImpl::arrayLength): (WTF::FastBitVectorImpl::operator==): (WTF::FastBitVectorImpl::operator!=): (WTF::FastBitVectorImpl::at): (WTF::FastBitVectorImpl::operator[]): (WTF::FastBitVectorImpl::bitCount): (WTF::FastBitVectorImpl::operator&): (WTF::FastBitVectorImpl::operator|): (WTF::FastBitVectorImpl::operator~): (WTF::FastBitVectorImpl::forEachSetBit): (WTF::FastBitVectorImpl::forEachClearBit): (WTF::FastBitVectorImpl::forEachBit): (WTF::FastBitVectorImpl::findBit): (WTF::FastBitVectorImpl::findSetBit): (WTF::FastBitVectorImpl::findClearBit): (WTF::FastBitVectorImpl::dump): (WTF::FastBitVectorImpl::atImpl): (WTF::FastBitVector::FastBitVector): (WTF::FastBitVector::operator=): (WTF::FastBitVector::resize): (WTF::FastBitVector::setAll): (WTF::FastBitVector::clearAll): (WTF::FastBitVector::setAndCheck): (WTF::FastBitVector::operator|=): (WTF::FastBitVector::operator&=): (WTF::FastBitVector::at): (WTF::FastBitVector::operator[]): (WTF::FastBitVector::BitReference::BitReference): (WTF::FastBitVector::BitReference::operator bool): (WTF::FastBitVector::BitReference::operator=): (WTF::FastBitVector::~FastBitVector): Deleted. (WTF::FastBitVector::numBits): Deleted. (WTF::FastBitVector::set): Deleted. (WTF::FastBitVector::equals): Deleted. (WTF::FastBitVector::merge): Deleted. (WTF::FastBitVector::filter): Deleted. (WTF::FastBitVector::exclude): Deleted. (WTF::FastBitVector::clear): Deleted. (WTF::FastBitVector::get): Deleted. (WTF::FastBitVector::bitCount): Deleted. (WTF::FastBitVector::forEachSetBit): Deleted. (WTF::FastBitVector::arrayLength): Deleted. * wtf/StdLibExtras.h: (WTF::findBitInWord): Canonical link: https://commits.webkit.org/180007@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205794 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-09-12 04:03:36 +00:00
m_scratch[idx] = true;
Dominators should be factored out of the DFG https://bugs.webkit.org/show_bug.cgi?id=150764 Reviewed by Geoffrey Garen. Source/JavaScriptCore: Factored DFGDominators.h/DFGDominators.cpp into WTF. To do this, I made two changes to the DFG: 1) DFG now has a CFG abstraction called DFG::CFG. The cool thing about this is that in the future if we wanted to support inverted dominators, we could do it by just creating a DFG::BackwardCFG. 2) Got rid of DFG::Analysis. From now on, an Analysis being invalidated is expressed by the DFG::Graph having a null pointer for that analysis. When we "run" the analysis, we just instantiate it. This makes it much more natural to integrate WTF::Dominators into the DFG. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * dfg/DFGAnalysis.h: Removed. * dfg/DFGCFG.h: Added. (JSC::DFG::CFG::CFG): (JSC::DFG::CFG::root): (JSC::DFG::CFG::newMap<T>): (JSC::DFG::CFG::successors): (JSC::DFG::CFG::predecessors): (JSC::DFG::CFG::index): (JSC::DFG::CFG::node): (JSC::DFG::CFG::numNodes): (JSC::DFG::CFG::dump): * dfg/DFGCSEPhase.cpp: * dfg/DFGDisassembler.cpp: (JSC::DFG::Disassembler::createDumpList): * dfg/DFGDominators.cpp: Removed. * dfg/DFGDominators.h: (JSC::DFG::Dominators::Dominators): (JSC::DFG::Dominators::strictlyDominates): Deleted. (JSC::DFG::Dominators::dominates): Deleted. (JSC::DFG::Dominators::immediateDominatorOf): Deleted. (JSC::DFG::Dominators::forAllStrictDominatorsOf): Deleted. (JSC::DFG::Dominators::forAllDominatorsOf): Deleted. (JSC::DFG::Dominators::forAllBlocksStrictlyDominatedBy): Deleted. (JSC::DFG::Dominators::forAllBlocksDominatedBy): Deleted. (JSC::DFG::Dominators::forAllBlocksInDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInIteratedDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInPrunedIteratedDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInDominanceFrontierOfImpl): Deleted. (JSC::DFG::Dominators::forAllBlocksInIteratedDominanceFrontierOfImpl): Deleted. (JSC::DFG::Dominators::BlockData::BlockData): Deleted. * dfg/DFGEdgeDominates.h: (JSC::DFG::EdgeDominates::operator()): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::Graph): (JSC::DFG::Graph::dumpBlockHeader): (JSC::DFG::Graph::invalidateCFG): (JSC::DFG::Graph::substituteGetLocal): (JSC::DFG::Graph::handleAssertionFailure): (JSC::DFG::Graph::ensureDominators): (JSC::DFG::Graph::ensurePrePostNumbering): (JSC::DFG::Graph::ensureNaturalLoops): (JSC::DFG::Graph::valueProfileFor): * dfg/DFGGraph.h: (JSC::DFG::Graph::hasDebuggerEnabled): * dfg/DFGLICMPhase.cpp: (JSC::DFG::LICMPhase::run): (JSC::DFG::LICMPhase::attemptHoist): * dfg/DFGLoopPreHeaderCreationPhase.cpp: (JSC::DFG::createPreHeader): (JSC::DFG::LoopPreHeaderCreationPhase::run): * dfg/DFGNaturalLoops.cpp: (JSC::DFG::NaturalLoop::dump): (JSC::DFG::NaturalLoops::NaturalLoops): (JSC::DFG::NaturalLoops::~NaturalLoops): (JSC::DFG::NaturalLoops::loopsOf): (JSC::DFG::NaturalLoops::computeDependencies): Deleted. (JSC::DFG::NaturalLoops::compute): Deleted. * dfg/DFGNaturalLoops.h: (JSC::DFG::NaturalLoops::numLoops): * dfg/DFGNode.h: (JSC::DFG::Node::SuccessorsIterable::end): (JSC::DFG::Node::SuccessorsIterable::size): (JSC::DFG::Node::SuccessorsIterable::at): (JSC::DFG::Node::SuccessorsIterable::operator[]): * dfg/DFGOSREntrypointCreationPhase.cpp: (JSC::DFG::OSREntrypointCreationPhase::run): * dfg/DFGObjectAllocationSinkingPhase.cpp: * dfg/DFGPlan.cpp: (JSC::DFG::Plan::compileInThreadImpl): * dfg/DFGPrePostNumbering.cpp: (JSC::DFG::PrePostNumbering::PrePostNumbering): (JSC::DFG::PrePostNumbering::~PrePostNumbering): (JSC::DFG::PrePostNumbering::compute): Deleted. * dfg/DFGPrePostNumbering.h: (JSC::DFG::PrePostNumbering::preNumber): (JSC::DFG::PrePostNumbering::postNumber): * dfg/DFGPutStackSinkingPhase.cpp: * dfg/DFGSSACalculator.cpp: (JSC::DFG::SSACalculator::nonLocalReachingDef): (JSC::DFG::SSACalculator::reachingDefAtTail): * dfg/DFGSSACalculator.h: (JSC::DFG::SSACalculator::computePhis): * dfg/DFGSSAConversionPhase.cpp: (JSC::DFG::SSAConversionPhase::run): * ftl/FTLLink.cpp: (JSC::FTL::link): * ftl/FTLLowerDFGToLLVM.cpp: (JSC::FTL::DFG::LowerDFGToLLVM::lower): (JSC::FTL::DFG::LowerDFGToLLVM::safelyInvalidateAfterTermination): (JSC::FTL::DFG::LowerDFGToLLVM::isValid): Source/WTF: This takes what used to be DFGDominators.h/DFGDominators.cpp and turns it into a generic algorithm that can take any abstract graph. The idea is that you create Dominators<CFG> and pass it a CFG object, which defines the types of graph nodes and methods for getting successors, predecessors, etc. The DFG now defines a class called CFG, which is a wrapper for DFG::Graph that conforms to the thing that wtf/Dominators.h expects. When doing things to graphs, it's common to refer to the things in the graph as "nodes". Because I intend to reuse the CFG abstraction with many graph algorithms, that abstraction uses the term "node" to refer to a DFG basic block. But in Dominators, the method and variable names still use "block". This is because although Dominators are applicable to any kind of directed graph, it's super unlikely that we will ever use them for anything but compilers. Indeed, the only reason why I'm factoring them out of the DFG is so that I can use them with B3 and Air. This has the nice side effect that a user of WTF::Dominators<JSC::DFG::CFG> will see familiar terminology like "blocksStrictlyDominatedBy(...)" instead of "nodesStrictlyDominatedBy(...)", which would be super confusing. Overall, wtf/Dominators.h is a combination of what used to be in DFGDominators.h, DFGDominators.cpp, DFGNaiveDominators.h, and DFGNaiveDominators.cpp. I only changed code when I had to in order to make it generic. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/Dominators.h: Added. (WTF::Dominators::Dominators): (WTF::Dominators::compute): (WTF::Dominators::strictlyDominates): (WTF::Dominators::dominates): (WTF::Dominators::immediateDominatorOf): (WTF::Dominators::forAllStrictDominatorsOf): (WTF::Dominators::forAllDominatorsOf): (WTF::Dominators::forAllBlocksStrictlyDominatedBy): (WTF::Dominators::forAllBlocksDominatedBy): (WTF::Dominators::strictDominatorsOf): (WTF::Dominators::dominatorsOf): (WTF::Dominators::blocksStrictlyDominatedBy): (WTF::Dominators::blocksDominatedBy): (WTF::Dominators::forAllBlocksInDominanceFrontierOf): (WTF::Dominators::dominanceFrontierOf): (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOf): (WTF::Dominators::forAllBlocksInPrunedIteratedDominanceFrontierOf): (WTF::Dominators::iteratedDominanceFrontierOf): (WTF::Dominators::dump): (WTF::Dominators::LengauerTarjan::LengauerTarjan): (WTF::Dominators::LengauerTarjan::compute): (WTF::Dominators::LengauerTarjan::immediateDominator): (WTF::Dominators::LengauerTarjan::computeDepthFirstPreNumbering): (WTF::Dominators::LengauerTarjan::computeSemiDominatorsAndImplicitImmediateDominators): (WTF::Dominators::LengauerTarjan::computeExplicitImmediateDominators): (WTF::Dominators::LengauerTarjan::link): (WTF::Dominators::LengauerTarjan::eval): (WTF::Dominators::LengauerTarjan::compress): (WTF::Dominators::LengauerTarjan::BlockData::BlockData): (WTF::Dominators::NaiveDominators::NaiveDominators): (WTF::Dominators::NaiveDominators::dominates): (WTF::Dominators::NaiveDominators::dump): (WTF::Dominators::NaiveDominators::pruneDominators): (WTF::Dominators::ValidationContext::ValidationContext): (WTF::Dominators::ValidationContext::reportError): (WTF::Dominators::ValidationContext::handleErrors): (WTF::Dominators::naiveDominates): (WTF::Dominators::forAllBlocksInDominanceFrontierOfImpl): (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOfImpl): (WTF::Dominators::BlockData::BlockData): Canonical link: https://commits.webkit.org/168962@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@191870 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-11-02 00:48:03 +00:00
return m_results[idx].setAndCheck(m_scratch);
}
FTL B3 should be able to flag the tag constants as being super important so that B3 can hoist them and Air can force them into registers https://bugs.webkit.org/show_bug.cgi?id=151955 Reviewed by Geoffrey Garen. Source/JavaScriptCore: Taught B3 about the concept of "fast constants". A client of B3 can now tell B3 which constants are super important. B3 will not spill the constant in that case and will ensure that the constant is materialized only once: statically once, and dynamically once per procedure execution. The hoistFastConstants() algorithm in B3MoveConstants.cpp achieves this by first picking the lowest common dominator of all uses of each fast constant, and then picking the materialization point by finding the lowest dominator of that dominator that is tied for lowest block frequency. In practice, the second step ensures that this is the lowest point in the program that is not in a loop (i.e. executes no more than once dynamically per procedure invocation). Taught Air about the concept of "fast tmps". B3 tells Air that a tmp is fast if it is used to hold the materialization of a fast constant. IRC will use the lowest possible spill score for fast tmps. In practice, this ensures that fast constants are never spilled. Added a small snippet of code to FTL::LowerDFGToLLVM that makes both of the tag constants into fast constants. My hope is that this very brute-force heuristic is good enough that we don't have to think about constants for a while. Based on my experience with how LLVM's constant hoisting works out, the heuristic in this patch is going to be tough to beat. LLVM's constant hoisting does good things when it hoists the tags, and usually causes nothing but problems when it hoists anything else. This is because there is no way a low-level compiler to really understand how a constant materialization impacts some operation's contribution to the overall execution time of a procedure. But, in the FTL we know that constant materializations for type checks are a bummer because we are super comfortable placing type checks on the hottest of paths. So those are the last paths where extra instructions should be added by the compiler. On the other hand, all other large constant uses are on relatively cold paths, or paths that are already expensive for other reasons. For example, global variable accesses have to materialize a pointer to the global. But that's not really a big deal, since a load from a global involves first the load itself and then type checks on the result - so probably the constant materialization is just not interesting. A store to a global often involves a store barrier, so the constant materialization is really not interesting. This patch codifies this heuristic in a pact between Air, B3, and the FTL: FTL demands that B3 pin the two tags in registers, and B3 relays the demand to Air. * JavaScriptCore.xcodeproj/project.pbxproj: * b3/B3CFG.h: Added. (JSC::B3::CFG::CFG): (JSC::B3::CFG::root): (JSC::B3::CFG::newMap): (JSC::B3::CFG::successors): (JSC::B3::CFG::predecessors): (JSC::B3::CFG::index): (JSC::B3::CFG::node): (JSC::B3::CFG::numNodes): (JSC::B3::CFG::dump): * b3/B3Dominators.h: Added. (JSC::B3::Dominators::Dominators): * b3/B3IndexMap.h: (JSC::B3::IndexMap::resize): (JSC::B3::IndexMap::size): (JSC::B3::IndexMap::operator[]): * b3/B3LowerMacros.cpp: * b3/B3LowerToAir.cpp: (JSC::B3::Air::LowerToAir::tmp): * b3/B3MoveConstants.cpp: * b3/B3Opcode.h: (JSC::B3::constPtrOpcode): (JSC::B3::isConstant): * b3/B3Procedure.cpp: (JSC::B3::Procedure::Procedure): (JSC::B3::Procedure::resetReachability): (JSC::B3::Procedure::invalidateCFG): (JSC::B3::Procedure::dump): (JSC::B3::Procedure::deleteValue): (JSC::B3::Procedure::dominators): (JSC::B3::Procedure::addFastConstant): (JSC::B3::Procedure::isFastConstant): (JSC::B3::Procedure::addDataSection): * b3/B3Procedure.h: (JSC::B3::Procedure::size): (JSC::B3::Procedure::cfg): (JSC::B3::Procedure::setLastPhaseName): * b3/B3ReduceStrength.cpp: * b3/B3ValueInlines.h: (JSC::B3::Value::isConstant): (JSC::B3::Value::isInteger): * b3/B3ValueKey.h: (JSC::B3::ValueKey::canMaterialize): (JSC::B3::ValueKey::isConstant): * b3/air/AirCode.cpp: (JSC::B3::Air::Code::findNextBlock): (JSC::B3::Air::Code::addFastTmp): * b3/air/AirCode.h: (JSC::B3::Air::Code::specials): (JSC::B3::Air::Code::isFastTmp): (JSC::B3::Air::Code::setLastPhaseName): * b3/air/AirIteratedRegisterCoalescing.cpp: * dfg/DFGDominators.h: * dfg/DFGSSACalculator.cpp: * ftl/FTLLowerDFGToLLVM.cpp: (JSC::FTL::DFG::LowerDFGToLLVM::lower): Source/WTF: Remove some remaining DFG-specific snippets from Dominators. This used to be a non-template DFG class, and some time ago I hoisted it into WTF and made it generic. But since the only user of the class was the DFG, this class still had a handful of DFG-specific snippets that didn't compile when I started using it from B3. Also renamed immediateDominatorOf() to idom(). This is the sort of abbreviation that we wouldn't ordinarily want to have in WebKit. But WebKit does allow for abbreviations that are "more canonical". The term "idom" is definitely more canonical than "immediateDominatorOf". * wtf/Dominators.h: (WTF::Dominators::dominates): (WTF::Dominators::idom): (WTF::Dominators::forAllStrictDominatorsOf): (WTF::Dominators::NaiveDominators::dominates): (WTF::Dominators::NaiveDominators::dump): (WTF::Dominators::ValidationContext::handleErrors): Canonical link: https://commits.webkit.org/170119@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@193682 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-12-08 02:46:22 +00:00
Graph& m_graph;
Dominators should be factored out of the DFG https://bugs.webkit.org/show_bug.cgi?id=150764 Reviewed by Geoffrey Garen. Source/JavaScriptCore: Factored DFGDominators.h/DFGDominators.cpp into WTF. To do this, I made two changes to the DFG: 1) DFG now has a CFG abstraction called DFG::CFG. The cool thing about this is that in the future if we wanted to support inverted dominators, we could do it by just creating a DFG::BackwardCFG. 2) Got rid of DFG::Analysis. From now on, an Analysis being invalidated is expressed by the DFG::Graph having a null pointer for that analysis. When we "run" the analysis, we just instantiate it. This makes it much more natural to integrate WTF::Dominators into the DFG. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * dfg/DFGAnalysis.h: Removed. * dfg/DFGCFG.h: Added. (JSC::DFG::CFG::CFG): (JSC::DFG::CFG::root): (JSC::DFG::CFG::newMap<T>): (JSC::DFG::CFG::successors): (JSC::DFG::CFG::predecessors): (JSC::DFG::CFG::index): (JSC::DFG::CFG::node): (JSC::DFG::CFG::numNodes): (JSC::DFG::CFG::dump): * dfg/DFGCSEPhase.cpp: * dfg/DFGDisassembler.cpp: (JSC::DFG::Disassembler::createDumpList): * dfg/DFGDominators.cpp: Removed. * dfg/DFGDominators.h: (JSC::DFG::Dominators::Dominators): (JSC::DFG::Dominators::strictlyDominates): Deleted. (JSC::DFG::Dominators::dominates): Deleted. (JSC::DFG::Dominators::immediateDominatorOf): Deleted. (JSC::DFG::Dominators::forAllStrictDominatorsOf): Deleted. (JSC::DFG::Dominators::forAllDominatorsOf): Deleted. (JSC::DFG::Dominators::forAllBlocksStrictlyDominatedBy): Deleted. (JSC::DFG::Dominators::forAllBlocksDominatedBy): Deleted. (JSC::DFG::Dominators::forAllBlocksInDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInIteratedDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInPrunedIteratedDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInDominanceFrontierOfImpl): Deleted. (JSC::DFG::Dominators::forAllBlocksInIteratedDominanceFrontierOfImpl): Deleted. (JSC::DFG::Dominators::BlockData::BlockData): Deleted. * dfg/DFGEdgeDominates.h: (JSC::DFG::EdgeDominates::operator()): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::Graph): (JSC::DFG::Graph::dumpBlockHeader): (JSC::DFG::Graph::invalidateCFG): (JSC::DFG::Graph::substituteGetLocal): (JSC::DFG::Graph::handleAssertionFailure): (JSC::DFG::Graph::ensureDominators): (JSC::DFG::Graph::ensurePrePostNumbering): (JSC::DFG::Graph::ensureNaturalLoops): (JSC::DFG::Graph::valueProfileFor): * dfg/DFGGraph.h: (JSC::DFG::Graph::hasDebuggerEnabled): * dfg/DFGLICMPhase.cpp: (JSC::DFG::LICMPhase::run): (JSC::DFG::LICMPhase::attemptHoist): * dfg/DFGLoopPreHeaderCreationPhase.cpp: (JSC::DFG::createPreHeader): (JSC::DFG::LoopPreHeaderCreationPhase::run): * dfg/DFGNaturalLoops.cpp: (JSC::DFG::NaturalLoop::dump): (JSC::DFG::NaturalLoops::NaturalLoops): (JSC::DFG::NaturalLoops::~NaturalLoops): (JSC::DFG::NaturalLoops::loopsOf): (JSC::DFG::NaturalLoops::computeDependencies): Deleted. (JSC::DFG::NaturalLoops::compute): Deleted. * dfg/DFGNaturalLoops.h: (JSC::DFG::NaturalLoops::numLoops): * dfg/DFGNode.h: (JSC::DFG::Node::SuccessorsIterable::end): (JSC::DFG::Node::SuccessorsIterable::size): (JSC::DFG::Node::SuccessorsIterable::at): (JSC::DFG::Node::SuccessorsIterable::operator[]): * dfg/DFGOSREntrypointCreationPhase.cpp: (JSC::DFG::OSREntrypointCreationPhase::run): * dfg/DFGObjectAllocationSinkingPhase.cpp: * dfg/DFGPlan.cpp: (JSC::DFG::Plan::compileInThreadImpl): * dfg/DFGPrePostNumbering.cpp: (JSC::DFG::PrePostNumbering::PrePostNumbering): (JSC::DFG::PrePostNumbering::~PrePostNumbering): (JSC::DFG::PrePostNumbering::compute): Deleted. * dfg/DFGPrePostNumbering.h: (JSC::DFG::PrePostNumbering::preNumber): (JSC::DFG::PrePostNumbering::postNumber): * dfg/DFGPutStackSinkingPhase.cpp: * dfg/DFGSSACalculator.cpp: (JSC::DFG::SSACalculator::nonLocalReachingDef): (JSC::DFG::SSACalculator::reachingDefAtTail): * dfg/DFGSSACalculator.h: (JSC::DFG::SSACalculator::computePhis): * dfg/DFGSSAConversionPhase.cpp: (JSC::DFG::SSAConversionPhase::run): * ftl/FTLLink.cpp: (JSC::FTL::link): * ftl/FTLLowerDFGToLLVM.cpp: (JSC::FTL::DFG::LowerDFGToLLVM::lower): (JSC::FTL::DFG::LowerDFGToLLVM::safelyInvalidateAfterTermination): (JSC::FTL::DFG::LowerDFGToLLVM::isValid): Source/WTF: This takes what used to be DFGDominators.h/DFGDominators.cpp and turns it into a generic algorithm that can take any abstract graph. The idea is that you create Dominators<CFG> and pass it a CFG object, which defines the types of graph nodes and methods for getting successors, predecessors, etc. The DFG now defines a class called CFG, which is a wrapper for DFG::Graph that conforms to the thing that wtf/Dominators.h expects. When doing things to graphs, it's common to refer to the things in the graph as "nodes". Because I intend to reuse the CFG abstraction with many graph algorithms, that abstraction uses the term "node" to refer to a DFG basic block. But in Dominators, the method and variable names still use "block". This is because although Dominators are applicable to any kind of directed graph, it's super unlikely that we will ever use them for anything but compilers. Indeed, the only reason why I'm factoring them out of the DFG is so that I can use them with B3 and Air. This has the nice side effect that a user of WTF::Dominators<JSC::DFG::CFG> will see familiar terminology like "blocksStrictlyDominatedBy(...)" instead of "nodesStrictlyDominatedBy(...)", which would be super confusing. Overall, wtf/Dominators.h is a combination of what used to be in DFGDominators.h, DFGDominators.cpp, DFGNaiveDominators.h, and DFGNaiveDominators.cpp. I only changed code when I had to in order to make it generic. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/Dominators.h: Added. (WTF::Dominators::Dominators): (WTF::Dominators::compute): (WTF::Dominators::strictlyDominates): (WTF::Dominators::dominates): (WTF::Dominators::immediateDominatorOf): (WTF::Dominators::forAllStrictDominatorsOf): (WTF::Dominators::forAllDominatorsOf): (WTF::Dominators::forAllBlocksStrictlyDominatedBy): (WTF::Dominators::forAllBlocksDominatedBy): (WTF::Dominators::strictDominatorsOf): (WTF::Dominators::dominatorsOf): (WTF::Dominators::blocksStrictlyDominatedBy): (WTF::Dominators::blocksDominatedBy): (WTF::Dominators::forAllBlocksInDominanceFrontierOf): (WTF::Dominators::dominanceFrontierOf): (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOf): (WTF::Dominators::forAllBlocksInPrunedIteratedDominanceFrontierOf): (WTF::Dominators::iteratedDominanceFrontierOf): (WTF::Dominators::dump): (WTF::Dominators::LengauerTarjan::LengauerTarjan): (WTF::Dominators::LengauerTarjan::compute): (WTF::Dominators::LengauerTarjan::immediateDominator): (WTF::Dominators::LengauerTarjan::computeDepthFirstPreNumbering): (WTF::Dominators::LengauerTarjan::computeSemiDominatorsAndImplicitImmediateDominators): (WTF::Dominators::LengauerTarjan::computeExplicitImmediateDominators): (WTF::Dominators::LengauerTarjan::link): (WTF::Dominators::LengauerTarjan::eval): (WTF::Dominators::LengauerTarjan::compress): (WTF::Dominators::LengauerTarjan::BlockData::BlockData): (WTF::Dominators::NaiveDominators::NaiveDominators): (WTF::Dominators::NaiveDominators::dominates): (WTF::Dominators::NaiveDominators::dump): (WTF::Dominators::NaiveDominators::pruneDominators): (WTF::Dominators::ValidationContext::ValidationContext): (WTF::Dominators::ValidationContext::reportError): (WTF::Dominators::ValidationContext::handleErrors): (WTF::Dominators::naiveDominates): (WTF::Dominators::forAllBlocksInDominanceFrontierOfImpl): (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOfImpl): (WTF::Dominators::BlockData::BlockData): Canonical link: https://commits.webkit.org/168962@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@191870 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-11-02 00:48:03 +00:00
Vector<FastBitVector> m_results; // For each block, the bitvector of blocks that dominate it.
FastBitVector m_scratch; // A temporary bitvector with bit for each block. We recycle this to save new/deletes.
};
struct ValidationContext {
[WTF][JSC] Make JSC and WTF aggressively-fast-malloced https://bugs.webkit.org/show_bug.cgi?id=200611 Reviewed by Saam Barati. Source/JavaScriptCore: This patch aggressively puts many classes into FastMalloc. In JSC side, we grep `std::make_unique` etc. to find potentially system-malloc-allocated classes. After this patch, all the JSC related allocations in JetStream2 cli is done from bmalloc. In the future, it would be nice that we add `WTF::makeUnique<T>` helper function and throw a compile error if `T` is not FastMalloc annotated[1]. Putting WebKit classes in FastMalloc has many benefits. 1. Simply, it is fast. 2. vmmap can tell the amount of memory used for WebKit. 3. bmalloc can isolate WebKit memory allocation from the rest of the world. This is useful since we can know more about what component is corrupting the memory from the memory corruption crash. [1]: https://bugs.webkit.org/show_bug.cgi?id=200620 * API/ObjCCallbackFunction.mm: * assembler/AbstractMacroAssembler.h: * b3/B3PhiChildren.h: * b3/air/AirAllocateRegistersAndStackAndGenerateCode.h: * b3/air/AirDisassembler.h: * bytecode/AccessCaseSnippetParams.h: * bytecode/CallVariant.h: * bytecode/DeferredSourceDump.h: * bytecode/ExecutionCounter.h: * bytecode/GetByIdStatus.h: * bytecode/GetByIdVariant.h: * bytecode/InByIdStatus.h: * bytecode/InByIdVariant.h: * bytecode/InstanceOfStatus.h: * bytecode/InstanceOfVariant.h: * bytecode/PutByIdStatus.h: * bytecode/PutByIdVariant.h: * bytecode/ValueProfile.h: * dfg/DFGAbstractInterpreter.h: * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::newVariableAccessData): * dfg/DFGFlowIndexing.h: * dfg/DFGFlowMap.h: * dfg/DFGLiveCatchVariablePreservationPhase.cpp: (JSC::DFG::LiveCatchVariablePreservationPhase::newVariableAccessData): * dfg/DFGMaximalFlushInsertionPhase.cpp: (JSC::DFG::MaximalFlushInsertionPhase::newVariableAccessData): * dfg/DFGOSRExit.h: * dfg/DFGSpeculativeJIT.h: * dfg/DFGVariableAccessData.h: * disassembler/ARM64/A64DOpcode.h: * inspector/remote/socket/RemoteInspectorMessageParser.h: * inspector/remote/socket/RemoteInspectorSocket.h: * inspector/remote/socket/RemoteInspectorSocketEndpoint.h: * jit/PCToCodeOriginMap.h: * runtime/BasicBlockLocation.h: * runtime/DoublePredictionFuzzerAgent.h: * runtime/JSRunLoopTimer.h: * runtime/PromiseDeferredTimer.h: (JSC::PromiseDeferredTimer::create): PromiseDeferredTimer should be allocated as `Ref<>` instead of `std::unique_ptr` since it is inheriting ThreadSafeRefCounted<>. Holding such a class with std::unique_ptr could lead to potentially dangerous operations (like, someone holds it with Ref<> while it is deleted by std::unique_ptr<>). * runtime/RandomizingFuzzerAgent.h: * runtime/SymbolTable.h: * runtime/VM.cpp: (JSC::VM::VM): * runtime/VM.h: * tools/JSDollarVM.cpp: * tools/SigillCrashAnalyzer.cpp: * wasm/WasmFormat.h: * wasm/WasmMemory.cpp: * wasm/WasmSignature.h: * yarr/YarrJIT.h: Source/WebCore: Changed the accessor since we changed std::unique_ptr to Ref for this field. No behavior change. * bindings/js/WorkerScriptController.cpp: (WebCore::WorkerScriptController::addTimerSetNotification): (WebCore::WorkerScriptController::removeTimerSetNotification): Source/WTF: WTF has many data structures, in particular, containers. And these containers can be allocated like `std::make_unique<Container>()`. Without WTF_MAKE_FAST_ALLOCATED, this container itself is allocated from the system malloc. This patch attaches WTF_MAKE_FAST_ALLOCATED more aggressively not to allocate them from the system malloc. And we add some `final` to containers and classes that would be never inherited. * wtf/Assertions.cpp: * wtf/Atomics.h: * wtf/AutodrainedPool.h: * wtf/Bag.h: (WTF::Bag::Bag): Deleted. (WTF::Bag::~Bag): Deleted. (WTF::Bag::clear): Deleted. (WTF::Bag::add): Deleted. (WTF::Bag::iterator::iterator): Deleted. (WTF::Bag::iterator::operator! const): Deleted. (WTF::Bag::iterator::operator* const): Deleted. (WTF::Bag::iterator::operator++): Deleted. (WTF::Bag::iterator::operator== const): Deleted. (WTF::Bag::iterator::operator!= const): Deleted. (WTF::Bag::begin): Deleted. (WTF::Bag::begin const): Deleted. (WTF::Bag::end const): Deleted. (WTF::Bag::isEmpty const): Deleted. (WTF::Bag::unwrappedHead const): Deleted. * wtf/BitVector.h: (WTF::BitVector::BitVector): Deleted. (WTF::BitVector::~BitVector): Deleted. (WTF::BitVector::operator=): Deleted. (WTF::BitVector::size const): Deleted. (WTF::BitVector::ensureSize): Deleted. (WTF::BitVector::quickGet const): Deleted. (WTF::BitVector::quickSet): Deleted. (WTF::BitVector::quickClear): Deleted. (WTF::BitVector::get const): Deleted. (WTF::BitVector::contains const): Deleted. (WTF::BitVector::set): Deleted. (WTF::BitVector::add): Deleted. (WTF::BitVector::ensureSizeAndSet): Deleted. (WTF::BitVector::clear): Deleted. (WTF::BitVector::remove): Deleted. (WTF::BitVector::merge): Deleted. (WTF::BitVector::filter): Deleted. (WTF::BitVector::exclude): Deleted. (WTF::BitVector::bitCount const): Deleted. (WTF::BitVector::isEmpty const): Deleted. (WTF::BitVector::findBit const): Deleted. (WTF::BitVector::isEmptyValue const): Deleted. (WTF::BitVector::isDeletedValue const): Deleted. (WTF::BitVector::isEmptyOrDeletedValue const): Deleted. (WTF::BitVector::operator== const): Deleted. (WTF::BitVector::hash const): Deleted. (WTF::BitVector::iterator::iterator): Deleted. (WTF::BitVector::iterator::operator* const): Deleted. (WTF::BitVector::iterator::operator++): Deleted. (WTF::BitVector::iterator::isAtEnd const): Deleted. (WTF::BitVector::iterator::operator== const): Deleted. (WTF::BitVector::iterator::operator!= const): Deleted. (WTF::BitVector::begin const): Deleted. (WTF::BitVector::end const): Deleted. (WTF::BitVector::bitsInPointer): Deleted. (WTF::BitVector::maxInlineBits): Deleted. (WTF::BitVector::byteCount): Deleted. (WTF::BitVector::makeInlineBits): Deleted. (WTF::BitVector::cleanseInlineBits): Deleted. (WTF::BitVector::bitCount): Deleted. (WTF::BitVector::findBitFast const): Deleted. (WTF::BitVector::findBitSimple const): Deleted. (WTF::BitVector::OutOfLineBits::numBits const): Deleted. (WTF::BitVector::OutOfLineBits::numWords const): Deleted. (WTF::BitVector::OutOfLineBits::bits): Deleted. (WTF::BitVector::OutOfLineBits::bits const): Deleted. (WTF::BitVector::OutOfLineBits::OutOfLineBits): Deleted. (WTF::BitVector::isInline const): Deleted. (WTF::BitVector::outOfLineBits const): Deleted. (WTF::BitVector::outOfLineBits): Deleted. (WTF::BitVector::bits): Deleted. (WTF::BitVector::bits const): Deleted. * wtf/Bitmap.h: (WTF::Bitmap::size): Deleted. (WTF::Bitmap::iterator::iterator): Deleted. (WTF::Bitmap::iterator::operator* const): Deleted. (WTF::Bitmap::iterator::operator++): Deleted. (WTF::Bitmap::iterator::operator== const): Deleted. (WTF::Bitmap::iterator::operator!= const): Deleted. (WTF::Bitmap::begin const): Deleted. (WTF::Bitmap::end const): Deleted. * wtf/Box.h: * wtf/BumpPointerAllocator.h: * wtf/CPUTime.h: * wtf/CheckedBoolean.h: * wtf/CommaPrinter.h: (WTF::CommaPrinter::CommaPrinter): Deleted. (WTF::CommaPrinter::dump const): Deleted. (WTF::CommaPrinter::didPrint const): Deleted. * wtf/CompactPointerTuple.h: (WTF::CompactPointerTuple::encodeType): Deleted. (WTF::CompactPointerTuple::decodeType): Deleted. (WTF::CompactPointerTuple::CompactPointerTuple): Deleted. (WTF::CompactPointerTuple::pointer const): Deleted. (WTF::CompactPointerTuple::setPointer): Deleted. (WTF::CompactPointerTuple::type const): Deleted. (WTF::CompactPointerTuple::setType): Deleted. * wtf/CompilationThread.h: (WTF::CompilationScope::CompilationScope): Deleted. (WTF::CompilationScope::~CompilationScope): Deleted. (WTF::CompilationScope::leaveEarly): Deleted. * wtf/CompletionHandler.h: (WTF::CompletionHandler<Out): (WTF::Detail::CallableWrapper<CompletionHandler<Out): (WTF::CompletionHandlerCallingScope::CompletionHandlerCallingScope): Deleted. (WTF::CompletionHandlerCallingScope::~CompletionHandlerCallingScope): Deleted. (WTF::CompletionHandlerCallingScope::CompletionHandler<void): Deleted. * wtf/ConcurrentBuffer.h: (WTF::ConcurrentBuffer::ConcurrentBuffer): Deleted. (WTF::ConcurrentBuffer::~ConcurrentBuffer): Deleted. (WTF::ConcurrentBuffer::growExact): Deleted. (WTF::ConcurrentBuffer::grow): Deleted. (WTF::ConcurrentBuffer::array const): Deleted. (WTF::ConcurrentBuffer::operator[]): Deleted. (WTF::ConcurrentBuffer::operator[] const): Deleted. (WTF::ConcurrentBuffer::createArray): Deleted. * wtf/ConcurrentPtrHashSet.h: (WTF::ConcurrentPtrHashSet::contains): Deleted. (WTF::ConcurrentPtrHashSet::add): Deleted. (WTF::ConcurrentPtrHashSet::size const): Deleted. (WTF::ConcurrentPtrHashSet::Table::maxLoad const): Deleted. (WTF::ConcurrentPtrHashSet::hash): Deleted. (WTF::ConcurrentPtrHashSet::cast): Deleted. (WTF::ConcurrentPtrHashSet::containsImpl const): Deleted. (WTF::ConcurrentPtrHashSet::addImpl): Deleted. * wtf/ConcurrentVector.h: (WTF::ConcurrentVector::~ConcurrentVector): Deleted. (WTF::ConcurrentVector::size const): Deleted. (WTF::ConcurrentVector::isEmpty const): Deleted. (WTF::ConcurrentVector::at): Deleted. (WTF::ConcurrentVector::at const): Deleted. (WTF::ConcurrentVector::operator[]): Deleted. (WTF::ConcurrentVector::operator[] const): Deleted. (WTF::ConcurrentVector::first): Deleted. (WTF::ConcurrentVector::first const): Deleted. (WTF::ConcurrentVector::last): Deleted. (WTF::ConcurrentVector::last const): Deleted. (WTF::ConcurrentVector::takeLast): Deleted. (WTF::ConcurrentVector::append): Deleted. (WTF::ConcurrentVector::alloc): Deleted. (WTF::ConcurrentVector::removeLast): Deleted. (WTF::ConcurrentVector::grow): Deleted. (WTF::ConcurrentVector::begin): Deleted. (WTF::ConcurrentVector::end): Deleted. (WTF::ConcurrentVector::segmentExistsFor): Deleted. (WTF::ConcurrentVector::segmentFor): Deleted. (WTF::ConcurrentVector::subscriptFor): Deleted. (WTF::ConcurrentVector::ensureSegmentsFor): Deleted. (WTF::ConcurrentVector::ensureSegment): Deleted. (WTF::ConcurrentVector::allocateSegment): Deleted. * wtf/Condition.h: (WTF::Condition::waitUntil): Deleted. (WTF::Condition::waitFor): Deleted. (WTF::Condition::wait): Deleted. (WTF::Condition::notifyOne): Deleted. (WTF::Condition::notifyAll): Deleted. * wtf/CountingLock.h: (WTF::CountingLock::LockHooks::lockHook): Deleted. (WTF::CountingLock::LockHooks::unlockHook): Deleted. (WTF::CountingLock::LockHooks::parkHook): Deleted. (WTF::CountingLock::LockHooks::handoffHook): Deleted. (WTF::CountingLock::tryLock): Deleted. (WTF::CountingLock::lock): Deleted. (WTF::CountingLock::unlock): Deleted. (WTF::CountingLock::isHeld const): Deleted. (WTF::CountingLock::isLocked const): Deleted. (WTF::CountingLock::Count::operator bool const): Deleted. (WTF::CountingLock::Count::operator== const): Deleted. (WTF::CountingLock::Count::operator!= const): Deleted. (WTF::CountingLock::tryOptimisticRead): Deleted. (WTF::CountingLock::validate): Deleted. (WTF::CountingLock::doOptimizedRead): Deleted. (WTF::CountingLock::tryOptimisticFencelessRead): Deleted. (WTF::CountingLock::fencelessValidate): Deleted. (WTF::CountingLock::doOptimizedFencelessRead): Deleted. (WTF::CountingLock::getCount): Deleted. * wtf/CrossThreadQueue.h: * wtf/CrossThreadTask.h: * wtf/CryptographicallyRandomNumber.cpp: * wtf/DataMutex.h: * wtf/DateMath.h: * wtf/Deque.h: (WTF::Deque::size const): Deleted. (WTF::Deque::isEmpty const): Deleted. (WTF::Deque::begin): Deleted. (WTF::Deque::end): Deleted. (WTF::Deque::begin const): Deleted. (WTF::Deque::end const): Deleted. (WTF::Deque::rbegin): Deleted. (WTF::Deque::rend): Deleted. (WTF::Deque::rbegin const): Deleted. (WTF::Deque::rend const): Deleted. (WTF::Deque::first): Deleted. (WTF::Deque::first const): Deleted. (WTF::Deque::last): Deleted. (WTF::Deque::last const): Deleted. (WTF::Deque::append): Deleted. * wtf/Dominators.h: * wtf/DoublyLinkedList.h: * wtf/Expected.h: * wtf/FastBitVector.h: * wtf/FileMetadata.h: * wtf/FileSystem.h: * wtf/GraphNodeWorklist.h: * wtf/GregorianDateTime.h: (WTF::GregorianDateTime::GregorianDateTime): Deleted. (WTF::GregorianDateTime::year const): Deleted. (WTF::GregorianDateTime::month const): Deleted. (WTF::GregorianDateTime::yearDay const): Deleted. (WTF::GregorianDateTime::monthDay const): Deleted. (WTF::GregorianDateTime::weekDay const): Deleted. (WTF::GregorianDateTime::hour const): Deleted. (WTF::GregorianDateTime::minute const): Deleted. (WTF::GregorianDateTime::second const): Deleted. (WTF::GregorianDateTime::utcOffset const): Deleted. (WTF::GregorianDateTime::isDST const): Deleted. (WTF::GregorianDateTime::setYear): Deleted. (WTF::GregorianDateTime::setMonth): Deleted. (WTF::GregorianDateTime::setYearDay): Deleted. (WTF::GregorianDateTime::setMonthDay): Deleted. (WTF::GregorianDateTime::setWeekDay): Deleted. (WTF::GregorianDateTime::setHour): Deleted. (WTF::GregorianDateTime::setMinute): Deleted. (WTF::GregorianDateTime::setSecond): Deleted. (WTF::GregorianDateTime::setUtcOffset): Deleted. (WTF::GregorianDateTime::setIsDST): Deleted. (WTF::GregorianDateTime::operator tm const): Deleted. (WTF::GregorianDateTime::copyFrom): Deleted. * wtf/HashTable.h: * wtf/Hasher.h: * wtf/HexNumber.h: * wtf/Indenter.h: * wtf/IndexMap.h: * wtf/IndexSet.h: * wtf/IndexSparseSet.h: * wtf/IndexedContainerIterator.h: * wtf/Insertion.h: * wtf/IteratorAdaptors.h: * wtf/IteratorRange.h: * wtf/KeyValuePair.h: * wtf/ListHashSet.h: (WTF::ListHashSet::begin): Deleted. (WTF::ListHashSet::end): Deleted. (WTF::ListHashSet::begin const): Deleted. (WTF::ListHashSet::end const): Deleted. (WTF::ListHashSet::random): Deleted. (WTF::ListHashSet::random const): Deleted. (WTF::ListHashSet::rbegin): Deleted. (WTF::ListHashSet::rend): Deleted. (WTF::ListHashSet::rbegin const): Deleted. (WTF::ListHashSet::rend const): Deleted. * wtf/Liveness.h: * wtf/LocklessBag.h: (WTF::LocklessBag::LocklessBag): Deleted. (WTF::LocklessBag::add): Deleted. (WTF::LocklessBag::iterate): Deleted. (WTF::LocklessBag::consumeAll): Deleted. (WTF::LocklessBag::consumeAllWithNode): Deleted. (WTF::LocklessBag::~LocklessBag): Deleted. * wtf/LoggingHashID.h: * wtf/MD5.h: * wtf/MachSendRight.h: * wtf/MainThreadData.h: * wtf/Markable.h: * wtf/MediaTime.h: * wtf/MemoryPressureHandler.h: * wtf/MessageQueue.h: (WTF::MessageQueue::MessageQueue): Deleted. * wtf/MetaAllocator.h: * wtf/MonotonicTime.h: (WTF::MonotonicTime::MonotonicTime): Deleted. (WTF::MonotonicTime::fromRawSeconds): Deleted. (WTF::MonotonicTime::infinity): Deleted. (WTF::MonotonicTime::nan): Deleted. (WTF::MonotonicTime::secondsSinceEpoch const): Deleted. (WTF::MonotonicTime::approximateMonotonicTime const): Deleted. (WTF::MonotonicTime::operator bool const): Deleted. (WTF::MonotonicTime::operator+ const): Deleted. (WTF::MonotonicTime::operator- const): Deleted. (WTF::MonotonicTime::operator% const): Deleted. (WTF::MonotonicTime::operator+=): Deleted. (WTF::MonotonicTime::operator-=): Deleted. (WTF::MonotonicTime::operator== const): Deleted. (WTF::MonotonicTime::operator!= const): Deleted. (WTF::MonotonicTime::operator< const): Deleted. (WTF::MonotonicTime::operator> const): Deleted. (WTF::MonotonicTime::operator<= const): Deleted. (WTF::MonotonicTime::operator>= const): Deleted. (WTF::MonotonicTime::isolatedCopy const): Deleted. (WTF::MonotonicTime::encode const): Deleted. (WTF::MonotonicTime::decode): Deleted. * wtf/NaturalLoops.h: * wtf/NoLock.h: * wtf/OSAllocator.h: * wtf/OptionSet.h: * wtf/Optional.h: * wtf/OrderMaker.h: * wtf/Packed.h: (WTF::alignof): * wtf/PackedIntVector.h: (WTF::PackedIntVector::PackedIntVector): Deleted. (WTF::PackedIntVector::operator=): Deleted. (WTF::PackedIntVector::size const): Deleted. (WTF::PackedIntVector::ensureSize): Deleted. (WTF::PackedIntVector::resize): Deleted. (WTF::PackedIntVector::clearAll): Deleted. (WTF::PackedIntVector::get const): Deleted. (WTF::PackedIntVector::set): Deleted. (WTF::PackedIntVector::mask): Deleted. * wtf/PageBlock.h: * wtf/ParallelJobsOpenMP.h: * wtf/ParkingLot.h: * wtf/PriorityQueue.h: (WTF::PriorityQueue::size const): Deleted. (WTF::PriorityQueue::isEmpty const): Deleted. (WTF::PriorityQueue::enqueue): Deleted. (WTF::PriorityQueue::peek const): Deleted. (WTF::PriorityQueue::dequeue): Deleted. (WTF::PriorityQueue::decreaseKey): Deleted. (WTF::PriorityQueue::increaseKey): Deleted. (WTF::PriorityQueue::begin const): Deleted. (WTF::PriorityQueue::end const): Deleted. (WTF::PriorityQueue::isValidHeap const): Deleted. (WTF::PriorityQueue::parentOf): Deleted. (WTF::PriorityQueue::leftChildOf): Deleted. (WTF::PriorityQueue::rightChildOf): Deleted. (WTF::PriorityQueue::siftUp): Deleted. (WTF::PriorityQueue::siftDown): Deleted. * wtf/RandomDevice.h: * wtf/Range.h: * wtf/RangeSet.h: (WTF::RangeSet::RangeSet): Deleted. (WTF::RangeSet::~RangeSet): Deleted. (WTF::RangeSet::add): Deleted. (WTF::RangeSet::contains const): Deleted. (WTF::RangeSet::overlaps const): Deleted. (WTF::RangeSet::clear): Deleted. (WTF::RangeSet::dump const): Deleted. (WTF::RangeSet::dumpRaw const): Deleted. (WTF::RangeSet::begin const): Deleted. (WTF::RangeSet::end const): Deleted. (WTF::RangeSet::addAll): Deleted. (WTF::RangeSet::compact): Deleted. (WTF::RangeSet::overlapsNonEmpty): Deleted. (WTF::RangeSet::subsumesNonEmpty): Deleted. (WTF::RangeSet::findRange const): Deleted. * wtf/RecursableLambda.h: * wtf/RedBlackTree.h: (WTF::RedBlackTree::Node::successor const): Deleted. (WTF::RedBlackTree::Node::predecessor const): Deleted. (WTF::RedBlackTree::Node::successor): Deleted. (WTF::RedBlackTree::Node::predecessor): Deleted. (WTF::RedBlackTree::Node::reset): Deleted. (WTF::RedBlackTree::Node::parent const): Deleted. (WTF::RedBlackTree::Node::setParent): Deleted. (WTF::RedBlackTree::Node::left const): Deleted. (WTF::RedBlackTree::Node::setLeft): Deleted. (WTF::RedBlackTree::Node::right const): Deleted. (WTF::RedBlackTree::Node::setRight): Deleted. (WTF::RedBlackTree::Node::color const): Deleted. (WTF::RedBlackTree::Node::setColor): Deleted. (WTF::RedBlackTree::RedBlackTree): Deleted. (WTF::RedBlackTree::insert): Deleted. (WTF::RedBlackTree::remove): Deleted. (WTF::RedBlackTree::findExact const): Deleted. (WTF::RedBlackTree::findLeastGreaterThanOrEqual const): Deleted. (WTF::RedBlackTree::findGreatestLessThanOrEqual const): Deleted. (WTF::RedBlackTree::first const): Deleted. (WTF::RedBlackTree::last const): Deleted. (WTF::RedBlackTree::size): Deleted. (WTF::RedBlackTree::isEmpty): Deleted. (WTF::RedBlackTree::treeMinimum): Deleted. (WTF::RedBlackTree::treeMaximum): Deleted. (WTF::RedBlackTree::treeInsert): Deleted. (WTF::RedBlackTree::leftRotate): Deleted. (WTF::RedBlackTree::rightRotate): Deleted. (WTF::RedBlackTree::removeFixup): Deleted. * wtf/ResourceUsage.h: * wtf/RunLoop.cpp: * wtf/RunLoopTimer.h: * wtf/SHA1.h: * wtf/Seconds.h: (WTF::Seconds::Seconds): Deleted. (WTF::Seconds::value const): Deleted. (WTF::Seconds::minutes const): Deleted. (WTF::Seconds::seconds const): Deleted. (WTF::Seconds::milliseconds const): Deleted. (WTF::Seconds::microseconds const): Deleted. (WTF::Seconds::nanoseconds const): Deleted. (WTF::Seconds::minutesAs const): Deleted. (WTF::Seconds::secondsAs const): Deleted. (WTF::Seconds::millisecondsAs const): Deleted. (WTF::Seconds::microsecondsAs const): Deleted. (WTF::Seconds::nanosecondsAs const): Deleted. (WTF::Seconds::fromMinutes): Deleted. (WTF::Seconds::fromHours): Deleted. (WTF::Seconds::fromMilliseconds): Deleted. (WTF::Seconds::fromMicroseconds): Deleted. (WTF::Seconds::fromNanoseconds): Deleted. (WTF::Seconds::infinity): Deleted. (WTF::Seconds::nan): Deleted. (WTF::Seconds::operator bool const): Deleted. (WTF::Seconds::operator+ const): Deleted. (WTF::Seconds::operator- const): Deleted. (WTF::Seconds::operator* const): Deleted. (WTF::Seconds::operator/ const): Deleted. (WTF::Seconds::operator% const): Deleted. (WTF::Seconds::operator+=): Deleted. (WTF::Seconds::operator-=): Deleted. (WTF::Seconds::operator*=): Deleted. (WTF::Seconds::operator/=): Deleted. (WTF::Seconds::operator%=): Deleted. (WTF::Seconds::operator== const): Deleted. (WTF::Seconds::operator!= const): Deleted. (WTF::Seconds::operator< const): Deleted. (WTF::Seconds::operator> const): Deleted. (WTF::Seconds::operator<= const): Deleted. (WTF::Seconds::operator>= const): Deleted. (WTF::Seconds::isolatedCopy const): Deleted. (WTF::Seconds::encode const): Deleted. (WTF::Seconds::decode): Deleted. * wtf/SegmentedVector.h: (WTF::SegmentedVector::~SegmentedVector): Deleted. (WTF::SegmentedVector::size const): Deleted. (WTF::SegmentedVector::isEmpty const): Deleted. (WTF::SegmentedVector::at): Deleted. (WTF::SegmentedVector::at const): Deleted. (WTF::SegmentedVector::operator[]): Deleted. (WTF::SegmentedVector::operator[] const): Deleted. (WTF::SegmentedVector::first): Deleted. (WTF::SegmentedVector::first const): Deleted. (WTF::SegmentedVector::last): Deleted. (WTF::SegmentedVector::last const): Deleted. (WTF::SegmentedVector::takeLast): Deleted. (WTF::SegmentedVector::append): Deleted. (WTF::SegmentedVector::alloc): Deleted. (WTF::SegmentedVector::removeLast): Deleted. (WTF::SegmentedVector::grow): Deleted. (WTF::SegmentedVector::clear): Deleted. (WTF::SegmentedVector::begin): Deleted. (WTF::SegmentedVector::end): Deleted. (WTF::SegmentedVector::shrinkToFit): Deleted. (WTF::SegmentedVector::deleteAllSegments): Deleted. (WTF::SegmentedVector::segmentExistsFor): Deleted. (WTF::SegmentedVector::segmentFor): Deleted. (WTF::SegmentedVector::subscriptFor): Deleted. (WTF::SegmentedVector::ensureSegmentsFor): Deleted. (WTF::SegmentedVector::ensureSegment): Deleted. (WTF::SegmentedVector::allocateSegment): Deleted. * wtf/SetForScope.h: * wtf/SingleRootGraph.h: * wtf/SinglyLinkedList.h: * wtf/SmallPtrSet.h: * wtf/SpanningTree.h: * wtf/Spectrum.h: * wtf/StackBounds.h: * wtf/StackShot.h: * wtf/StackShotProfiler.h: * wtf/StackStats.h: * wtf/StackTrace.h: * wtf/StreamBuffer.h: * wtf/SynchronizedFixedQueue.h: (WTF::SynchronizedFixedQueue::create): Deleted. (WTF::SynchronizedFixedQueue::open): Deleted. (WTF::SynchronizedFixedQueue::close): Deleted. (WTF::SynchronizedFixedQueue::isOpen): Deleted. (WTF::SynchronizedFixedQueue::enqueue): Deleted. (WTF::SynchronizedFixedQueue::dequeue): Deleted. (WTF::SynchronizedFixedQueue::SynchronizedFixedQueue): Deleted. * wtf/SystemTracing.h: * wtf/ThreadGroup.h: (WTF::ThreadGroup::create): Deleted. (WTF::ThreadGroup::threads const): Deleted. (WTF::ThreadGroup::getLock): Deleted. (WTF::ThreadGroup::weakFromThis): Deleted. * wtf/ThreadSpecific.h: * wtf/ThreadingPrimitives.h: (WTF::Mutex::impl): Deleted. * wtf/TimeWithDynamicClockType.h: (WTF::TimeWithDynamicClockType::TimeWithDynamicClockType): Deleted. (WTF::TimeWithDynamicClockType::fromRawSeconds): Deleted. (WTF::TimeWithDynamicClockType::secondsSinceEpoch const): Deleted. (WTF::TimeWithDynamicClockType::clockType const): Deleted. (WTF::TimeWithDynamicClockType::withSameClockAndRawSeconds const): Deleted. (WTF::TimeWithDynamicClockType::operator bool const): Deleted. (WTF::TimeWithDynamicClockType::operator+ const): Deleted. (WTF::TimeWithDynamicClockType::operator- const): Deleted. (WTF::TimeWithDynamicClockType::operator+=): Deleted. (WTF::TimeWithDynamicClockType::operator-=): Deleted. (WTF::TimeWithDynamicClockType::operator== const): Deleted. (WTF::TimeWithDynamicClockType::operator!= const): Deleted. * wtf/TimingScope.h: * wtf/TinyLRUCache.h: * wtf/TinyPtrSet.h: * wtf/URLParser.cpp: * wtf/URLParser.h: * wtf/Unexpected.h: * wtf/Variant.h: * wtf/WTFSemaphore.h: (WTF::Semaphore::Semaphore): Deleted. (WTF::Semaphore::signal): Deleted. (WTF::Semaphore::waitUntil): Deleted. (WTF::Semaphore::waitFor): Deleted. (WTF::Semaphore::wait): Deleted. * wtf/WallTime.h: (WTF::WallTime::WallTime): Deleted. (WTF::WallTime::fromRawSeconds): Deleted. (WTF::WallTime::infinity): Deleted. (WTF::WallTime::nan): Deleted. (WTF::WallTime::secondsSinceEpoch const): Deleted. (WTF::WallTime::approximateWallTime const): Deleted. (WTF::WallTime::operator bool const): Deleted. (WTF::WallTime::operator+ const): Deleted. (WTF::WallTime::operator- const): Deleted. (WTF::WallTime::operator+=): Deleted. (WTF::WallTime::operator-=): Deleted. (WTF::WallTime::operator== const): Deleted. (WTF::WallTime::operator!= const): Deleted. (WTF::WallTime::operator< const): Deleted. (WTF::WallTime::operator> const): Deleted. (WTF::WallTime::operator<= const): Deleted. (WTF::WallTime::operator>= const): Deleted. (WTF::WallTime::isolatedCopy const): Deleted. * wtf/WeakHashSet.h: (WTF::WeakHashSet::WeakHashSetConstIterator::WeakHashSetConstIterator): Deleted. (WTF::WeakHashSet::WeakHashSetConstIterator::get const): Deleted. (WTF::WeakHashSet::WeakHashSetConstIterator::operator* const): Deleted. (WTF::WeakHashSet::WeakHashSetConstIterator::operator-> const): Deleted. (WTF::WeakHashSet::WeakHashSetConstIterator::operator++): Deleted. (WTF::WeakHashSet::WeakHashSetConstIterator::skipEmptyBuckets): Deleted. (WTF::WeakHashSet::WeakHashSetConstIterator::operator== const): Deleted. (WTF::WeakHashSet::WeakHashSetConstIterator::operator!= const): Deleted. (WTF::WeakHashSet::WeakHashSet): Deleted. (WTF::WeakHashSet::begin const): Deleted. (WTF::WeakHashSet::end const): Deleted. (WTF::WeakHashSet::add): Deleted. (WTF::WeakHashSet::remove): Deleted. (WTF::WeakHashSet::contains const): Deleted. (WTF::WeakHashSet::capacity const): Deleted. (WTF::WeakHashSet::computesEmpty const): Deleted. (WTF::WeakHashSet::hasNullReferences const): Deleted. (WTF::WeakHashSet::computeSize const): Deleted. (WTF::WeakHashSet::checkConsistency const): Deleted. * wtf/WeakRandom.h: (WTF::WeakRandom::WeakRandom): Deleted. (WTF::WeakRandom::setSeed): Deleted. (WTF::WeakRandom::seed const): Deleted. (WTF::WeakRandom::get): Deleted. (WTF::WeakRandom::getUint32): Deleted. (WTF::WeakRandom::lowOffset): Deleted. (WTF::WeakRandom::highOffset): Deleted. (WTF::WeakRandom::nextState): Deleted. (WTF::WeakRandom::generate): Deleted. (WTF::WeakRandom::advance): Deleted. * wtf/WordLock.h: (WTF::WordLock::lock): Deleted. (WTF::WordLock::unlock): Deleted. (WTF::WordLock::isHeld const): Deleted. (WTF::WordLock::isLocked const): Deleted. (WTF::WordLock::isFullyReset const): Deleted. * wtf/generic/MainThreadGeneric.cpp: * wtf/glib/GMutexLocker.h: * wtf/linux/CurrentProcessMemoryStatus.h: * wtf/posix/ThreadingPOSIX.cpp: (WTF::Semaphore::Semaphore): Deleted. (WTF::Semaphore::~Semaphore): Deleted. (WTF::Semaphore::wait): Deleted. (WTF::Semaphore::post): Deleted. * wtf/text/ASCIILiteral.h: (WTF::ASCIILiteral::operator const char* const): Deleted. (WTF::ASCIILiteral::fromLiteralUnsafe): Deleted. (WTF::ASCIILiteral::null): Deleted. (WTF::ASCIILiteral::characters const): Deleted. (WTF::ASCIILiteral::ASCIILiteral): Deleted. * wtf/text/AtomString.h: (WTF::AtomString::operator=): Deleted. (WTF::AtomString::isHashTableDeletedValue const): Deleted. (WTF::AtomString::existingHash const): Deleted. (WTF::AtomString::operator const String& const): Deleted. (WTF::AtomString::string const): Deleted. (WTF::AtomString::impl const): Deleted. (WTF::AtomString::is8Bit const): Deleted. (WTF::AtomString::characters8 const): Deleted. (WTF::AtomString::characters16 const): Deleted. (WTF::AtomString::length const): Deleted. (WTF::AtomString::operator[] const): Deleted. (WTF::AtomString::contains const): Deleted. (WTF::AtomString::containsIgnoringASCIICase const): Deleted. (WTF::AtomString::find const): Deleted. (WTF::AtomString::findIgnoringASCIICase const): Deleted. (WTF::AtomString::startsWith const): Deleted. (WTF::AtomString::startsWithIgnoringASCIICase const): Deleted. (WTF::AtomString::endsWith const): Deleted. (WTF::AtomString::endsWithIgnoringASCIICase const): Deleted. (WTF::AtomString::toInt const): Deleted. (WTF::AtomString::toDouble const): Deleted. (WTF::AtomString::toFloat const): Deleted. (WTF::AtomString::percentage const): Deleted. (WTF::AtomString::isNull const): Deleted. (WTF::AtomString::isEmpty const): Deleted. (WTF::AtomString::operator NSString * const): Deleted. * wtf/text/AtomStringImpl.h: (WTF::AtomStringImpl::lookUp): Deleted. (WTF::AtomStringImpl::add): Deleted. (WTF::AtomStringImpl::addWithStringTableProvider): Deleted. * wtf/text/CString.h: (WTF::CStringBuffer::data): Deleted. (WTF::CStringBuffer::length const): Deleted. (WTF::CStringBuffer::CStringBuffer): Deleted. (WTF::CStringBuffer::mutableData): Deleted. (WTF::CString::CString): Deleted. (WTF::CString::data const): Deleted. (WTF::CString::length const): Deleted. (WTF::CString::isNull const): Deleted. (WTF::CString::buffer const): Deleted. (WTF::CString::isHashTableDeletedValue const): Deleted. * wtf/text/ExternalStringImpl.h: (WTF::ExternalStringImpl::freeExternalBuffer): Deleted. * wtf/text/LineBreakIteratorPoolICU.h: * wtf/text/NullTextBreakIterator.h: * wtf/text/OrdinalNumber.h: * wtf/text/StringBuffer.h: * wtf/text/StringBuilder.h: * wtf/text/StringConcatenateNumbers.h: * wtf/text/StringHasher.h: * wtf/text/StringImpl.h: * wtf/text/StringView.cpp: * wtf/text/StringView.h: (WTF::StringView::left const): Deleted. (WTF::StringView::right const): Deleted. (WTF::StringView::underlyingStringIsValid const): Deleted. (WTF::StringView::setUnderlyingString): Deleted. * wtf/text/SymbolImpl.h: (WTF::SymbolImpl::StaticSymbolImpl::StaticSymbolImpl): Deleted. (WTF::SymbolImpl::StaticSymbolImpl::operator SymbolImpl&): Deleted. (WTF::PrivateSymbolImpl::PrivateSymbolImpl): Deleted. (WTF::RegisteredSymbolImpl::symbolRegistry const): Deleted. (WTF::RegisteredSymbolImpl::clearSymbolRegistry): Deleted. (WTF::RegisteredSymbolImpl::RegisteredSymbolImpl): Deleted. * wtf/text/SymbolRegistry.h: * wtf/text/TextBreakIterator.h: * wtf/text/TextPosition.h: * wtf/text/TextStream.h: * wtf/text/WTFString.h: (WTF::String::swap): Deleted. (WTF::String::adopt): Deleted. (WTF::String::isNull const): Deleted. (WTF::String::isEmpty const): Deleted. (WTF::String::impl const): Deleted. (WTF::String::releaseImpl): Deleted. (WTF::String::length const): Deleted. (WTF::String::characters8 const): Deleted. (WTF::String::characters16 const): Deleted. (WTF::String::is8Bit const): Deleted. (WTF::String::sizeInBytes const): Deleted. (WTF::String::operator[] const): Deleted. (WTF::String::find const): Deleted. (WTF::String::findIgnoringASCIICase const): Deleted. (WTF::String::reverseFind const): Deleted. (WTF::String::contains const): Deleted. (WTF::String::containsIgnoringASCIICase const): Deleted. (WTF::String::startsWith const): Deleted. (WTF::String::startsWithIgnoringASCIICase const): Deleted. (WTF::String::hasInfixStartingAt const): Deleted. (WTF::String::endsWith const): Deleted. (WTF::String::endsWithIgnoringASCIICase const): Deleted. (WTF::String::hasInfixEndingAt const): Deleted. (WTF::String::append): Deleted. (WTF::String::left const): Deleted. (WTF::String::right const): Deleted. (WTF::String::createUninitialized): Deleted. (WTF::String::fromUTF8WithLatin1Fallback): Deleted. (WTF::String::isAllASCII const): Deleted. (WTF::String::isAllLatin1 const): Deleted. (WTF::String::isSpecialCharacter const): Deleted. (WTF::String::isHashTableDeletedValue const): Deleted. (WTF::String::hash const): Deleted. (WTF::String::existingHash const): Deleted. * wtf/text/cf/TextBreakIteratorCF.h: * wtf/text/icu/TextBreakIteratorICU.h: * wtf/text/icu/UTextProviderLatin1.h: * wtf/threads/BinarySemaphore.h: (WTF::BinarySemaphore::waitFor): Deleted. (WTF::BinarySemaphore::wait): Deleted. * wtf/unicode/Collator.h: * wtf/win/GDIObject.h: * wtf/win/PathWalker.h: * wtf/win/Win32Handle.h: Canonical link: https://commits.webkit.org/214396@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248546 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-08-12 20:57:15 +00:00
WTF_MAKE_STRUCT_FAST_ALLOCATED;
Dominators should be factored out of the DFG https://bugs.webkit.org/show_bug.cgi?id=150764 Reviewed by Geoffrey Garen. Source/JavaScriptCore: Factored DFGDominators.h/DFGDominators.cpp into WTF. To do this, I made two changes to the DFG: 1) DFG now has a CFG abstraction called DFG::CFG. The cool thing about this is that in the future if we wanted to support inverted dominators, we could do it by just creating a DFG::BackwardCFG. 2) Got rid of DFG::Analysis. From now on, an Analysis being invalidated is expressed by the DFG::Graph having a null pointer for that analysis. When we "run" the analysis, we just instantiate it. This makes it much more natural to integrate WTF::Dominators into the DFG. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * dfg/DFGAnalysis.h: Removed. * dfg/DFGCFG.h: Added. (JSC::DFG::CFG::CFG): (JSC::DFG::CFG::root): (JSC::DFG::CFG::newMap<T>): (JSC::DFG::CFG::successors): (JSC::DFG::CFG::predecessors): (JSC::DFG::CFG::index): (JSC::DFG::CFG::node): (JSC::DFG::CFG::numNodes): (JSC::DFG::CFG::dump): * dfg/DFGCSEPhase.cpp: * dfg/DFGDisassembler.cpp: (JSC::DFG::Disassembler::createDumpList): * dfg/DFGDominators.cpp: Removed. * dfg/DFGDominators.h: (JSC::DFG::Dominators::Dominators): (JSC::DFG::Dominators::strictlyDominates): Deleted. (JSC::DFG::Dominators::dominates): Deleted. (JSC::DFG::Dominators::immediateDominatorOf): Deleted. (JSC::DFG::Dominators::forAllStrictDominatorsOf): Deleted. (JSC::DFG::Dominators::forAllDominatorsOf): Deleted. (JSC::DFG::Dominators::forAllBlocksStrictlyDominatedBy): Deleted. (JSC::DFG::Dominators::forAllBlocksDominatedBy): Deleted. (JSC::DFG::Dominators::forAllBlocksInDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInIteratedDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInPrunedIteratedDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInDominanceFrontierOfImpl): Deleted. (JSC::DFG::Dominators::forAllBlocksInIteratedDominanceFrontierOfImpl): Deleted. (JSC::DFG::Dominators::BlockData::BlockData): Deleted. * dfg/DFGEdgeDominates.h: (JSC::DFG::EdgeDominates::operator()): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::Graph): (JSC::DFG::Graph::dumpBlockHeader): (JSC::DFG::Graph::invalidateCFG): (JSC::DFG::Graph::substituteGetLocal): (JSC::DFG::Graph::handleAssertionFailure): (JSC::DFG::Graph::ensureDominators): (JSC::DFG::Graph::ensurePrePostNumbering): (JSC::DFG::Graph::ensureNaturalLoops): (JSC::DFG::Graph::valueProfileFor): * dfg/DFGGraph.h: (JSC::DFG::Graph::hasDebuggerEnabled): * dfg/DFGLICMPhase.cpp: (JSC::DFG::LICMPhase::run): (JSC::DFG::LICMPhase::attemptHoist): * dfg/DFGLoopPreHeaderCreationPhase.cpp: (JSC::DFG::createPreHeader): (JSC::DFG::LoopPreHeaderCreationPhase::run): * dfg/DFGNaturalLoops.cpp: (JSC::DFG::NaturalLoop::dump): (JSC::DFG::NaturalLoops::NaturalLoops): (JSC::DFG::NaturalLoops::~NaturalLoops): (JSC::DFG::NaturalLoops::loopsOf): (JSC::DFG::NaturalLoops::computeDependencies): Deleted. (JSC::DFG::NaturalLoops::compute): Deleted. * dfg/DFGNaturalLoops.h: (JSC::DFG::NaturalLoops::numLoops): * dfg/DFGNode.h: (JSC::DFG::Node::SuccessorsIterable::end): (JSC::DFG::Node::SuccessorsIterable::size): (JSC::DFG::Node::SuccessorsIterable::at): (JSC::DFG::Node::SuccessorsIterable::operator[]): * dfg/DFGOSREntrypointCreationPhase.cpp: (JSC::DFG::OSREntrypointCreationPhase::run): * dfg/DFGObjectAllocationSinkingPhase.cpp: * dfg/DFGPlan.cpp: (JSC::DFG::Plan::compileInThreadImpl): * dfg/DFGPrePostNumbering.cpp: (JSC::DFG::PrePostNumbering::PrePostNumbering): (JSC::DFG::PrePostNumbering::~PrePostNumbering): (JSC::DFG::PrePostNumbering::compute): Deleted. * dfg/DFGPrePostNumbering.h: (JSC::DFG::PrePostNumbering::preNumber): (JSC::DFG::PrePostNumbering::postNumber): * dfg/DFGPutStackSinkingPhase.cpp: * dfg/DFGSSACalculator.cpp: (JSC::DFG::SSACalculator::nonLocalReachingDef): (JSC::DFG::SSACalculator::reachingDefAtTail): * dfg/DFGSSACalculator.h: (JSC::DFG::SSACalculator::computePhis): * dfg/DFGSSAConversionPhase.cpp: (JSC::DFG::SSAConversionPhase::run): * ftl/FTLLink.cpp: (JSC::FTL::link): * ftl/FTLLowerDFGToLLVM.cpp: (JSC::FTL::DFG::LowerDFGToLLVM::lower): (JSC::FTL::DFG::LowerDFGToLLVM::safelyInvalidateAfterTermination): (JSC::FTL::DFG::LowerDFGToLLVM::isValid): Source/WTF: This takes what used to be DFGDominators.h/DFGDominators.cpp and turns it into a generic algorithm that can take any abstract graph. The idea is that you create Dominators<CFG> and pass it a CFG object, which defines the types of graph nodes and methods for getting successors, predecessors, etc. The DFG now defines a class called CFG, which is a wrapper for DFG::Graph that conforms to the thing that wtf/Dominators.h expects. When doing things to graphs, it's common to refer to the things in the graph as "nodes". Because I intend to reuse the CFG abstraction with many graph algorithms, that abstraction uses the term "node" to refer to a DFG basic block. But in Dominators, the method and variable names still use "block". This is because although Dominators are applicable to any kind of directed graph, it's super unlikely that we will ever use them for anything but compilers. Indeed, the only reason why I'm factoring them out of the DFG is so that I can use them with B3 and Air. This has the nice side effect that a user of WTF::Dominators<JSC::DFG::CFG> will see familiar terminology like "blocksStrictlyDominatedBy(...)" instead of "nodesStrictlyDominatedBy(...)", which would be super confusing. Overall, wtf/Dominators.h is a combination of what used to be in DFGDominators.h, DFGDominators.cpp, DFGNaiveDominators.h, and DFGNaiveDominators.cpp. I only changed code when I had to in order to make it generic. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/Dominators.h: Added. (WTF::Dominators::Dominators): (WTF::Dominators::compute): (WTF::Dominators::strictlyDominates): (WTF::Dominators::dominates): (WTF::Dominators::immediateDominatorOf): (WTF::Dominators::forAllStrictDominatorsOf): (WTF::Dominators::forAllDominatorsOf): (WTF::Dominators::forAllBlocksStrictlyDominatedBy): (WTF::Dominators::forAllBlocksDominatedBy): (WTF::Dominators::strictDominatorsOf): (WTF::Dominators::dominatorsOf): (WTF::Dominators::blocksStrictlyDominatedBy): (WTF::Dominators::blocksDominatedBy): (WTF::Dominators::forAllBlocksInDominanceFrontierOf): (WTF::Dominators::dominanceFrontierOf): (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOf): (WTF::Dominators::forAllBlocksInPrunedIteratedDominanceFrontierOf): (WTF::Dominators::iteratedDominanceFrontierOf): (WTF::Dominators::dump): (WTF::Dominators::LengauerTarjan::LengauerTarjan): (WTF::Dominators::LengauerTarjan::compute): (WTF::Dominators::LengauerTarjan::immediateDominator): (WTF::Dominators::LengauerTarjan::computeDepthFirstPreNumbering): (WTF::Dominators::LengauerTarjan::computeSemiDominatorsAndImplicitImmediateDominators): (WTF::Dominators::LengauerTarjan::computeExplicitImmediateDominators): (WTF::Dominators::LengauerTarjan::link): (WTF::Dominators::LengauerTarjan::eval): (WTF::Dominators::LengauerTarjan::compress): (WTF::Dominators::LengauerTarjan::BlockData::BlockData): (WTF::Dominators::NaiveDominators::NaiveDominators): (WTF::Dominators::NaiveDominators::dominates): (WTF::Dominators::NaiveDominators::dump): (WTF::Dominators::NaiveDominators::pruneDominators): (WTF::Dominators::ValidationContext::ValidationContext): (WTF::Dominators::ValidationContext::reportError): (WTF::Dominators::ValidationContext::handleErrors): (WTF::Dominators::naiveDominates): (WTF::Dominators::forAllBlocksInDominanceFrontierOfImpl): (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOfImpl): (WTF::Dominators::BlockData::BlockData): Canonical link: https://commits.webkit.org/168962@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@191870 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-11-02 00:48:03 +00:00
ValidationContext(Graph& graph, Dominators& dominators)
: graph(graph)
, dominators(dominators)
, naiveDominators(graph)
{
}
void reportError(typename Graph::Node from, typename Graph::Node to, const char* message)
{
Error error;
error.from = from;
error.to = to;
error.message = message;
errors.append(error);
}
void handleErrors()
{
if (errors.isEmpty())
return;
dataLog("DFG DOMINATOR VALIDATION FAILED:\n");
dataLog("\n");
dataLog("For block domination relationships:\n");
for (unsigned i = 0; i < errors.size(); ++i) {
dataLog(
" ", graph.dump(errors[i].from), " -> ", graph.dump(errors[i].to),
" (", errors[i].message, ")\n");
}
dataLog("\n");
dataLog("Control flow graph:\n");
for (unsigned blockIndex = 0; blockIndex < graph.numNodes(); ++blockIndex) {
typename Graph::Node block = graph.node(blockIndex);
if (!block)
continue;
dataLog(" Block ", graph.dump(graph.node(blockIndex)), ": successors = [");
CommaPrinter comma;
FTL B3 should be able to flag the tag constants as being super important so that B3 can hoist them and Air can force them into registers https://bugs.webkit.org/show_bug.cgi?id=151955 Reviewed by Geoffrey Garen. Source/JavaScriptCore: Taught B3 about the concept of "fast constants". A client of B3 can now tell B3 which constants are super important. B3 will not spill the constant in that case and will ensure that the constant is materialized only once: statically once, and dynamically once per procedure execution. The hoistFastConstants() algorithm in B3MoveConstants.cpp achieves this by first picking the lowest common dominator of all uses of each fast constant, and then picking the materialization point by finding the lowest dominator of that dominator that is tied for lowest block frequency. In practice, the second step ensures that this is the lowest point in the program that is not in a loop (i.e. executes no more than once dynamically per procedure invocation). Taught Air about the concept of "fast tmps". B3 tells Air that a tmp is fast if it is used to hold the materialization of a fast constant. IRC will use the lowest possible spill score for fast tmps. In practice, this ensures that fast constants are never spilled. Added a small snippet of code to FTL::LowerDFGToLLVM that makes both of the tag constants into fast constants. My hope is that this very brute-force heuristic is good enough that we don't have to think about constants for a while. Based on my experience with how LLVM's constant hoisting works out, the heuristic in this patch is going to be tough to beat. LLVM's constant hoisting does good things when it hoists the tags, and usually causes nothing but problems when it hoists anything else. This is because there is no way a low-level compiler to really understand how a constant materialization impacts some operation's contribution to the overall execution time of a procedure. But, in the FTL we know that constant materializations for type checks are a bummer because we are super comfortable placing type checks on the hottest of paths. So those are the last paths where extra instructions should be added by the compiler. On the other hand, all other large constant uses are on relatively cold paths, or paths that are already expensive for other reasons. For example, global variable accesses have to materialize a pointer to the global. But that's not really a big deal, since a load from a global involves first the load itself and then type checks on the result - so probably the constant materialization is just not interesting. A store to a global often involves a store barrier, so the constant materialization is really not interesting. This patch codifies this heuristic in a pact between Air, B3, and the FTL: FTL demands that B3 pin the two tags in registers, and B3 relays the demand to Air. * JavaScriptCore.xcodeproj/project.pbxproj: * b3/B3CFG.h: Added. (JSC::B3::CFG::CFG): (JSC::B3::CFG::root): (JSC::B3::CFG::newMap): (JSC::B3::CFG::successors): (JSC::B3::CFG::predecessors): (JSC::B3::CFG::index): (JSC::B3::CFG::node): (JSC::B3::CFG::numNodes): (JSC::B3::CFG::dump): * b3/B3Dominators.h: Added. (JSC::B3::Dominators::Dominators): * b3/B3IndexMap.h: (JSC::B3::IndexMap::resize): (JSC::B3::IndexMap::size): (JSC::B3::IndexMap::operator[]): * b3/B3LowerMacros.cpp: * b3/B3LowerToAir.cpp: (JSC::B3::Air::LowerToAir::tmp): * b3/B3MoveConstants.cpp: * b3/B3Opcode.h: (JSC::B3::constPtrOpcode): (JSC::B3::isConstant): * b3/B3Procedure.cpp: (JSC::B3::Procedure::Procedure): (JSC::B3::Procedure::resetReachability): (JSC::B3::Procedure::invalidateCFG): (JSC::B3::Procedure::dump): (JSC::B3::Procedure::deleteValue): (JSC::B3::Procedure::dominators): (JSC::B3::Procedure::addFastConstant): (JSC::B3::Procedure::isFastConstant): (JSC::B3::Procedure::addDataSection): * b3/B3Procedure.h: (JSC::B3::Procedure::size): (JSC::B3::Procedure::cfg): (JSC::B3::Procedure::setLastPhaseName): * b3/B3ReduceStrength.cpp: * b3/B3ValueInlines.h: (JSC::B3::Value::isConstant): (JSC::B3::Value::isInteger): * b3/B3ValueKey.h: (JSC::B3::ValueKey::canMaterialize): (JSC::B3::ValueKey::isConstant): * b3/air/AirCode.cpp: (JSC::B3::Air::Code::findNextBlock): (JSC::B3::Air::Code::addFastTmp): * b3/air/AirCode.h: (JSC::B3::Air::Code::specials): (JSC::B3::Air::Code::isFastTmp): (JSC::B3::Air::Code::setLastPhaseName): * b3/air/AirIteratedRegisterCoalescing.cpp: * dfg/DFGDominators.h: * dfg/DFGSSACalculator.cpp: * ftl/FTLLowerDFGToLLVM.cpp: (JSC::FTL::DFG::LowerDFGToLLVM::lower): Source/WTF: Remove some remaining DFG-specific snippets from Dominators. This used to be a non-template DFG class, and some time ago I hoisted it into WTF and made it generic. But since the only user of the class was the DFG, this class still had a handful of DFG-specific snippets that didn't compile when I started using it from B3. Also renamed immediateDominatorOf() to idom(). This is the sort of abbreviation that we wouldn't ordinarily want to have in WebKit. But WebKit does allow for abbreviations that are "more canonical". The term "idom" is definitely more canonical than "immediateDominatorOf". * wtf/Dominators.h: (WTF::Dominators::dominates): (WTF::Dominators::idom): (WTF::Dominators::forAllStrictDominatorsOf): (WTF::Dominators::NaiveDominators::dominates): (WTF::Dominators::NaiveDominators::dump): (WTF::Dominators::ValidationContext::handleErrors): Canonical link: https://commits.webkit.org/170119@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@193682 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-12-08 02:46:22 +00:00
for (auto successor : graph.successors(block))
dataLog(comma, graph.dump(successor));
Dominators should be factored out of the DFG https://bugs.webkit.org/show_bug.cgi?id=150764 Reviewed by Geoffrey Garen. Source/JavaScriptCore: Factored DFGDominators.h/DFGDominators.cpp into WTF. To do this, I made two changes to the DFG: 1) DFG now has a CFG abstraction called DFG::CFG. The cool thing about this is that in the future if we wanted to support inverted dominators, we could do it by just creating a DFG::BackwardCFG. 2) Got rid of DFG::Analysis. From now on, an Analysis being invalidated is expressed by the DFG::Graph having a null pointer for that analysis. When we "run" the analysis, we just instantiate it. This makes it much more natural to integrate WTF::Dominators into the DFG. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * dfg/DFGAnalysis.h: Removed. * dfg/DFGCFG.h: Added. (JSC::DFG::CFG::CFG): (JSC::DFG::CFG::root): (JSC::DFG::CFG::newMap<T>): (JSC::DFG::CFG::successors): (JSC::DFG::CFG::predecessors): (JSC::DFG::CFG::index): (JSC::DFG::CFG::node): (JSC::DFG::CFG::numNodes): (JSC::DFG::CFG::dump): * dfg/DFGCSEPhase.cpp: * dfg/DFGDisassembler.cpp: (JSC::DFG::Disassembler::createDumpList): * dfg/DFGDominators.cpp: Removed. * dfg/DFGDominators.h: (JSC::DFG::Dominators::Dominators): (JSC::DFG::Dominators::strictlyDominates): Deleted. (JSC::DFG::Dominators::dominates): Deleted. (JSC::DFG::Dominators::immediateDominatorOf): Deleted. (JSC::DFG::Dominators::forAllStrictDominatorsOf): Deleted. (JSC::DFG::Dominators::forAllDominatorsOf): Deleted. (JSC::DFG::Dominators::forAllBlocksStrictlyDominatedBy): Deleted. (JSC::DFG::Dominators::forAllBlocksDominatedBy): Deleted. (JSC::DFG::Dominators::forAllBlocksInDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInIteratedDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInPrunedIteratedDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInDominanceFrontierOfImpl): Deleted. (JSC::DFG::Dominators::forAllBlocksInIteratedDominanceFrontierOfImpl): Deleted. (JSC::DFG::Dominators::BlockData::BlockData): Deleted. * dfg/DFGEdgeDominates.h: (JSC::DFG::EdgeDominates::operator()): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::Graph): (JSC::DFG::Graph::dumpBlockHeader): (JSC::DFG::Graph::invalidateCFG): (JSC::DFG::Graph::substituteGetLocal): (JSC::DFG::Graph::handleAssertionFailure): (JSC::DFG::Graph::ensureDominators): (JSC::DFG::Graph::ensurePrePostNumbering): (JSC::DFG::Graph::ensureNaturalLoops): (JSC::DFG::Graph::valueProfileFor): * dfg/DFGGraph.h: (JSC::DFG::Graph::hasDebuggerEnabled): * dfg/DFGLICMPhase.cpp: (JSC::DFG::LICMPhase::run): (JSC::DFG::LICMPhase::attemptHoist): * dfg/DFGLoopPreHeaderCreationPhase.cpp: (JSC::DFG::createPreHeader): (JSC::DFG::LoopPreHeaderCreationPhase::run): * dfg/DFGNaturalLoops.cpp: (JSC::DFG::NaturalLoop::dump): (JSC::DFG::NaturalLoops::NaturalLoops): (JSC::DFG::NaturalLoops::~NaturalLoops): (JSC::DFG::NaturalLoops::loopsOf): (JSC::DFG::NaturalLoops::computeDependencies): Deleted. (JSC::DFG::NaturalLoops::compute): Deleted. * dfg/DFGNaturalLoops.h: (JSC::DFG::NaturalLoops::numLoops): * dfg/DFGNode.h: (JSC::DFG::Node::SuccessorsIterable::end): (JSC::DFG::Node::SuccessorsIterable::size): (JSC::DFG::Node::SuccessorsIterable::at): (JSC::DFG::Node::SuccessorsIterable::operator[]): * dfg/DFGOSREntrypointCreationPhase.cpp: (JSC::DFG::OSREntrypointCreationPhase::run): * dfg/DFGObjectAllocationSinkingPhase.cpp: * dfg/DFGPlan.cpp: (JSC::DFG::Plan::compileInThreadImpl): * dfg/DFGPrePostNumbering.cpp: (JSC::DFG::PrePostNumbering::PrePostNumbering): (JSC::DFG::PrePostNumbering::~PrePostNumbering): (JSC::DFG::PrePostNumbering::compute): Deleted. * dfg/DFGPrePostNumbering.h: (JSC::DFG::PrePostNumbering::preNumber): (JSC::DFG::PrePostNumbering::postNumber): * dfg/DFGPutStackSinkingPhase.cpp: * dfg/DFGSSACalculator.cpp: (JSC::DFG::SSACalculator::nonLocalReachingDef): (JSC::DFG::SSACalculator::reachingDefAtTail): * dfg/DFGSSACalculator.h: (JSC::DFG::SSACalculator::computePhis): * dfg/DFGSSAConversionPhase.cpp: (JSC::DFG::SSAConversionPhase::run): * ftl/FTLLink.cpp: (JSC::FTL::link): * ftl/FTLLowerDFGToLLVM.cpp: (JSC::FTL::DFG::LowerDFGToLLVM::lower): (JSC::FTL::DFG::LowerDFGToLLVM::safelyInvalidateAfterTermination): (JSC::FTL::DFG::LowerDFGToLLVM::isValid): Source/WTF: This takes what used to be DFGDominators.h/DFGDominators.cpp and turns it into a generic algorithm that can take any abstract graph. The idea is that you create Dominators<CFG> and pass it a CFG object, which defines the types of graph nodes and methods for getting successors, predecessors, etc. The DFG now defines a class called CFG, which is a wrapper for DFG::Graph that conforms to the thing that wtf/Dominators.h expects. When doing things to graphs, it's common to refer to the things in the graph as "nodes". Because I intend to reuse the CFG abstraction with many graph algorithms, that abstraction uses the term "node" to refer to a DFG basic block. But in Dominators, the method and variable names still use "block". This is because although Dominators are applicable to any kind of directed graph, it's super unlikely that we will ever use them for anything but compilers. Indeed, the only reason why I'm factoring them out of the DFG is so that I can use them with B3 and Air. This has the nice side effect that a user of WTF::Dominators<JSC::DFG::CFG> will see familiar terminology like "blocksStrictlyDominatedBy(...)" instead of "nodesStrictlyDominatedBy(...)", which would be super confusing. Overall, wtf/Dominators.h is a combination of what used to be in DFGDominators.h, DFGDominators.cpp, DFGNaiveDominators.h, and DFGNaiveDominators.cpp. I only changed code when I had to in order to make it generic. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/Dominators.h: Added. (WTF::Dominators::Dominators): (WTF::Dominators::compute): (WTF::Dominators::strictlyDominates): (WTF::Dominators::dominates): (WTF::Dominators::immediateDominatorOf): (WTF::Dominators::forAllStrictDominatorsOf): (WTF::Dominators::forAllDominatorsOf): (WTF::Dominators::forAllBlocksStrictlyDominatedBy): (WTF::Dominators::forAllBlocksDominatedBy): (WTF::Dominators::strictDominatorsOf): (WTF::Dominators::dominatorsOf): (WTF::Dominators::blocksStrictlyDominatedBy): (WTF::Dominators::blocksDominatedBy): (WTF::Dominators::forAllBlocksInDominanceFrontierOf): (WTF::Dominators::dominanceFrontierOf): (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOf): (WTF::Dominators::forAllBlocksInPrunedIteratedDominanceFrontierOf): (WTF::Dominators::iteratedDominanceFrontierOf): (WTF::Dominators::dump): (WTF::Dominators::LengauerTarjan::LengauerTarjan): (WTF::Dominators::LengauerTarjan::compute): (WTF::Dominators::LengauerTarjan::immediateDominator): (WTF::Dominators::LengauerTarjan::computeDepthFirstPreNumbering): (WTF::Dominators::LengauerTarjan::computeSemiDominatorsAndImplicitImmediateDominators): (WTF::Dominators::LengauerTarjan::computeExplicitImmediateDominators): (WTF::Dominators::LengauerTarjan::link): (WTF::Dominators::LengauerTarjan::eval): (WTF::Dominators::LengauerTarjan::compress): (WTF::Dominators::LengauerTarjan::BlockData::BlockData): (WTF::Dominators::NaiveDominators::NaiveDominators): (WTF::Dominators::NaiveDominators::dominates): (WTF::Dominators::NaiveDominators::dump): (WTF::Dominators::NaiveDominators::pruneDominators): (WTF::Dominators::ValidationContext::ValidationContext): (WTF::Dominators::ValidationContext::reportError): (WTF::Dominators::ValidationContext::handleErrors): (WTF::Dominators::naiveDominates): (WTF::Dominators::forAllBlocksInDominanceFrontierOfImpl): (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOfImpl): (WTF::Dominators::BlockData::BlockData): Canonical link: https://commits.webkit.org/168962@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@191870 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-11-02 00:48:03 +00:00
dataLog("], predecessors = [");
comma = CommaPrinter();
FTL B3 should be able to flag the tag constants as being super important so that B3 can hoist them and Air can force them into registers https://bugs.webkit.org/show_bug.cgi?id=151955 Reviewed by Geoffrey Garen. Source/JavaScriptCore: Taught B3 about the concept of "fast constants". A client of B3 can now tell B3 which constants are super important. B3 will not spill the constant in that case and will ensure that the constant is materialized only once: statically once, and dynamically once per procedure execution. The hoistFastConstants() algorithm in B3MoveConstants.cpp achieves this by first picking the lowest common dominator of all uses of each fast constant, and then picking the materialization point by finding the lowest dominator of that dominator that is tied for lowest block frequency. In practice, the second step ensures that this is the lowest point in the program that is not in a loop (i.e. executes no more than once dynamically per procedure invocation). Taught Air about the concept of "fast tmps". B3 tells Air that a tmp is fast if it is used to hold the materialization of a fast constant. IRC will use the lowest possible spill score for fast tmps. In practice, this ensures that fast constants are never spilled. Added a small snippet of code to FTL::LowerDFGToLLVM that makes both of the tag constants into fast constants. My hope is that this very brute-force heuristic is good enough that we don't have to think about constants for a while. Based on my experience with how LLVM's constant hoisting works out, the heuristic in this patch is going to be tough to beat. LLVM's constant hoisting does good things when it hoists the tags, and usually causes nothing but problems when it hoists anything else. This is because there is no way a low-level compiler to really understand how a constant materialization impacts some operation's contribution to the overall execution time of a procedure. But, in the FTL we know that constant materializations for type checks are a bummer because we are super comfortable placing type checks on the hottest of paths. So those are the last paths where extra instructions should be added by the compiler. On the other hand, all other large constant uses are on relatively cold paths, or paths that are already expensive for other reasons. For example, global variable accesses have to materialize a pointer to the global. But that's not really a big deal, since a load from a global involves first the load itself and then type checks on the result - so probably the constant materialization is just not interesting. A store to a global often involves a store barrier, so the constant materialization is really not interesting. This patch codifies this heuristic in a pact between Air, B3, and the FTL: FTL demands that B3 pin the two tags in registers, and B3 relays the demand to Air. * JavaScriptCore.xcodeproj/project.pbxproj: * b3/B3CFG.h: Added. (JSC::B3::CFG::CFG): (JSC::B3::CFG::root): (JSC::B3::CFG::newMap): (JSC::B3::CFG::successors): (JSC::B3::CFG::predecessors): (JSC::B3::CFG::index): (JSC::B3::CFG::node): (JSC::B3::CFG::numNodes): (JSC::B3::CFG::dump): * b3/B3Dominators.h: Added. (JSC::B3::Dominators::Dominators): * b3/B3IndexMap.h: (JSC::B3::IndexMap::resize): (JSC::B3::IndexMap::size): (JSC::B3::IndexMap::operator[]): * b3/B3LowerMacros.cpp: * b3/B3LowerToAir.cpp: (JSC::B3::Air::LowerToAir::tmp): * b3/B3MoveConstants.cpp: * b3/B3Opcode.h: (JSC::B3::constPtrOpcode): (JSC::B3::isConstant): * b3/B3Procedure.cpp: (JSC::B3::Procedure::Procedure): (JSC::B3::Procedure::resetReachability): (JSC::B3::Procedure::invalidateCFG): (JSC::B3::Procedure::dump): (JSC::B3::Procedure::deleteValue): (JSC::B3::Procedure::dominators): (JSC::B3::Procedure::addFastConstant): (JSC::B3::Procedure::isFastConstant): (JSC::B3::Procedure::addDataSection): * b3/B3Procedure.h: (JSC::B3::Procedure::size): (JSC::B3::Procedure::cfg): (JSC::B3::Procedure::setLastPhaseName): * b3/B3ReduceStrength.cpp: * b3/B3ValueInlines.h: (JSC::B3::Value::isConstant): (JSC::B3::Value::isInteger): * b3/B3ValueKey.h: (JSC::B3::ValueKey::canMaterialize): (JSC::B3::ValueKey::isConstant): * b3/air/AirCode.cpp: (JSC::B3::Air::Code::findNextBlock): (JSC::B3::Air::Code::addFastTmp): * b3/air/AirCode.h: (JSC::B3::Air::Code::specials): (JSC::B3::Air::Code::isFastTmp): (JSC::B3::Air::Code::setLastPhaseName): * b3/air/AirIteratedRegisterCoalescing.cpp: * dfg/DFGDominators.h: * dfg/DFGSSACalculator.cpp: * ftl/FTLLowerDFGToLLVM.cpp: (JSC::FTL::DFG::LowerDFGToLLVM::lower): Source/WTF: Remove some remaining DFG-specific snippets from Dominators. This used to be a non-template DFG class, and some time ago I hoisted it into WTF and made it generic. But since the only user of the class was the DFG, this class still had a handful of DFG-specific snippets that didn't compile when I started using it from B3. Also renamed immediateDominatorOf() to idom(). This is the sort of abbreviation that we wouldn't ordinarily want to have in WebKit. But WebKit does allow for abbreviations that are "more canonical". The term "idom" is definitely more canonical than "immediateDominatorOf". * wtf/Dominators.h: (WTF::Dominators::dominates): (WTF::Dominators::idom): (WTF::Dominators::forAllStrictDominatorsOf): (WTF::Dominators::NaiveDominators::dominates): (WTF::Dominators::NaiveDominators::dump): (WTF::Dominators::ValidationContext::handleErrors): Canonical link: https://commits.webkit.org/170119@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@193682 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-12-08 02:46:22 +00:00
for (auto predecessor : graph.predecessors(block))
dataLog(comma, graph.dump(predecessor));
Dominators should be factored out of the DFG https://bugs.webkit.org/show_bug.cgi?id=150764 Reviewed by Geoffrey Garen. Source/JavaScriptCore: Factored DFGDominators.h/DFGDominators.cpp into WTF. To do this, I made two changes to the DFG: 1) DFG now has a CFG abstraction called DFG::CFG. The cool thing about this is that in the future if we wanted to support inverted dominators, we could do it by just creating a DFG::BackwardCFG. 2) Got rid of DFG::Analysis. From now on, an Analysis being invalidated is expressed by the DFG::Graph having a null pointer for that analysis. When we "run" the analysis, we just instantiate it. This makes it much more natural to integrate WTF::Dominators into the DFG. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * dfg/DFGAnalysis.h: Removed. * dfg/DFGCFG.h: Added. (JSC::DFG::CFG::CFG): (JSC::DFG::CFG::root): (JSC::DFG::CFG::newMap<T>): (JSC::DFG::CFG::successors): (JSC::DFG::CFG::predecessors): (JSC::DFG::CFG::index): (JSC::DFG::CFG::node): (JSC::DFG::CFG::numNodes): (JSC::DFG::CFG::dump): * dfg/DFGCSEPhase.cpp: * dfg/DFGDisassembler.cpp: (JSC::DFG::Disassembler::createDumpList): * dfg/DFGDominators.cpp: Removed. * dfg/DFGDominators.h: (JSC::DFG::Dominators::Dominators): (JSC::DFG::Dominators::strictlyDominates): Deleted. (JSC::DFG::Dominators::dominates): Deleted. (JSC::DFG::Dominators::immediateDominatorOf): Deleted. (JSC::DFG::Dominators::forAllStrictDominatorsOf): Deleted. (JSC::DFG::Dominators::forAllDominatorsOf): Deleted. (JSC::DFG::Dominators::forAllBlocksStrictlyDominatedBy): Deleted. (JSC::DFG::Dominators::forAllBlocksDominatedBy): Deleted. (JSC::DFG::Dominators::forAllBlocksInDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInIteratedDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInPrunedIteratedDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInDominanceFrontierOfImpl): Deleted. (JSC::DFG::Dominators::forAllBlocksInIteratedDominanceFrontierOfImpl): Deleted. (JSC::DFG::Dominators::BlockData::BlockData): Deleted. * dfg/DFGEdgeDominates.h: (JSC::DFG::EdgeDominates::operator()): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::Graph): (JSC::DFG::Graph::dumpBlockHeader): (JSC::DFG::Graph::invalidateCFG): (JSC::DFG::Graph::substituteGetLocal): (JSC::DFG::Graph::handleAssertionFailure): (JSC::DFG::Graph::ensureDominators): (JSC::DFG::Graph::ensurePrePostNumbering): (JSC::DFG::Graph::ensureNaturalLoops): (JSC::DFG::Graph::valueProfileFor): * dfg/DFGGraph.h: (JSC::DFG::Graph::hasDebuggerEnabled): * dfg/DFGLICMPhase.cpp: (JSC::DFG::LICMPhase::run): (JSC::DFG::LICMPhase::attemptHoist): * dfg/DFGLoopPreHeaderCreationPhase.cpp: (JSC::DFG::createPreHeader): (JSC::DFG::LoopPreHeaderCreationPhase::run): * dfg/DFGNaturalLoops.cpp: (JSC::DFG::NaturalLoop::dump): (JSC::DFG::NaturalLoops::NaturalLoops): (JSC::DFG::NaturalLoops::~NaturalLoops): (JSC::DFG::NaturalLoops::loopsOf): (JSC::DFG::NaturalLoops::computeDependencies): Deleted. (JSC::DFG::NaturalLoops::compute): Deleted. * dfg/DFGNaturalLoops.h: (JSC::DFG::NaturalLoops::numLoops): * dfg/DFGNode.h: (JSC::DFG::Node::SuccessorsIterable::end): (JSC::DFG::Node::SuccessorsIterable::size): (JSC::DFG::Node::SuccessorsIterable::at): (JSC::DFG::Node::SuccessorsIterable::operator[]): * dfg/DFGOSREntrypointCreationPhase.cpp: (JSC::DFG::OSREntrypointCreationPhase::run): * dfg/DFGObjectAllocationSinkingPhase.cpp: * dfg/DFGPlan.cpp: (JSC::DFG::Plan::compileInThreadImpl): * dfg/DFGPrePostNumbering.cpp: (JSC::DFG::PrePostNumbering::PrePostNumbering): (JSC::DFG::PrePostNumbering::~PrePostNumbering): (JSC::DFG::PrePostNumbering::compute): Deleted. * dfg/DFGPrePostNumbering.h: (JSC::DFG::PrePostNumbering::preNumber): (JSC::DFG::PrePostNumbering::postNumber): * dfg/DFGPutStackSinkingPhase.cpp: * dfg/DFGSSACalculator.cpp: (JSC::DFG::SSACalculator::nonLocalReachingDef): (JSC::DFG::SSACalculator::reachingDefAtTail): * dfg/DFGSSACalculator.h: (JSC::DFG::SSACalculator::computePhis): * dfg/DFGSSAConversionPhase.cpp: (JSC::DFG::SSAConversionPhase::run): * ftl/FTLLink.cpp: (JSC::FTL::link): * ftl/FTLLowerDFGToLLVM.cpp: (JSC::FTL::DFG::LowerDFGToLLVM::lower): (JSC::FTL::DFG::LowerDFGToLLVM::safelyInvalidateAfterTermination): (JSC::FTL::DFG::LowerDFGToLLVM::isValid): Source/WTF: This takes what used to be DFGDominators.h/DFGDominators.cpp and turns it into a generic algorithm that can take any abstract graph. The idea is that you create Dominators<CFG> and pass it a CFG object, which defines the types of graph nodes and methods for getting successors, predecessors, etc. The DFG now defines a class called CFG, which is a wrapper for DFG::Graph that conforms to the thing that wtf/Dominators.h expects. When doing things to graphs, it's common to refer to the things in the graph as "nodes". Because I intend to reuse the CFG abstraction with many graph algorithms, that abstraction uses the term "node" to refer to a DFG basic block. But in Dominators, the method and variable names still use "block". This is because although Dominators are applicable to any kind of directed graph, it's super unlikely that we will ever use them for anything but compilers. Indeed, the only reason why I'm factoring them out of the DFG is so that I can use them with B3 and Air. This has the nice side effect that a user of WTF::Dominators<JSC::DFG::CFG> will see familiar terminology like "blocksStrictlyDominatedBy(...)" instead of "nodesStrictlyDominatedBy(...)", which would be super confusing. Overall, wtf/Dominators.h is a combination of what used to be in DFGDominators.h, DFGDominators.cpp, DFGNaiveDominators.h, and DFGNaiveDominators.cpp. I only changed code when I had to in order to make it generic. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/Dominators.h: Added. (WTF::Dominators::Dominators): (WTF::Dominators::compute): (WTF::Dominators::strictlyDominates): (WTF::Dominators::dominates): (WTF::Dominators::immediateDominatorOf): (WTF::Dominators::forAllStrictDominatorsOf): (WTF::Dominators::forAllDominatorsOf): (WTF::Dominators::forAllBlocksStrictlyDominatedBy): (WTF::Dominators::forAllBlocksDominatedBy): (WTF::Dominators::strictDominatorsOf): (WTF::Dominators::dominatorsOf): (WTF::Dominators::blocksStrictlyDominatedBy): (WTF::Dominators::blocksDominatedBy): (WTF::Dominators::forAllBlocksInDominanceFrontierOf): (WTF::Dominators::dominanceFrontierOf): (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOf): (WTF::Dominators::forAllBlocksInPrunedIteratedDominanceFrontierOf): (WTF::Dominators::iteratedDominanceFrontierOf): (WTF::Dominators::dump): (WTF::Dominators::LengauerTarjan::LengauerTarjan): (WTF::Dominators::LengauerTarjan::compute): (WTF::Dominators::LengauerTarjan::immediateDominator): (WTF::Dominators::LengauerTarjan::computeDepthFirstPreNumbering): (WTF::Dominators::LengauerTarjan::computeSemiDominatorsAndImplicitImmediateDominators): (WTF::Dominators::LengauerTarjan::computeExplicitImmediateDominators): (WTF::Dominators::LengauerTarjan::link): (WTF::Dominators::LengauerTarjan::eval): (WTF::Dominators::LengauerTarjan::compress): (WTF::Dominators::LengauerTarjan::BlockData::BlockData): (WTF::Dominators::NaiveDominators::NaiveDominators): (WTF::Dominators::NaiveDominators::dominates): (WTF::Dominators::NaiveDominators::dump): (WTF::Dominators::NaiveDominators::pruneDominators): (WTF::Dominators::ValidationContext::ValidationContext): (WTF::Dominators::ValidationContext::reportError): (WTF::Dominators::ValidationContext::handleErrors): (WTF::Dominators::naiveDominates): (WTF::Dominators::forAllBlocksInDominanceFrontierOfImpl): (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOfImpl): (WTF::Dominators::BlockData::BlockData): Canonical link: https://commits.webkit.org/168962@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@191870 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-11-02 00:48:03 +00:00
dataLog("]\n");
}
dataLog("\n");
dataLog("Lengauer-Tarjan Dominators:\n");
dataLog(dominators);
dataLog("\n");
dataLog("Naive Dominators:\n");
naiveDominators.dump(WTF::dataFile());
dataLog("\n");
dataLog("Graph at time of failure:\n");
dataLog(graph);
dataLog("\n");
dataLog("DFG DOMINATOR VALIDATION FAILIED!\n");
CRASH();
}
Graph& graph;
Dominators& dominators;
NaiveDominators naiveDominators;
struct Error {
[WTF][JSC] Make JSC and WTF aggressively-fast-malloced https://bugs.webkit.org/show_bug.cgi?id=200611 Reviewed by Saam Barati. Source/JavaScriptCore: This patch aggressively puts many classes into FastMalloc. In JSC side, we grep `std::make_unique` etc. to find potentially system-malloc-allocated classes. After this patch, all the JSC related allocations in JetStream2 cli is done from bmalloc. In the future, it would be nice that we add `WTF::makeUnique<T>` helper function and throw a compile error if `T` is not FastMalloc annotated[1]. Putting WebKit classes in FastMalloc has many benefits. 1. Simply, it is fast. 2. vmmap can tell the amount of memory used for WebKit. 3. bmalloc can isolate WebKit memory allocation from the rest of the world. This is useful since we can know more about what component is corrupting the memory from the memory corruption crash. [1]: https://bugs.webkit.org/show_bug.cgi?id=200620 * API/ObjCCallbackFunction.mm: * assembler/AbstractMacroAssembler.h: * b3/B3PhiChildren.h: * b3/air/AirAllocateRegistersAndStackAndGenerateCode.h: * b3/air/AirDisassembler.h: * bytecode/AccessCaseSnippetParams.h: * bytecode/CallVariant.h: * bytecode/DeferredSourceDump.h: * bytecode/ExecutionCounter.h: * bytecode/GetByIdStatus.h: * bytecode/GetByIdVariant.h: * bytecode/InByIdStatus.h: * bytecode/InByIdVariant.h: * bytecode/InstanceOfStatus.h: * bytecode/InstanceOfVariant.h: * bytecode/PutByIdStatus.h: * bytecode/PutByIdVariant.h: * bytecode/ValueProfile.h: * dfg/DFGAbstractInterpreter.h: * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::newVariableAccessData): * dfg/DFGFlowIndexing.h: * dfg/DFGFlowMap.h: * dfg/DFGLiveCatchVariablePreservationPhase.cpp: (JSC::DFG::LiveCatchVariablePreservationPhase::newVariableAccessData): * dfg/DFGMaximalFlushInsertionPhase.cpp: (JSC::DFG::MaximalFlushInsertionPhase::newVariableAccessData): * dfg/DFGOSRExit.h: * dfg/DFGSpeculativeJIT.h: * dfg/DFGVariableAccessData.h: * disassembler/ARM64/A64DOpcode.h: * inspector/remote/socket/RemoteInspectorMessageParser.h: * inspector/remote/socket/RemoteInspectorSocket.h: * inspector/remote/socket/RemoteInspectorSocketEndpoint.h: * jit/PCToCodeOriginMap.h: * runtime/BasicBlockLocation.h: * runtime/DoublePredictionFuzzerAgent.h: * runtime/JSRunLoopTimer.h: * runtime/PromiseDeferredTimer.h: (JSC::PromiseDeferredTimer::create): PromiseDeferredTimer should be allocated as `Ref<>` instead of `std::unique_ptr` since it is inheriting ThreadSafeRefCounted<>. Holding such a class with std::unique_ptr could lead to potentially dangerous operations (like, someone holds it with Ref<> while it is deleted by std::unique_ptr<>). * runtime/RandomizingFuzzerAgent.h: * runtime/SymbolTable.h: * runtime/VM.cpp: (JSC::VM::VM): * runtime/VM.h: * tools/JSDollarVM.cpp: * tools/SigillCrashAnalyzer.cpp: * wasm/WasmFormat.h: * wasm/WasmMemory.cpp: * wasm/WasmSignature.h: * yarr/YarrJIT.h: Source/WebCore: Changed the accessor since we changed std::unique_ptr to Ref for this field. No behavior change. * bindings/js/WorkerScriptController.cpp: (WebCore::WorkerScriptController::addTimerSetNotification): (WebCore::WorkerScriptController::removeTimerSetNotification): Source/WTF: WTF has many data structures, in particular, containers. And these containers can be allocated like `std::make_unique<Container>()`. Without WTF_MAKE_FAST_ALLOCATED, this container itself is allocated from the system malloc. This patch attaches WTF_MAKE_FAST_ALLOCATED more aggressively not to allocate them from the system malloc. And we add some `final` to containers and classes that would be never inherited. * wtf/Assertions.cpp: * wtf/Atomics.h: * wtf/AutodrainedPool.h: * wtf/Bag.h: (WTF::Bag::Bag): Deleted. (WTF::Bag::~Bag): Deleted. (WTF::Bag::clear): Deleted. (WTF::Bag::add): Deleted. (WTF::Bag::iterator::iterator): Deleted. (WTF::Bag::iterator::operator! const): Deleted. (WTF::Bag::iterator::operator* const): Deleted. (WTF::Bag::iterator::operator++): Deleted. (WTF::Bag::iterator::operator== const): Deleted. (WTF::Bag::iterator::operator!= const): Deleted. (WTF::Bag::begin): Deleted. (WTF::Bag::begin const): Deleted. (WTF::Bag::end const): Deleted. (WTF::Bag::isEmpty const): Deleted. (WTF::Bag::unwrappedHead const): Deleted. * wtf/BitVector.h: (WTF::BitVector::BitVector): Deleted. (WTF::BitVector::~BitVector): Deleted. (WTF::BitVector::operator=): Deleted. (WTF::BitVector::size const): Deleted. (WTF::BitVector::ensureSize): Deleted. (WTF::BitVector::quickGet const): Deleted. (WTF::BitVector::quickSet): Deleted. (WTF::BitVector::quickClear): Deleted. (WTF::BitVector::get const): Deleted. (WTF::BitVector::contains const): Deleted. (WTF::BitVector::set): Deleted. (WTF::BitVector::add): Deleted. (WTF::BitVector::ensureSizeAndSet): Deleted. (WTF::BitVector::clear): Deleted. (WTF::BitVector::remove): Deleted. (WTF::BitVector::merge): Deleted. (WTF::BitVector::filter): Deleted. (WTF::BitVector::exclude): Deleted. (WTF::BitVector::bitCount const): Deleted. (WTF::BitVector::isEmpty const): Deleted. (WTF::BitVector::findBit const): Deleted. (WTF::BitVector::isEmptyValue const): Deleted. (WTF::BitVector::isDeletedValue const): Deleted. (WTF::BitVector::isEmptyOrDeletedValue const): Deleted. (WTF::BitVector::operator== const): Deleted. (WTF::BitVector::hash const): Deleted. (WTF::BitVector::iterator::iterator): Deleted. (WTF::BitVector::iterator::operator* const): Deleted. (WTF::BitVector::iterator::operator++): Deleted. (WTF::BitVector::iterator::isAtEnd const): Deleted. (WTF::BitVector::iterator::operator== const): Deleted. (WTF::BitVector::iterator::operator!= const): Deleted. (WTF::BitVector::begin const): Deleted. (WTF::BitVector::end const): Deleted. (WTF::BitVector::bitsInPointer): Deleted. (WTF::BitVector::maxInlineBits): Deleted. (WTF::BitVector::byteCount): Deleted. (WTF::BitVector::makeInlineBits): Deleted. (WTF::BitVector::cleanseInlineBits): Deleted. (WTF::BitVector::bitCount): Deleted. (WTF::BitVector::findBitFast const): Deleted. (WTF::BitVector::findBitSimple const): Deleted. (WTF::BitVector::OutOfLineBits::numBits const): Deleted. (WTF::BitVector::OutOfLineBits::numWords const): Deleted. (WTF::BitVector::OutOfLineBits::bits): Deleted. (WTF::BitVector::OutOfLineBits::bits const): Deleted. (WTF::BitVector::OutOfLineBits::OutOfLineBits): Deleted. (WTF::BitVector::isInline const): Deleted. (WTF::BitVector::outOfLineBits const): Deleted. (WTF::BitVector::outOfLineBits): Deleted. (WTF::BitVector::bits): Deleted. (WTF::BitVector::bits const): Deleted. * wtf/Bitmap.h: (WTF::Bitmap::size): Deleted. (WTF::Bitmap::iterator::iterator): Deleted. (WTF::Bitmap::iterator::operator* const): Deleted. (WTF::Bitmap::iterator::operator++): Deleted. (WTF::Bitmap::iterator::operator== const): Deleted. (WTF::Bitmap::iterator::operator!= const): Deleted. (WTF::Bitmap::begin const): Deleted. (WTF::Bitmap::end const): Deleted. * wtf/Box.h: * wtf/BumpPointerAllocator.h: * wtf/CPUTime.h: * wtf/CheckedBoolean.h: * wtf/CommaPrinter.h: (WTF::CommaPrinter::CommaPrinter): Deleted. (WTF::CommaPrinter::dump const): Deleted. (WTF::CommaPrinter::didPrint const): Deleted. * wtf/CompactPointerTuple.h: (WTF::CompactPointerTuple::encodeType): Deleted. (WTF::CompactPointerTuple::decodeType): Deleted. (WTF::CompactPointerTuple::CompactPointerTuple): Deleted. (WTF::CompactPointerTuple::pointer const): Deleted. (WTF::CompactPointerTuple::setPointer): Deleted. (WTF::CompactPointerTuple::type const): Deleted. (WTF::CompactPointerTuple::setType): Deleted. * wtf/CompilationThread.h: (WTF::CompilationScope::CompilationScope): Deleted. (WTF::CompilationScope::~CompilationScope): Deleted. (WTF::CompilationScope::leaveEarly): Deleted. * wtf/CompletionHandler.h: (WTF::CompletionHandler<Out): (WTF::Detail::CallableWrapper<CompletionHandler<Out): (WTF::CompletionHandlerCallingScope::CompletionHandlerCallingScope): Deleted. (WTF::CompletionHandlerCallingScope::~CompletionHandlerCallingScope): Deleted. (WTF::CompletionHandlerCallingScope::CompletionHandler<void): Deleted. * wtf/ConcurrentBuffer.h: (WTF::ConcurrentBuffer::ConcurrentBuffer): Deleted. (WTF::ConcurrentBuffer::~ConcurrentBuffer): Deleted. (WTF::ConcurrentBuffer::growExact): Deleted. (WTF::ConcurrentBuffer::grow): Deleted. (WTF::ConcurrentBuffer::array const): Deleted. (WTF::ConcurrentBuffer::operator[]): Deleted. (WTF::ConcurrentBuffer::operator[] const): Deleted. (WTF::ConcurrentBuffer::createArray): Deleted. * wtf/ConcurrentPtrHashSet.h: (WTF::ConcurrentPtrHashSet::contains): Deleted. (WTF::ConcurrentPtrHashSet::add): Deleted. (WTF::ConcurrentPtrHashSet::size const): Deleted. (WTF::ConcurrentPtrHashSet::Table::maxLoad const): Deleted. (WTF::ConcurrentPtrHashSet::hash): Deleted. (WTF::ConcurrentPtrHashSet::cast): Deleted. (WTF::ConcurrentPtrHashSet::containsImpl const): Deleted. (WTF::ConcurrentPtrHashSet::addImpl): Deleted. * wtf/ConcurrentVector.h: (WTF::ConcurrentVector::~ConcurrentVector): Deleted. (WTF::ConcurrentVector::size const): Deleted. (WTF::ConcurrentVector::isEmpty const): Deleted. (WTF::ConcurrentVector::at): Deleted. (WTF::ConcurrentVector::at const): Deleted. (WTF::ConcurrentVector::operator[]): Deleted. (WTF::ConcurrentVector::operator[] const): Deleted. (WTF::ConcurrentVector::first): Deleted. (WTF::ConcurrentVector::first const): Deleted. (WTF::ConcurrentVector::last): Deleted. (WTF::ConcurrentVector::last const): Deleted. (WTF::ConcurrentVector::takeLast): Deleted. (WTF::ConcurrentVector::append): Deleted. (WTF::ConcurrentVector::alloc): Deleted. (WTF::ConcurrentVector::removeLast): Deleted. (WTF::ConcurrentVector::grow): Deleted. (WTF::ConcurrentVector::begin): Deleted. (WTF::ConcurrentVector::end): Deleted. (WTF::ConcurrentVector::segmentExistsFor): Deleted. (WTF::ConcurrentVector::segmentFor): Deleted. (WTF::ConcurrentVector::subscriptFor): Deleted. (WTF::ConcurrentVector::ensureSegmentsFor): Deleted. (WTF::ConcurrentVector::ensureSegment): Deleted. (WTF::ConcurrentVector::allocateSegment): Deleted. * wtf/Condition.h: (WTF::Condition::waitUntil): Deleted. (WTF::Condition::waitFor): Deleted. (WTF::Condition::wait): Deleted. (WTF::Condition::notifyOne): Deleted. (WTF::Condition::notifyAll): Deleted. * wtf/CountingLock.h: (WTF::CountingLock::LockHooks::lockHook): Deleted. (WTF::CountingLock::LockHooks::unlockHook): Deleted. (WTF::CountingLock::LockHooks::parkHook): Deleted. (WTF::CountingLock::LockHooks::handoffHook): Deleted. (WTF::CountingLock::tryLock): Deleted. (WTF::CountingLock::lock): Deleted. (WTF::CountingLock::unlock): Deleted. (WTF::CountingLock::isHeld const): Deleted. (WTF::CountingLock::isLocked const): Deleted. (WTF::CountingLock::Count::operator bool const): Deleted. (WTF::CountingLock::Count::operator== const): Deleted. (WTF::CountingLock::Count::operator!= const): Deleted. (WTF::CountingLock::tryOptimisticRead): Deleted. (WTF::CountingLock::validate): Deleted. (WTF::CountingLock::doOptimizedRead): Deleted. (WTF::CountingLock::tryOptimisticFencelessRead): Deleted. (WTF::CountingLock::fencelessValidate): Deleted. (WTF::CountingLock::doOptimizedFencelessRead): Deleted. (WTF::CountingLock::getCount): Deleted. * wtf/CrossThreadQueue.h: * wtf/CrossThreadTask.h: * wtf/CryptographicallyRandomNumber.cpp: * wtf/DataMutex.h: * wtf/DateMath.h: * wtf/Deque.h: (WTF::Deque::size const): Deleted. (WTF::Deque::isEmpty const): Deleted. (WTF::Deque::begin): Deleted. (WTF::Deque::end): Deleted. (WTF::Deque::begin const): Deleted. (WTF::Deque::end const): Deleted. (WTF::Deque::rbegin): Deleted. (WTF::Deque::rend): Deleted. (WTF::Deque::rbegin const): Deleted. (WTF::Deque::rend const): Deleted. (WTF::Deque::first): Deleted. (WTF::Deque::first const): Deleted. (WTF::Deque::last): Deleted. (WTF::Deque::last const): Deleted. (WTF::Deque::append): Deleted. * wtf/Dominators.h: * wtf/DoublyLinkedList.h: * wtf/Expected.h: * wtf/FastBitVector.h: * wtf/FileMetadata.h: * wtf/FileSystem.h: * wtf/GraphNodeWorklist.h: * wtf/GregorianDateTime.h: (WTF::GregorianDateTime::GregorianDateTime): Deleted. (WTF::GregorianDateTime::year const): Deleted. (WTF::GregorianDateTime::month const): Deleted. (WTF::GregorianDateTime::yearDay const): Deleted. (WTF::GregorianDateTime::monthDay const): Deleted. (WTF::GregorianDateTime::weekDay const): Deleted. (WTF::GregorianDateTime::hour const): Deleted. (WTF::GregorianDateTime::minute const): Deleted. (WTF::GregorianDateTime::second const): Deleted. (WTF::GregorianDateTime::utcOffset const): Deleted. (WTF::GregorianDateTime::isDST const): Deleted. (WTF::GregorianDateTime::setYear): Deleted. (WTF::GregorianDateTime::setMonth): Deleted. (WTF::GregorianDateTime::setYearDay): Deleted. (WTF::GregorianDateTime::setMonthDay): Deleted. (WTF::GregorianDateTime::setWeekDay): Deleted. (WTF::GregorianDateTime::setHour): Deleted. (WTF::GregorianDateTime::setMinute): Deleted. (WTF::GregorianDateTime::setSecond): Deleted. (WTF::GregorianDateTime::setUtcOffset): Deleted. (WTF::GregorianDateTime::setIsDST): Deleted. (WTF::GregorianDateTime::operator tm const): Deleted. (WTF::GregorianDateTime::copyFrom): Deleted. * wtf/HashTable.h: * wtf/Hasher.h: * wtf/HexNumber.h: * wtf/Indenter.h: * wtf/IndexMap.h: * wtf/IndexSet.h: * wtf/IndexSparseSet.h: * wtf/IndexedContainerIterator.h: * wtf/Insertion.h: * wtf/IteratorAdaptors.h: * wtf/IteratorRange.h: * wtf/KeyValuePair.h: * wtf/ListHashSet.h: (WTF::ListHashSet::begin): Deleted. (WTF::ListHashSet::end): Deleted. (WTF::ListHashSet::begin const): Deleted. (WTF::ListHashSet::end const): Deleted. (WTF::ListHashSet::random): Deleted. (WTF::ListHashSet::random const): Deleted. (WTF::ListHashSet::rbegin): Deleted. (WTF::ListHashSet::rend): Deleted. (WTF::ListHashSet::rbegin const): Deleted. (WTF::ListHashSet::rend const): Deleted. * wtf/Liveness.h: * wtf/LocklessBag.h: (WTF::LocklessBag::LocklessBag): Deleted. (WTF::LocklessBag::add): Deleted. (WTF::LocklessBag::iterate): Deleted. (WTF::LocklessBag::consumeAll): Deleted. (WTF::LocklessBag::consumeAllWithNode): Deleted. (WTF::LocklessBag::~LocklessBag): Deleted. * wtf/LoggingHashID.h: * wtf/MD5.h: * wtf/MachSendRight.h: * wtf/MainThreadData.h: * wtf/Markable.h: * wtf/MediaTime.h: * wtf/MemoryPressureHandler.h: * wtf/MessageQueue.h: (WTF::MessageQueue::MessageQueue): Deleted. * wtf/MetaAllocator.h: * wtf/MonotonicTime.h: (WTF::MonotonicTime::MonotonicTime): Deleted. (WTF::MonotonicTime::fromRawSeconds): Deleted. (WTF::MonotonicTime::infinity): Deleted. (WTF::MonotonicTime::nan): Deleted. (WTF::MonotonicTime::secondsSinceEpoch const): Deleted. (WTF::MonotonicTime::approximateMonotonicTime const): Deleted. (WTF::MonotonicTime::operator bool const): Deleted. (WTF::MonotonicTime::operator+ const): Deleted. (WTF::MonotonicTime::operator- const): Deleted. (WTF::MonotonicTime::operator% const): Deleted. (WTF::MonotonicTime::operator+=): Deleted. (WTF::MonotonicTime::operator-=): Deleted. (WTF::MonotonicTime::operator== const): Deleted. (WTF::MonotonicTime::operator!= const): Deleted. (WTF::MonotonicTime::operator< const): Deleted. (WTF::MonotonicTime::operator> const): Deleted. (WTF::MonotonicTime::operator<= const): Deleted. (WTF::MonotonicTime::operator>= const): Deleted. (WTF::MonotonicTime::isolatedCopy const): Deleted. (WTF::MonotonicTime::encode const): Deleted. (WTF::MonotonicTime::decode): Deleted. * wtf/NaturalLoops.h: * wtf/NoLock.h: * wtf/OSAllocator.h: * wtf/OptionSet.h: * wtf/Optional.h: * wtf/OrderMaker.h: * wtf/Packed.h: (WTF::alignof): * wtf/PackedIntVector.h: (WTF::PackedIntVector::PackedIntVector): Deleted. (WTF::PackedIntVector::operator=): Deleted. (WTF::PackedIntVector::size const): Deleted. (WTF::PackedIntVector::ensureSize): Deleted. (WTF::PackedIntVector::resize): Deleted. (WTF::PackedIntVector::clearAll): Deleted. (WTF::PackedIntVector::get const): Deleted. (WTF::PackedIntVector::set): Deleted. (WTF::PackedIntVector::mask): Deleted. * wtf/PageBlock.h: * wtf/ParallelJobsOpenMP.h: * wtf/ParkingLot.h: * wtf/PriorityQueue.h: (WTF::PriorityQueue::size const): Deleted. (WTF::PriorityQueue::isEmpty const): Deleted. (WTF::PriorityQueue::enqueue): Deleted. (WTF::PriorityQueue::peek const): Deleted. (WTF::PriorityQueue::dequeue): Deleted. (WTF::PriorityQueue::decreaseKey): Deleted. (WTF::PriorityQueue::increaseKey): Deleted. (WTF::PriorityQueue::begin const): Deleted. (WTF::PriorityQueue::end const): Deleted. (WTF::PriorityQueue::isValidHeap const): Deleted. (WTF::PriorityQueue::parentOf): Deleted. (WTF::PriorityQueue::leftChildOf): Deleted. (WTF::PriorityQueue::rightChildOf): Deleted. (WTF::PriorityQueue::siftUp): Deleted. (WTF::PriorityQueue::siftDown): Deleted. * wtf/RandomDevice.h: * wtf/Range.h: * wtf/RangeSet.h: (WTF::RangeSet::RangeSet): Deleted. (WTF::RangeSet::~RangeSet): Deleted. (WTF::RangeSet::add): Deleted. (WTF::RangeSet::contains const): Deleted. (WTF::RangeSet::overlaps const): Deleted. (WTF::RangeSet::clear): Deleted. (WTF::RangeSet::dump const): Deleted. (WTF::RangeSet::dumpRaw const): Deleted. (WTF::RangeSet::begin const): Deleted. (WTF::RangeSet::end const): Deleted. (WTF::RangeSet::addAll): Deleted. (WTF::RangeSet::compact): Deleted. (WTF::RangeSet::overlapsNonEmpty): Deleted. (WTF::RangeSet::subsumesNonEmpty): Deleted. (WTF::RangeSet::findRange const): Deleted. * wtf/RecursableLambda.h: * wtf/RedBlackTree.h: (WTF::RedBlackTree::Node::successor const): Deleted. (WTF::RedBlackTree::Node::predecessor const): Deleted. (WTF::RedBlackTree::Node::successor): Deleted. (WTF::RedBlackTree::Node::predecessor): Deleted. (WTF::RedBlackTree::Node::reset): Deleted. (WTF::RedBlackTree::Node::parent const): Deleted. (WTF::RedBlackTree::Node::setParent): Deleted. (WTF::RedBlackTree::Node::left const): Deleted. (WTF::RedBlackTree::Node::setLeft): Deleted. (WTF::RedBlackTree::Node::right const): Deleted. (WTF::RedBlackTree::Node::setRight): Deleted. (WTF::RedBlackTree::Node::color const): Deleted. (WTF::RedBlackTree::Node::setColor): Deleted. (WTF::RedBlackTree::RedBlackTree): Deleted. (WTF::RedBlackTree::insert): Deleted. (WTF::RedBlackTree::remove): Deleted. (WTF::RedBlackTree::findExact const): Deleted. (WTF::RedBlackTree::findLeastGreaterThanOrEqual const): Deleted. (WTF::RedBlackTree::findGreatestLessThanOrEqual const): Deleted. (WTF::RedBlackTree::first const): Deleted. (WTF::RedBlackTree::last const): Deleted. (WTF::RedBlackTree::size): Deleted. (WTF::RedBlackTree::isEmpty): Deleted. (WTF::RedBlackTree::treeMinimum): Deleted. (WTF::RedBlackTree::treeMaximum): Deleted. (WTF::RedBlackTree::treeInsert): Deleted. (WTF::RedBlackTree::leftRotate): Deleted. (WTF::RedBlackTree::rightRotate): Deleted. (WTF::RedBlackTree::removeFixup): Deleted. * wtf/ResourceUsage.h: * wtf/RunLoop.cpp: * wtf/RunLoopTimer.h: * wtf/SHA1.h: * wtf/Seconds.h: (WTF::Seconds::Seconds): Deleted. (WTF::Seconds::value const): Deleted. (WTF::Seconds::minutes const): Deleted. (WTF::Seconds::seconds const): Deleted. (WTF::Seconds::milliseconds const): Deleted. (WTF::Seconds::microseconds const): Deleted. (WTF::Seconds::nanoseconds const): Deleted. (WTF::Seconds::minutesAs const): Deleted. (WTF::Seconds::secondsAs const): Deleted. (WTF::Seconds::millisecondsAs const): Deleted. (WTF::Seconds::microsecondsAs const): Deleted. (WTF::Seconds::nanosecondsAs const): Deleted. (WTF::Seconds::fromMinutes): Deleted. (WTF::Seconds::fromHours): Deleted. (WTF::Seconds::fromMilliseconds): Deleted. (WTF::Seconds::fromMicroseconds): Deleted. (WTF::Seconds::fromNanoseconds): Deleted. (WTF::Seconds::infinity): Deleted. (WTF::Seconds::nan): Deleted. (WTF::Seconds::operator bool const): Deleted. (WTF::Seconds::operator+ const): Deleted. (WTF::Seconds::operator- const): Deleted. (WTF::Seconds::operator* const): Deleted. (WTF::Seconds::operator/ const): Deleted. (WTF::Seconds::operator% const): Deleted. (WTF::Seconds::operator+=): Deleted. (WTF::Seconds::operator-=): Deleted. (WTF::Seconds::operator*=): Deleted. (WTF::Seconds::operator/=): Deleted. (WTF::Seconds::operator%=): Deleted. (WTF::Seconds::operator== const): Deleted. (WTF::Seconds::operator!= const): Deleted. (WTF::Seconds::operator< const): Deleted. (WTF::Seconds::operator> const): Deleted. (WTF::Seconds::operator<= const): Deleted. (WTF::Seconds::operator>= const): Deleted. (WTF::Seconds::isolatedCopy const): Deleted. (WTF::Seconds::encode const): Deleted. (WTF::Seconds::decode): Deleted. * wtf/SegmentedVector.h: (WTF::SegmentedVector::~SegmentedVector): Deleted. (WTF::SegmentedVector::size const): Deleted. (WTF::SegmentedVector::isEmpty const): Deleted. (WTF::SegmentedVector::at): Deleted. (WTF::SegmentedVector::at const): Deleted. (WTF::SegmentedVector::operator[]): Deleted. (WTF::SegmentedVector::operator[] const): Deleted. (WTF::SegmentedVector::first): Deleted. (WTF::SegmentedVector::first const): Deleted. (WTF::SegmentedVector::last): Deleted. (WTF::SegmentedVector::last const): Deleted. (WTF::SegmentedVector::takeLast): Deleted. (WTF::SegmentedVector::append): Deleted. (WTF::SegmentedVector::alloc): Deleted. (WTF::SegmentedVector::removeLast): Deleted. (WTF::SegmentedVector::grow): Deleted. (WTF::SegmentedVector::clear): Deleted. (WTF::SegmentedVector::begin): Deleted. (WTF::SegmentedVector::end): Deleted. (WTF::SegmentedVector::shrinkToFit): Deleted. (WTF::SegmentedVector::deleteAllSegments): Deleted. (WTF::SegmentedVector::segmentExistsFor): Deleted. (WTF::SegmentedVector::segmentFor): Deleted. (WTF::SegmentedVector::subscriptFor): Deleted. (WTF::SegmentedVector::ensureSegmentsFor): Deleted. (WTF::SegmentedVector::ensureSegment): Deleted. (WTF::SegmentedVector::allocateSegment): Deleted. * wtf/SetForScope.h: * wtf/SingleRootGraph.h: * wtf/SinglyLinkedList.h: * wtf/SmallPtrSet.h: * wtf/SpanningTree.h: * wtf/Spectrum.h: * wtf/StackBounds.h: * wtf/StackShot.h: * wtf/StackShotProfiler.h: * wtf/StackStats.h: * wtf/StackTrace.h: * wtf/StreamBuffer.h: * wtf/SynchronizedFixedQueue.h: (WTF::SynchronizedFixedQueue::create): Deleted. (WTF::SynchronizedFixedQueue::open): Deleted. (WTF::SynchronizedFixedQueue::close): Deleted. (WTF::SynchronizedFixedQueue::isOpen): Deleted. (WTF::SynchronizedFixedQueue::enqueue): Deleted. (WTF::SynchronizedFixedQueue::dequeue): Deleted. (WTF::SynchronizedFixedQueue::SynchronizedFixedQueue): Deleted. * wtf/SystemTracing.h: * wtf/ThreadGroup.h: (WTF::ThreadGroup::create): Deleted. (WTF::ThreadGroup::threads const): Deleted. (WTF::ThreadGroup::getLock): Deleted. (WTF::ThreadGroup::weakFromThis): Deleted. * wtf/ThreadSpecific.h: * wtf/ThreadingPrimitives.h: (WTF::Mutex::impl): Deleted. * wtf/TimeWithDynamicClockType.h: (WTF::TimeWithDynamicClockType::TimeWithDynamicClockType): Deleted. (WTF::TimeWithDynamicClockType::fromRawSeconds): Deleted. (WTF::TimeWithDynamicClockType::secondsSinceEpoch const): Deleted. (WTF::TimeWithDynamicClockType::clockType const): Deleted. (WTF::TimeWithDynamicClockType::withSameClockAndRawSeconds const): Deleted. (WTF::TimeWithDynamicClockType::operator bool const): Deleted. (WTF::TimeWithDynamicClockType::operator+ const): Deleted. (WTF::TimeWithDynamicClockType::operator- const): Deleted. (WTF::TimeWithDynamicClockType::operator+=): Deleted. (WTF::TimeWithDynamicClockType::operator-=): Deleted. (WTF::TimeWithDynamicClockType::operator== const): Deleted. (WTF::TimeWithDynamicClockType::operator!= const): Deleted. * wtf/TimingScope.h: * wtf/TinyLRUCache.h: * wtf/TinyPtrSet.h: * wtf/URLParser.cpp: * wtf/URLParser.h: * wtf/Unexpected.h: * wtf/Variant.h: * wtf/WTFSemaphore.h: (WTF::Semaphore::Semaphore): Deleted. (WTF::Semaphore::signal): Deleted. (WTF::Semaphore::waitUntil): Deleted. (WTF::Semaphore::waitFor): Deleted. (WTF::Semaphore::wait): Deleted. * wtf/WallTime.h: (WTF::WallTime::WallTime): Deleted. (WTF::WallTime::fromRawSeconds): Deleted. (WTF::WallTime::infinity): Deleted. (WTF::WallTime::nan): Deleted. (WTF::WallTime::secondsSinceEpoch const): Deleted. (WTF::WallTime::approximateWallTime const): Deleted. (WTF::WallTime::operator bool const): Deleted. (WTF::WallTime::operator+ const): Deleted. (WTF::WallTime::operator- const): Deleted. (WTF::WallTime::operator+=): Deleted. (WTF::WallTime::operator-=): Deleted. (WTF::WallTime::operator== const): Deleted. (WTF::WallTime::operator!= const): Deleted. (WTF::WallTime::operator< const): Deleted. (WTF::WallTime::operator> const): Deleted. (WTF::WallTime::operator<= const): Deleted. (WTF::WallTime::operator>= const): Deleted. (WTF::WallTime::isolatedCopy const): Deleted. * wtf/WeakHashSet.h: (WTF::WeakHashSet::WeakHashSetConstIterator::WeakHashSetConstIterator): Deleted. (WTF::WeakHashSet::WeakHashSetConstIterator::get const): Deleted. (WTF::WeakHashSet::WeakHashSetConstIterator::operator* const): Deleted. (WTF::WeakHashSet::WeakHashSetConstIterator::operator-> const): Deleted. (WTF::WeakHashSet::WeakHashSetConstIterator::operator++): Deleted. (WTF::WeakHashSet::WeakHashSetConstIterator::skipEmptyBuckets): Deleted. (WTF::WeakHashSet::WeakHashSetConstIterator::operator== const): Deleted. (WTF::WeakHashSet::WeakHashSetConstIterator::operator!= const): Deleted. (WTF::WeakHashSet::WeakHashSet): Deleted. (WTF::WeakHashSet::begin const): Deleted. (WTF::WeakHashSet::end const): Deleted. (WTF::WeakHashSet::add): Deleted. (WTF::WeakHashSet::remove): Deleted. (WTF::WeakHashSet::contains const): Deleted. (WTF::WeakHashSet::capacity const): Deleted. (WTF::WeakHashSet::computesEmpty const): Deleted. (WTF::WeakHashSet::hasNullReferences const): Deleted. (WTF::WeakHashSet::computeSize const): Deleted. (WTF::WeakHashSet::checkConsistency const): Deleted. * wtf/WeakRandom.h: (WTF::WeakRandom::WeakRandom): Deleted. (WTF::WeakRandom::setSeed): Deleted. (WTF::WeakRandom::seed const): Deleted. (WTF::WeakRandom::get): Deleted. (WTF::WeakRandom::getUint32): Deleted. (WTF::WeakRandom::lowOffset): Deleted. (WTF::WeakRandom::highOffset): Deleted. (WTF::WeakRandom::nextState): Deleted. (WTF::WeakRandom::generate): Deleted. (WTF::WeakRandom::advance): Deleted. * wtf/WordLock.h: (WTF::WordLock::lock): Deleted. (WTF::WordLock::unlock): Deleted. (WTF::WordLock::isHeld const): Deleted. (WTF::WordLock::isLocked const): Deleted. (WTF::WordLock::isFullyReset const): Deleted. * wtf/generic/MainThreadGeneric.cpp: * wtf/glib/GMutexLocker.h: * wtf/linux/CurrentProcessMemoryStatus.h: * wtf/posix/ThreadingPOSIX.cpp: (WTF::Semaphore::Semaphore): Deleted. (WTF::Semaphore::~Semaphore): Deleted. (WTF::Semaphore::wait): Deleted. (WTF::Semaphore::post): Deleted. * wtf/text/ASCIILiteral.h: (WTF::ASCIILiteral::operator const char* const): Deleted. (WTF::ASCIILiteral::fromLiteralUnsafe): Deleted. (WTF::ASCIILiteral::null): Deleted. (WTF::ASCIILiteral::characters const): Deleted. (WTF::ASCIILiteral::ASCIILiteral): Deleted. * wtf/text/AtomString.h: (WTF::AtomString::operator=): Deleted. (WTF::AtomString::isHashTableDeletedValue const): Deleted. (WTF::AtomString::existingHash const): Deleted. (WTF::AtomString::operator const String& const): Deleted. (WTF::AtomString::string const): Deleted. (WTF::AtomString::impl const): Deleted. (WTF::AtomString::is8Bit const): Deleted. (WTF::AtomString::characters8 const): Deleted. (WTF::AtomString::characters16 const): Deleted. (WTF::AtomString::length const): Deleted. (WTF::AtomString::operator[] const): Deleted. (WTF::AtomString::contains const): Deleted. (WTF::AtomString::containsIgnoringASCIICase const): Deleted. (WTF::AtomString::find const): Deleted. (WTF::AtomString::findIgnoringASCIICase const): Deleted. (WTF::AtomString::startsWith const): Deleted. (WTF::AtomString::startsWithIgnoringASCIICase const): Deleted. (WTF::AtomString::endsWith const): Deleted. (WTF::AtomString::endsWithIgnoringASCIICase const): Deleted. (WTF::AtomString::toInt const): Deleted. (WTF::AtomString::toDouble const): Deleted. (WTF::AtomString::toFloat const): Deleted. (WTF::AtomString::percentage const): Deleted. (WTF::AtomString::isNull const): Deleted. (WTF::AtomString::isEmpty const): Deleted. (WTF::AtomString::operator NSString * const): Deleted. * wtf/text/AtomStringImpl.h: (WTF::AtomStringImpl::lookUp): Deleted. (WTF::AtomStringImpl::add): Deleted. (WTF::AtomStringImpl::addWithStringTableProvider): Deleted. * wtf/text/CString.h: (WTF::CStringBuffer::data): Deleted. (WTF::CStringBuffer::length const): Deleted. (WTF::CStringBuffer::CStringBuffer): Deleted. (WTF::CStringBuffer::mutableData): Deleted. (WTF::CString::CString): Deleted. (WTF::CString::data const): Deleted. (WTF::CString::length const): Deleted. (WTF::CString::isNull const): Deleted. (WTF::CString::buffer const): Deleted. (WTF::CString::isHashTableDeletedValue const): Deleted. * wtf/text/ExternalStringImpl.h: (WTF::ExternalStringImpl::freeExternalBuffer): Deleted. * wtf/text/LineBreakIteratorPoolICU.h: * wtf/text/NullTextBreakIterator.h: * wtf/text/OrdinalNumber.h: * wtf/text/StringBuffer.h: * wtf/text/StringBuilder.h: * wtf/text/StringConcatenateNumbers.h: * wtf/text/StringHasher.h: * wtf/text/StringImpl.h: * wtf/text/StringView.cpp: * wtf/text/StringView.h: (WTF::StringView::left const): Deleted. (WTF::StringView::right const): Deleted. (WTF::StringView::underlyingStringIsValid const): Deleted. (WTF::StringView::setUnderlyingString): Deleted. * wtf/text/SymbolImpl.h: (WTF::SymbolImpl::StaticSymbolImpl::StaticSymbolImpl): Deleted. (WTF::SymbolImpl::StaticSymbolImpl::operator SymbolImpl&): Deleted. (WTF::PrivateSymbolImpl::PrivateSymbolImpl): Deleted. (WTF::RegisteredSymbolImpl::symbolRegistry const): Deleted. (WTF::RegisteredSymbolImpl::clearSymbolRegistry): Deleted. (WTF::RegisteredSymbolImpl::RegisteredSymbolImpl): Deleted. * wtf/text/SymbolRegistry.h: * wtf/text/TextBreakIterator.h: * wtf/text/TextPosition.h: * wtf/text/TextStream.h: * wtf/text/WTFString.h: (WTF::String::swap): Deleted. (WTF::String::adopt): Deleted. (WTF::String::isNull const): Deleted. (WTF::String::isEmpty const): Deleted. (WTF::String::impl const): Deleted. (WTF::String::releaseImpl): Deleted. (WTF::String::length const): Deleted. (WTF::String::characters8 const): Deleted. (WTF::String::characters16 const): Deleted. (WTF::String::is8Bit const): Deleted. (WTF::String::sizeInBytes const): Deleted. (WTF::String::operator[] const): Deleted. (WTF::String::find const): Deleted. (WTF::String::findIgnoringASCIICase const): Deleted. (WTF::String::reverseFind const): Deleted. (WTF::String::contains const): Deleted. (WTF::String::containsIgnoringASCIICase const): Deleted. (WTF::String::startsWith const): Deleted. (WTF::String::startsWithIgnoringASCIICase const): Deleted. (WTF::String::hasInfixStartingAt const): Deleted. (WTF::String::endsWith const): Deleted. (WTF::String::endsWithIgnoringASCIICase const): Deleted. (WTF::String::hasInfixEndingAt const): Deleted. (WTF::String::append): Deleted. (WTF::String::left const): Deleted. (WTF::String::right const): Deleted. (WTF::String::createUninitialized): Deleted. (WTF::String::fromUTF8WithLatin1Fallback): Deleted. (WTF::String::isAllASCII const): Deleted. (WTF::String::isAllLatin1 const): Deleted. (WTF::String::isSpecialCharacter const): Deleted. (WTF::String::isHashTableDeletedValue const): Deleted. (WTF::String::hash const): Deleted. (WTF::String::existingHash const): Deleted. * wtf/text/cf/TextBreakIteratorCF.h: * wtf/text/icu/TextBreakIteratorICU.h: * wtf/text/icu/UTextProviderLatin1.h: * wtf/threads/BinarySemaphore.h: (WTF::BinarySemaphore::waitFor): Deleted. (WTF::BinarySemaphore::wait): Deleted. * wtf/unicode/Collator.h: * wtf/win/GDIObject.h: * wtf/win/PathWalker.h: * wtf/win/Win32Handle.h: Canonical link: https://commits.webkit.org/214396@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248546 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-08-12 20:57:15 +00:00
WTF_MAKE_STRUCT_FAST_ALLOCATED;
Dominators should be factored out of the DFG https://bugs.webkit.org/show_bug.cgi?id=150764 Reviewed by Geoffrey Garen. Source/JavaScriptCore: Factored DFGDominators.h/DFGDominators.cpp into WTF. To do this, I made two changes to the DFG: 1) DFG now has a CFG abstraction called DFG::CFG. The cool thing about this is that in the future if we wanted to support inverted dominators, we could do it by just creating a DFG::BackwardCFG. 2) Got rid of DFG::Analysis. From now on, an Analysis being invalidated is expressed by the DFG::Graph having a null pointer for that analysis. When we "run" the analysis, we just instantiate it. This makes it much more natural to integrate WTF::Dominators into the DFG. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * dfg/DFGAnalysis.h: Removed. * dfg/DFGCFG.h: Added. (JSC::DFG::CFG::CFG): (JSC::DFG::CFG::root): (JSC::DFG::CFG::newMap<T>): (JSC::DFG::CFG::successors): (JSC::DFG::CFG::predecessors): (JSC::DFG::CFG::index): (JSC::DFG::CFG::node): (JSC::DFG::CFG::numNodes): (JSC::DFG::CFG::dump): * dfg/DFGCSEPhase.cpp: * dfg/DFGDisassembler.cpp: (JSC::DFG::Disassembler::createDumpList): * dfg/DFGDominators.cpp: Removed. * dfg/DFGDominators.h: (JSC::DFG::Dominators::Dominators): (JSC::DFG::Dominators::strictlyDominates): Deleted. (JSC::DFG::Dominators::dominates): Deleted. (JSC::DFG::Dominators::immediateDominatorOf): Deleted. (JSC::DFG::Dominators::forAllStrictDominatorsOf): Deleted. (JSC::DFG::Dominators::forAllDominatorsOf): Deleted. (JSC::DFG::Dominators::forAllBlocksStrictlyDominatedBy): Deleted. (JSC::DFG::Dominators::forAllBlocksDominatedBy): Deleted. (JSC::DFG::Dominators::forAllBlocksInDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInIteratedDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInPrunedIteratedDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInDominanceFrontierOfImpl): Deleted. (JSC::DFG::Dominators::forAllBlocksInIteratedDominanceFrontierOfImpl): Deleted. (JSC::DFG::Dominators::BlockData::BlockData): Deleted. * dfg/DFGEdgeDominates.h: (JSC::DFG::EdgeDominates::operator()): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::Graph): (JSC::DFG::Graph::dumpBlockHeader): (JSC::DFG::Graph::invalidateCFG): (JSC::DFG::Graph::substituteGetLocal): (JSC::DFG::Graph::handleAssertionFailure): (JSC::DFG::Graph::ensureDominators): (JSC::DFG::Graph::ensurePrePostNumbering): (JSC::DFG::Graph::ensureNaturalLoops): (JSC::DFG::Graph::valueProfileFor): * dfg/DFGGraph.h: (JSC::DFG::Graph::hasDebuggerEnabled): * dfg/DFGLICMPhase.cpp: (JSC::DFG::LICMPhase::run): (JSC::DFG::LICMPhase::attemptHoist): * dfg/DFGLoopPreHeaderCreationPhase.cpp: (JSC::DFG::createPreHeader): (JSC::DFG::LoopPreHeaderCreationPhase::run): * dfg/DFGNaturalLoops.cpp: (JSC::DFG::NaturalLoop::dump): (JSC::DFG::NaturalLoops::NaturalLoops): (JSC::DFG::NaturalLoops::~NaturalLoops): (JSC::DFG::NaturalLoops::loopsOf): (JSC::DFG::NaturalLoops::computeDependencies): Deleted. (JSC::DFG::NaturalLoops::compute): Deleted. * dfg/DFGNaturalLoops.h: (JSC::DFG::NaturalLoops::numLoops): * dfg/DFGNode.h: (JSC::DFG::Node::SuccessorsIterable::end): (JSC::DFG::Node::SuccessorsIterable::size): (JSC::DFG::Node::SuccessorsIterable::at): (JSC::DFG::Node::SuccessorsIterable::operator[]): * dfg/DFGOSREntrypointCreationPhase.cpp: (JSC::DFG::OSREntrypointCreationPhase::run): * dfg/DFGObjectAllocationSinkingPhase.cpp: * dfg/DFGPlan.cpp: (JSC::DFG::Plan::compileInThreadImpl): * dfg/DFGPrePostNumbering.cpp: (JSC::DFG::PrePostNumbering::PrePostNumbering): (JSC::DFG::PrePostNumbering::~PrePostNumbering): (JSC::DFG::PrePostNumbering::compute): Deleted. * dfg/DFGPrePostNumbering.h: (JSC::DFG::PrePostNumbering::preNumber): (JSC::DFG::PrePostNumbering::postNumber): * dfg/DFGPutStackSinkingPhase.cpp: * dfg/DFGSSACalculator.cpp: (JSC::DFG::SSACalculator::nonLocalReachingDef): (JSC::DFG::SSACalculator::reachingDefAtTail): * dfg/DFGSSACalculator.h: (JSC::DFG::SSACalculator::computePhis): * dfg/DFGSSAConversionPhase.cpp: (JSC::DFG::SSAConversionPhase::run): * ftl/FTLLink.cpp: (JSC::FTL::link): * ftl/FTLLowerDFGToLLVM.cpp: (JSC::FTL::DFG::LowerDFGToLLVM::lower): (JSC::FTL::DFG::LowerDFGToLLVM::safelyInvalidateAfterTermination): (JSC::FTL::DFG::LowerDFGToLLVM::isValid): Source/WTF: This takes what used to be DFGDominators.h/DFGDominators.cpp and turns it into a generic algorithm that can take any abstract graph. The idea is that you create Dominators<CFG> and pass it a CFG object, which defines the types of graph nodes and methods for getting successors, predecessors, etc. The DFG now defines a class called CFG, which is a wrapper for DFG::Graph that conforms to the thing that wtf/Dominators.h expects. When doing things to graphs, it's common to refer to the things in the graph as "nodes". Because I intend to reuse the CFG abstraction with many graph algorithms, that abstraction uses the term "node" to refer to a DFG basic block. But in Dominators, the method and variable names still use "block". This is because although Dominators are applicable to any kind of directed graph, it's super unlikely that we will ever use them for anything but compilers. Indeed, the only reason why I'm factoring them out of the DFG is so that I can use them with B3 and Air. This has the nice side effect that a user of WTF::Dominators<JSC::DFG::CFG> will see familiar terminology like "blocksStrictlyDominatedBy(...)" instead of "nodesStrictlyDominatedBy(...)", which would be super confusing. Overall, wtf/Dominators.h is a combination of what used to be in DFGDominators.h, DFGDominators.cpp, DFGNaiveDominators.h, and DFGNaiveDominators.cpp. I only changed code when I had to in order to make it generic. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/Dominators.h: Added. (WTF::Dominators::Dominators): (WTF::Dominators::compute): (WTF::Dominators::strictlyDominates): (WTF::Dominators::dominates): (WTF::Dominators::immediateDominatorOf): (WTF::Dominators::forAllStrictDominatorsOf): (WTF::Dominators::forAllDominatorsOf): (WTF::Dominators::forAllBlocksStrictlyDominatedBy): (WTF::Dominators::forAllBlocksDominatedBy): (WTF::Dominators::strictDominatorsOf): (WTF::Dominators::dominatorsOf): (WTF::Dominators::blocksStrictlyDominatedBy): (WTF::Dominators::blocksDominatedBy): (WTF::Dominators::forAllBlocksInDominanceFrontierOf): (WTF::Dominators::dominanceFrontierOf): (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOf): (WTF::Dominators::forAllBlocksInPrunedIteratedDominanceFrontierOf): (WTF::Dominators::iteratedDominanceFrontierOf): (WTF::Dominators::dump): (WTF::Dominators::LengauerTarjan::LengauerTarjan): (WTF::Dominators::LengauerTarjan::compute): (WTF::Dominators::LengauerTarjan::immediateDominator): (WTF::Dominators::LengauerTarjan::computeDepthFirstPreNumbering): (WTF::Dominators::LengauerTarjan::computeSemiDominatorsAndImplicitImmediateDominators): (WTF::Dominators::LengauerTarjan::computeExplicitImmediateDominators): (WTF::Dominators::LengauerTarjan::link): (WTF::Dominators::LengauerTarjan::eval): (WTF::Dominators::LengauerTarjan::compress): (WTF::Dominators::LengauerTarjan::BlockData::BlockData): (WTF::Dominators::NaiveDominators::NaiveDominators): (WTF::Dominators::NaiveDominators::dominates): (WTF::Dominators::NaiveDominators::dump): (WTF::Dominators::NaiveDominators::pruneDominators): (WTF::Dominators::ValidationContext::ValidationContext): (WTF::Dominators::ValidationContext::reportError): (WTF::Dominators::ValidationContext::handleErrors): (WTF::Dominators::naiveDominates): (WTF::Dominators::forAllBlocksInDominanceFrontierOfImpl): (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOfImpl): (WTF::Dominators::BlockData::BlockData): Canonical link: https://commits.webkit.org/168962@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@191870 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-11-02 00:48:03 +00:00
typename Graph::Node from;
typename Graph::Node to;
const char* message;
};
Vector<Error> errors;
};
bool naiveDominates(typename Graph::Node from, typename Graph::Node to) const
{
for (typename Graph::Node block = to; block; block = m_data[block].idomParent) {
if (block == from)
return true;
}
return false;
}
template<typename Functor>
void forAllBlocksInDominanceFrontierOfImpl(
typename Graph::Node from, const Functor& functor) const
{
// Paraphrasing from http://en.wikipedia.org/wiki/Dominator_(graph_theory):
// "The dominance frontier of a block 'from' is the set of all blocks 'to' such that
// 'from' dominates an immediate predecessor of 'to', but 'from' does not strictly
// dominate 'to'."
//
// A useful corner case to remember: a block may be in its own dominance frontier if it has
// a loop edge to itself, since it dominates itself and so it dominates its own immediate
// predecessor, and a block never strictly dominates itself.
forAllBlocksDominatedBy(
from,
[&] (typename Graph::Node block) {
for (typename Graph::Node to : m_graph.successors(block)) {
if (!strictlyDominates(from, to))
functor(to);
}
});
}
template<typename Functor>
void forAllBlocksInIteratedDominanceFrontierOfImpl(
Support compiling catch in the DFG https://bugs.webkit.org/show_bug.cgi?id=174590 <rdar://problem/34047845> Reviewed by Filip Pizlo. JSTests: * microbenchmarks/delta-blue-try-catch.js: Added. (exception): (value): (OrderedCollection): (OrderedCollection.prototype.add): (OrderedCollection.prototype.at): (OrderedCollection.prototype.size): (OrderedCollection.prototype.removeFirst): (OrderedCollection.prototype.remove): (Strength): (Strength.stronger): (Strength.weaker): (Strength.weakestOf): (Strength.strongest): (Strength.prototype.nextWeaker): (Constraint): (Constraint.prototype.addConstraint): (Constraint.prototype.satisfy): (Constraint.prototype.destroyConstraint): (Constraint.prototype.isInput): (UnaryConstraint): (UnaryConstraint.prototype.addToGraph): (UnaryConstraint.prototype.chooseMethod): (UnaryConstraint.prototype.isSatisfied): (UnaryConstraint.prototype.markInputs): (UnaryConstraint.prototype.output): (UnaryConstraint.prototype.recalculate): (UnaryConstraint.prototype.markUnsatisfied): (UnaryConstraint.prototype.inputsKnown): (UnaryConstraint.prototype.removeFromGraph): (StayConstraint): (StayConstraint.prototype.execute): (EditConstraint.prototype.isInput): (EditConstraint.prototype.execute): (BinaryConstraint): (BinaryConstraint.prototype.chooseMethod): (BinaryConstraint.prototype.addToGraph): (BinaryConstraint.prototype.isSatisfied): (BinaryConstraint.prototype.markInputs): (BinaryConstraint.prototype.input): (BinaryConstraint.prototype.output): (BinaryConstraint.prototype.recalculate): (BinaryConstraint.prototype.markUnsatisfied): (BinaryConstraint.prototype.inputsKnown): (BinaryConstraint.prototype.removeFromGraph): (ScaleConstraint): (ScaleConstraint.prototype.addToGraph): (ScaleConstraint.prototype.removeFromGraph): (ScaleConstraint.prototype.markInputs): (ScaleConstraint.prototype.execute): (ScaleConstraint.prototype.recalculate): (EqualityConstraint): (EqualityConstraint.prototype.execute): (Variable): (Variable.prototype.addConstraint): (Variable.prototype.removeConstraint): (Planner): (Planner.prototype.incrementalAdd): (Planner.prototype.incrementalRemove): (Planner.prototype.newMark): (Planner.prototype.makePlan): (Planner.prototype.extractPlanFromConstraints): (Planner.prototype.addPropagate): (Planner.prototype.removePropagateFrom): (Planner.prototype.addConstraintsConsumingTo): (Plan): (Plan.prototype.addConstraint): (Plan.prototype.size): (Plan.prototype.constraintAt): (Plan.prototype.execute): (chainTest): (projectionTest): (change): (deltaBlue): * microbenchmarks/fake-iterators-that-throw-when-finished.js: Added. (assert): (Numbers): (Numbers.prototype.next): (return.Transpose): (return.Transpose.prototype.next): (transpose): (verifyEven): (verifyString): (foo): (runIterators): * microbenchmarks/try-catch-word-count.js: Added. (let.assert): (EOF): (let.texts): (let.o.apply): (foo): (bar): (f): (run): (test1): (test2): (test3): (fn): (A): (B): (A.prototype.getValue): (B.prototype.getParentValue): (strlen): (sum.0): (test): (result.test.o): (set add.set add): (set forEach): (stringHash): (set if): (testFunction): (set delete.set has.set add): * stress/catch-set-argument-speculation-failure.js: Added. (o): (e): (e2): (escape): (baz): (noInline.run): (noInline): * stress/osr-enter-to-catch-with-set-local-type-check-failure.js: Added. (foo): (e): (baz): (bar): Source/JavaScriptCore: This patch implements OSR entry into op_catch in the DFG. We will support OSR entry into the FTL in a followup: https://bugs.webkit.org/show_bug.cgi?id=175396 To implement catch in the DFG, this patch introduces the concept of multiple entrypoints into CPS/LoadStore DFG IR. A lot of this patch is stringing this concept through the DFG. Many phases used to assume that Graph::block(0) is the only root, and this patch contains many straight forward changes generalizing the code to handle more than one entrypoint. A main building block of this is moving to two CFG types: SSACFG and CPSCFG. SSACFG is the same CFG we used to have. CPSCFG is a new type that introduces a fake root that has an outgoing edge to all the entrypoints. This allows our existing graph algorithms to Just Work over CPSCFG. For example, there is now the concept of SSADominators vs CPSDominators, and SSANaturalLoops vs CPSNaturalLoops. The way we compile the catch entrypoint is by bootstrapping the state of the program by loading all live bytecode locals from a buffer. The OSR entry code will store all live values into that buffer before jumping to the entrypoint. The OSR entry code is also responsible for performing type proofs of the arguments before doing an OSR entry. If there is a type mismatch, it's not legal to OSR enter into the DFG compilation. Currently, each catch entrypoint knows the argument type proofs it must perform to enter into the DFG. Currently, all entrypoints' arguments flush format are unified via ArgumentPosition, but this is just an implementation detail. The code is written more generally to assume that each entrypoint may perform its own distinct proof. op_catch now performs value profiling for all live bytecode locals in the LLInt and baseline JIT. This information is then fed into the DFG via the ExtractCatchLocal node in the prediction propagation phase. This patch also changes how we generate op_catch in bytecode. All op_catches are now split out at the end of the program in bytecode. This ensures that no op_catch is inside a try block. This is needed to ensure correctness in the DFGLiveCatchVariablePreservationPhase. That phase only inserts flushes before SetLocals inside a try block. If an op_catch were in a try block, this would cause the phase to insert a Flush before one of the state bootstrapping SetLocals, which would generate invalid IR. Moving op_catch to be generated on its own at the end of a bytecode stream seemed like the most elegant solution since it better represents that we treat op_catch as an entrypoint. This is true both in the DFG and in the baseline and LLInt: we don't reach an op_catch via normal control flow. Because op_catch cannot throw, this will not break any previous semantics of op_catch. Logically, it'd be valid to split try blocks around any non-throwing bytecode operation. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * bytecode/BytecodeDumper.cpp: (JSC::BytecodeDumper<Block>::dumpBytecode): * bytecode/BytecodeList.json: * bytecode/BytecodeUseDef.h: (JSC::computeUsesForBytecodeOffset): * bytecode/CodeBlock.cpp: (JSC::CodeBlock::finishCreation): (JSC::CodeBlock::ensureCatchLivenessIsComputedForBytecodeOffset): (JSC::CodeBlock::updateAllPredictionsAndCountLiveness): (JSC::CodeBlock::validate): * bytecode/CodeBlock.h: * bytecode/ValueProfile.h: (JSC::ValueProfile::ValueProfile): (JSC::ValueProfileAndOperandBuffer::ValueProfileAndOperandBuffer): (JSC::ValueProfileAndOperandBuffer::~ValueProfileAndOperandBuffer): (JSC::ValueProfileAndOperandBuffer::forEach): * bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::generate): (JSC::BytecodeGenerator::BytecodeGenerator): (JSC::BytecodeGenerator::emitCatch): (JSC::BytecodeGenerator::emitEnumeration): * bytecompiler/BytecodeGenerator.h: * bytecompiler/NodesCodegen.cpp: (JSC::TryNode::emitBytecode): * dfg/DFGAbstractInterpreterInlines.h: (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects): * dfg/DFGBackwardsCFG.h: (JSC::DFG::BackwardsCFG::BackwardsCFG): * dfg/DFGBasicBlock.cpp: (JSC::DFG::BasicBlock::BasicBlock): * dfg/DFGBasicBlock.h: (JSC::DFG::BasicBlock::findTerminal const): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::setDirect): (JSC::DFG::ByteCodeParser::flush): (JSC::DFG::ByteCodeParser::DelayedSetLocal::DelayedSetLocal): (JSC::DFG::ByteCodeParser::DelayedSetLocal::execute): (JSC::DFG::ByteCodeParser::parseBlock): (JSC::DFG::ByteCodeParser::parseCodeBlock): (JSC::DFG::ByteCodeParser::parse): * dfg/DFGCFG.h: (JSC::DFG::CFG::root): (JSC::DFG::CFG::roots): (JSC::DFG::CPSCFG::CPSCFG): (JSC::DFG::selectCFG): * dfg/DFGCPSRethreadingPhase.cpp: (JSC::DFG::CPSRethreadingPhase::specialCaseArguments): * dfg/DFGCSEPhase.cpp: * dfg/DFGClobberize.h: (JSC::DFG::clobberize): * dfg/DFGControlEquivalenceAnalysis.h: (JSC::DFG::ControlEquivalenceAnalysis::ControlEquivalenceAnalysis): * dfg/DFGDCEPhase.cpp: (JSC::DFG::DCEPhase::run): * dfg/DFGDisassembler.cpp: (JSC::DFG::Disassembler::createDumpList): * dfg/DFGDoesGC.cpp: (JSC::DFG::doesGC): * dfg/DFGDominators.h: (JSC::DFG::Dominators::Dominators): (JSC::DFG::ensureDominatorsForCFG): * dfg/DFGEdgeDominates.h: (JSC::DFG::EdgeDominates::EdgeDominates): (JSC::DFG::EdgeDominates::operator()): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): (JSC::DFG::FixupPhase::fixupChecksInBlock): * dfg/DFGFlushFormat.h: * dfg/DFGGraph.cpp: (JSC::DFG::Graph::Graph): (JSC::DFG::unboxLoopNode): (JSC::DFG::Graph::dumpBlockHeader): (JSC::DFG::Graph::dump): (JSC::DFG::Graph::determineReachability): (JSC::DFG::Graph::invalidateCFG): (JSC::DFG::Graph::blocksInPreOrder): (JSC::DFG::Graph::blocksInPostOrder): (JSC::DFG::Graph::ensureCPSDominators): (JSC::DFG::Graph::ensureSSADominators): (JSC::DFG::Graph::ensureCPSNaturalLoops): (JSC::DFG::Graph::ensureSSANaturalLoops): (JSC::DFG::Graph::ensureBackwardsCFG): (JSC::DFG::Graph::ensureBackwardsDominators): (JSC::DFG::Graph::ensureControlEquivalenceAnalysis): (JSC::DFG::Graph::methodOfGettingAValueProfileFor): (JSC::DFG::Graph::clearCPSCFGData): (JSC::DFG::Graph::ensureDominators): Deleted. (JSC::DFG::Graph::ensurePrePostNumbering): Deleted. (JSC::DFG::Graph::ensureNaturalLoops): Deleted. * dfg/DFGGraph.h: (JSC::DFG::Graph::willCatchExceptionInMachineFrame): (JSC::DFG::Graph::isEntrypoint const): * dfg/DFGInPlaceAbstractState.cpp: (JSC::DFG::InPlaceAbstractState::initialize): (JSC::DFG::InPlaceAbstractState::mergeToSuccessors): * dfg/DFGJITCode.cpp: (JSC::DFG::JITCode::shrinkToFit): * dfg/DFGJITCode.h: (JSC::DFG::JITCode::catchOSREntryDataForBytecodeIndex): (JSC::DFG::JITCode::finalizeCatchOSREntrypoints): (JSC::DFG::JITCode::appendCatchEntrypoint): * dfg/DFGJITCompiler.cpp: (JSC::DFG::JITCompiler::compile): (JSC::DFG::JITCompiler::compileFunction): (JSC::DFG::JITCompiler::noticeCatchEntrypoint): (JSC::DFG::JITCompiler::noticeOSREntry): (JSC::DFG::JITCompiler::makeCatchOSREntryBuffer): * dfg/DFGJITCompiler.h: * dfg/DFGLICMPhase.cpp: (JSC::DFG::LICMPhase::run): (JSC::DFG::LICMPhase::attemptHoist): * dfg/DFGLiveCatchVariablePreservationPhase.cpp: (JSC::DFG::LiveCatchVariablePreservationPhase::run): (JSC::DFG::LiveCatchVariablePreservationPhase::isValidFlushLocation): (JSC::DFG::LiveCatchVariablePreservationPhase::handleBlockForTryCatch): (JSC::DFG::LiveCatchVariablePreservationPhase::newVariableAccessData): (JSC::DFG::LiveCatchVariablePreservationPhase::willCatchException): Deleted. (JSC::DFG::LiveCatchVariablePreservationPhase::handleBlock): Deleted. * dfg/DFGLoopPreHeaderCreationPhase.cpp: (JSC::DFG::createPreHeader): (JSC::DFG::LoopPreHeaderCreationPhase::run): * dfg/DFGMaximalFlushInsertionPhase.cpp: (JSC::DFG::MaximalFlushInsertionPhase::run): (JSC::DFG::MaximalFlushInsertionPhase::treatRegularBlock): (JSC::DFG::MaximalFlushInsertionPhase::treatRootBlock): * dfg/DFGMayExit.cpp: * dfg/DFGNaturalLoops.h: (JSC::DFG::NaturalLoops::NaturalLoops): * dfg/DFGNode.h: (JSC::DFG::Node::isSwitch const): (JSC::DFG::Node::successor): (JSC::DFG::Node::catchOSREntryIndex const): (JSC::DFG::Node::catchLocalPrediction): (JSC::DFG::Node::isSwitch): Deleted. * dfg/DFGNodeType.h: * dfg/DFGOSREntry.cpp: (JSC::DFG::prepareCatchOSREntry): * dfg/DFGOSREntry.h: * dfg/DFGOSREntrypointCreationPhase.cpp: (JSC::DFG::OSREntrypointCreationPhase::run): * dfg/DFGOSRExitCompilerCommon.cpp: (JSC::DFG::handleExitCounts): * dfg/DFGObjectAllocationSinkingPhase.cpp: * dfg/DFGPlan.cpp: (JSC::DFG::Plan::compileInThreadImpl): * dfg/DFGPrePostNumbering.cpp: (JSC::DFG::PrePostNumbering::PrePostNumbering): Deleted. (JSC::DFG::PrePostNumbering::~PrePostNumbering): Deleted. (WTF::printInternal): Deleted. * dfg/DFGPrePostNumbering.h: (): Deleted. (JSC::DFG::PrePostNumbering::preNumber const): Deleted. (JSC::DFG::PrePostNumbering::postNumber const): Deleted. (JSC::DFG::PrePostNumbering::isStrictAncestorOf const): Deleted. (JSC::DFG::PrePostNumbering::isAncestorOf const): Deleted. (JSC::DFG::PrePostNumbering::isStrictDescendantOf const): Deleted. (JSC::DFG::PrePostNumbering::isDescendantOf const): Deleted. (JSC::DFG::PrePostNumbering::edgeKind const): Deleted. * dfg/DFGPredictionInjectionPhase.cpp: (JSC::DFG::PredictionInjectionPhase::run): * dfg/DFGPredictionPropagationPhase.cpp: * dfg/DFGPutStackSinkingPhase.cpp: * dfg/DFGSSACalculator.cpp: (JSC::DFG::SSACalculator::nonLocalReachingDef): (JSC::DFG::SSACalculator::reachingDefAtTail): * dfg/DFGSSACalculator.h: (JSC::DFG::SSACalculator::computePhis): * dfg/DFGSSAConversionPhase.cpp: (JSC::DFG::SSAConversionPhase::run): (JSC::DFG::performSSAConversion): * dfg/DFGSafeToExecute.h: (JSC::DFG::safeToExecute): * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::compileCurrentBlock): (JSC::DFG::SpeculativeJIT::checkArgumentTypes): (JSC::DFG::SpeculativeJIT::createOSREntries): (JSC::DFG::SpeculativeJIT::linkOSREntries): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGStaticExecutionCountEstimationPhase.cpp: (JSC::DFG::StaticExecutionCountEstimationPhase::run): * dfg/DFGStrengthReductionPhase.cpp: (JSC::DFG::StrengthReductionPhase::handleNode): * dfg/DFGTierUpCheckInjectionPhase.cpp: (JSC::DFG::TierUpCheckInjectionPhase::run): (JSC::DFG::TierUpCheckInjectionPhase::buildNaturalLoopToLoopHintMap): * dfg/DFGTypeCheckHoistingPhase.cpp: (JSC::DFG::TypeCheckHoistingPhase::run): * dfg/DFGValidate.cpp: * ftl/FTLLink.cpp: (JSC::FTL::link): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::lower): (JSC::FTL::DFG::LowerDFGToB3::safelyInvalidateAfterTermination): (JSC::FTL::DFG::LowerDFGToB3::isValid): * jit/JIT.h: * jit/JITInlines.h: (JSC::JIT::callOperation): * jit/JITOpcodes.cpp: (JSC::JIT::emit_op_catch): * jit/JITOpcodes32_64.cpp: (JSC::JIT::emit_op_catch): * jit/JITOperations.cpp: * jit/JITOperations.h: * llint/LLIntSlowPaths.cpp: (JSC::LLInt::LLINT_SLOW_PATH_DECL): * llint/LLIntSlowPaths.h: * llint/LowLevelInterpreter32_64.asm: * llint/LowLevelInterpreter64.asm: Source/WTF: This patch generalizes the BackwardsGraph fake root into a more generalizable class called SingleRootGraph. SingleRootGraph exposes the general graph interface used in Dominators and NaturalLoops. SingleRootGraph takes as input a graph with the normal graph interface, but also allows the input graph to contain more than one root. SingleRootGraph then exposes a single root, which it creates, that has an outgoing edge to all the roots in the original graph. * WTF.xcodeproj/project.pbxproj: * wtf/BackwardsGraph.h: (WTF::BackwardsGraph::dump const): (WTF::BackwardsGraph::rootName): Deleted. (WTF::BackwardsGraph::Node::Node): Deleted. (WTF::BackwardsGraph::Node::root): Deleted. (WTF::BackwardsGraph::Node::operator== const): Deleted. (WTF::BackwardsGraph::Node::operator!= const): Deleted. (WTF::BackwardsGraph::Node::operator bool const): Deleted. (WTF::BackwardsGraph::Node::isRoot const): Deleted. (WTF::BackwardsGraph::Node::node const): Deleted. (): Deleted. (WTF::BackwardsGraph::Set::Set): Deleted. (WTF::BackwardsGraph::Set::add): Deleted. (WTF::BackwardsGraph::Set::remove): Deleted. (WTF::BackwardsGraph::Set::contains): Deleted. (WTF::BackwardsGraph::Set::dump const): Deleted. (WTF::BackwardsGraph::Map::Map): Deleted. (WTF::BackwardsGraph::Map::clear): Deleted. (WTF::BackwardsGraph::Map::size const): Deleted. (WTF::BackwardsGraph::Map::operator[]): Deleted. (WTF::BackwardsGraph::Map::operator[] const): Deleted. * wtf/Dominators.h: (WTF::Dominators::Dominators): (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOf): (WTF::Dominators::forAllBlocksInPrunedIteratedDominanceFrontierOf): (WTF::Dominators::iteratedDominanceFrontierOf const): (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOfImpl const): * wtf/SingleRootGraph.h: Added. (WTF::SingleRootGraphNode::rootName): (WTF::SingleRootGraphNode::SingleRootGraphNode): (WTF::SingleRootGraphNode::root): (WTF::SingleRootGraphNode::operator== const): (WTF::SingleRootGraphNode::operator!= const): (WTF::SingleRootGraphNode::operator bool const): (WTF::SingleRootGraphNode::isRoot const): (WTF::SingleRootGraphNode::node const): (WTF::SingleRootGraphSet::add): (WTF::SingleRootGraphSet::remove): (WTF::SingleRootGraphSet::contains): (WTF::SingleRootGraphSet::dump const): (WTF::SingleRootMap::SingleRootMap): (WTF::SingleRootMap::clear): (WTF::SingleRootMap::size const): (WTF::SingleRootMap::operator[]): (WTF::SingleRootMap::operator[] const): (WTF::SingleRootGraph::SingleRootGraph): (WTF::SingleRootGraph::root const): (WTF::SingleRootGraph::newMap): (WTF::SingleRootGraph::successors const): (WTF::SingleRootGraph::predecessors const): (WTF::SingleRootGraph::index const): (WTF::SingleRootGraph::node const): (WTF::SingleRootGraph::numNodes const): (WTF::SingleRootGraph::dump const): (WTF::SingleRootGraph::assertIsConsistent const): Canonical link: https://commits.webkit.org/192644@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@221196 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-08-25 18:26:15 +00:00
const List& from, const Functor& functor) const
Dominators should be factored out of the DFG https://bugs.webkit.org/show_bug.cgi?id=150764 Reviewed by Geoffrey Garen. Source/JavaScriptCore: Factored DFGDominators.h/DFGDominators.cpp into WTF. To do this, I made two changes to the DFG: 1) DFG now has a CFG abstraction called DFG::CFG. The cool thing about this is that in the future if we wanted to support inverted dominators, we could do it by just creating a DFG::BackwardCFG. 2) Got rid of DFG::Analysis. From now on, an Analysis being invalidated is expressed by the DFG::Graph having a null pointer for that analysis. When we "run" the analysis, we just instantiate it. This makes it much more natural to integrate WTF::Dominators into the DFG. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * dfg/DFGAnalysis.h: Removed. * dfg/DFGCFG.h: Added. (JSC::DFG::CFG::CFG): (JSC::DFG::CFG::root): (JSC::DFG::CFG::newMap<T>): (JSC::DFG::CFG::successors): (JSC::DFG::CFG::predecessors): (JSC::DFG::CFG::index): (JSC::DFG::CFG::node): (JSC::DFG::CFG::numNodes): (JSC::DFG::CFG::dump): * dfg/DFGCSEPhase.cpp: * dfg/DFGDisassembler.cpp: (JSC::DFG::Disassembler::createDumpList): * dfg/DFGDominators.cpp: Removed. * dfg/DFGDominators.h: (JSC::DFG::Dominators::Dominators): (JSC::DFG::Dominators::strictlyDominates): Deleted. (JSC::DFG::Dominators::dominates): Deleted. (JSC::DFG::Dominators::immediateDominatorOf): Deleted. (JSC::DFG::Dominators::forAllStrictDominatorsOf): Deleted. (JSC::DFG::Dominators::forAllDominatorsOf): Deleted. (JSC::DFG::Dominators::forAllBlocksStrictlyDominatedBy): Deleted. (JSC::DFG::Dominators::forAllBlocksDominatedBy): Deleted. (JSC::DFG::Dominators::forAllBlocksInDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInIteratedDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInPrunedIteratedDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInDominanceFrontierOfImpl): Deleted. (JSC::DFG::Dominators::forAllBlocksInIteratedDominanceFrontierOfImpl): Deleted. (JSC::DFG::Dominators::BlockData::BlockData): Deleted. * dfg/DFGEdgeDominates.h: (JSC::DFG::EdgeDominates::operator()): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::Graph): (JSC::DFG::Graph::dumpBlockHeader): (JSC::DFG::Graph::invalidateCFG): (JSC::DFG::Graph::substituteGetLocal): (JSC::DFG::Graph::handleAssertionFailure): (JSC::DFG::Graph::ensureDominators): (JSC::DFG::Graph::ensurePrePostNumbering): (JSC::DFG::Graph::ensureNaturalLoops): (JSC::DFG::Graph::valueProfileFor): * dfg/DFGGraph.h: (JSC::DFG::Graph::hasDebuggerEnabled): * dfg/DFGLICMPhase.cpp: (JSC::DFG::LICMPhase::run): (JSC::DFG::LICMPhase::attemptHoist): * dfg/DFGLoopPreHeaderCreationPhase.cpp: (JSC::DFG::createPreHeader): (JSC::DFG::LoopPreHeaderCreationPhase::run): * dfg/DFGNaturalLoops.cpp: (JSC::DFG::NaturalLoop::dump): (JSC::DFG::NaturalLoops::NaturalLoops): (JSC::DFG::NaturalLoops::~NaturalLoops): (JSC::DFG::NaturalLoops::loopsOf): (JSC::DFG::NaturalLoops::computeDependencies): Deleted. (JSC::DFG::NaturalLoops::compute): Deleted. * dfg/DFGNaturalLoops.h: (JSC::DFG::NaturalLoops::numLoops): * dfg/DFGNode.h: (JSC::DFG::Node::SuccessorsIterable::end): (JSC::DFG::Node::SuccessorsIterable::size): (JSC::DFG::Node::SuccessorsIterable::at): (JSC::DFG::Node::SuccessorsIterable::operator[]): * dfg/DFGOSREntrypointCreationPhase.cpp: (JSC::DFG::OSREntrypointCreationPhase::run): * dfg/DFGObjectAllocationSinkingPhase.cpp: * dfg/DFGPlan.cpp: (JSC::DFG::Plan::compileInThreadImpl): * dfg/DFGPrePostNumbering.cpp: (JSC::DFG::PrePostNumbering::PrePostNumbering): (JSC::DFG::PrePostNumbering::~PrePostNumbering): (JSC::DFG::PrePostNumbering::compute): Deleted. * dfg/DFGPrePostNumbering.h: (JSC::DFG::PrePostNumbering::preNumber): (JSC::DFG::PrePostNumbering::postNumber): * dfg/DFGPutStackSinkingPhase.cpp: * dfg/DFGSSACalculator.cpp: (JSC::DFG::SSACalculator::nonLocalReachingDef): (JSC::DFG::SSACalculator::reachingDefAtTail): * dfg/DFGSSACalculator.h: (JSC::DFG::SSACalculator::computePhis): * dfg/DFGSSAConversionPhase.cpp: (JSC::DFG::SSAConversionPhase::run): * ftl/FTLLink.cpp: (JSC::FTL::link): * ftl/FTLLowerDFGToLLVM.cpp: (JSC::FTL::DFG::LowerDFGToLLVM::lower): (JSC::FTL::DFG::LowerDFGToLLVM::safelyInvalidateAfterTermination): (JSC::FTL::DFG::LowerDFGToLLVM::isValid): Source/WTF: This takes what used to be DFGDominators.h/DFGDominators.cpp and turns it into a generic algorithm that can take any abstract graph. The idea is that you create Dominators<CFG> and pass it a CFG object, which defines the types of graph nodes and methods for getting successors, predecessors, etc. The DFG now defines a class called CFG, which is a wrapper for DFG::Graph that conforms to the thing that wtf/Dominators.h expects. When doing things to graphs, it's common to refer to the things in the graph as "nodes". Because I intend to reuse the CFG abstraction with many graph algorithms, that abstraction uses the term "node" to refer to a DFG basic block. But in Dominators, the method and variable names still use "block". This is because although Dominators are applicable to any kind of directed graph, it's super unlikely that we will ever use them for anything but compilers. Indeed, the only reason why I'm factoring them out of the DFG is so that I can use them with B3 and Air. This has the nice side effect that a user of WTF::Dominators<JSC::DFG::CFG> will see familiar terminology like "blocksStrictlyDominatedBy(...)" instead of "nodesStrictlyDominatedBy(...)", which would be super confusing. Overall, wtf/Dominators.h is a combination of what used to be in DFGDominators.h, DFGDominators.cpp, DFGNaiveDominators.h, and DFGNaiveDominators.cpp. I only changed code when I had to in order to make it generic. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/Dominators.h: Added. (WTF::Dominators::Dominators): (WTF::Dominators::compute): (WTF::Dominators::strictlyDominates): (WTF::Dominators::dominates): (WTF::Dominators::immediateDominatorOf): (WTF::Dominators::forAllStrictDominatorsOf): (WTF::Dominators::forAllDominatorsOf): (WTF::Dominators::forAllBlocksStrictlyDominatedBy): (WTF::Dominators::forAllBlocksDominatedBy): (WTF::Dominators::strictDominatorsOf): (WTF::Dominators::dominatorsOf): (WTF::Dominators::blocksStrictlyDominatedBy): (WTF::Dominators::blocksDominatedBy): (WTF::Dominators::forAllBlocksInDominanceFrontierOf): (WTF::Dominators::dominanceFrontierOf): (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOf): (WTF::Dominators::forAllBlocksInPrunedIteratedDominanceFrontierOf): (WTF::Dominators::iteratedDominanceFrontierOf): (WTF::Dominators::dump): (WTF::Dominators::LengauerTarjan::LengauerTarjan): (WTF::Dominators::LengauerTarjan::compute): (WTF::Dominators::LengauerTarjan::immediateDominator): (WTF::Dominators::LengauerTarjan::computeDepthFirstPreNumbering): (WTF::Dominators::LengauerTarjan::computeSemiDominatorsAndImplicitImmediateDominators): (WTF::Dominators::LengauerTarjan::computeExplicitImmediateDominators): (WTF::Dominators::LengauerTarjan::link): (WTF::Dominators::LengauerTarjan::eval): (WTF::Dominators::LengauerTarjan::compress): (WTF::Dominators::LengauerTarjan::BlockData::BlockData): (WTF::Dominators::NaiveDominators::NaiveDominators): (WTF::Dominators::NaiveDominators::dominates): (WTF::Dominators::NaiveDominators::dump): (WTF::Dominators::NaiveDominators::pruneDominators): (WTF::Dominators::ValidationContext::ValidationContext): (WTF::Dominators::ValidationContext::reportError): (WTF::Dominators::ValidationContext::handleErrors): (WTF::Dominators::naiveDominates): (WTF::Dominators::forAllBlocksInDominanceFrontierOfImpl): (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOfImpl): (WTF::Dominators::BlockData::BlockData): Canonical link: https://commits.webkit.org/168962@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@191870 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-11-02 00:48:03 +00:00
{
Support compiling catch in the DFG https://bugs.webkit.org/show_bug.cgi?id=174590 <rdar://problem/34047845> Reviewed by Filip Pizlo. JSTests: * microbenchmarks/delta-blue-try-catch.js: Added. (exception): (value): (OrderedCollection): (OrderedCollection.prototype.add): (OrderedCollection.prototype.at): (OrderedCollection.prototype.size): (OrderedCollection.prototype.removeFirst): (OrderedCollection.prototype.remove): (Strength): (Strength.stronger): (Strength.weaker): (Strength.weakestOf): (Strength.strongest): (Strength.prototype.nextWeaker): (Constraint): (Constraint.prototype.addConstraint): (Constraint.prototype.satisfy): (Constraint.prototype.destroyConstraint): (Constraint.prototype.isInput): (UnaryConstraint): (UnaryConstraint.prototype.addToGraph): (UnaryConstraint.prototype.chooseMethod): (UnaryConstraint.prototype.isSatisfied): (UnaryConstraint.prototype.markInputs): (UnaryConstraint.prototype.output): (UnaryConstraint.prototype.recalculate): (UnaryConstraint.prototype.markUnsatisfied): (UnaryConstraint.prototype.inputsKnown): (UnaryConstraint.prototype.removeFromGraph): (StayConstraint): (StayConstraint.prototype.execute): (EditConstraint.prototype.isInput): (EditConstraint.prototype.execute): (BinaryConstraint): (BinaryConstraint.prototype.chooseMethod): (BinaryConstraint.prototype.addToGraph): (BinaryConstraint.prototype.isSatisfied): (BinaryConstraint.prototype.markInputs): (BinaryConstraint.prototype.input): (BinaryConstraint.prototype.output): (BinaryConstraint.prototype.recalculate): (BinaryConstraint.prototype.markUnsatisfied): (BinaryConstraint.prototype.inputsKnown): (BinaryConstraint.prototype.removeFromGraph): (ScaleConstraint): (ScaleConstraint.prototype.addToGraph): (ScaleConstraint.prototype.removeFromGraph): (ScaleConstraint.prototype.markInputs): (ScaleConstraint.prototype.execute): (ScaleConstraint.prototype.recalculate): (EqualityConstraint): (EqualityConstraint.prototype.execute): (Variable): (Variable.prototype.addConstraint): (Variable.prototype.removeConstraint): (Planner): (Planner.prototype.incrementalAdd): (Planner.prototype.incrementalRemove): (Planner.prototype.newMark): (Planner.prototype.makePlan): (Planner.prototype.extractPlanFromConstraints): (Planner.prototype.addPropagate): (Planner.prototype.removePropagateFrom): (Planner.prototype.addConstraintsConsumingTo): (Plan): (Plan.prototype.addConstraint): (Plan.prototype.size): (Plan.prototype.constraintAt): (Plan.prototype.execute): (chainTest): (projectionTest): (change): (deltaBlue): * microbenchmarks/fake-iterators-that-throw-when-finished.js: Added. (assert): (Numbers): (Numbers.prototype.next): (return.Transpose): (return.Transpose.prototype.next): (transpose): (verifyEven): (verifyString): (foo): (runIterators): * microbenchmarks/try-catch-word-count.js: Added. (let.assert): (EOF): (let.texts): (let.o.apply): (foo): (bar): (f): (run): (test1): (test2): (test3): (fn): (A): (B): (A.prototype.getValue): (B.prototype.getParentValue): (strlen): (sum.0): (test): (result.test.o): (set add.set add): (set forEach): (stringHash): (set if): (testFunction): (set delete.set has.set add): * stress/catch-set-argument-speculation-failure.js: Added. (o): (e): (e2): (escape): (baz): (noInline.run): (noInline): * stress/osr-enter-to-catch-with-set-local-type-check-failure.js: Added. (foo): (e): (baz): (bar): Source/JavaScriptCore: This patch implements OSR entry into op_catch in the DFG. We will support OSR entry into the FTL in a followup: https://bugs.webkit.org/show_bug.cgi?id=175396 To implement catch in the DFG, this patch introduces the concept of multiple entrypoints into CPS/LoadStore DFG IR. A lot of this patch is stringing this concept through the DFG. Many phases used to assume that Graph::block(0) is the only root, and this patch contains many straight forward changes generalizing the code to handle more than one entrypoint. A main building block of this is moving to two CFG types: SSACFG and CPSCFG. SSACFG is the same CFG we used to have. CPSCFG is a new type that introduces a fake root that has an outgoing edge to all the entrypoints. This allows our existing graph algorithms to Just Work over CPSCFG. For example, there is now the concept of SSADominators vs CPSDominators, and SSANaturalLoops vs CPSNaturalLoops. The way we compile the catch entrypoint is by bootstrapping the state of the program by loading all live bytecode locals from a buffer. The OSR entry code will store all live values into that buffer before jumping to the entrypoint. The OSR entry code is also responsible for performing type proofs of the arguments before doing an OSR entry. If there is a type mismatch, it's not legal to OSR enter into the DFG compilation. Currently, each catch entrypoint knows the argument type proofs it must perform to enter into the DFG. Currently, all entrypoints' arguments flush format are unified via ArgumentPosition, but this is just an implementation detail. The code is written more generally to assume that each entrypoint may perform its own distinct proof. op_catch now performs value profiling for all live bytecode locals in the LLInt and baseline JIT. This information is then fed into the DFG via the ExtractCatchLocal node in the prediction propagation phase. This patch also changes how we generate op_catch in bytecode. All op_catches are now split out at the end of the program in bytecode. This ensures that no op_catch is inside a try block. This is needed to ensure correctness in the DFGLiveCatchVariablePreservationPhase. That phase only inserts flushes before SetLocals inside a try block. If an op_catch were in a try block, this would cause the phase to insert a Flush before one of the state bootstrapping SetLocals, which would generate invalid IR. Moving op_catch to be generated on its own at the end of a bytecode stream seemed like the most elegant solution since it better represents that we treat op_catch as an entrypoint. This is true both in the DFG and in the baseline and LLInt: we don't reach an op_catch via normal control flow. Because op_catch cannot throw, this will not break any previous semantics of op_catch. Logically, it'd be valid to split try blocks around any non-throwing bytecode operation. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * bytecode/BytecodeDumper.cpp: (JSC::BytecodeDumper<Block>::dumpBytecode): * bytecode/BytecodeList.json: * bytecode/BytecodeUseDef.h: (JSC::computeUsesForBytecodeOffset): * bytecode/CodeBlock.cpp: (JSC::CodeBlock::finishCreation): (JSC::CodeBlock::ensureCatchLivenessIsComputedForBytecodeOffset): (JSC::CodeBlock::updateAllPredictionsAndCountLiveness): (JSC::CodeBlock::validate): * bytecode/CodeBlock.h: * bytecode/ValueProfile.h: (JSC::ValueProfile::ValueProfile): (JSC::ValueProfileAndOperandBuffer::ValueProfileAndOperandBuffer): (JSC::ValueProfileAndOperandBuffer::~ValueProfileAndOperandBuffer): (JSC::ValueProfileAndOperandBuffer::forEach): * bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::generate): (JSC::BytecodeGenerator::BytecodeGenerator): (JSC::BytecodeGenerator::emitCatch): (JSC::BytecodeGenerator::emitEnumeration): * bytecompiler/BytecodeGenerator.h: * bytecompiler/NodesCodegen.cpp: (JSC::TryNode::emitBytecode): * dfg/DFGAbstractInterpreterInlines.h: (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects): * dfg/DFGBackwardsCFG.h: (JSC::DFG::BackwardsCFG::BackwardsCFG): * dfg/DFGBasicBlock.cpp: (JSC::DFG::BasicBlock::BasicBlock): * dfg/DFGBasicBlock.h: (JSC::DFG::BasicBlock::findTerminal const): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::setDirect): (JSC::DFG::ByteCodeParser::flush): (JSC::DFG::ByteCodeParser::DelayedSetLocal::DelayedSetLocal): (JSC::DFG::ByteCodeParser::DelayedSetLocal::execute): (JSC::DFG::ByteCodeParser::parseBlock): (JSC::DFG::ByteCodeParser::parseCodeBlock): (JSC::DFG::ByteCodeParser::parse): * dfg/DFGCFG.h: (JSC::DFG::CFG::root): (JSC::DFG::CFG::roots): (JSC::DFG::CPSCFG::CPSCFG): (JSC::DFG::selectCFG): * dfg/DFGCPSRethreadingPhase.cpp: (JSC::DFG::CPSRethreadingPhase::specialCaseArguments): * dfg/DFGCSEPhase.cpp: * dfg/DFGClobberize.h: (JSC::DFG::clobberize): * dfg/DFGControlEquivalenceAnalysis.h: (JSC::DFG::ControlEquivalenceAnalysis::ControlEquivalenceAnalysis): * dfg/DFGDCEPhase.cpp: (JSC::DFG::DCEPhase::run): * dfg/DFGDisassembler.cpp: (JSC::DFG::Disassembler::createDumpList): * dfg/DFGDoesGC.cpp: (JSC::DFG::doesGC): * dfg/DFGDominators.h: (JSC::DFG::Dominators::Dominators): (JSC::DFG::ensureDominatorsForCFG): * dfg/DFGEdgeDominates.h: (JSC::DFG::EdgeDominates::EdgeDominates): (JSC::DFG::EdgeDominates::operator()): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): (JSC::DFG::FixupPhase::fixupChecksInBlock): * dfg/DFGFlushFormat.h: * dfg/DFGGraph.cpp: (JSC::DFG::Graph::Graph): (JSC::DFG::unboxLoopNode): (JSC::DFG::Graph::dumpBlockHeader): (JSC::DFG::Graph::dump): (JSC::DFG::Graph::determineReachability): (JSC::DFG::Graph::invalidateCFG): (JSC::DFG::Graph::blocksInPreOrder): (JSC::DFG::Graph::blocksInPostOrder): (JSC::DFG::Graph::ensureCPSDominators): (JSC::DFG::Graph::ensureSSADominators): (JSC::DFG::Graph::ensureCPSNaturalLoops): (JSC::DFG::Graph::ensureSSANaturalLoops): (JSC::DFG::Graph::ensureBackwardsCFG): (JSC::DFG::Graph::ensureBackwardsDominators): (JSC::DFG::Graph::ensureControlEquivalenceAnalysis): (JSC::DFG::Graph::methodOfGettingAValueProfileFor): (JSC::DFG::Graph::clearCPSCFGData): (JSC::DFG::Graph::ensureDominators): Deleted. (JSC::DFG::Graph::ensurePrePostNumbering): Deleted. (JSC::DFG::Graph::ensureNaturalLoops): Deleted. * dfg/DFGGraph.h: (JSC::DFG::Graph::willCatchExceptionInMachineFrame): (JSC::DFG::Graph::isEntrypoint const): * dfg/DFGInPlaceAbstractState.cpp: (JSC::DFG::InPlaceAbstractState::initialize): (JSC::DFG::InPlaceAbstractState::mergeToSuccessors): * dfg/DFGJITCode.cpp: (JSC::DFG::JITCode::shrinkToFit): * dfg/DFGJITCode.h: (JSC::DFG::JITCode::catchOSREntryDataForBytecodeIndex): (JSC::DFG::JITCode::finalizeCatchOSREntrypoints): (JSC::DFG::JITCode::appendCatchEntrypoint): * dfg/DFGJITCompiler.cpp: (JSC::DFG::JITCompiler::compile): (JSC::DFG::JITCompiler::compileFunction): (JSC::DFG::JITCompiler::noticeCatchEntrypoint): (JSC::DFG::JITCompiler::noticeOSREntry): (JSC::DFG::JITCompiler::makeCatchOSREntryBuffer): * dfg/DFGJITCompiler.h: * dfg/DFGLICMPhase.cpp: (JSC::DFG::LICMPhase::run): (JSC::DFG::LICMPhase::attemptHoist): * dfg/DFGLiveCatchVariablePreservationPhase.cpp: (JSC::DFG::LiveCatchVariablePreservationPhase::run): (JSC::DFG::LiveCatchVariablePreservationPhase::isValidFlushLocation): (JSC::DFG::LiveCatchVariablePreservationPhase::handleBlockForTryCatch): (JSC::DFG::LiveCatchVariablePreservationPhase::newVariableAccessData): (JSC::DFG::LiveCatchVariablePreservationPhase::willCatchException): Deleted. (JSC::DFG::LiveCatchVariablePreservationPhase::handleBlock): Deleted. * dfg/DFGLoopPreHeaderCreationPhase.cpp: (JSC::DFG::createPreHeader): (JSC::DFG::LoopPreHeaderCreationPhase::run): * dfg/DFGMaximalFlushInsertionPhase.cpp: (JSC::DFG::MaximalFlushInsertionPhase::run): (JSC::DFG::MaximalFlushInsertionPhase::treatRegularBlock): (JSC::DFG::MaximalFlushInsertionPhase::treatRootBlock): * dfg/DFGMayExit.cpp: * dfg/DFGNaturalLoops.h: (JSC::DFG::NaturalLoops::NaturalLoops): * dfg/DFGNode.h: (JSC::DFG::Node::isSwitch const): (JSC::DFG::Node::successor): (JSC::DFG::Node::catchOSREntryIndex const): (JSC::DFG::Node::catchLocalPrediction): (JSC::DFG::Node::isSwitch): Deleted. * dfg/DFGNodeType.h: * dfg/DFGOSREntry.cpp: (JSC::DFG::prepareCatchOSREntry): * dfg/DFGOSREntry.h: * dfg/DFGOSREntrypointCreationPhase.cpp: (JSC::DFG::OSREntrypointCreationPhase::run): * dfg/DFGOSRExitCompilerCommon.cpp: (JSC::DFG::handleExitCounts): * dfg/DFGObjectAllocationSinkingPhase.cpp: * dfg/DFGPlan.cpp: (JSC::DFG::Plan::compileInThreadImpl): * dfg/DFGPrePostNumbering.cpp: (JSC::DFG::PrePostNumbering::PrePostNumbering): Deleted. (JSC::DFG::PrePostNumbering::~PrePostNumbering): Deleted. (WTF::printInternal): Deleted. * dfg/DFGPrePostNumbering.h: (): Deleted. (JSC::DFG::PrePostNumbering::preNumber const): Deleted. (JSC::DFG::PrePostNumbering::postNumber const): Deleted. (JSC::DFG::PrePostNumbering::isStrictAncestorOf const): Deleted. (JSC::DFG::PrePostNumbering::isAncestorOf const): Deleted. (JSC::DFG::PrePostNumbering::isStrictDescendantOf const): Deleted. (JSC::DFG::PrePostNumbering::isDescendantOf const): Deleted. (JSC::DFG::PrePostNumbering::edgeKind const): Deleted. * dfg/DFGPredictionInjectionPhase.cpp: (JSC::DFG::PredictionInjectionPhase::run): * dfg/DFGPredictionPropagationPhase.cpp: * dfg/DFGPutStackSinkingPhase.cpp: * dfg/DFGSSACalculator.cpp: (JSC::DFG::SSACalculator::nonLocalReachingDef): (JSC::DFG::SSACalculator::reachingDefAtTail): * dfg/DFGSSACalculator.h: (JSC::DFG::SSACalculator::computePhis): * dfg/DFGSSAConversionPhase.cpp: (JSC::DFG::SSAConversionPhase::run): (JSC::DFG::performSSAConversion): * dfg/DFGSafeToExecute.h: (JSC::DFG::safeToExecute): * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::compileCurrentBlock): (JSC::DFG::SpeculativeJIT::checkArgumentTypes): (JSC::DFG::SpeculativeJIT::createOSREntries): (JSC::DFG::SpeculativeJIT::linkOSREntries): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGStaticExecutionCountEstimationPhase.cpp: (JSC::DFG::StaticExecutionCountEstimationPhase::run): * dfg/DFGStrengthReductionPhase.cpp: (JSC::DFG::StrengthReductionPhase::handleNode): * dfg/DFGTierUpCheckInjectionPhase.cpp: (JSC::DFG::TierUpCheckInjectionPhase::run): (JSC::DFG::TierUpCheckInjectionPhase::buildNaturalLoopToLoopHintMap): * dfg/DFGTypeCheckHoistingPhase.cpp: (JSC::DFG::TypeCheckHoistingPhase::run): * dfg/DFGValidate.cpp: * ftl/FTLLink.cpp: (JSC::FTL::link): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::lower): (JSC::FTL::DFG::LowerDFGToB3::safelyInvalidateAfterTermination): (JSC::FTL::DFG::LowerDFGToB3::isValid): * jit/JIT.h: * jit/JITInlines.h: (JSC::JIT::callOperation): * jit/JITOpcodes.cpp: (JSC::JIT::emit_op_catch): * jit/JITOpcodes32_64.cpp: (JSC::JIT::emit_op_catch): * jit/JITOperations.cpp: * jit/JITOperations.h: * llint/LLIntSlowPaths.cpp: (JSC::LLInt::LLINT_SLOW_PATH_DECL): * llint/LLIntSlowPaths.h: * llint/LowLevelInterpreter32_64.asm: * llint/LowLevelInterpreter64.asm: Source/WTF: This patch generalizes the BackwardsGraph fake root into a more generalizable class called SingleRootGraph. SingleRootGraph exposes the general graph interface used in Dominators and NaturalLoops. SingleRootGraph takes as input a graph with the normal graph interface, but also allows the input graph to contain more than one root. SingleRootGraph then exposes a single root, which it creates, that has an outgoing edge to all the roots in the original graph. * WTF.xcodeproj/project.pbxproj: * wtf/BackwardsGraph.h: (WTF::BackwardsGraph::dump const): (WTF::BackwardsGraph::rootName): Deleted. (WTF::BackwardsGraph::Node::Node): Deleted. (WTF::BackwardsGraph::Node::root): Deleted. (WTF::BackwardsGraph::Node::operator== const): Deleted. (WTF::BackwardsGraph::Node::operator!= const): Deleted. (WTF::BackwardsGraph::Node::operator bool const): Deleted. (WTF::BackwardsGraph::Node::isRoot const): Deleted. (WTF::BackwardsGraph::Node::node const): Deleted. (): Deleted. (WTF::BackwardsGraph::Set::Set): Deleted. (WTF::BackwardsGraph::Set::add): Deleted. (WTF::BackwardsGraph::Set::remove): Deleted. (WTF::BackwardsGraph::Set::contains): Deleted. (WTF::BackwardsGraph::Set::dump const): Deleted. (WTF::BackwardsGraph::Map::Map): Deleted. (WTF::BackwardsGraph::Map::clear): Deleted. (WTF::BackwardsGraph::Map::size const): Deleted. (WTF::BackwardsGraph::Map::operator[]): Deleted. (WTF::BackwardsGraph::Map::operator[] const): Deleted. * wtf/Dominators.h: (WTF::Dominators::Dominators): (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOf): (WTF::Dominators::forAllBlocksInPrunedIteratedDominanceFrontierOf): (WTF::Dominators::iteratedDominanceFrontierOf const): (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOfImpl const): * wtf/SingleRootGraph.h: Added. (WTF::SingleRootGraphNode::rootName): (WTF::SingleRootGraphNode::SingleRootGraphNode): (WTF::SingleRootGraphNode::root): (WTF::SingleRootGraphNode::operator== const): (WTF::SingleRootGraphNode::operator!= const): (WTF::SingleRootGraphNode::operator bool const): (WTF::SingleRootGraphNode::isRoot const): (WTF::SingleRootGraphNode::node const): (WTF::SingleRootGraphSet::add): (WTF::SingleRootGraphSet::remove): (WTF::SingleRootGraphSet::contains): (WTF::SingleRootGraphSet::dump const): (WTF::SingleRootMap::SingleRootMap): (WTF::SingleRootMap::clear): (WTF::SingleRootMap::size const): (WTF::SingleRootMap::operator[]): (WTF::SingleRootMap::operator[] const): (WTF::SingleRootGraph::SingleRootGraph): (WTF::SingleRootGraph::root const): (WTF::SingleRootGraph::newMap): (WTF::SingleRootGraph::successors const): (WTF::SingleRootGraph::predecessors const): (WTF::SingleRootGraph::index const): (WTF::SingleRootGraph::node const): (WTF::SingleRootGraph::numNodes const): (WTF::SingleRootGraph::dump const): (WTF::SingleRootGraph::assertIsConsistent const): Canonical link: https://commits.webkit.org/192644@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@221196 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-08-25 18:26:15 +00:00
List worklist = from;
Dominators should be factored out of the DFG https://bugs.webkit.org/show_bug.cgi?id=150764 Reviewed by Geoffrey Garen. Source/JavaScriptCore: Factored DFGDominators.h/DFGDominators.cpp into WTF. To do this, I made two changes to the DFG: 1) DFG now has a CFG abstraction called DFG::CFG. The cool thing about this is that in the future if we wanted to support inverted dominators, we could do it by just creating a DFG::BackwardCFG. 2) Got rid of DFG::Analysis. From now on, an Analysis being invalidated is expressed by the DFG::Graph having a null pointer for that analysis. When we "run" the analysis, we just instantiate it. This makes it much more natural to integrate WTF::Dominators into the DFG. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * dfg/DFGAnalysis.h: Removed. * dfg/DFGCFG.h: Added. (JSC::DFG::CFG::CFG): (JSC::DFG::CFG::root): (JSC::DFG::CFG::newMap<T>): (JSC::DFG::CFG::successors): (JSC::DFG::CFG::predecessors): (JSC::DFG::CFG::index): (JSC::DFG::CFG::node): (JSC::DFG::CFG::numNodes): (JSC::DFG::CFG::dump): * dfg/DFGCSEPhase.cpp: * dfg/DFGDisassembler.cpp: (JSC::DFG::Disassembler::createDumpList): * dfg/DFGDominators.cpp: Removed. * dfg/DFGDominators.h: (JSC::DFG::Dominators::Dominators): (JSC::DFG::Dominators::strictlyDominates): Deleted. (JSC::DFG::Dominators::dominates): Deleted. (JSC::DFG::Dominators::immediateDominatorOf): Deleted. (JSC::DFG::Dominators::forAllStrictDominatorsOf): Deleted. (JSC::DFG::Dominators::forAllDominatorsOf): Deleted. (JSC::DFG::Dominators::forAllBlocksStrictlyDominatedBy): Deleted. (JSC::DFG::Dominators::forAllBlocksDominatedBy): Deleted. (JSC::DFG::Dominators::forAllBlocksInDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInIteratedDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInPrunedIteratedDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInDominanceFrontierOfImpl): Deleted. (JSC::DFG::Dominators::forAllBlocksInIteratedDominanceFrontierOfImpl): Deleted. (JSC::DFG::Dominators::BlockData::BlockData): Deleted. * dfg/DFGEdgeDominates.h: (JSC::DFG::EdgeDominates::operator()): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::Graph): (JSC::DFG::Graph::dumpBlockHeader): (JSC::DFG::Graph::invalidateCFG): (JSC::DFG::Graph::substituteGetLocal): (JSC::DFG::Graph::handleAssertionFailure): (JSC::DFG::Graph::ensureDominators): (JSC::DFG::Graph::ensurePrePostNumbering): (JSC::DFG::Graph::ensureNaturalLoops): (JSC::DFG::Graph::valueProfileFor): * dfg/DFGGraph.h: (JSC::DFG::Graph::hasDebuggerEnabled): * dfg/DFGLICMPhase.cpp: (JSC::DFG::LICMPhase::run): (JSC::DFG::LICMPhase::attemptHoist): * dfg/DFGLoopPreHeaderCreationPhase.cpp: (JSC::DFG::createPreHeader): (JSC::DFG::LoopPreHeaderCreationPhase::run): * dfg/DFGNaturalLoops.cpp: (JSC::DFG::NaturalLoop::dump): (JSC::DFG::NaturalLoops::NaturalLoops): (JSC::DFG::NaturalLoops::~NaturalLoops): (JSC::DFG::NaturalLoops::loopsOf): (JSC::DFG::NaturalLoops::computeDependencies): Deleted. (JSC::DFG::NaturalLoops::compute): Deleted. * dfg/DFGNaturalLoops.h: (JSC::DFG::NaturalLoops::numLoops): * dfg/DFGNode.h: (JSC::DFG::Node::SuccessorsIterable::end): (JSC::DFG::Node::SuccessorsIterable::size): (JSC::DFG::Node::SuccessorsIterable::at): (JSC::DFG::Node::SuccessorsIterable::operator[]): * dfg/DFGOSREntrypointCreationPhase.cpp: (JSC::DFG::OSREntrypointCreationPhase::run): * dfg/DFGObjectAllocationSinkingPhase.cpp: * dfg/DFGPlan.cpp: (JSC::DFG::Plan::compileInThreadImpl): * dfg/DFGPrePostNumbering.cpp: (JSC::DFG::PrePostNumbering::PrePostNumbering): (JSC::DFG::PrePostNumbering::~PrePostNumbering): (JSC::DFG::PrePostNumbering::compute): Deleted. * dfg/DFGPrePostNumbering.h: (JSC::DFG::PrePostNumbering::preNumber): (JSC::DFG::PrePostNumbering::postNumber): * dfg/DFGPutStackSinkingPhase.cpp: * dfg/DFGSSACalculator.cpp: (JSC::DFG::SSACalculator::nonLocalReachingDef): (JSC::DFG::SSACalculator::reachingDefAtTail): * dfg/DFGSSACalculator.h: (JSC::DFG::SSACalculator::computePhis): * dfg/DFGSSAConversionPhase.cpp: (JSC::DFG::SSAConversionPhase::run): * ftl/FTLLink.cpp: (JSC::FTL::link): * ftl/FTLLowerDFGToLLVM.cpp: (JSC::FTL::DFG::LowerDFGToLLVM::lower): (JSC::FTL::DFG::LowerDFGToLLVM::safelyInvalidateAfterTermination): (JSC::FTL::DFG::LowerDFGToLLVM::isValid): Source/WTF: This takes what used to be DFGDominators.h/DFGDominators.cpp and turns it into a generic algorithm that can take any abstract graph. The idea is that you create Dominators<CFG> and pass it a CFG object, which defines the types of graph nodes and methods for getting successors, predecessors, etc. The DFG now defines a class called CFG, which is a wrapper for DFG::Graph that conforms to the thing that wtf/Dominators.h expects. When doing things to graphs, it's common to refer to the things in the graph as "nodes". Because I intend to reuse the CFG abstraction with many graph algorithms, that abstraction uses the term "node" to refer to a DFG basic block. But in Dominators, the method and variable names still use "block". This is because although Dominators are applicable to any kind of directed graph, it's super unlikely that we will ever use them for anything but compilers. Indeed, the only reason why I'm factoring them out of the DFG is so that I can use them with B3 and Air. This has the nice side effect that a user of WTF::Dominators<JSC::DFG::CFG> will see familiar terminology like "blocksStrictlyDominatedBy(...)" instead of "nodesStrictlyDominatedBy(...)", which would be super confusing. Overall, wtf/Dominators.h is a combination of what used to be in DFGDominators.h, DFGDominators.cpp, DFGNaiveDominators.h, and DFGNaiveDominators.cpp. I only changed code when I had to in order to make it generic. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/Dominators.h: Added. (WTF::Dominators::Dominators): (WTF::Dominators::compute): (WTF::Dominators::strictlyDominates): (WTF::Dominators::dominates): (WTF::Dominators::immediateDominatorOf): (WTF::Dominators::forAllStrictDominatorsOf): (WTF::Dominators::forAllDominatorsOf): (WTF::Dominators::forAllBlocksStrictlyDominatedBy): (WTF::Dominators::forAllBlocksDominatedBy): (WTF::Dominators::strictDominatorsOf): (WTF::Dominators::dominatorsOf): (WTF::Dominators::blocksStrictlyDominatedBy): (WTF::Dominators::blocksDominatedBy): (WTF::Dominators::forAllBlocksInDominanceFrontierOf): (WTF::Dominators::dominanceFrontierOf): (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOf): (WTF::Dominators::forAllBlocksInPrunedIteratedDominanceFrontierOf): (WTF::Dominators::iteratedDominanceFrontierOf): (WTF::Dominators::dump): (WTF::Dominators::LengauerTarjan::LengauerTarjan): (WTF::Dominators::LengauerTarjan::compute): (WTF::Dominators::LengauerTarjan::immediateDominator): (WTF::Dominators::LengauerTarjan::computeDepthFirstPreNumbering): (WTF::Dominators::LengauerTarjan::computeSemiDominatorsAndImplicitImmediateDominators): (WTF::Dominators::LengauerTarjan::computeExplicitImmediateDominators): (WTF::Dominators::LengauerTarjan::link): (WTF::Dominators::LengauerTarjan::eval): (WTF::Dominators::LengauerTarjan::compress): (WTF::Dominators::LengauerTarjan::BlockData::BlockData): (WTF::Dominators::NaiveDominators::NaiveDominators): (WTF::Dominators::NaiveDominators::dominates): (WTF::Dominators::NaiveDominators::dump): (WTF::Dominators::NaiveDominators::pruneDominators): (WTF::Dominators::ValidationContext::ValidationContext): (WTF::Dominators::ValidationContext::reportError): (WTF::Dominators::ValidationContext::handleErrors): (WTF::Dominators::naiveDominates): (WTF::Dominators::forAllBlocksInDominanceFrontierOfImpl): (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOfImpl): (WTF::Dominators::BlockData::BlockData): Canonical link: https://commits.webkit.org/168962@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@191870 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-11-02 00:48:03 +00:00
while (!worklist.isEmpty()) {
typename Graph::Node block = worklist.takeLast();
forAllBlocksInDominanceFrontierOfImpl(
block,
[&] (typename Graph::Node otherBlock) {
if (functor(otherBlock))
worklist.append(otherBlock);
});
}
}
struct BlockData {
[WTF][JSC] Make JSC and WTF aggressively-fast-malloced https://bugs.webkit.org/show_bug.cgi?id=200611 Reviewed by Saam Barati. Source/JavaScriptCore: This patch aggressively puts many classes into FastMalloc. In JSC side, we grep `std::make_unique` etc. to find potentially system-malloc-allocated classes. After this patch, all the JSC related allocations in JetStream2 cli is done from bmalloc. In the future, it would be nice that we add `WTF::makeUnique<T>` helper function and throw a compile error if `T` is not FastMalloc annotated[1]. Putting WebKit classes in FastMalloc has many benefits. 1. Simply, it is fast. 2. vmmap can tell the amount of memory used for WebKit. 3. bmalloc can isolate WebKit memory allocation from the rest of the world. This is useful since we can know more about what component is corrupting the memory from the memory corruption crash. [1]: https://bugs.webkit.org/show_bug.cgi?id=200620 * API/ObjCCallbackFunction.mm: * assembler/AbstractMacroAssembler.h: * b3/B3PhiChildren.h: * b3/air/AirAllocateRegistersAndStackAndGenerateCode.h: * b3/air/AirDisassembler.h: * bytecode/AccessCaseSnippetParams.h: * bytecode/CallVariant.h: * bytecode/DeferredSourceDump.h: * bytecode/ExecutionCounter.h: * bytecode/GetByIdStatus.h: * bytecode/GetByIdVariant.h: * bytecode/InByIdStatus.h: * bytecode/InByIdVariant.h: * bytecode/InstanceOfStatus.h: * bytecode/InstanceOfVariant.h: * bytecode/PutByIdStatus.h: * bytecode/PutByIdVariant.h: * bytecode/ValueProfile.h: * dfg/DFGAbstractInterpreter.h: * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::newVariableAccessData): * dfg/DFGFlowIndexing.h: * dfg/DFGFlowMap.h: * dfg/DFGLiveCatchVariablePreservationPhase.cpp: (JSC::DFG::LiveCatchVariablePreservationPhase::newVariableAccessData): * dfg/DFGMaximalFlushInsertionPhase.cpp: (JSC::DFG::MaximalFlushInsertionPhase::newVariableAccessData): * dfg/DFGOSRExit.h: * dfg/DFGSpeculativeJIT.h: * dfg/DFGVariableAccessData.h: * disassembler/ARM64/A64DOpcode.h: * inspector/remote/socket/RemoteInspectorMessageParser.h: * inspector/remote/socket/RemoteInspectorSocket.h: * inspector/remote/socket/RemoteInspectorSocketEndpoint.h: * jit/PCToCodeOriginMap.h: * runtime/BasicBlockLocation.h: * runtime/DoublePredictionFuzzerAgent.h: * runtime/JSRunLoopTimer.h: * runtime/PromiseDeferredTimer.h: (JSC::PromiseDeferredTimer::create): PromiseDeferredTimer should be allocated as `Ref<>` instead of `std::unique_ptr` since it is inheriting ThreadSafeRefCounted<>. Holding such a class with std::unique_ptr could lead to potentially dangerous operations (like, someone holds it with Ref<> while it is deleted by std::unique_ptr<>). * runtime/RandomizingFuzzerAgent.h: * runtime/SymbolTable.h: * runtime/VM.cpp: (JSC::VM::VM): * runtime/VM.h: * tools/JSDollarVM.cpp: * tools/SigillCrashAnalyzer.cpp: * wasm/WasmFormat.h: * wasm/WasmMemory.cpp: * wasm/WasmSignature.h: * yarr/YarrJIT.h: Source/WebCore: Changed the accessor since we changed std::unique_ptr to Ref for this field. No behavior change. * bindings/js/WorkerScriptController.cpp: (WebCore::WorkerScriptController::addTimerSetNotification): (WebCore::WorkerScriptController::removeTimerSetNotification): Source/WTF: WTF has many data structures, in particular, containers. And these containers can be allocated like `std::make_unique<Container>()`. Without WTF_MAKE_FAST_ALLOCATED, this container itself is allocated from the system malloc. This patch attaches WTF_MAKE_FAST_ALLOCATED more aggressively not to allocate them from the system malloc. And we add some `final` to containers and classes that would be never inherited. * wtf/Assertions.cpp: * wtf/Atomics.h: * wtf/AutodrainedPool.h: * wtf/Bag.h: (WTF::Bag::Bag): Deleted. (WTF::Bag::~Bag): Deleted. (WTF::Bag::clear): Deleted. (WTF::Bag::add): Deleted. (WTF::Bag::iterator::iterator): Deleted. (WTF::Bag::iterator::operator! const): Deleted. (WTF::Bag::iterator::operator* const): Deleted. (WTF::Bag::iterator::operator++): Deleted. (WTF::Bag::iterator::operator== const): Deleted. (WTF::Bag::iterator::operator!= const): Deleted. (WTF::Bag::begin): Deleted. (WTF::Bag::begin const): Deleted. (WTF::Bag::end const): Deleted. (WTF::Bag::isEmpty const): Deleted. (WTF::Bag::unwrappedHead const): Deleted. * wtf/BitVector.h: (WTF::BitVector::BitVector): Deleted. (WTF::BitVector::~BitVector): Deleted. (WTF::BitVector::operator=): Deleted. (WTF::BitVector::size const): Deleted. (WTF::BitVector::ensureSize): Deleted. (WTF::BitVector::quickGet const): Deleted. (WTF::BitVector::quickSet): Deleted. (WTF::BitVector::quickClear): Deleted. (WTF::BitVector::get const): Deleted. (WTF::BitVector::contains const): Deleted. (WTF::BitVector::set): Deleted. (WTF::BitVector::add): Deleted. (WTF::BitVector::ensureSizeAndSet): Deleted. (WTF::BitVector::clear): Deleted. (WTF::BitVector::remove): Deleted. (WTF::BitVector::merge): Deleted. (WTF::BitVector::filter): Deleted. (WTF::BitVector::exclude): Deleted. (WTF::BitVector::bitCount const): Deleted. (WTF::BitVector::isEmpty const): Deleted. (WTF::BitVector::findBit const): Deleted. (WTF::BitVector::isEmptyValue const): Deleted. (WTF::BitVector::isDeletedValue const): Deleted. (WTF::BitVector::isEmptyOrDeletedValue const): Deleted. (WTF::BitVector::operator== const): Deleted. (WTF::BitVector::hash const): Deleted. (WTF::BitVector::iterator::iterator): Deleted. (WTF::BitVector::iterator::operator* const): Deleted. (WTF::BitVector::iterator::operator++): Deleted. (WTF::BitVector::iterator::isAtEnd const): Deleted. (WTF::BitVector::iterator::operator== const): Deleted. (WTF::BitVector::iterator::operator!= const): Deleted. (WTF::BitVector::begin const): Deleted. (WTF::BitVector::end const): Deleted. (WTF::BitVector::bitsInPointer): Deleted. (WTF::BitVector::maxInlineBits): Deleted. (WTF::BitVector::byteCount): Deleted. (WTF::BitVector::makeInlineBits): Deleted. (WTF::BitVector::cleanseInlineBits): Deleted. (WTF::BitVector::bitCount): Deleted. (WTF::BitVector::findBitFast const): Deleted. (WTF::BitVector::findBitSimple const): Deleted. (WTF::BitVector::OutOfLineBits::numBits const): Deleted. (WTF::BitVector::OutOfLineBits::numWords const): Deleted. (WTF::BitVector::OutOfLineBits::bits): Deleted. (WTF::BitVector::OutOfLineBits::bits const): Deleted. (WTF::BitVector::OutOfLineBits::OutOfLineBits): Deleted. (WTF::BitVector::isInline const): Deleted. (WTF::BitVector::outOfLineBits const): Deleted. (WTF::BitVector::outOfLineBits): Deleted. (WTF::BitVector::bits): Deleted. (WTF::BitVector::bits const): Deleted. * wtf/Bitmap.h: (WTF::Bitmap::size): Deleted. (WTF::Bitmap::iterator::iterator): Deleted. (WTF::Bitmap::iterator::operator* const): Deleted. (WTF::Bitmap::iterator::operator++): Deleted. (WTF::Bitmap::iterator::operator== const): Deleted. (WTF::Bitmap::iterator::operator!= const): Deleted. (WTF::Bitmap::begin const): Deleted. (WTF::Bitmap::end const): Deleted. * wtf/Box.h: * wtf/BumpPointerAllocator.h: * wtf/CPUTime.h: * wtf/CheckedBoolean.h: * wtf/CommaPrinter.h: (WTF::CommaPrinter::CommaPrinter): Deleted. (WTF::CommaPrinter::dump const): Deleted. (WTF::CommaPrinter::didPrint const): Deleted. * wtf/CompactPointerTuple.h: (WTF::CompactPointerTuple::encodeType): Deleted. (WTF::CompactPointerTuple::decodeType): Deleted. (WTF::CompactPointerTuple::CompactPointerTuple): Deleted. (WTF::CompactPointerTuple::pointer const): Deleted. (WTF::CompactPointerTuple::setPointer): Deleted. (WTF::CompactPointerTuple::type const): Deleted. (WTF::CompactPointerTuple::setType): Deleted. * wtf/CompilationThread.h: (WTF::CompilationScope::CompilationScope): Deleted. (WTF::CompilationScope::~CompilationScope): Deleted. (WTF::CompilationScope::leaveEarly): Deleted. * wtf/CompletionHandler.h: (WTF::CompletionHandler<Out): (WTF::Detail::CallableWrapper<CompletionHandler<Out): (WTF::CompletionHandlerCallingScope::CompletionHandlerCallingScope): Deleted. (WTF::CompletionHandlerCallingScope::~CompletionHandlerCallingScope): Deleted. (WTF::CompletionHandlerCallingScope::CompletionHandler<void): Deleted. * wtf/ConcurrentBuffer.h: (WTF::ConcurrentBuffer::ConcurrentBuffer): Deleted. (WTF::ConcurrentBuffer::~ConcurrentBuffer): Deleted. (WTF::ConcurrentBuffer::growExact): Deleted. (WTF::ConcurrentBuffer::grow): Deleted. (WTF::ConcurrentBuffer::array const): Deleted. (WTF::ConcurrentBuffer::operator[]): Deleted. (WTF::ConcurrentBuffer::operator[] const): Deleted. (WTF::ConcurrentBuffer::createArray): Deleted. * wtf/ConcurrentPtrHashSet.h: (WTF::ConcurrentPtrHashSet::contains): Deleted. (WTF::ConcurrentPtrHashSet::add): Deleted. (WTF::ConcurrentPtrHashSet::size const): Deleted. (WTF::ConcurrentPtrHashSet::Table::maxLoad const): Deleted. (WTF::ConcurrentPtrHashSet::hash): Deleted. (WTF::ConcurrentPtrHashSet::cast): Deleted. (WTF::ConcurrentPtrHashSet::containsImpl const): Deleted. (WTF::ConcurrentPtrHashSet::addImpl): Deleted. * wtf/ConcurrentVector.h: (WTF::ConcurrentVector::~ConcurrentVector): Deleted. (WTF::ConcurrentVector::size const): Deleted. (WTF::ConcurrentVector::isEmpty const): Deleted. (WTF::ConcurrentVector::at): Deleted. (WTF::ConcurrentVector::at const): Deleted. (WTF::ConcurrentVector::operator[]): Deleted. (WTF::ConcurrentVector::operator[] const): Deleted. (WTF::ConcurrentVector::first): Deleted. (WTF::ConcurrentVector::first const): Deleted. (WTF::ConcurrentVector::last): Deleted. (WTF::ConcurrentVector::last const): Deleted. (WTF::ConcurrentVector::takeLast): Deleted. (WTF::ConcurrentVector::append): Deleted. (WTF::ConcurrentVector::alloc): Deleted. (WTF::ConcurrentVector::removeLast): Deleted. (WTF::ConcurrentVector::grow): Deleted. (WTF::ConcurrentVector::begin): Deleted. (WTF::ConcurrentVector::end): Deleted. (WTF::ConcurrentVector::segmentExistsFor): Deleted. (WTF::ConcurrentVector::segmentFor): Deleted. (WTF::ConcurrentVector::subscriptFor): Deleted. (WTF::ConcurrentVector::ensureSegmentsFor): Deleted. (WTF::ConcurrentVector::ensureSegment): Deleted. (WTF::ConcurrentVector::allocateSegment): Deleted. * wtf/Condition.h: (WTF::Condition::waitUntil): Deleted. (WTF::Condition::waitFor): Deleted. (WTF::Condition::wait): Deleted. (WTF::Condition::notifyOne): Deleted. (WTF::Condition::notifyAll): Deleted. * wtf/CountingLock.h: (WTF::CountingLock::LockHooks::lockHook): Deleted. (WTF::CountingLock::LockHooks::unlockHook): Deleted. (WTF::CountingLock::LockHooks::parkHook): Deleted. (WTF::CountingLock::LockHooks::handoffHook): Deleted. (WTF::CountingLock::tryLock): Deleted. (WTF::CountingLock::lock): Deleted. (WTF::CountingLock::unlock): Deleted. (WTF::CountingLock::isHeld const): Deleted. (WTF::CountingLock::isLocked const): Deleted. (WTF::CountingLock::Count::operator bool const): Deleted. (WTF::CountingLock::Count::operator== const): Deleted. (WTF::CountingLock::Count::operator!= const): Deleted. (WTF::CountingLock::tryOptimisticRead): Deleted. (WTF::CountingLock::validate): Deleted. (WTF::CountingLock::doOptimizedRead): Deleted. (WTF::CountingLock::tryOptimisticFencelessRead): Deleted. (WTF::CountingLock::fencelessValidate): Deleted. (WTF::CountingLock::doOptimizedFencelessRead): Deleted. (WTF::CountingLock::getCount): Deleted. * wtf/CrossThreadQueue.h: * wtf/CrossThreadTask.h: * wtf/CryptographicallyRandomNumber.cpp: * wtf/DataMutex.h: * wtf/DateMath.h: * wtf/Deque.h: (WTF::Deque::size const): Deleted. (WTF::Deque::isEmpty const): Deleted. (WTF::Deque::begin): Deleted. (WTF::Deque::end): Deleted. (WTF::Deque::begin const): Deleted. (WTF::Deque::end const): Deleted. (WTF::Deque::rbegin): Deleted. (WTF::Deque::rend): Deleted. (WTF::Deque::rbegin const): Deleted. (WTF::Deque::rend const): Deleted. (WTF::Deque::first): Deleted. (WTF::Deque::first const): Deleted. (WTF::Deque::last): Deleted. (WTF::Deque::last const): Deleted. (WTF::Deque::append): Deleted. * wtf/Dominators.h: * wtf/DoublyLinkedList.h: * wtf/Expected.h: * wtf/FastBitVector.h: * wtf/FileMetadata.h: * wtf/FileSystem.h: * wtf/GraphNodeWorklist.h: * wtf/GregorianDateTime.h: (WTF::GregorianDateTime::GregorianDateTime): Deleted. (WTF::GregorianDateTime::year const): Deleted. (WTF::GregorianDateTime::month const): Deleted. (WTF::GregorianDateTime::yearDay const): Deleted. (WTF::GregorianDateTime::monthDay const): Deleted. (WTF::GregorianDateTime::weekDay const): Deleted. (WTF::GregorianDateTime::hour const): Deleted. (WTF::GregorianDateTime::minute const): Deleted. (WTF::GregorianDateTime::second const): Deleted. (WTF::GregorianDateTime::utcOffset const): Deleted. (WTF::GregorianDateTime::isDST const): Deleted. (WTF::GregorianDateTime::setYear): Deleted. (WTF::GregorianDateTime::setMonth): Deleted. (WTF::GregorianDateTime::setYearDay): Deleted. (WTF::GregorianDateTime::setMonthDay): Deleted. (WTF::GregorianDateTime::setWeekDay): Deleted. (WTF::GregorianDateTime::setHour): Deleted. (WTF::GregorianDateTime::setMinute): Deleted. (WTF::GregorianDateTime::setSecond): Deleted. (WTF::GregorianDateTime::setUtcOffset): Deleted. (WTF::GregorianDateTime::setIsDST): Deleted. (WTF::GregorianDateTime::operator tm const): Deleted. (WTF::GregorianDateTime::copyFrom): Deleted. * wtf/HashTable.h: * wtf/Hasher.h: * wtf/HexNumber.h: * wtf/Indenter.h: * wtf/IndexMap.h: * wtf/IndexSet.h: * wtf/IndexSparseSet.h: * wtf/IndexedContainerIterator.h: * wtf/Insertion.h: * wtf/IteratorAdaptors.h: * wtf/IteratorRange.h: * wtf/KeyValuePair.h: * wtf/ListHashSet.h: (WTF::ListHashSet::begin): Deleted. (WTF::ListHashSet::end): Deleted. (WTF::ListHashSet::begin const): Deleted. (WTF::ListHashSet::end const): Deleted. (WTF::ListHashSet::random): Deleted. (WTF::ListHashSet::random const): Deleted. (WTF::ListHashSet::rbegin): Deleted. (WTF::ListHashSet::rend): Deleted. (WTF::ListHashSet::rbegin const): Deleted. (WTF::ListHashSet::rend const): Deleted. * wtf/Liveness.h: * wtf/LocklessBag.h: (WTF::LocklessBag::LocklessBag): Deleted. (WTF::LocklessBag::add): Deleted. (WTF::LocklessBag::iterate): Deleted. (WTF::LocklessBag::consumeAll): Deleted. (WTF::LocklessBag::consumeAllWithNode): Deleted. (WTF::LocklessBag::~LocklessBag): Deleted. * wtf/LoggingHashID.h: * wtf/MD5.h: * wtf/MachSendRight.h: * wtf/MainThreadData.h: * wtf/Markable.h: * wtf/MediaTime.h: * wtf/MemoryPressureHandler.h: * wtf/MessageQueue.h: (WTF::MessageQueue::MessageQueue): Deleted. * wtf/MetaAllocator.h: * wtf/MonotonicTime.h: (WTF::MonotonicTime::MonotonicTime): Deleted. (WTF::MonotonicTime::fromRawSeconds): Deleted. (WTF::MonotonicTime::infinity): Deleted. (WTF::MonotonicTime::nan): Deleted. (WTF::MonotonicTime::secondsSinceEpoch const): Deleted. (WTF::MonotonicTime::approximateMonotonicTime const): Deleted. (WTF::MonotonicTime::operator bool const): Deleted. (WTF::MonotonicTime::operator+ const): Deleted. (WTF::MonotonicTime::operator- const): Deleted. (WTF::MonotonicTime::operator% const): Deleted. (WTF::MonotonicTime::operator+=): Deleted. (WTF::MonotonicTime::operator-=): Deleted. (WTF::MonotonicTime::operator== const): Deleted. (WTF::MonotonicTime::operator!= const): Deleted. (WTF::MonotonicTime::operator< const): Deleted. (WTF::MonotonicTime::operator> const): Deleted. (WTF::MonotonicTime::operator<= const): Deleted. (WTF::MonotonicTime::operator>= const): Deleted. (WTF::MonotonicTime::isolatedCopy const): Deleted. (WTF::MonotonicTime::encode const): Deleted. (WTF::MonotonicTime::decode): Deleted. * wtf/NaturalLoops.h: * wtf/NoLock.h: * wtf/OSAllocator.h: * wtf/OptionSet.h: * wtf/Optional.h: * wtf/OrderMaker.h: * wtf/Packed.h: (WTF::alignof): * wtf/PackedIntVector.h: (WTF::PackedIntVector::PackedIntVector): Deleted. (WTF::PackedIntVector::operator=): Deleted. (WTF::PackedIntVector::size const): Deleted. (WTF::PackedIntVector::ensureSize): Deleted. (WTF::PackedIntVector::resize): Deleted. (WTF::PackedIntVector::clearAll): Deleted. (WTF::PackedIntVector::get const): Deleted. (WTF::PackedIntVector::set): Deleted. (WTF::PackedIntVector::mask): Deleted. * wtf/PageBlock.h: * wtf/ParallelJobsOpenMP.h: * wtf/ParkingLot.h: * wtf/PriorityQueue.h: (WTF::PriorityQueue::size const): Deleted. (WTF::PriorityQueue::isEmpty const): Deleted. (WTF::PriorityQueue::enqueue): Deleted. (WTF::PriorityQueue::peek const): Deleted. (WTF::PriorityQueue::dequeue): Deleted. (WTF::PriorityQueue::decreaseKey): Deleted. (WTF::PriorityQueue::increaseKey): Deleted. (WTF::PriorityQueue::begin const): Deleted. (WTF::PriorityQueue::end const): Deleted. (WTF::PriorityQueue::isValidHeap const): Deleted. (WTF::PriorityQueue::parentOf): Deleted. (WTF::PriorityQueue::leftChildOf): Deleted. (WTF::PriorityQueue::rightChildOf): Deleted. (WTF::PriorityQueue::siftUp): Deleted. (WTF::PriorityQueue::siftDown): Deleted. * wtf/RandomDevice.h: * wtf/Range.h: * wtf/RangeSet.h: (WTF::RangeSet::RangeSet): Deleted. (WTF::RangeSet::~RangeSet): Deleted. (WTF::RangeSet::add): Deleted. (WTF::RangeSet::contains const): Deleted. (WTF::RangeSet::overlaps const): Deleted. (WTF::RangeSet::clear): Deleted. (WTF::RangeSet::dump const): Deleted. (WTF::RangeSet::dumpRaw const): Deleted. (WTF::RangeSet::begin const): Deleted. (WTF::RangeSet::end const): Deleted. (WTF::RangeSet::addAll): Deleted. (WTF::RangeSet::compact): Deleted. (WTF::RangeSet::overlapsNonEmpty): Deleted. (WTF::RangeSet::subsumesNonEmpty): Deleted. (WTF::RangeSet::findRange const): Deleted. * wtf/RecursableLambda.h: * wtf/RedBlackTree.h: (WTF::RedBlackTree::Node::successor const): Deleted. (WTF::RedBlackTree::Node::predecessor const): Deleted. (WTF::RedBlackTree::Node::successor): Deleted. (WTF::RedBlackTree::Node::predecessor): Deleted. (WTF::RedBlackTree::Node::reset): Deleted. (WTF::RedBlackTree::Node::parent const): Deleted. (WTF::RedBlackTree::Node::setParent): Deleted. (WTF::RedBlackTree::Node::left const): Deleted. (WTF::RedBlackTree::Node::setLeft): Deleted. (WTF::RedBlackTree::Node::right const): Deleted. (WTF::RedBlackTree::Node::setRight): Deleted. (WTF::RedBlackTree::Node::color const): Deleted. (WTF::RedBlackTree::Node::setColor): Deleted. (WTF::RedBlackTree::RedBlackTree): Deleted. (WTF::RedBlackTree::insert): Deleted. (WTF::RedBlackTree::remove): Deleted. (WTF::RedBlackTree::findExact const): Deleted. (WTF::RedBlackTree::findLeastGreaterThanOrEqual const): Deleted. (WTF::RedBlackTree::findGreatestLessThanOrEqual const): Deleted. (WTF::RedBlackTree::first const): Deleted. (WTF::RedBlackTree::last const): Deleted. (WTF::RedBlackTree::size): Deleted. (WTF::RedBlackTree::isEmpty): Deleted. (WTF::RedBlackTree::treeMinimum): Deleted. (WTF::RedBlackTree::treeMaximum): Deleted. (WTF::RedBlackTree::treeInsert): Deleted. (WTF::RedBlackTree::leftRotate): Deleted. (WTF::RedBlackTree::rightRotate): Deleted. (WTF::RedBlackTree::removeFixup): Deleted. * wtf/ResourceUsage.h: * wtf/RunLoop.cpp: * wtf/RunLoopTimer.h: * wtf/SHA1.h: * wtf/Seconds.h: (WTF::Seconds::Seconds): Deleted. (WTF::Seconds::value const): Deleted. (WTF::Seconds::minutes const): Deleted. (WTF::Seconds::seconds const): Deleted. (WTF::Seconds::milliseconds const): Deleted. (WTF::Seconds::microseconds const): Deleted. (WTF::Seconds::nanoseconds const): Deleted. (WTF::Seconds::minutesAs const): Deleted. (WTF::Seconds::secondsAs const): Deleted. (WTF::Seconds::millisecondsAs const): Deleted. (WTF::Seconds::microsecondsAs const): Deleted. (WTF::Seconds::nanosecondsAs const): Deleted. (WTF::Seconds::fromMinutes): Deleted. (WTF::Seconds::fromHours): Deleted. (WTF::Seconds::fromMilliseconds): Deleted. (WTF::Seconds::fromMicroseconds): Deleted. (WTF::Seconds::fromNanoseconds): Deleted. (WTF::Seconds::infinity): Deleted. (WTF::Seconds::nan): Deleted. (WTF::Seconds::operator bool const): Deleted. (WTF::Seconds::operator+ const): Deleted. (WTF::Seconds::operator- const): Deleted. (WTF::Seconds::operator* const): Deleted. (WTF::Seconds::operator/ const): Deleted. (WTF::Seconds::operator% const): Deleted. (WTF::Seconds::operator+=): Deleted. (WTF::Seconds::operator-=): Deleted. (WTF::Seconds::operator*=): Deleted. (WTF::Seconds::operator/=): Deleted. (WTF::Seconds::operator%=): Deleted. (WTF::Seconds::operator== const): Deleted. (WTF::Seconds::operator!= const): Deleted. (WTF::Seconds::operator< const): Deleted. (WTF::Seconds::operator> const): Deleted. (WTF::Seconds::operator<= const): Deleted. (WTF::Seconds::operator>= const): Deleted. (WTF::Seconds::isolatedCopy const): Deleted. (WTF::Seconds::encode const): Deleted. (WTF::Seconds::decode): Deleted. * wtf/SegmentedVector.h: (WTF::SegmentedVector::~SegmentedVector): Deleted. (WTF::SegmentedVector::size const): Deleted. (WTF::SegmentedVector::isEmpty const): Deleted. (WTF::SegmentedVector::at): Deleted. (WTF::SegmentedVector::at const): Deleted. (WTF::SegmentedVector::operator[]): Deleted. (WTF::SegmentedVector::operator[] const): Deleted. (WTF::SegmentedVector::first): Deleted. (WTF::SegmentedVector::first const): Deleted. (WTF::SegmentedVector::last): Deleted. (WTF::SegmentedVector::last const): Deleted. (WTF::SegmentedVector::takeLast): Deleted. (WTF::SegmentedVector::append): Deleted. (WTF::SegmentedVector::alloc): Deleted. (WTF::SegmentedVector::removeLast): Deleted. (WTF::SegmentedVector::grow): Deleted. (WTF::SegmentedVector::clear): Deleted. (WTF::SegmentedVector::begin): Deleted. (WTF::SegmentedVector::end): Deleted. (WTF::SegmentedVector::shrinkToFit): Deleted. (WTF::SegmentedVector::deleteAllSegments): Deleted. (WTF::SegmentedVector::segmentExistsFor): Deleted. (WTF::SegmentedVector::segmentFor): Deleted. (WTF::SegmentedVector::subscriptFor): Deleted. (WTF::SegmentedVector::ensureSegmentsFor): Deleted. (WTF::SegmentedVector::ensureSegment): Deleted. (WTF::SegmentedVector::allocateSegment): Deleted. * wtf/SetForScope.h: * wtf/SingleRootGraph.h: * wtf/SinglyLinkedList.h: * wtf/SmallPtrSet.h: * wtf/SpanningTree.h: * wtf/Spectrum.h: * wtf/StackBounds.h: * wtf/StackShot.h: * wtf/StackShotProfiler.h: * wtf/StackStats.h: * wtf/StackTrace.h: * wtf/StreamBuffer.h: * wtf/SynchronizedFixedQueue.h: (WTF::SynchronizedFixedQueue::create): Deleted. (WTF::SynchronizedFixedQueue::open): Deleted. (WTF::SynchronizedFixedQueue::close): Deleted. (WTF::SynchronizedFixedQueue::isOpen): Deleted. (WTF::SynchronizedFixedQueue::enqueue): Deleted. (WTF::SynchronizedFixedQueue::dequeue): Deleted. (WTF::SynchronizedFixedQueue::SynchronizedFixedQueue): Deleted. * wtf/SystemTracing.h: * wtf/ThreadGroup.h: (WTF::ThreadGroup::create): Deleted. (WTF::ThreadGroup::threads const): Deleted. (WTF::ThreadGroup::getLock): Deleted. (WTF::ThreadGroup::weakFromThis): Deleted. * wtf/ThreadSpecific.h: * wtf/ThreadingPrimitives.h: (WTF::Mutex::impl): Deleted. * wtf/TimeWithDynamicClockType.h: (WTF::TimeWithDynamicClockType::TimeWithDynamicClockType): Deleted. (WTF::TimeWithDynamicClockType::fromRawSeconds): Deleted. (WTF::TimeWithDynamicClockType::secondsSinceEpoch const): Deleted. (WTF::TimeWithDynamicClockType::clockType const): Deleted. (WTF::TimeWithDynamicClockType::withSameClockAndRawSeconds const): Deleted. (WTF::TimeWithDynamicClockType::operator bool const): Deleted. (WTF::TimeWithDynamicClockType::operator+ const): Deleted. (WTF::TimeWithDynamicClockType::operator- const): Deleted. (WTF::TimeWithDynamicClockType::operator+=): Deleted. (WTF::TimeWithDynamicClockType::operator-=): Deleted. (WTF::TimeWithDynamicClockType::operator== const): Deleted. (WTF::TimeWithDynamicClockType::operator!= const): Deleted. * wtf/TimingScope.h: * wtf/TinyLRUCache.h: * wtf/TinyPtrSet.h: * wtf/URLParser.cpp: * wtf/URLParser.h: * wtf/Unexpected.h: * wtf/Variant.h: * wtf/WTFSemaphore.h: (WTF::Semaphore::Semaphore): Deleted. (WTF::Semaphore::signal): Deleted. (WTF::Semaphore::waitUntil): Deleted. (WTF::Semaphore::waitFor): Deleted. (WTF::Semaphore::wait): Deleted. * wtf/WallTime.h: (WTF::WallTime::WallTime): Deleted. (WTF::WallTime::fromRawSeconds): Deleted. (WTF::WallTime::infinity): Deleted. (WTF::WallTime::nan): Deleted. (WTF::WallTime::secondsSinceEpoch const): Deleted. (WTF::WallTime::approximateWallTime const): Deleted. (WTF::WallTime::operator bool const): Deleted. (WTF::WallTime::operator+ const): Deleted. (WTF::WallTime::operator- const): Deleted. (WTF::WallTime::operator+=): Deleted. (WTF::WallTime::operator-=): Deleted. (WTF::WallTime::operator== const): Deleted. (WTF::WallTime::operator!= const): Deleted. (WTF::WallTime::operator< const): Deleted. (WTF::WallTime::operator> const): Deleted. (WTF::WallTime::operator<= const): Deleted. (WTF::WallTime::operator>= const): Deleted. (WTF::WallTime::isolatedCopy const): Deleted. * wtf/WeakHashSet.h: (WTF::WeakHashSet::WeakHashSetConstIterator::WeakHashSetConstIterator): Deleted. (WTF::WeakHashSet::WeakHashSetConstIterator::get const): Deleted. (WTF::WeakHashSet::WeakHashSetConstIterator::operator* const): Deleted. (WTF::WeakHashSet::WeakHashSetConstIterator::operator-> const): Deleted. (WTF::WeakHashSet::WeakHashSetConstIterator::operator++): Deleted. (WTF::WeakHashSet::WeakHashSetConstIterator::skipEmptyBuckets): Deleted. (WTF::WeakHashSet::WeakHashSetConstIterator::operator== const): Deleted. (WTF::WeakHashSet::WeakHashSetConstIterator::operator!= const): Deleted. (WTF::WeakHashSet::WeakHashSet): Deleted. (WTF::WeakHashSet::begin const): Deleted. (WTF::WeakHashSet::end const): Deleted. (WTF::WeakHashSet::add): Deleted. (WTF::WeakHashSet::remove): Deleted. (WTF::WeakHashSet::contains const): Deleted. (WTF::WeakHashSet::capacity const): Deleted. (WTF::WeakHashSet::computesEmpty const): Deleted. (WTF::WeakHashSet::hasNullReferences const): Deleted. (WTF::WeakHashSet::computeSize const): Deleted. (WTF::WeakHashSet::checkConsistency const): Deleted. * wtf/WeakRandom.h: (WTF::WeakRandom::WeakRandom): Deleted. (WTF::WeakRandom::setSeed): Deleted. (WTF::WeakRandom::seed const): Deleted. (WTF::WeakRandom::get): Deleted. (WTF::WeakRandom::getUint32): Deleted. (WTF::WeakRandom::lowOffset): Deleted. (WTF::WeakRandom::highOffset): Deleted. (WTF::WeakRandom::nextState): Deleted. (WTF::WeakRandom::generate): Deleted. (WTF::WeakRandom::advance): Deleted. * wtf/WordLock.h: (WTF::WordLock::lock): Deleted. (WTF::WordLock::unlock): Deleted. (WTF::WordLock::isHeld const): Deleted. (WTF::WordLock::isLocked const): Deleted. (WTF::WordLock::isFullyReset const): Deleted. * wtf/generic/MainThreadGeneric.cpp: * wtf/glib/GMutexLocker.h: * wtf/linux/CurrentProcessMemoryStatus.h: * wtf/posix/ThreadingPOSIX.cpp: (WTF::Semaphore::Semaphore): Deleted. (WTF::Semaphore::~Semaphore): Deleted. (WTF::Semaphore::wait): Deleted. (WTF::Semaphore::post): Deleted. * wtf/text/ASCIILiteral.h: (WTF::ASCIILiteral::operator const char* const): Deleted. (WTF::ASCIILiteral::fromLiteralUnsafe): Deleted. (WTF::ASCIILiteral::null): Deleted. (WTF::ASCIILiteral::characters const): Deleted. (WTF::ASCIILiteral::ASCIILiteral): Deleted. * wtf/text/AtomString.h: (WTF::AtomString::operator=): Deleted. (WTF::AtomString::isHashTableDeletedValue const): Deleted. (WTF::AtomString::existingHash const): Deleted. (WTF::AtomString::operator const String& const): Deleted. (WTF::AtomString::string const): Deleted. (WTF::AtomString::impl const): Deleted. (WTF::AtomString::is8Bit const): Deleted. (WTF::AtomString::characters8 const): Deleted. (WTF::AtomString::characters16 const): Deleted. (WTF::AtomString::length const): Deleted. (WTF::AtomString::operator[] const): Deleted. (WTF::AtomString::contains const): Deleted. (WTF::AtomString::containsIgnoringASCIICase const): Deleted. (WTF::AtomString::find const): Deleted. (WTF::AtomString::findIgnoringASCIICase const): Deleted. (WTF::AtomString::startsWith const): Deleted. (WTF::AtomString::startsWithIgnoringASCIICase const): Deleted. (WTF::AtomString::endsWith const): Deleted. (WTF::AtomString::endsWithIgnoringASCIICase const): Deleted. (WTF::AtomString::toInt const): Deleted. (WTF::AtomString::toDouble const): Deleted. (WTF::AtomString::toFloat const): Deleted. (WTF::AtomString::percentage const): Deleted. (WTF::AtomString::isNull const): Deleted. (WTF::AtomString::isEmpty const): Deleted. (WTF::AtomString::operator NSString * const): Deleted. * wtf/text/AtomStringImpl.h: (WTF::AtomStringImpl::lookUp): Deleted. (WTF::AtomStringImpl::add): Deleted. (WTF::AtomStringImpl::addWithStringTableProvider): Deleted. * wtf/text/CString.h: (WTF::CStringBuffer::data): Deleted. (WTF::CStringBuffer::length const): Deleted. (WTF::CStringBuffer::CStringBuffer): Deleted. (WTF::CStringBuffer::mutableData): Deleted. (WTF::CString::CString): Deleted. (WTF::CString::data const): Deleted. (WTF::CString::length const): Deleted. (WTF::CString::isNull const): Deleted. (WTF::CString::buffer const): Deleted. (WTF::CString::isHashTableDeletedValue const): Deleted. * wtf/text/ExternalStringImpl.h: (WTF::ExternalStringImpl::freeExternalBuffer): Deleted. * wtf/text/LineBreakIteratorPoolICU.h: * wtf/text/NullTextBreakIterator.h: * wtf/text/OrdinalNumber.h: * wtf/text/StringBuffer.h: * wtf/text/StringBuilder.h: * wtf/text/StringConcatenateNumbers.h: * wtf/text/StringHasher.h: * wtf/text/StringImpl.h: * wtf/text/StringView.cpp: * wtf/text/StringView.h: (WTF::StringView::left const): Deleted. (WTF::StringView::right const): Deleted. (WTF::StringView::underlyingStringIsValid const): Deleted. (WTF::StringView::setUnderlyingString): Deleted. * wtf/text/SymbolImpl.h: (WTF::SymbolImpl::StaticSymbolImpl::StaticSymbolImpl): Deleted. (WTF::SymbolImpl::StaticSymbolImpl::operator SymbolImpl&): Deleted. (WTF::PrivateSymbolImpl::PrivateSymbolImpl): Deleted. (WTF::RegisteredSymbolImpl::symbolRegistry const): Deleted. (WTF::RegisteredSymbolImpl::clearSymbolRegistry): Deleted. (WTF::RegisteredSymbolImpl::RegisteredSymbolImpl): Deleted. * wtf/text/SymbolRegistry.h: * wtf/text/TextBreakIterator.h: * wtf/text/TextPosition.h: * wtf/text/TextStream.h: * wtf/text/WTFString.h: (WTF::String::swap): Deleted. (WTF::String::adopt): Deleted. (WTF::String::isNull const): Deleted. (WTF::String::isEmpty const): Deleted. (WTF::String::impl const): Deleted. (WTF::String::releaseImpl): Deleted. (WTF::String::length const): Deleted. (WTF::String::characters8 const): Deleted. (WTF::String::characters16 const): Deleted. (WTF::String::is8Bit const): Deleted. (WTF::String::sizeInBytes const): Deleted. (WTF::String::operator[] const): Deleted. (WTF::String::find const): Deleted. (WTF::String::findIgnoringASCIICase const): Deleted. (WTF::String::reverseFind const): Deleted. (WTF::String::contains const): Deleted. (WTF::String::containsIgnoringASCIICase const): Deleted. (WTF::String::startsWith const): Deleted. (WTF::String::startsWithIgnoringASCIICase const): Deleted. (WTF::String::hasInfixStartingAt const): Deleted. (WTF::String::endsWith const): Deleted. (WTF::String::endsWithIgnoringASCIICase const): Deleted. (WTF::String::hasInfixEndingAt const): Deleted. (WTF::String::append): Deleted. (WTF::String::left const): Deleted. (WTF::String::right const): Deleted. (WTF::String::createUninitialized): Deleted. (WTF::String::fromUTF8WithLatin1Fallback): Deleted. (WTF::String::isAllASCII const): Deleted. (WTF::String::isAllLatin1 const): Deleted. (WTF::String::isSpecialCharacter const): Deleted. (WTF::String::isHashTableDeletedValue const): Deleted. (WTF::String::hash const): Deleted. (WTF::String::existingHash const): Deleted. * wtf/text/cf/TextBreakIteratorCF.h: * wtf/text/icu/TextBreakIteratorICU.h: * wtf/text/icu/UTextProviderLatin1.h: * wtf/threads/BinarySemaphore.h: (WTF::BinarySemaphore::waitFor): Deleted. (WTF::BinarySemaphore::wait): Deleted. * wtf/unicode/Collator.h: * wtf/win/GDIObject.h: * wtf/win/PathWalker.h: * wtf/win/Win32Handle.h: Canonical link: https://commits.webkit.org/214396@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248546 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-08-12 20:57:15 +00:00
WTF_MAKE_STRUCT_FAST_ALLOCATED;
Dominators should be factored out of the DFG https://bugs.webkit.org/show_bug.cgi?id=150764 Reviewed by Geoffrey Garen. Source/JavaScriptCore: Factored DFGDominators.h/DFGDominators.cpp into WTF. To do this, I made two changes to the DFG: 1) DFG now has a CFG abstraction called DFG::CFG. The cool thing about this is that in the future if we wanted to support inverted dominators, we could do it by just creating a DFG::BackwardCFG. 2) Got rid of DFG::Analysis. From now on, an Analysis being invalidated is expressed by the DFG::Graph having a null pointer for that analysis. When we "run" the analysis, we just instantiate it. This makes it much more natural to integrate WTF::Dominators into the DFG. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * dfg/DFGAnalysis.h: Removed. * dfg/DFGCFG.h: Added. (JSC::DFG::CFG::CFG): (JSC::DFG::CFG::root): (JSC::DFG::CFG::newMap<T>): (JSC::DFG::CFG::successors): (JSC::DFG::CFG::predecessors): (JSC::DFG::CFG::index): (JSC::DFG::CFG::node): (JSC::DFG::CFG::numNodes): (JSC::DFG::CFG::dump): * dfg/DFGCSEPhase.cpp: * dfg/DFGDisassembler.cpp: (JSC::DFG::Disassembler::createDumpList): * dfg/DFGDominators.cpp: Removed. * dfg/DFGDominators.h: (JSC::DFG::Dominators::Dominators): (JSC::DFG::Dominators::strictlyDominates): Deleted. (JSC::DFG::Dominators::dominates): Deleted. (JSC::DFG::Dominators::immediateDominatorOf): Deleted. (JSC::DFG::Dominators::forAllStrictDominatorsOf): Deleted. (JSC::DFG::Dominators::forAllDominatorsOf): Deleted. (JSC::DFG::Dominators::forAllBlocksStrictlyDominatedBy): Deleted. (JSC::DFG::Dominators::forAllBlocksDominatedBy): Deleted. (JSC::DFG::Dominators::forAllBlocksInDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInIteratedDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInPrunedIteratedDominanceFrontierOf): Deleted. (JSC::DFG::Dominators::forAllBlocksInDominanceFrontierOfImpl): Deleted. (JSC::DFG::Dominators::forAllBlocksInIteratedDominanceFrontierOfImpl): Deleted. (JSC::DFG::Dominators::BlockData::BlockData): Deleted. * dfg/DFGEdgeDominates.h: (JSC::DFG::EdgeDominates::operator()): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::Graph): (JSC::DFG::Graph::dumpBlockHeader): (JSC::DFG::Graph::invalidateCFG): (JSC::DFG::Graph::substituteGetLocal): (JSC::DFG::Graph::handleAssertionFailure): (JSC::DFG::Graph::ensureDominators): (JSC::DFG::Graph::ensurePrePostNumbering): (JSC::DFG::Graph::ensureNaturalLoops): (JSC::DFG::Graph::valueProfileFor): * dfg/DFGGraph.h: (JSC::DFG::Graph::hasDebuggerEnabled): * dfg/DFGLICMPhase.cpp: (JSC::DFG::LICMPhase::run): (JSC::DFG::LICMPhase::attemptHoist): * dfg/DFGLoopPreHeaderCreationPhase.cpp: (JSC::DFG::createPreHeader): (JSC::DFG::LoopPreHeaderCreationPhase::run): * dfg/DFGNaturalLoops.cpp: (JSC::DFG::NaturalLoop::dump): (JSC::DFG::NaturalLoops::NaturalLoops): (JSC::DFG::NaturalLoops::~NaturalLoops): (JSC::DFG::NaturalLoops::loopsOf): (JSC::DFG::NaturalLoops::computeDependencies): Deleted. (JSC::DFG::NaturalLoops::compute): Deleted. * dfg/DFGNaturalLoops.h: (JSC::DFG::NaturalLoops::numLoops): * dfg/DFGNode.h: (JSC::DFG::Node::SuccessorsIterable::end): (JSC::DFG::Node::SuccessorsIterable::size): (JSC::DFG::Node::SuccessorsIterable::at): (JSC::DFG::Node::SuccessorsIterable::operator[]): * dfg/DFGOSREntrypointCreationPhase.cpp: (JSC::DFG::OSREntrypointCreationPhase::run): * dfg/DFGObjectAllocationSinkingPhase.cpp: * dfg/DFGPlan.cpp: (JSC::DFG::Plan::compileInThreadImpl): * dfg/DFGPrePostNumbering.cpp: (JSC::DFG::PrePostNumbering::PrePostNumbering): (JSC::DFG::PrePostNumbering::~PrePostNumbering): (JSC::DFG::PrePostNumbering::compute): Deleted. * dfg/DFGPrePostNumbering.h: (JSC::DFG::PrePostNumbering::preNumber): (JSC::DFG::PrePostNumbering::postNumber): * dfg/DFGPutStackSinkingPhase.cpp: * dfg/DFGSSACalculator.cpp: (JSC::DFG::SSACalculator::nonLocalReachingDef): (JSC::DFG::SSACalculator::reachingDefAtTail): * dfg/DFGSSACalculator.h: (JSC::DFG::SSACalculator::computePhis): * dfg/DFGSSAConversionPhase.cpp: (JSC::DFG::SSAConversionPhase::run): * ftl/FTLLink.cpp: (JSC::FTL::link): * ftl/FTLLowerDFGToLLVM.cpp: (JSC::FTL::DFG::LowerDFGToLLVM::lower): (JSC::FTL::DFG::LowerDFGToLLVM::safelyInvalidateAfterTermination): (JSC::FTL::DFG::LowerDFGToLLVM::isValid): Source/WTF: This takes what used to be DFGDominators.h/DFGDominators.cpp and turns it into a generic algorithm that can take any abstract graph. The idea is that you create Dominators<CFG> and pass it a CFG object, which defines the types of graph nodes and methods for getting successors, predecessors, etc. The DFG now defines a class called CFG, which is a wrapper for DFG::Graph that conforms to the thing that wtf/Dominators.h expects. When doing things to graphs, it's common to refer to the things in the graph as "nodes". Because I intend to reuse the CFG abstraction with many graph algorithms, that abstraction uses the term "node" to refer to a DFG basic block. But in Dominators, the method and variable names still use "block". This is because although Dominators are applicable to any kind of directed graph, it's super unlikely that we will ever use them for anything but compilers. Indeed, the only reason why I'm factoring them out of the DFG is so that I can use them with B3 and Air. This has the nice side effect that a user of WTF::Dominators<JSC::DFG::CFG> will see familiar terminology like "blocksStrictlyDominatedBy(...)" instead of "nodesStrictlyDominatedBy(...)", which would be super confusing. Overall, wtf/Dominators.h is a combination of what used to be in DFGDominators.h, DFGDominators.cpp, DFGNaiveDominators.h, and DFGNaiveDominators.cpp. I only changed code when I had to in order to make it generic. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/Dominators.h: Added. (WTF::Dominators::Dominators): (WTF::Dominators::compute): (WTF::Dominators::strictlyDominates): (WTF::Dominators::dominates): (WTF::Dominators::immediateDominatorOf): (WTF::Dominators::forAllStrictDominatorsOf): (WTF::Dominators::forAllDominatorsOf): (WTF::Dominators::forAllBlocksStrictlyDominatedBy): (WTF::Dominators::forAllBlocksDominatedBy): (WTF::Dominators::strictDominatorsOf): (WTF::Dominators::dominatorsOf): (WTF::Dominators::blocksStrictlyDominatedBy): (WTF::Dominators::blocksDominatedBy): (WTF::Dominators::forAllBlocksInDominanceFrontierOf): (WTF::Dominators::dominanceFrontierOf): (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOf): (WTF::Dominators::forAllBlocksInPrunedIteratedDominanceFrontierOf): (WTF::Dominators::iteratedDominanceFrontierOf): (WTF::Dominators::dump): (WTF::Dominators::LengauerTarjan::LengauerTarjan): (WTF::Dominators::LengauerTarjan::compute): (WTF::Dominators::LengauerTarjan::immediateDominator): (WTF::Dominators::LengauerTarjan::computeDepthFirstPreNumbering): (WTF::Dominators::LengauerTarjan::computeSemiDominatorsAndImplicitImmediateDominators): (WTF::Dominators::LengauerTarjan::computeExplicitImmediateDominators): (WTF::Dominators::LengauerTarjan::link): (WTF::Dominators::LengauerTarjan::eval): (WTF::Dominators::LengauerTarjan::compress): (WTF::Dominators::LengauerTarjan::BlockData::BlockData): (WTF::Dominators::NaiveDominators::NaiveDominators): (WTF::Dominators::NaiveDominators::dominates): (WTF::Dominators::NaiveDominators::dump): (WTF::Dominators::NaiveDominators::pruneDominators): (WTF::Dominators::ValidationContext::ValidationContext): (WTF::Dominators::ValidationContext::reportError): (WTF::Dominators::ValidationContext::handleErrors): (WTF::Dominators::naiveDominates): (WTF::Dominators::forAllBlocksInDominanceFrontierOfImpl): (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOfImpl): (WTF::Dominators::BlockData::BlockData): Canonical link: https://commits.webkit.org/168962@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@191870 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-11-02 00:48:03 +00:00
BlockData()
: idomParent(nullptr)
, preNumber(UINT_MAX)
, postNumber(UINT_MAX)
{
}
Vector<typename Graph::Node> idomKids;
typename Graph::Node idomParent;
unsigned preNumber;
unsigned postNumber;
};
Graph& m_graph;
typename Graph::template Map<BlockData> m_data;
};
} // namespace WTF
using WTF::Dominators;