haikuwebkit/Source/WTF/wtf/ListDump.h

184 lines
5.1 KiB
C
Raw Permalink Normal View History

fourthTier: DFG should have an SSA form for use by FTL https://bugs.webkit.org/show_bug.cgi?id=118338 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. Adds an SSA form to the DFG. We can convert ThreadedCPS form into SSA form after breaking critical edges. The conversion algorithm follows Aycock and Horspool, and the SSA form itself follows something I've done before, where instead of having Phi functions specify input nodes corresponding to block predecessors, we instead have Upsilon functions in the predecessors that specify which value in that block goes into which subsequent Phi. Upsilons don't have to dominate Phis (usually they don't) and they correspond to a non-SSA "mov" into the Phi's "variable". This gives all of the good properties of SSA, while ensuring that a bunch of CFG transformations don't have to be SSA-aware. So far the only DFG phases that are SSA-aware are DCE and CFA. CFG simplification is probably SSA-aware by default, though I haven't tried it. Constant folding probably needs a few tweaks, but is likely ready. Ditto for CSE, though it's not clear that we'd want to use block-local CSE when we could be doing GVN. Currently only the FTL can generate code from the SSA form, and there is no way to convert from SSA to ThreadedCPS or LoadStore. There probably will never be such a capability. In order to handle OSR exit state in the SSA, we place MovHints at Phi points. Other than that, you can reconstruct state-at-exit by forward propagating MovHints. Note that MovHint is the new SetLocal in SSA. SetLocal and GetLocal only survive into SSA if they are on captured variables, or in the case of flushes. A "live SetLocal" will be NodeMustGenerate and will always correspond to a flush. Computing the state-at-exit requires running SSA liveness analysis, OSR availability analysis, and flush liveness analysis. The FTL runs all of these prior to generating code. While OSR exit continues to be tricky, much of the logic is now factored into separate phases and the backend has to do less work to reason about what happened outside of the basic block that is being lowered. Conversion from DFG SSA to LLVM SSA is done by ensuring that we generate code in depth-first order, thus guaranteeing that a node will always be lowered (and hence have a LValue) before any of the blocks dominated by that node's block have code generated. For Upsilon/Phi, we just use alloca's. We could do something more clever there, but it's probably not worth it, at least not now. Finally, while the SSA form is currently only being converted to LLVM IR, there is nothing that prevents us from considering other backends in the future - with the caveat that this form is designed to be first lowered to a lower-level SSA before actual machine code generation commences. So we ought to either use LLVM (the intended path) or we will have to write our own SSA low-level backend. This runs all of the code that the FTL was known to run previously. No change in performance for now. But it does open some exciting possibilities! * JavaScriptCore.xcodeproj/project.pbxproj: * bytecode/Operands.h: (JSC::OperandValueTraits::dump): (JSC::Operands::fill): (Operands): (JSC::Operands::clear): (JSC::Operands::operator==): * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::beginBasicBlock): (JSC::DFG::setLiveValues): (DFG): (JSC::DFG::AbstractState::initialize): (JSC::DFG::AbstractState::endBasicBlock): (JSC::DFG::AbstractState::executeEffects): (JSC::DFG::AbstractState::mergeStateAtTail): (JSC::DFG::AbstractState::merge): * dfg/DFGAbstractState.h: (AbstractState): * dfg/DFGAdjacencyList.h: (JSC::DFG::AdjacencyList::justOneChild): (AdjacencyList): * dfg/DFGBasicBlock.cpp: Added. (DFG): (JSC::DFG::BasicBlock::BasicBlock): (JSC::DFG::BasicBlock::~BasicBlock): (JSC::DFG::BasicBlock::ensureLocals): (JSC::DFG::BasicBlock::isInPhis): (JSC::DFG::BasicBlock::isInBlock): (JSC::DFG::BasicBlock::removePredecessor): (JSC::DFG::BasicBlock::replacePredecessor): (JSC::DFG::BasicBlock::dump): (JSC::DFG::BasicBlock::SSAData::SSAData): (JSC::DFG::BasicBlock::SSAData::~SSAData): * dfg/DFGBasicBlock.h: (BasicBlock): (JSC::DFG::BasicBlock::operator[]): (JSC::DFG::BasicBlock::successor): (JSC::DFG::BasicBlock::successorForCondition): (SSAData): * dfg/DFGBasicBlockInlines.h: (DFG): * dfg/DFGBlockInsertionSet.cpp: Added. (DFG): (JSC::DFG::BlockInsertionSet::BlockInsertionSet): (JSC::DFG::BlockInsertionSet::~BlockInsertionSet): (JSC::DFG::BlockInsertionSet::insert): (JSC::DFG::BlockInsertionSet::insertBefore): (JSC::DFG::BlockInsertionSet::execute): * dfg/DFGBlockInsertionSet.h: Added. (DFG): (BlockInsertionSet): * dfg/DFGCFAPhase.cpp: (JSC::DFG::CFAPhase::run): * dfg/DFGCFGSimplificationPhase.cpp: * dfg/DFGCPSRethreadingPhase.cpp: (JSC::DFG::CPSRethreadingPhase::canonicalizeLocalsInBlock): * dfg/DFGCommon.cpp: (WTF::printInternal): * dfg/DFGCommon.h: (JSC::DFG::doesKill): (DFG): (JSC::DFG::killStatusForDoesKill): * dfg/DFGConstantFoldingPhase.cpp: (JSC::DFG::ConstantFoldingPhase::foldConstants): (JSC::DFG::ConstantFoldingPhase::isCapturedAtOrAfter): * dfg/DFGCriticalEdgeBreakingPhase.cpp: Added. (DFG): (CriticalEdgeBreakingPhase): (JSC::DFG::CriticalEdgeBreakingPhase::CriticalEdgeBreakingPhase): (JSC::DFG::CriticalEdgeBreakingPhase::run): (JSC::DFG::CriticalEdgeBreakingPhase::breakCriticalEdge): (JSC::DFG::performCriticalEdgeBreaking): * dfg/DFGCriticalEdgeBreakingPhase.h: Added. (DFG): * dfg/DFGDCEPhase.cpp: (JSC::DFG::DCEPhase::run): (JSC::DFG::DCEPhase::findTypeCheckRoot): (JSC::DFG::DCEPhase::countNode): (DCEPhase): (JSC::DFG::DCEPhase::countEdge): (JSC::DFG::DCEPhase::eliminateIrrelevantPhantomChildren): * dfg/DFGDriver.cpp: (JSC::DFG::compile): * dfg/DFGEdge.cpp: (JSC::DFG::Edge::dump): * dfg/DFGEdge.h: (JSC::DFG::Edge::Edge): (JSC::DFG::Edge::setNode): (JSC::DFG::Edge::useKindUnchecked): (JSC::DFG::Edge::setUseKind): (JSC::DFG::Edge::setProofStatus): (JSC::DFG::Edge::willNotHaveCheck): (JSC::DFG::Edge::willHaveCheck): (Edge): (JSC::DFG::Edge::killStatusUnchecked): (JSC::DFG::Edge::killStatus): (JSC::DFG::Edge::setKillStatus): (JSC::DFG::Edge::doesKill): (JSC::DFG::Edge::doesNotKill): (JSC::DFG::Edge::shift): (JSC::DFG::Edge::makeWord): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGFlushFormat.cpp: Added. (WTF): (WTF::printInternal): * dfg/DFGFlushFormat.h: Added. (DFG): (JSC::DFG::resultFor): (JSC::DFG::useKindFor): (WTF): * dfg/DFGFlushLivenessAnalysisPhase.cpp: Added. (DFG): (FlushLivenessAnalysisPhase): (JSC::DFG::FlushLivenessAnalysisPhase::FlushLivenessAnalysisPhase): (JSC::DFG::FlushLivenessAnalysisPhase::run): (JSC::DFG::FlushLivenessAnalysisPhase::process): (JSC::DFG::FlushLivenessAnalysisPhase::setForNode): (JSC::DFG::FlushLivenessAnalysisPhase::flushFormat): (JSC::DFG::performFlushLivenessAnalysis): * dfg/DFGFlushLivenessAnalysisPhase.h: Added. (DFG): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::dump): (JSC::DFG::Graph::dumpBlockHeader): (DFG): (JSC::DFG::Graph::addForDepthFirstSort): (JSC::DFG::Graph::getBlocksInDepthFirstOrder): * dfg/DFGGraph.h: (JSC::DFG::Graph::convertToConstant): (JSC::DFG::Graph::valueProfileFor): (Graph): * dfg/DFGInsertionSet.h: (DFG): (JSC::DFG::InsertionSet::execute): * dfg/DFGLivenessAnalysisPhase.cpp: Added. (DFG): (LivenessAnalysisPhase): (JSC::DFG::LivenessAnalysisPhase::LivenessAnalysisPhase): (JSC::DFG::LivenessAnalysisPhase::run): (JSC::DFG::LivenessAnalysisPhase::process): (JSC::DFG::LivenessAnalysisPhase::addChildUse): (JSC::DFG::performLivenessAnalysis): * dfg/DFGLivenessAnalysisPhase.h: Added. (DFG): * dfg/DFGNode.cpp: (JSC::DFG::Node::hasVariableAccessData): (DFG): * dfg/DFGNode.h: (DFG): (Node): (JSC::DFG::Node::hasLocal): (JSC::DFG::Node::variableAccessData): (JSC::DFG::Node::hasPhi): (JSC::DFG::Node::phi): (JSC::DFG::Node::takenBlock): (JSC::DFG::Node::notTakenBlock): (JSC::DFG::Node::successor): (JSC::DFG::Node::successorForCondition): (JSC::DFG::nodeComparator): (JSC::DFG::nodeListDump): (JSC::DFG::nodeMapDump): * dfg/DFGNodeFlags.cpp: (JSC::DFG::dumpNodeFlags): * dfg/DFGNodeType.h: (DFG): * dfg/DFGOSRAvailabilityAnalysisPhase.cpp: Added. (DFG): (OSRAvailabilityAnalysisPhase): (JSC::DFG::OSRAvailabilityAnalysisPhase::OSRAvailabilityAnalysisPhase): (JSC::DFG::OSRAvailabilityAnalysisPhase::run): (JSC::DFG::performOSRAvailabilityAnalysis): * dfg/DFGOSRAvailabilityAnalysisPhase.h: Added. (DFG): * dfg/DFGPlan.cpp: (JSC::DFG::Plan::compileInThreadImpl): * dfg/DFGPredictionInjectionPhase.cpp: (JSC::DFG::PredictionInjectionPhase::run): * dfg/DFGPredictionPropagationPhase.cpp: (JSC::DFG::PredictionPropagationPhase::propagate): * dfg/DFGSSAConversionPhase.cpp: Added. (DFG): (SSAConversionPhase): (JSC::DFG::SSAConversionPhase::SSAConversionPhase): (JSC::DFG::SSAConversionPhase::run): (JSC::DFG::SSAConversionPhase::forwardPhiChildren): (JSC::DFG::SSAConversionPhase::forwardPhi): (JSC::DFG::SSAConversionPhase::forwardPhiEdge): (JSC::DFG::SSAConversionPhase::deduplicateChildren): (JSC::DFG::SSAConversionPhase::addFlushedLocalOp): (JSC::DFG::SSAConversionPhase::addFlushedLocalEdge): (JSC::DFG::performSSAConversion): * dfg/DFGSSAConversionPhase.h: Added. (DFG): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGValidate.cpp: (JSC::DFG::Validate::validate): (Validate): (JSC::DFG::Validate::validateCPS): * dfg/DFGVariableAccessData.h: (JSC::DFG::VariableAccessData::flushFormat): (VariableAccessData): * ftl/FTLCapabilities.cpp: (JSC::FTL::canCompile): * ftl/FTLLowerDFGToLLVM.cpp: (JSC::FTL::LowerDFGToLLVM::LowerDFGToLLVM): (JSC::FTL::LowerDFGToLLVM::lower): (JSC::FTL::LowerDFGToLLVM::createPhiVariables): (JSC::FTL::LowerDFGToLLVM::compileBlock): (JSC::FTL::LowerDFGToLLVM::compileNode): (JSC::FTL::LowerDFGToLLVM::compileUpsilon): (LowerDFGToLLVM): (JSC::FTL::LowerDFGToLLVM::compilePhi): (JSC::FTL::LowerDFGToLLVM::compileJSConstant): (JSC::FTL::LowerDFGToLLVM::compileWeakJSConstant): (JSC::FTL::LowerDFGToLLVM::compileGetArgument): (JSC::FTL::LowerDFGToLLVM::compileGetLocal): (JSC::FTL::LowerDFGToLLVM::compileSetLocal): (JSC::FTL::LowerDFGToLLVM::compileAdd): (JSC::FTL::LowerDFGToLLVM::compileArithSub): (JSC::FTL::LowerDFGToLLVM::compileArithMul): (JSC::FTL::LowerDFGToLLVM::compileArithDiv): (JSC::FTL::LowerDFGToLLVM::compileArithMod): (JSC::FTL::LowerDFGToLLVM::compileArithMinOrMax): (JSC::FTL::LowerDFGToLLVM::compileArithAbs): (JSC::FTL::LowerDFGToLLVM::compileArithNegate): (JSC::FTL::LowerDFGToLLVM::compileBitAnd): (JSC::FTL::LowerDFGToLLVM::compileBitOr): (JSC::FTL::LowerDFGToLLVM::compileBitXor): (JSC::FTL::LowerDFGToLLVM::compileBitRShift): (JSC::FTL::LowerDFGToLLVM::compileBitLShift): (JSC::FTL::LowerDFGToLLVM::compileBitURShift): (JSC::FTL::LowerDFGToLLVM::compileUInt32ToNumber): (JSC::FTL::LowerDFGToLLVM::compileInt32ToDouble): (JSC::FTL::LowerDFGToLLVM::compileGetButterfly): (JSC::FTL::LowerDFGToLLVM::compileGetArrayLength): (JSC::FTL::LowerDFGToLLVM::compileGetByVal): (JSC::FTL::LowerDFGToLLVM::compileGetByOffset): (JSC::FTL::LowerDFGToLLVM::compileGetGlobalVar): (JSC::FTL::LowerDFGToLLVM::compileCompareEqConstant): (JSC::FTL::LowerDFGToLLVM::compileCompareStrictEq): (JSC::FTL::LowerDFGToLLVM::compileCompareStrictEqConstant): (JSC::FTL::LowerDFGToLLVM::compileCompareLess): (JSC::FTL::LowerDFGToLLVM::compileCompareLessEq): (JSC::FTL::LowerDFGToLLVM::compileCompareGreater): (JSC::FTL::LowerDFGToLLVM::compileCompareGreaterEq): (JSC::FTL::LowerDFGToLLVM::compileLogicalNot): (JSC::FTL::LowerDFGToLLVM::speculateBackward): (JSC::FTL::LowerDFGToLLVM::lowInt32): (JSC::FTL::LowerDFGToLLVM::lowCell): (JSC::FTL::LowerDFGToLLVM::lowBoolean): (JSC::FTL::LowerDFGToLLVM::lowDouble): (JSC::FTL::LowerDFGToLLVM::lowJSValue): (JSC::FTL::LowerDFGToLLVM::lowStorage): (JSC::FTL::LowerDFGToLLVM::speculate): (JSC::FTL::LowerDFGToLLVM::speculateBoolean): (JSC::FTL::LowerDFGToLLVM::isLive): (JSC::FTL::LowerDFGToLLVM::use): (JSC::FTL::LowerDFGToLLVM::initializeOSRExitStateForBlock): (JSC::FTL::LowerDFGToLLVM::appendOSRExit): (JSC::FTL::LowerDFGToLLVM::emitOSRExitCall): (JSC::FTL::LowerDFGToLLVM::addExitArgumentForNode): (JSC::FTL::LowerDFGToLLVM::linkOSRExitsAndCompleteInitializationBlocks): (JSC::FTL::LowerDFGToLLVM::setInt32): (JSC::FTL::LowerDFGToLLVM::setJSValue): (JSC::FTL::LowerDFGToLLVM::setBoolean): (JSC::FTL::LowerDFGToLLVM::setStorage): (JSC::FTL::LowerDFGToLLVM::setDouble): (JSC::FTL::LowerDFGToLLVM::isValid): * ftl/FTLLoweredNodeValue.h: Added. (FTL): (LoweredNodeValue): (JSC::FTL::LoweredNodeValue::LoweredNodeValue): (JSC::FTL::LoweredNodeValue::isSet): (JSC::FTL::LoweredNodeValue::operator!): (JSC::FTL::LoweredNodeValue::value): (JSC::FTL::LoweredNodeValue::block): * ftl/FTLValueFromBlock.h: (JSC::FTL::ValueFromBlock::ValueFromBlock): (ValueFromBlock): * ftl/FTLValueSource.cpp: (JSC::FTL::ValueSource::dump): * ftl/FTLValueSource.h: Source/WTF: Reviewed by Mark Hahnenberg. - Extend variadicity of PrintStream and dataLog. - Give HashSet the ability to add a span of things. - Give HashSet the ability to == another HashSet. - Note FIXME's in HashTable concerning copying performance, that affects the way that the DFG now uses HashSets and HashMaps. - Factor out the bulk-insertion logic of JSC::DFG::InsertionSet into WTF::Insertion, so that it can be used in more places. - Create a dumper for lists and maps. * WTF.xcodeproj/project.pbxproj: * wtf/DataLog.h: (WTF): (WTF::dataLog): * wtf/HashSet.h: (HashSet): (WTF): (WTF::::add): (WTF::=): * wtf/HashTable.h: (WTF::::HashTable): (WTF::=): * wtf/Insertion.h: Added. (WTF): (Insertion): (WTF::Insertion::Insertion): (WTF::Insertion::index): (WTF::Insertion::element): (WTF::Insertion::operator<): (WTF::executeInsertions): * wtf/ListDump.h: Added. (WTF): (ListDump): (WTF::ListDump::ListDump): (WTF::ListDump::dump): (MapDump): (WTF::MapDump::MapDump): (WTF::MapDump::dump): (WTF::listDump): (WTF::sortedListDump): (WTF::lessThan): (WTF::mapDump): (WTF::sortedMapDump): * wtf/PrintStream.h: (PrintStream): (WTF::PrintStream::print): Conflicts: Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj Canonical link: https://commits.webkit.org/137058@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153274 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:04:45 +00:00
/*
Create a super rough prototype of B3 https://bugs.webkit.org/show_bug.cgi?id=150280 Reviewed by Benjamin Poulain. Source/JavaScriptCore: This changeset adds the basic scaffolding of the B3 compiler. B3 stands for Bare Bones Backend. It's a low-level SSA-based language-agnostic compiler. The basic structure allows for aggressive C-level optimizations and an awesome portable backend. The backend, called Air (Assembly IR), is a reflective abstraction over our MacroAssembler. The abstraction is defined using a spec file (AirOpcode.opcodes) which describes the various kinds of instructions that we wish to support. Then, the B3::LowerToAir phase, which does our instruction selection, reflectively selects Air opcodes by querying which instruction forms are possible. Air allows for optimal register allocation and stack layout. Currently the register allocator isn't written, but the stack layout is. Of course this isn't done yet. It can only compile simple programs, seen in the "test suite" called "testb3.cpp". There's a lot of optimizations that have to be written and a lot of stuff added to the instruction selector. But it's a neat start. * CMakeLists.txt: * DerivedSources.make: * JavaScriptCore.xcodeproj/project.pbxproj: * assembler/MacroAssembler.cpp: (WTF::printInternal): * assembler/MacroAssembler.h: * b3: Added. * b3/B3AddressMatcher.patterns: Added. * b3/B3ArgumentRegValue.cpp: Added. (JSC::B3::ArgumentRegValue::~ArgumentRegValue): (JSC::B3::ArgumentRegValue::dumpMeta): * b3/B3ArgumentRegValue.h: Added. * b3/B3BasicBlock.cpp: Added. (JSC::B3::BasicBlock::BasicBlock): (JSC::B3::BasicBlock::~BasicBlock): (JSC::B3::BasicBlock::append): (JSC::B3::BasicBlock::addPredecessor): (JSC::B3::BasicBlock::removePredecessor): (JSC::B3::BasicBlock::replacePredecessor): (JSC::B3::BasicBlock::removeNops): (JSC::B3::BasicBlock::dump): (JSC::B3::BasicBlock::deepDump): * b3/B3BasicBlock.h: Added. (JSC::B3::BasicBlock::index): (JSC::B3::BasicBlock::begin): (JSC::B3::BasicBlock::end): (JSC::B3::BasicBlock::size): (JSC::B3::BasicBlock::at): (JSC::B3::BasicBlock::last): (JSC::B3::BasicBlock::values): (JSC::B3::BasicBlock::numPredecessors): (JSC::B3::BasicBlock::predecessor): (JSC::B3::BasicBlock::predecessors): (JSC::B3::BasicBlock::frequency): (JSC::B3::DeepBasicBlockDump::DeepBasicBlockDump): (JSC::B3::DeepBasicBlockDump::dump): (JSC::B3::deepDump): * b3/B3BasicBlockInlines.h: Added. (JSC::B3::BasicBlock::appendNew): (JSC::B3::BasicBlock::numSuccessors): (JSC::B3::BasicBlock::successor): (JSC::B3::BasicBlock::successors): (JSC::B3::BasicBlock::successorBlock): (JSC::B3::BasicBlock::successorBlocks): * b3/B3BasicBlockUtils.h: Added. (JSC::B3::addPredecessor): (JSC::B3::removePredecessor): (JSC::B3::replacePredecessor): (JSC::B3::resetReachability): (JSC::B3::blocksInPreOrder): (JSC::B3::blocksInPostOrder): * b3/B3BlockWorklist.h: Added. * b3/B3CheckSpecial.cpp: Added. (JSC::B3::Air::numB3Args): (JSC::B3::CheckSpecial::CheckSpecial): (JSC::B3::CheckSpecial::~CheckSpecial): (JSC::B3::CheckSpecial::hiddenBranch): (JSC::B3::CheckSpecial::forEachArg): (JSC::B3::CheckSpecial::isValid): (JSC::B3::CheckSpecial::admitsStack): (JSC::B3::CheckSpecial::generate): (JSC::B3::CheckSpecial::dumpImpl): (JSC::B3::CheckSpecial::deepDumpImpl): * b3/B3CheckSpecial.h: Added. * b3/B3CheckValue.cpp: Added. (JSC::B3::CheckValue::~CheckValue): (JSC::B3::CheckValue::dumpMeta): * b3/B3CheckValue.h: Added. * b3/B3Common.cpp: Added. (JSC::B3::shouldDumpIR): (JSC::B3::shouldDumpIRAtEachPhase): (JSC::B3::shouldValidateIR): (JSC::B3::shouldValidateIRAtEachPhase): (JSC::B3::shouldSaveIRBeforePhase): * b3/B3Common.h: Added. (JSC::B3::is64Bit): (JSC::B3::is32Bit): * b3/B3Commutativity.cpp: Added. (WTF::printInternal): * b3/B3Commutativity.h: Added. * b3/B3Const32Value.cpp: Added. (JSC::B3::Const32Value::~Const32Value): (JSC::B3::Const32Value::negConstant): (JSC::B3::Const32Value::addConstant): (JSC::B3::Const32Value::subConstant): (JSC::B3::Const32Value::dumpMeta): * b3/B3Const32Value.h: Added. * b3/B3Const64Value.cpp: Added. (JSC::B3::Const64Value::~Const64Value): (JSC::B3::Const64Value::negConstant): (JSC::B3::Const64Value::addConstant): (JSC::B3::Const64Value::subConstant): (JSC::B3::Const64Value::dumpMeta): * b3/B3Const64Value.h: Added. * b3/B3ConstDoubleValue.cpp: Added. (JSC::B3::ConstDoubleValue::~ConstDoubleValue): (JSC::B3::ConstDoubleValue::negConstant): (JSC::B3::ConstDoubleValue::addConstant): (JSC::B3::ConstDoubleValue::subConstant): (JSC::B3::ConstDoubleValue::dumpMeta): * b3/B3ConstDoubleValue.h: Added. (JSC::B3::ConstDoubleValue::accepts): (JSC::B3::ConstDoubleValue::value): (JSC::B3::ConstDoubleValue::ConstDoubleValue): * b3/B3ConstPtrValue.h: Added. (JSC::B3::ConstPtrValue::value): (JSC::B3::ConstPtrValue::ConstPtrValue): * b3/B3ControlValue.cpp: Added. (JSC::B3::ControlValue::~ControlValue): (JSC::B3::ControlValue::dumpMeta): * b3/B3ControlValue.h: Added. * b3/B3Effects.cpp: Added. (JSC::B3::Effects::dump): * b3/B3Effects.h: Added. (JSC::B3::Effects::mustExecute): * b3/B3FrequencyClass.cpp: Added. (WTF::printInternal): * b3/B3FrequencyClass.h: Added. * b3/B3FrequentedBlock.h: Added. * b3/B3Generate.cpp: Added. (JSC::B3::generate): (JSC::B3::generateToAir): * b3/B3Generate.h: Added. * b3/B3GenericFrequentedBlock.h: Added. (JSC::B3::GenericFrequentedBlock::GenericFrequentedBlock): (JSC::B3::GenericFrequentedBlock::operator==): (JSC::B3::GenericFrequentedBlock::operator!=): (JSC::B3::GenericFrequentedBlock::operator bool): (JSC::B3::GenericFrequentedBlock::block): (JSC::B3::GenericFrequentedBlock::frequency): (JSC::B3::GenericFrequentedBlock::dump): * b3/B3HeapRange.cpp: Added. (JSC::B3::HeapRange::dump): * b3/B3HeapRange.h: Added. (JSC::B3::HeapRange::HeapRange): (JSC::B3::HeapRange::top): (JSC::B3::HeapRange::operator==): (JSC::B3::HeapRange::operator!=): (JSC::B3::HeapRange::operator bool): (JSC::B3::HeapRange::begin): (JSC::B3::HeapRange::end): (JSC::B3::HeapRange::overlaps): * b3/B3IndexMap.h: Added. (JSC::B3::IndexMap::IndexMap): (JSC::B3::IndexMap::resize): (JSC::B3::IndexMap::operator[]): * b3/B3IndexSet.h: Added. (JSC::B3::IndexSet::IndexSet): (JSC::B3::IndexSet::add): (JSC::B3::IndexSet::contains): (JSC::B3::IndexSet::Iterable::Iterable): (JSC::B3::IndexSet::Iterable::iterator::iterator): (JSC::B3::IndexSet::Iterable::iterator::operator*): (JSC::B3::IndexSet::Iterable::iterator::operator++): (JSC::B3::IndexSet::Iterable::iterator::operator==): (JSC::B3::IndexSet::Iterable::iterator::operator!=): (JSC::B3::IndexSet::Iterable::begin): (JSC::B3::IndexSet::Iterable::end): (JSC::B3::IndexSet::values): (JSC::B3::IndexSet::indices): (JSC::B3::IndexSet::dump): * b3/B3InsertionSet.cpp: Added. (JSC::B3::InsertionSet::execute): * b3/B3InsertionSet.h: Added. (JSC::B3::InsertionSet::InsertionSet): (JSC::B3::InsertionSet::code): (JSC::B3::InsertionSet::appendInsertion): (JSC::B3::InsertionSet::insertValue): * b3/B3InsertionSetInlines.h: Added. (JSC::B3::InsertionSet::insert): * b3/B3LowerToAir.cpp: Added. (JSC::B3::Air::LowerToAir::LowerToAir): (JSC::B3::Air::LowerToAir::run): (JSC::B3::Air::LowerToAir::tmp): (JSC::B3::Air::LowerToAir::effectiveAddr): (JSC::B3::Air::LowerToAir::addr): (JSC::B3::Air::LowerToAir::loadAddr): (JSC::B3::Air::LowerToAir::imm): (JSC::B3::Air::LowerToAir::immOrTmp): (JSC::B3::Air::LowerToAir::appendBinOp): (JSC::B3::Air::LowerToAir::tryAppendStoreBinOp): (JSC::B3::Air::LowerToAir::moveForType): (JSC::B3::Air::LowerToAir::relaxedMoveForType): (JSC::B3::Air::LowerToAir::append): (JSC::B3::Air::LowerToAir::AddressSelector::AddressSelector): (JSC::B3::Air::LowerToAir::AddressSelector::acceptRoot): (JSC::B3::Air::LowerToAir::AddressSelector::acceptRootLate): (JSC::B3::Air::LowerToAir::AddressSelector::acceptInternals): (JSC::B3::Air::LowerToAir::AddressSelector::acceptInternalsLate): (JSC::B3::Air::LowerToAir::AddressSelector::acceptOperands): (JSC::B3::Air::LowerToAir::AddressSelector::acceptOperandsLate): (JSC::B3::Air::LowerToAir::AddressSelector::tryAddShift1): (JSC::B3::Air::LowerToAir::AddressSelector::tryAddShift2): (JSC::B3::Air::LowerToAir::AddressSelector::tryAdd): (JSC::B3::Air::LowerToAir::AddressSelector::tryDirect): (JSC::B3::Air::LowerToAir::acceptRoot): (JSC::B3::Air::LowerToAir::acceptRootLate): (JSC::B3::Air::LowerToAir::acceptInternals): (JSC::B3::Air::LowerToAir::acceptInternalsLate): (JSC::B3::Air::LowerToAir::acceptOperands): (JSC::B3::Air::LowerToAir::acceptOperandsLate): (JSC::B3::Air::LowerToAir::tryLoad): (JSC::B3::Air::LowerToAir::tryAdd): (JSC::B3::Air::LowerToAir::tryAnd): (JSC::B3::Air::LowerToAir::tryStoreAddLoad): (JSC::B3::Air::LowerToAir::tryStoreAndLoad): (JSC::B3::Air::LowerToAir::tryStore): (JSC::B3::Air::LowerToAir::tryTruncArgumentReg): (JSC::B3::Air::LowerToAir::tryTrunc): (JSC::B3::Air::LowerToAir::tryArgumentReg): (JSC::B3::Air::LowerToAir::tryConst32): (JSC::B3::Air::LowerToAir::tryConst64): (JSC::B3::Air::LowerToAir::tryIdentity): (JSC::B3::Air::LowerToAir::tryReturn): (JSC::B3::lowerToAir): * b3/B3LowerToAir.h: Added. * b3/B3LoweringMatcher.patterns: Added. * b3/B3MemoryValue.cpp: Added. (JSC::B3::MemoryValue::~MemoryValue): (JSC::B3::MemoryValue::dumpMeta): * b3/B3MemoryValue.h: Added. * b3/B3Opcode.cpp: Added. (WTF::printInternal): * b3/B3Opcode.h: Added. (JSC::B3::isCheckMath): * b3/B3Origin.cpp: Added. (JSC::B3::Origin::dump): * b3/B3Origin.h: Added. (JSC::B3::Origin::Origin): (JSC::B3::Origin::operator bool): (JSC::B3::Origin::data): * b3/B3PatchpointSpecial.cpp: Added. (JSC::B3::PatchpointSpecial::PatchpointSpecial): (JSC::B3::PatchpointSpecial::~PatchpointSpecial): (JSC::B3::PatchpointSpecial::forEachArg): (JSC::B3::PatchpointSpecial::isValid): (JSC::B3::PatchpointSpecial::admitsStack): (JSC::B3::PatchpointSpecial::generate): (JSC::B3::PatchpointSpecial::dumpImpl): (JSC::B3::PatchpointSpecial::deepDumpImpl): * b3/B3PatchpointSpecial.h: Added. * b3/B3PatchpointValue.cpp: Added. (JSC::B3::PatchpointValue::~PatchpointValue): (JSC::B3::PatchpointValue::dumpMeta): * b3/B3PatchpointValue.h: Added. (JSC::B3::PatchpointValue::accepts): (JSC::B3::PatchpointValue::PatchpointValue): * b3/B3PhaseScope.cpp: Added. (JSC::B3::PhaseScope::PhaseScope): (JSC::B3::PhaseScope::~PhaseScope): * b3/B3PhaseScope.h: Added. * b3/B3Procedure.cpp: Added. (JSC::B3::Procedure::Procedure): (JSC::B3::Procedure::~Procedure): (JSC::B3::Procedure::addBlock): (JSC::B3::Procedure::resetReachability): (JSC::B3::Procedure::dump): (JSC::B3::Procedure::blocksInPreOrder): (JSC::B3::Procedure::blocksInPostOrder): * b3/B3Procedure.h: Added. (JSC::B3::Procedure::size): (JSC::B3::Procedure::at): (JSC::B3::Procedure::operator[]): (JSC::B3::Procedure::iterator::iterator): (JSC::B3::Procedure::iterator::operator*): (JSC::B3::Procedure::iterator::operator++): (JSC::B3::Procedure::iterator::operator==): (JSC::B3::Procedure::iterator::operator!=): (JSC::B3::Procedure::iterator::findNext): (JSC::B3::Procedure::begin): (JSC::B3::Procedure::end): (JSC::B3::Procedure::ValuesCollection::ValuesCollection): (JSC::B3::Procedure::ValuesCollection::iterator::iterator): (JSC::B3::Procedure::ValuesCollection::iterator::operator*): (JSC::B3::Procedure::ValuesCollection::iterator::operator++): (JSC::B3::Procedure::ValuesCollection::iterator::operator==): (JSC::B3::Procedure::ValuesCollection::iterator::operator!=): (JSC::B3::Procedure::ValuesCollection::begin): (JSC::B3::Procedure::ValuesCollection::end): (JSC::B3::Procedure::ValuesCollection::size): (JSC::B3::Procedure::ValuesCollection::at): (JSC::B3::Procedure::ValuesCollection::operator[]): (JSC::B3::Procedure::values): (JSC::B3::Procedure::setLastPhaseName): (JSC::B3::Procedure::lastPhaseName): * b3/B3ProcedureInlines.h: Added. (JSC::B3::Procedure::add): * b3/B3ReduceStrength.cpp: Added. (JSC::B3::reduceStrength): * b3/B3ReduceStrength.h: Added. * b3/B3StackSlotKind.cpp: Added. (WTF::printInternal): * b3/B3StackSlotKind.h: Added. * b3/B3StackSlotValue.cpp: Added. (JSC::B3::StackSlotValue::~StackSlotValue): (JSC::B3::StackSlotValue::dumpMeta): * b3/B3StackSlotValue.h: Added. (JSC::B3::StackSlotValue::accepts): (JSC::B3::StackSlotValue::byteSize): (JSC::B3::StackSlotValue::kind): (JSC::B3::StackSlotValue::offsetFromFP): (JSC::B3::StackSlotValue::setOffsetFromFP): (JSC::B3::StackSlotValue::StackSlotValue): * b3/B3Stackmap.cpp: Added. (JSC::B3::Stackmap::Stackmap): (JSC::B3::Stackmap::~Stackmap): (JSC::B3::Stackmap::dump): * b3/B3Stackmap.h: Added. (JSC::B3::Stackmap::constrain): (JSC::B3::Stackmap::reps): (JSC::B3::Stackmap::clobber): (JSC::B3::Stackmap::clobbered): (JSC::B3::Stackmap::setGenerator): * b3/B3StackmapSpecial.cpp: Added. (JSC::B3::StackmapSpecial::StackmapSpecial): (JSC::B3::StackmapSpecial::~StackmapSpecial): (JSC::B3::StackmapSpecial::reportUsedRegisters): (JSC::B3::StackmapSpecial::extraClobberedRegs): (JSC::B3::StackmapSpecial::forEachArgImpl): (JSC::B3::StackmapSpecial::isValidImpl): (JSC::B3::StackmapSpecial::admitsStackImpl): (JSC::B3::StackmapSpecial::appendRepsImpl): (JSC::B3::StackmapSpecial::repForArg): * b3/B3StackmapSpecial.h: Added. * b3/B3SuccessorCollection.h: Added. (JSC::B3::SuccessorCollection::SuccessorCollection): (JSC::B3::SuccessorCollection::size): (JSC::B3::SuccessorCollection::at): (JSC::B3::SuccessorCollection::operator[]): (JSC::B3::SuccessorCollection::iterator::iterator): (JSC::B3::SuccessorCollection::iterator::operator*): (JSC::B3::SuccessorCollection::iterator::operator++): (JSC::B3::SuccessorCollection::iterator::operator==): (JSC::B3::SuccessorCollection::iterator::operator!=): (JSC::B3::SuccessorCollection::begin): (JSC::B3::SuccessorCollection::end): * b3/B3SwitchCase.cpp: Added. (JSC::B3::SwitchCase::dump): * b3/B3SwitchCase.h: Added. (JSC::B3::SwitchCase::SwitchCase): (JSC::B3::SwitchCase::operator bool): (JSC::B3::SwitchCase::caseValue): (JSC::B3::SwitchCase::target): (JSC::B3::SwitchCase::targetBlock): * b3/B3SwitchValue.cpp: Added. (JSC::B3::SwitchValue::~SwitchValue): (JSC::B3::SwitchValue::removeCase): (JSC::B3::SwitchValue::appendCase): (JSC::B3::SwitchValue::dumpMeta): (JSC::B3::SwitchValue::SwitchValue): * b3/B3SwitchValue.h: Added. (JSC::B3::SwitchValue::accepts): (JSC::B3::SwitchValue::numCaseValues): (JSC::B3::SwitchValue::caseValue): (JSC::B3::SwitchValue::caseValues): (JSC::B3::SwitchValue::fallThrough): (JSC::B3::SwitchValue::size): (JSC::B3::SwitchValue::at): (JSC::B3::SwitchValue::operator[]): (JSC::B3::SwitchValue::iterator::iterator): (JSC::B3::SwitchValue::iterator::operator*): (JSC::B3::SwitchValue::iterator::operator++): (JSC::B3::SwitchValue::iterator::operator==): (JSC::B3::SwitchValue::iterator::operator!=): (JSC::B3::SwitchValue::begin): (JSC::B3::SwitchValue::end): * b3/B3Type.cpp: Added. (WTF::printInternal): * b3/B3Type.h: Added. (JSC::B3::isInt): (JSC::B3::isFloat): (JSC::B3::pointerType): * b3/B3UpsilonValue.cpp: Added. (JSC::B3::UpsilonValue::~UpsilonValue): (JSC::B3::UpsilonValue::dumpMeta): * b3/B3UpsilonValue.h: Added. (JSC::B3::UpsilonValue::accepts): (JSC::B3::UpsilonValue::phi): (JSC::B3::UpsilonValue::UpsilonValue): * b3/B3UseCounts.cpp: Added. (JSC::B3::UseCounts::UseCounts): (JSC::B3::UseCounts::~UseCounts): * b3/B3UseCounts.h: Added. (JSC::B3::UseCounts::operator[]): * b3/B3Validate.cpp: Added. (JSC::B3::validate): * b3/B3Validate.h: Added. * b3/B3Value.cpp: Added. (JSC::B3::Value::~Value): (JSC::B3::Value::replaceWithIdentity): (JSC::B3::Value::replaceWithNop): (JSC::B3::Value::dump): (JSC::B3::Value::deepDump): (JSC::B3::Value::negConstant): (JSC::B3::Value::addConstant): (JSC::B3::Value::subConstant): (JSC::B3::Value::effects): (JSC::B3::Value::performSubstitution): (JSC::B3::Value::dumpMeta): (JSC::B3::Value::typeFor): * b3/B3Value.h: Added. (JSC::B3::DeepValueDump::DeepValueDump): (JSC::B3::DeepValueDump::dump): (JSC::B3::deepDump): * b3/B3ValueInlines.h: Added. (JSC::B3::Value::as): (JSC::B3::Value::isConstant): (JSC::B3::Value::hasInt32): (JSC::B3::Value::asInt32): (JSC::B3::Value::hasInt64): (JSC::B3::Value::asInt64): (JSC::B3::Value::hasInt): (JSC::B3::Value::asInt): (JSC::B3::Value::isInt): (JSC::B3::Value::hasIntPtr): (JSC::B3::Value::asIntPtr): (JSC::B3::Value::hasDouble): (JSC::B3::Value::asDouble): (JSC::B3::Value::stackmap): * b3/B3ValueRep.cpp: Added. (JSC::B3::ValueRep::dump): (WTF::printInternal): * b3/B3ValueRep.h: Added. (JSC::B3::ValueRep::ValueRep): (JSC::B3::ValueRep::reg): (JSC::B3::ValueRep::stack): (JSC::B3::ValueRep::stackArgument): (JSC::B3::ValueRep::constant): (JSC::B3::ValueRep::constantDouble): (JSC::B3::ValueRep::kind): (JSC::B3::ValueRep::operator bool): (JSC::B3::ValueRep::offsetFromFP): (JSC::B3::ValueRep::offsetFromSP): (JSC::B3::ValueRep::value): (JSC::B3::ValueRep::doubleValue): * b3/air: Added. * b3/air/AirAllocateStack.cpp: Added. (JSC::B3::Air::allocateStack): * b3/air/AirAllocateStack.h: Added. * b3/air/AirArg.cpp: Added. (JSC::B3::Air::Arg::dump): * b3/air/AirArg.h: Added. (JSC::B3::Air::Arg::isUse): (JSC::B3::Air::Arg::isDef): (JSC::B3::Air::Arg::typeForB3Type): (JSC::B3::Air::Arg::Arg): (JSC::B3::Air::Arg::imm): (JSC::B3::Air::Arg::imm64): (JSC::B3::Air::Arg::addr): (JSC::B3::Air::Arg::stack): (JSC::B3::Air::Arg::callArg): (JSC::B3::Air::Arg::isValidScale): (JSC::B3::Air::Arg::logScale): (JSC::B3::Air::Arg::index): (JSC::B3::Air::Arg::relCond): (JSC::B3::Air::Arg::resCond): (JSC::B3::Air::Arg::special): (JSC::B3::Air::Arg::operator==): (JSC::B3::Air::Arg::operator!=): (JSC::B3::Air::Arg::operator bool): (JSC::B3::Air::Arg::kind): (JSC::B3::Air::Arg::isTmp): (JSC::B3::Air::Arg::isImm): (JSC::B3::Air::Arg::isImm64): (JSC::B3::Air::Arg::isAddr): (JSC::B3::Air::Arg::isStack): (JSC::B3::Air::Arg::isCallArg): (JSC::B3::Air::Arg::isIndex): (JSC::B3::Air::Arg::isRelCond): (JSC::B3::Air::Arg::isResCond): (JSC::B3::Air::Arg::isSpecial): (JSC::B3::Air::Arg::isAlive): (JSC::B3::Air::Arg::tmp): (JSC::B3::Air::Arg::value): (JSC::B3::Air::Arg::pointerValue): (JSC::B3::Air::Arg::base): (JSC::B3::Air::Arg::hasOffset): (JSC::B3::Air::Arg::offset): (JSC::B3::Air::Arg::stackSlot): (JSC::B3::Air::Arg::scale): (JSC::B3::Air::Arg::isGPTmp): (JSC::B3::Air::Arg::isFPTmp): (JSC::B3::Air::Arg::isGP): (JSC::B3::Air::Arg::isFP): (JSC::B3::Air::Arg::hasType): (JSC::B3::Air::Arg::type): (JSC::B3::Air::Arg::isType): (JSC::B3::Air::Arg::isGPR): (JSC::B3::Air::Arg::gpr): (JSC::B3::Air::Arg::isFPR): (JSC::B3::Air::Arg::fpr): (JSC::B3::Air::Arg::isReg): (JSC::B3::Air::Arg::reg): (JSC::B3::Air::Arg::gpTmpIndex): (JSC::B3::Air::Arg::fpTmpIndex): (JSC::B3::Air::Arg::tmpIndex): (JSC::B3::Air::Arg::withOffset): (JSC::B3::Air::Arg::forEachTmpFast): (JSC::B3::Air::Arg::forEachTmp): (JSC::B3::Air::Arg::asTrustedImm32): (JSC::B3::Air::Arg::asTrustedImm64): (JSC::B3::Air::Arg::asTrustedImmPtr): (JSC::B3::Air::Arg::asAddress): (JSC::B3::Air::Arg::asBaseIndex): (JSC::B3::Air::Arg::asRelationalCondition): (JSC::B3::Air::Arg::asResultCondition): (JSC::B3::Air::Arg::isHashTableDeletedValue): (JSC::B3::Air::Arg::hash): (JSC::B3::Air::ArgHash::hash): (JSC::B3::Air::ArgHash::equal): * b3/air/AirBasicBlock.cpp: Added. (JSC::B3::Air::BasicBlock::addPredecessor): (JSC::B3::Air::BasicBlock::removePredecessor): (JSC::B3::Air::BasicBlock::replacePredecessor): (JSC::B3::Air::BasicBlock::dump): (JSC::B3::Air::BasicBlock::deepDump): (JSC::B3::Air::BasicBlock::BasicBlock): * b3/air/AirBasicBlock.h: Added. (JSC::B3::Air::BasicBlock::index): (JSC::B3::Air::BasicBlock::size): (JSC::B3::Air::BasicBlock::begin): (JSC::B3::Air::BasicBlock::end): (JSC::B3::Air::BasicBlock::at): (JSC::B3::Air::BasicBlock::last): (JSC::B3::Air::BasicBlock::appendInst): (JSC::B3::Air::BasicBlock::append): (JSC::B3::Air::BasicBlock::numSuccessors): (JSC::B3::Air::BasicBlock::successor): (JSC::B3::Air::BasicBlock::successors): (JSC::B3::Air::BasicBlock::successorBlock): (JSC::B3::Air::BasicBlock::successorBlocks): (JSC::B3::Air::BasicBlock::numPredecessors): (JSC::B3::Air::BasicBlock::predecessor): (JSC::B3::Air::BasicBlock::predecessors): (JSC::B3::Air::DeepBasicBlockDump::DeepBasicBlockDump): (JSC::B3::Air::DeepBasicBlockDump::dump): (JSC::B3::Air::deepDump): * b3/air/AirCCallSpecial.cpp: Added. (JSC::B3::Air::CCallSpecial::CCallSpecial): (JSC::B3::Air::CCallSpecial::~CCallSpecial): (JSC::B3::Air::CCallSpecial::forEachArg): (JSC::B3::Air::CCallSpecial::isValid): (JSC::B3::Air::CCallSpecial::admitsStack): (JSC::B3::Air::CCallSpecial::reportUsedRegisters): (JSC::B3::Air::CCallSpecial::generate): (JSC::B3::Air::CCallSpecial::extraClobberedRegs): (JSC::B3::Air::CCallSpecial::dumpImpl): (JSC::B3::Air::CCallSpecial::deepDumpImpl): * b3/air/AirCCallSpecial.h: Added. * b3/air/AirCode.cpp: Added. (JSC::B3::Air::Code::Code): (JSC::B3::Air::Code::~Code): (JSC::B3::Air::Code::addBlock): (JSC::B3::Air::Code::addStackSlot): (JSC::B3::Air::Code::addSpecial): (JSC::B3::Air::Code::cCallSpecial): (JSC::B3::Air::Code::resetReachability): (JSC::B3::Air::Code::dump): (JSC::B3::Air::Code::findFirstBlockIndex): (JSC::B3::Air::Code::findNextBlockIndex): (JSC::B3::Air::Code::findNextBlock): * b3/air/AirCode.h: Added. (JSC::B3::Air::Code::newTmp): (JSC::B3::Air::Code::numTmps): (JSC::B3::Air::Code::callArgAreaSize): (JSC::B3::Air::Code::requestCallArgAreaSize): (JSC::B3::Air::Code::frameSize): (JSC::B3::Air::Code::setFrameSize): (JSC::B3::Air::Code::calleeSaveRegisters): (JSC::B3::Air::Code::size): (JSC::B3::Air::Code::at): (JSC::B3::Air::Code::operator[]): (JSC::B3::Air::Code::iterator::iterator): (JSC::B3::Air::Code::iterator::operator*): (JSC::B3::Air::Code::iterator::operator++): (JSC::B3::Air::Code::iterator::operator==): (JSC::B3::Air::Code::iterator::operator!=): (JSC::B3::Air::Code::begin): (JSC::B3::Air::Code::end): (JSC::B3::Air::Code::StackSlotsCollection::StackSlotsCollection): (JSC::B3::Air::Code::StackSlotsCollection::size): (JSC::B3::Air::Code::StackSlotsCollection::at): (JSC::B3::Air::Code::StackSlotsCollection::operator[]): (JSC::B3::Air::Code::StackSlotsCollection::iterator::iterator): (JSC::B3::Air::Code::StackSlotsCollection::iterator::operator*): (JSC::B3::Air::Code::StackSlotsCollection::iterator::operator++): (JSC::B3::Air::Code::StackSlotsCollection::iterator::operator==): (JSC::B3::Air::Code::StackSlotsCollection::iterator::operator!=): (JSC::B3::Air::Code::StackSlotsCollection::begin): (JSC::B3::Air::Code::StackSlotsCollection::end): (JSC::B3::Air::Code::stackSlots): (JSC::B3::Air::Code::SpecialsCollection::SpecialsCollection): (JSC::B3::Air::Code::SpecialsCollection::size): (JSC::B3::Air::Code::SpecialsCollection::at): (JSC::B3::Air::Code::SpecialsCollection::operator[]): (JSC::B3::Air::Code::SpecialsCollection::iterator::iterator): (JSC::B3::Air::Code::SpecialsCollection::iterator::operator*): (JSC::B3::Air::Code::SpecialsCollection::iterator::operator++): (JSC::B3::Air::Code::SpecialsCollection::iterator::operator==): (JSC::B3::Air::Code::SpecialsCollection::iterator::operator!=): (JSC::B3::Air::Code::SpecialsCollection::begin): (JSC::B3::Air::Code::SpecialsCollection::end): (JSC::B3::Air::Code::specials): (JSC::B3::Air::Code::setLastPhaseName): (JSC::B3::Air::Code::lastPhaseName): * b3/air/AirFrequentedBlock.h: Added. * b3/air/AirGenerate.cpp: Added. (JSC::B3::Air::generate): * b3/air/AirGenerate.h: Added. * b3/air/AirGenerated.cpp: Added. * b3/air/AirGenerationContext.h: Added. * b3/air/AirHandleCalleeSaves.cpp: Added. (JSC::B3::Air::handleCalleeSaves): * b3/air/AirHandleCalleeSaves.h: Added. * b3/air/AirInsertionSet.cpp: Added. (JSC::B3::Air::InsertionSet::execute): * b3/air/AirInsertionSet.h: Added. (JSC::B3::Air::InsertionSet::InsertionSet): (JSC::B3::Air::InsertionSet::code): (JSC::B3::Air::InsertionSet::appendInsertion): (JSC::B3::Air::InsertionSet::insertInst): (JSC::B3::Air::InsertionSet::insert): * b3/air/AirInst.cpp: Added. (JSC::B3::Air::Inst::dump): * b3/air/AirInst.h: Added. (JSC::B3::Air::Inst::Inst): (JSC::B3::Air::Inst::opcode): (JSC::B3::Air::Inst::forEachTmpFast): (JSC::B3::Air::Inst::forEachTmp): * b3/air/AirInstInlines.h: Added. (JSC::B3::Air::ForEach<Tmp>::forEach): (JSC::B3::Air::ForEach<Arg>::forEach): (JSC::B3::Air::Inst::forEach): (JSC::B3::Air::Inst::hasSpecial): (JSC::B3::Air::Inst::extraClobberedRegs): (JSC::B3::Air::Inst::reportUsedRegisters): (JSC::B3::Air::isShiftValid): (JSC::B3::Air::isLshift32Valid): * b3/air/AirLiveness.h: Added. (JSC::B3::Air::Liveness::Liveness): (JSC::B3::Air::Liveness::liveAtHead): (JSC::B3::Air::Liveness::liveAtTail): (JSC::B3::Air::Liveness::LocalCalc::LocalCalc): (JSC::B3::Air::Liveness::LocalCalc::live): (JSC::B3::Air::Liveness::LocalCalc::takeLive): (JSC::B3::Air::Liveness::LocalCalc::execute): * b3/air/AirOpcode.opcodes: Added. * b3/air/AirPhaseScope.cpp: Added. (JSC::B3::Air::PhaseScope::PhaseScope): (JSC::B3::Air::PhaseScope::~PhaseScope): * b3/air/AirPhaseScope.h: Added. * b3/air/AirRegisterPriority.cpp: Added. (JSC::B3::Air::gprsInPriorityOrder): (JSC::B3::Air::fprsInPriorityOrder): (JSC::B3::Air::regsInPriorityOrder): * b3/air/AirRegisterPriority.h: Added. (JSC::B3::Air::RegistersInPriorityOrder<GPRInfo>::inPriorityOrder): (JSC::B3::Air::RegistersInPriorityOrder<FPRInfo>::inPriorityOrder): (JSC::B3::Air::regsInPriorityOrder): * b3/air/AirSpecial.cpp: Added. (JSC::B3::Air::Special::Special): (JSC::B3::Air::Special::~Special): (JSC::B3::Air::Special::name): (JSC::B3::Air::Special::dump): (JSC::B3::Air::Special::deepDump): * b3/air/AirSpecial.h: Added. (JSC::B3::Air::DeepSpecialDump::DeepSpecialDump): (JSC::B3::Air::DeepSpecialDump::dump): (JSC::B3::Air::deepDump): * b3/air/AirSpillEverything.cpp: Added. (JSC::B3::Air::spillEverything): * b3/air/AirSpillEverything.h: Added. * b3/air/AirStackSlot.cpp: Added. (JSC::B3::Air::StackSlot::setOffsetFromFP): (JSC::B3::Air::StackSlot::dump): (JSC::B3::Air::StackSlot::deepDump): (JSC::B3::Air::StackSlot::StackSlot): * b3/air/AirStackSlot.h: Added. (JSC::B3::Air::StackSlot::byteSize): (JSC::B3::Air::StackSlot::kind): (JSC::B3::Air::StackSlot::index): (JSC::B3::Air::StackSlot::alignment): (JSC::B3::Air::StackSlot::value): (JSC::B3::Air::StackSlot::offsetFromFP): (JSC::B3::Air::DeepStackSlotDump::DeepStackSlotDump): (JSC::B3::Air::DeepStackSlotDump::dump): (JSC::B3::Air::deepDump): * b3/air/AirTmp.cpp: Added. (JSC::B3::Air::Tmp::dump): * b3/air/AirTmp.h: Added. (JSC::B3::Air::Tmp::Tmp): (JSC::B3::Air::Tmp::gpTmpForIndex): (JSC::B3::Air::Tmp::fpTmpForIndex): (JSC::B3::Air::Tmp::operator bool): (JSC::B3::Air::Tmp::isGP): (JSC::B3::Air::Tmp::isFP): (JSC::B3::Air::Tmp::isGPR): (JSC::B3::Air::Tmp::isFPR): (JSC::B3::Air::Tmp::isReg): (JSC::B3::Air::Tmp::gpr): (JSC::B3::Air::Tmp::fpr): (JSC::B3::Air::Tmp::reg): (JSC::B3::Air::Tmp::hasTmpIndex): (JSC::B3::Air::Tmp::gpTmpIndex): (JSC::B3::Air::Tmp::fpTmpIndex): (JSC::B3::Air::Tmp::tmpIndex): (JSC::B3::Air::Tmp::isAlive): (JSC::B3::Air::Tmp::operator==): (JSC::B3::Air::Tmp::operator!=): (JSC::B3::Air::Tmp::isHashTableDeletedValue): (JSC::B3::Air::Tmp::hash): (JSC::B3::Air::Tmp::encodeGP): (JSC::B3::Air::Tmp::encodeFP): (JSC::B3::Air::Tmp::encodeGPR): (JSC::B3::Air::Tmp::encodeFPR): (JSC::B3::Air::Tmp::encodeGPTmp): (JSC::B3::Air::Tmp::encodeFPTmp): (JSC::B3::Air::Tmp::isEncodedGP): (JSC::B3::Air::Tmp::isEncodedFP): (JSC::B3::Air::Tmp::isEncodedGPR): (JSC::B3::Air::Tmp::isEncodedFPR): (JSC::B3::Air::Tmp::isEncodedGPTmp): (JSC::B3::Air::Tmp::isEncodedFPTmp): (JSC::B3::Air::Tmp::decodeGPR): (JSC::B3::Air::Tmp::decodeFPR): (JSC::B3::Air::Tmp::decodeGPTmp): (JSC::B3::Air::Tmp::decodeFPTmp): (JSC::B3::Air::TmpHash::hash): (JSC::B3::Air::TmpHash::equal): * b3/air/AirTmpInlines.h: Added. (JSC::B3::Air::Tmp::Tmp): * b3/air/AirValidate.cpp: Added. (JSC::B3::Air::validate): * b3/air/AirValidate.h: Added. * b3/air/opcode_generator.rb: Added. * b3/generate_pattern_matcher.rb: Added. * b3/testb3.cpp: Added. (JSC::B3::compileAndRun): (JSC::B3::test42): (JSC::B3::testLoad42): (JSC::B3::testArg): (JSC::B3::testAddArgs): (JSC::B3::testAddArgs32): (JSC::B3::testStore): (JSC::B3::testTrunc): (JSC::B3::testAdd1): (JSC::B3::testStoreAddLoad): (JSC::B3::testStoreAddAndLoad): (JSC::B3::testAdd1Uncommuted): (JSC::B3::testLoadOffset): (JSC::B3::testLoadOffsetNotConstant): (JSC::B3::testLoadOffsetUsingAdd): (JSC::B3::testLoadOffsetUsingAddNotConstant): (JSC::B3::run): (run): (main): * bytecode/CodeBlock.h: (JSC::CodeBlock::specializationKind): * jit/Reg.h: (JSC::Reg::index): (JSC::Reg::isSet): (JSC::Reg::operator bool): (JSC::Reg::isHashTableDeletedValue): (JSC::Reg::AllRegsIterable::iterator::iterator): (JSC::Reg::AllRegsIterable::iterator::operator*): (JSC::Reg::AllRegsIterable::iterator::operator++): (JSC::Reg::AllRegsIterable::iterator::operator==): (JSC::Reg::AllRegsIterable::iterator::operator!=): (JSC::Reg::AllRegsIterable::begin): (JSC::Reg::AllRegsIterable::end): (JSC::Reg::all): (JSC::Reg::invalid): (JSC::Reg::operator!): Deleted. * jit/RegisterAtOffsetList.cpp: (JSC::RegisterAtOffsetList::RegisterAtOffsetList): * jit/RegisterAtOffsetList.h: (JSC::RegisterAtOffsetList::clear): (JSC::RegisterAtOffsetList::size): (JSC::RegisterAtOffsetList::begin): (JSC::RegisterAtOffsetList::end): * jit/RegisterSet.h: (JSC::RegisterSet::operator==): (JSC::RegisterSet::hash): (JSC::RegisterSet::forEach): (JSC::RegisterSet::setAny): Source/WTF: * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/HashSet.h: (WTF::copyToVector): (WTF::=): * wtf/ListDump.h: (WTF::PointerListDump::PointerListDump): (WTF::PointerListDump::dump): (WTF::MapDump::MapDump): (WTF::listDump): (WTF::pointerListDump): (WTF::sortedListDump): * wtf/MathExtras.h: (WTF::leftShiftWithSaturation): (WTF::rangesOverlap): * wtf/Platform.h: * wtf/ScopedLambda.h: Added. (WTF::scopedLambda): * wtf/SharedTask.h: (WTF::createSharedTask): Canonical link: https://commits.webkit.org/168813@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@191705 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-10-28 23:57:04 +00:00
* Copyright (C) 2013, 2015 Apple Inc. All rights reserved.
fourthTier: DFG should have an SSA form for use by FTL https://bugs.webkit.org/show_bug.cgi?id=118338 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. Adds an SSA form to the DFG. We can convert ThreadedCPS form into SSA form after breaking critical edges. The conversion algorithm follows Aycock and Horspool, and the SSA form itself follows something I've done before, where instead of having Phi functions specify input nodes corresponding to block predecessors, we instead have Upsilon functions in the predecessors that specify which value in that block goes into which subsequent Phi. Upsilons don't have to dominate Phis (usually they don't) and they correspond to a non-SSA "mov" into the Phi's "variable". This gives all of the good properties of SSA, while ensuring that a bunch of CFG transformations don't have to be SSA-aware. So far the only DFG phases that are SSA-aware are DCE and CFA. CFG simplification is probably SSA-aware by default, though I haven't tried it. Constant folding probably needs a few tweaks, but is likely ready. Ditto for CSE, though it's not clear that we'd want to use block-local CSE when we could be doing GVN. Currently only the FTL can generate code from the SSA form, and there is no way to convert from SSA to ThreadedCPS or LoadStore. There probably will never be such a capability. In order to handle OSR exit state in the SSA, we place MovHints at Phi points. Other than that, you can reconstruct state-at-exit by forward propagating MovHints. Note that MovHint is the new SetLocal in SSA. SetLocal and GetLocal only survive into SSA if they are on captured variables, or in the case of flushes. A "live SetLocal" will be NodeMustGenerate and will always correspond to a flush. Computing the state-at-exit requires running SSA liveness analysis, OSR availability analysis, and flush liveness analysis. The FTL runs all of these prior to generating code. While OSR exit continues to be tricky, much of the logic is now factored into separate phases and the backend has to do less work to reason about what happened outside of the basic block that is being lowered. Conversion from DFG SSA to LLVM SSA is done by ensuring that we generate code in depth-first order, thus guaranteeing that a node will always be lowered (and hence have a LValue) before any of the blocks dominated by that node's block have code generated. For Upsilon/Phi, we just use alloca's. We could do something more clever there, but it's probably not worth it, at least not now. Finally, while the SSA form is currently only being converted to LLVM IR, there is nothing that prevents us from considering other backends in the future - with the caveat that this form is designed to be first lowered to a lower-level SSA before actual machine code generation commences. So we ought to either use LLVM (the intended path) or we will have to write our own SSA low-level backend. This runs all of the code that the FTL was known to run previously. No change in performance for now. But it does open some exciting possibilities! * JavaScriptCore.xcodeproj/project.pbxproj: * bytecode/Operands.h: (JSC::OperandValueTraits::dump): (JSC::Operands::fill): (Operands): (JSC::Operands::clear): (JSC::Operands::operator==): * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::beginBasicBlock): (JSC::DFG::setLiveValues): (DFG): (JSC::DFG::AbstractState::initialize): (JSC::DFG::AbstractState::endBasicBlock): (JSC::DFG::AbstractState::executeEffects): (JSC::DFG::AbstractState::mergeStateAtTail): (JSC::DFG::AbstractState::merge): * dfg/DFGAbstractState.h: (AbstractState): * dfg/DFGAdjacencyList.h: (JSC::DFG::AdjacencyList::justOneChild): (AdjacencyList): * dfg/DFGBasicBlock.cpp: Added. (DFG): (JSC::DFG::BasicBlock::BasicBlock): (JSC::DFG::BasicBlock::~BasicBlock): (JSC::DFG::BasicBlock::ensureLocals): (JSC::DFG::BasicBlock::isInPhis): (JSC::DFG::BasicBlock::isInBlock): (JSC::DFG::BasicBlock::removePredecessor): (JSC::DFG::BasicBlock::replacePredecessor): (JSC::DFG::BasicBlock::dump): (JSC::DFG::BasicBlock::SSAData::SSAData): (JSC::DFG::BasicBlock::SSAData::~SSAData): * dfg/DFGBasicBlock.h: (BasicBlock): (JSC::DFG::BasicBlock::operator[]): (JSC::DFG::BasicBlock::successor): (JSC::DFG::BasicBlock::successorForCondition): (SSAData): * dfg/DFGBasicBlockInlines.h: (DFG): * dfg/DFGBlockInsertionSet.cpp: Added. (DFG): (JSC::DFG::BlockInsertionSet::BlockInsertionSet): (JSC::DFG::BlockInsertionSet::~BlockInsertionSet): (JSC::DFG::BlockInsertionSet::insert): (JSC::DFG::BlockInsertionSet::insertBefore): (JSC::DFG::BlockInsertionSet::execute): * dfg/DFGBlockInsertionSet.h: Added. (DFG): (BlockInsertionSet): * dfg/DFGCFAPhase.cpp: (JSC::DFG::CFAPhase::run): * dfg/DFGCFGSimplificationPhase.cpp: * dfg/DFGCPSRethreadingPhase.cpp: (JSC::DFG::CPSRethreadingPhase::canonicalizeLocalsInBlock): * dfg/DFGCommon.cpp: (WTF::printInternal): * dfg/DFGCommon.h: (JSC::DFG::doesKill): (DFG): (JSC::DFG::killStatusForDoesKill): * dfg/DFGConstantFoldingPhase.cpp: (JSC::DFG::ConstantFoldingPhase::foldConstants): (JSC::DFG::ConstantFoldingPhase::isCapturedAtOrAfter): * dfg/DFGCriticalEdgeBreakingPhase.cpp: Added. (DFG): (CriticalEdgeBreakingPhase): (JSC::DFG::CriticalEdgeBreakingPhase::CriticalEdgeBreakingPhase): (JSC::DFG::CriticalEdgeBreakingPhase::run): (JSC::DFG::CriticalEdgeBreakingPhase::breakCriticalEdge): (JSC::DFG::performCriticalEdgeBreaking): * dfg/DFGCriticalEdgeBreakingPhase.h: Added. (DFG): * dfg/DFGDCEPhase.cpp: (JSC::DFG::DCEPhase::run): (JSC::DFG::DCEPhase::findTypeCheckRoot): (JSC::DFG::DCEPhase::countNode): (DCEPhase): (JSC::DFG::DCEPhase::countEdge): (JSC::DFG::DCEPhase::eliminateIrrelevantPhantomChildren): * dfg/DFGDriver.cpp: (JSC::DFG::compile): * dfg/DFGEdge.cpp: (JSC::DFG::Edge::dump): * dfg/DFGEdge.h: (JSC::DFG::Edge::Edge): (JSC::DFG::Edge::setNode): (JSC::DFG::Edge::useKindUnchecked): (JSC::DFG::Edge::setUseKind): (JSC::DFG::Edge::setProofStatus): (JSC::DFG::Edge::willNotHaveCheck): (JSC::DFG::Edge::willHaveCheck): (Edge): (JSC::DFG::Edge::killStatusUnchecked): (JSC::DFG::Edge::killStatus): (JSC::DFG::Edge::setKillStatus): (JSC::DFG::Edge::doesKill): (JSC::DFG::Edge::doesNotKill): (JSC::DFG::Edge::shift): (JSC::DFG::Edge::makeWord): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGFlushFormat.cpp: Added. (WTF): (WTF::printInternal): * dfg/DFGFlushFormat.h: Added. (DFG): (JSC::DFG::resultFor): (JSC::DFG::useKindFor): (WTF): * dfg/DFGFlushLivenessAnalysisPhase.cpp: Added. (DFG): (FlushLivenessAnalysisPhase): (JSC::DFG::FlushLivenessAnalysisPhase::FlushLivenessAnalysisPhase): (JSC::DFG::FlushLivenessAnalysisPhase::run): (JSC::DFG::FlushLivenessAnalysisPhase::process): (JSC::DFG::FlushLivenessAnalysisPhase::setForNode): (JSC::DFG::FlushLivenessAnalysisPhase::flushFormat): (JSC::DFG::performFlushLivenessAnalysis): * dfg/DFGFlushLivenessAnalysisPhase.h: Added. (DFG): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::dump): (JSC::DFG::Graph::dumpBlockHeader): (DFG): (JSC::DFG::Graph::addForDepthFirstSort): (JSC::DFG::Graph::getBlocksInDepthFirstOrder): * dfg/DFGGraph.h: (JSC::DFG::Graph::convertToConstant): (JSC::DFG::Graph::valueProfileFor): (Graph): * dfg/DFGInsertionSet.h: (DFG): (JSC::DFG::InsertionSet::execute): * dfg/DFGLivenessAnalysisPhase.cpp: Added. (DFG): (LivenessAnalysisPhase): (JSC::DFG::LivenessAnalysisPhase::LivenessAnalysisPhase): (JSC::DFG::LivenessAnalysisPhase::run): (JSC::DFG::LivenessAnalysisPhase::process): (JSC::DFG::LivenessAnalysisPhase::addChildUse): (JSC::DFG::performLivenessAnalysis): * dfg/DFGLivenessAnalysisPhase.h: Added. (DFG): * dfg/DFGNode.cpp: (JSC::DFG::Node::hasVariableAccessData): (DFG): * dfg/DFGNode.h: (DFG): (Node): (JSC::DFG::Node::hasLocal): (JSC::DFG::Node::variableAccessData): (JSC::DFG::Node::hasPhi): (JSC::DFG::Node::phi): (JSC::DFG::Node::takenBlock): (JSC::DFG::Node::notTakenBlock): (JSC::DFG::Node::successor): (JSC::DFG::Node::successorForCondition): (JSC::DFG::nodeComparator): (JSC::DFG::nodeListDump): (JSC::DFG::nodeMapDump): * dfg/DFGNodeFlags.cpp: (JSC::DFG::dumpNodeFlags): * dfg/DFGNodeType.h: (DFG): * dfg/DFGOSRAvailabilityAnalysisPhase.cpp: Added. (DFG): (OSRAvailabilityAnalysisPhase): (JSC::DFG::OSRAvailabilityAnalysisPhase::OSRAvailabilityAnalysisPhase): (JSC::DFG::OSRAvailabilityAnalysisPhase::run): (JSC::DFG::performOSRAvailabilityAnalysis): * dfg/DFGOSRAvailabilityAnalysisPhase.h: Added. (DFG): * dfg/DFGPlan.cpp: (JSC::DFG::Plan::compileInThreadImpl): * dfg/DFGPredictionInjectionPhase.cpp: (JSC::DFG::PredictionInjectionPhase::run): * dfg/DFGPredictionPropagationPhase.cpp: (JSC::DFG::PredictionPropagationPhase::propagate): * dfg/DFGSSAConversionPhase.cpp: Added. (DFG): (SSAConversionPhase): (JSC::DFG::SSAConversionPhase::SSAConversionPhase): (JSC::DFG::SSAConversionPhase::run): (JSC::DFG::SSAConversionPhase::forwardPhiChildren): (JSC::DFG::SSAConversionPhase::forwardPhi): (JSC::DFG::SSAConversionPhase::forwardPhiEdge): (JSC::DFG::SSAConversionPhase::deduplicateChildren): (JSC::DFG::SSAConversionPhase::addFlushedLocalOp): (JSC::DFG::SSAConversionPhase::addFlushedLocalEdge): (JSC::DFG::performSSAConversion): * dfg/DFGSSAConversionPhase.h: Added. (DFG): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGValidate.cpp: (JSC::DFG::Validate::validate): (Validate): (JSC::DFG::Validate::validateCPS): * dfg/DFGVariableAccessData.h: (JSC::DFG::VariableAccessData::flushFormat): (VariableAccessData): * ftl/FTLCapabilities.cpp: (JSC::FTL::canCompile): * ftl/FTLLowerDFGToLLVM.cpp: (JSC::FTL::LowerDFGToLLVM::LowerDFGToLLVM): (JSC::FTL::LowerDFGToLLVM::lower): (JSC::FTL::LowerDFGToLLVM::createPhiVariables): (JSC::FTL::LowerDFGToLLVM::compileBlock): (JSC::FTL::LowerDFGToLLVM::compileNode): (JSC::FTL::LowerDFGToLLVM::compileUpsilon): (LowerDFGToLLVM): (JSC::FTL::LowerDFGToLLVM::compilePhi): (JSC::FTL::LowerDFGToLLVM::compileJSConstant): (JSC::FTL::LowerDFGToLLVM::compileWeakJSConstant): (JSC::FTL::LowerDFGToLLVM::compileGetArgument): (JSC::FTL::LowerDFGToLLVM::compileGetLocal): (JSC::FTL::LowerDFGToLLVM::compileSetLocal): (JSC::FTL::LowerDFGToLLVM::compileAdd): (JSC::FTL::LowerDFGToLLVM::compileArithSub): (JSC::FTL::LowerDFGToLLVM::compileArithMul): (JSC::FTL::LowerDFGToLLVM::compileArithDiv): (JSC::FTL::LowerDFGToLLVM::compileArithMod): (JSC::FTL::LowerDFGToLLVM::compileArithMinOrMax): (JSC::FTL::LowerDFGToLLVM::compileArithAbs): (JSC::FTL::LowerDFGToLLVM::compileArithNegate): (JSC::FTL::LowerDFGToLLVM::compileBitAnd): (JSC::FTL::LowerDFGToLLVM::compileBitOr): (JSC::FTL::LowerDFGToLLVM::compileBitXor): (JSC::FTL::LowerDFGToLLVM::compileBitRShift): (JSC::FTL::LowerDFGToLLVM::compileBitLShift): (JSC::FTL::LowerDFGToLLVM::compileBitURShift): (JSC::FTL::LowerDFGToLLVM::compileUInt32ToNumber): (JSC::FTL::LowerDFGToLLVM::compileInt32ToDouble): (JSC::FTL::LowerDFGToLLVM::compileGetButterfly): (JSC::FTL::LowerDFGToLLVM::compileGetArrayLength): (JSC::FTL::LowerDFGToLLVM::compileGetByVal): (JSC::FTL::LowerDFGToLLVM::compileGetByOffset): (JSC::FTL::LowerDFGToLLVM::compileGetGlobalVar): (JSC::FTL::LowerDFGToLLVM::compileCompareEqConstant): (JSC::FTL::LowerDFGToLLVM::compileCompareStrictEq): (JSC::FTL::LowerDFGToLLVM::compileCompareStrictEqConstant): (JSC::FTL::LowerDFGToLLVM::compileCompareLess): (JSC::FTL::LowerDFGToLLVM::compileCompareLessEq): (JSC::FTL::LowerDFGToLLVM::compileCompareGreater): (JSC::FTL::LowerDFGToLLVM::compileCompareGreaterEq): (JSC::FTL::LowerDFGToLLVM::compileLogicalNot): (JSC::FTL::LowerDFGToLLVM::speculateBackward): (JSC::FTL::LowerDFGToLLVM::lowInt32): (JSC::FTL::LowerDFGToLLVM::lowCell): (JSC::FTL::LowerDFGToLLVM::lowBoolean): (JSC::FTL::LowerDFGToLLVM::lowDouble): (JSC::FTL::LowerDFGToLLVM::lowJSValue): (JSC::FTL::LowerDFGToLLVM::lowStorage): (JSC::FTL::LowerDFGToLLVM::speculate): (JSC::FTL::LowerDFGToLLVM::speculateBoolean): (JSC::FTL::LowerDFGToLLVM::isLive): (JSC::FTL::LowerDFGToLLVM::use): (JSC::FTL::LowerDFGToLLVM::initializeOSRExitStateForBlock): (JSC::FTL::LowerDFGToLLVM::appendOSRExit): (JSC::FTL::LowerDFGToLLVM::emitOSRExitCall): (JSC::FTL::LowerDFGToLLVM::addExitArgumentForNode): (JSC::FTL::LowerDFGToLLVM::linkOSRExitsAndCompleteInitializationBlocks): (JSC::FTL::LowerDFGToLLVM::setInt32): (JSC::FTL::LowerDFGToLLVM::setJSValue): (JSC::FTL::LowerDFGToLLVM::setBoolean): (JSC::FTL::LowerDFGToLLVM::setStorage): (JSC::FTL::LowerDFGToLLVM::setDouble): (JSC::FTL::LowerDFGToLLVM::isValid): * ftl/FTLLoweredNodeValue.h: Added. (FTL): (LoweredNodeValue): (JSC::FTL::LoweredNodeValue::LoweredNodeValue): (JSC::FTL::LoweredNodeValue::isSet): (JSC::FTL::LoweredNodeValue::operator!): (JSC::FTL::LoweredNodeValue::value): (JSC::FTL::LoweredNodeValue::block): * ftl/FTLValueFromBlock.h: (JSC::FTL::ValueFromBlock::ValueFromBlock): (ValueFromBlock): * ftl/FTLValueSource.cpp: (JSC::FTL::ValueSource::dump): * ftl/FTLValueSource.h: Source/WTF: Reviewed by Mark Hahnenberg. - Extend variadicity of PrintStream and dataLog. - Give HashSet the ability to add a span of things. - Give HashSet the ability to == another HashSet. - Note FIXME's in HashTable concerning copying performance, that affects the way that the DFG now uses HashSets and HashMaps. - Factor out the bulk-insertion logic of JSC::DFG::InsertionSet into WTF::Insertion, so that it can be used in more places. - Create a dumper for lists and maps. * WTF.xcodeproj/project.pbxproj: * wtf/DataLog.h: (WTF): (WTF::dataLog): * wtf/HashSet.h: (HashSet): (WTF): (WTF::::add): (WTF::=): * wtf/HashTable.h: (WTF::::HashTable): (WTF::=): * wtf/Insertion.h: Added. (WTF): (Insertion): (WTF::Insertion::Insertion): (WTF::Insertion::index): (WTF::Insertion::element): (WTF::Insertion::operator<): (WTF::executeInsertions): * wtf/ListDump.h: Added. (WTF): (ListDump): (WTF::ListDump::ListDump): (WTF::ListDump::dump): (MapDump): (WTF::MapDump::MapDump): (WTF::MapDump::dump): (WTF::listDump): (WTF::sortedListDump): (WTF::lessThan): (WTF::mapDump): (WTF::sortedMapDump): * wtf/PrintStream.h: (PrintStream): (WTF::PrintStream::print): Conflicts: Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj Canonical link: https://commits.webkit.org/137058@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153274 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:04:45 +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
fourthTier: DFG should have an SSA form for use by FTL https://bugs.webkit.org/show_bug.cgi?id=118338 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. Adds an SSA form to the DFG. We can convert ThreadedCPS form into SSA form after breaking critical edges. The conversion algorithm follows Aycock and Horspool, and the SSA form itself follows something I've done before, where instead of having Phi functions specify input nodes corresponding to block predecessors, we instead have Upsilon functions in the predecessors that specify which value in that block goes into which subsequent Phi. Upsilons don't have to dominate Phis (usually they don't) and they correspond to a non-SSA "mov" into the Phi's "variable". This gives all of the good properties of SSA, while ensuring that a bunch of CFG transformations don't have to be SSA-aware. So far the only DFG phases that are SSA-aware are DCE and CFA. CFG simplification is probably SSA-aware by default, though I haven't tried it. Constant folding probably needs a few tweaks, but is likely ready. Ditto for CSE, though it's not clear that we'd want to use block-local CSE when we could be doing GVN. Currently only the FTL can generate code from the SSA form, and there is no way to convert from SSA to ThreadedCPS or LoadStore. There probably will never be such a capability. In order to handle OSR exit state in the SSA, we place MovHints at Phi points. Other than that, you can reconstruct state-at-exit by forward propagating MovHints. Note that MovHint is the new SetLocal in SSA. SetLocal and GetLocal only survive into SSA if they are on captured variables, or in the case of flushes. A "live SetLocal" will be NodeMustGenerate and will always correspond to a flush. Computing the state-at-exit requires running SSA liveness analysis, OSR availability analysis, and flush liveness analysis. The FTL runs all of these prior to generating code. While OSR exit continues to be tricky, much of the logic is now factored into separate phases and the backend has to do less work to reason about what happened outside of the basic block that is being lowered. Conversion from DFG SSA to LLVM SSA is done by ensuring that we generate code in depth-first order, thus guaranteeing that a node will always be lowered (and hence have a LValue) before any of the blocks dominated by that node's block have code generated. For Upsilon/Phi, we just use alloca's. We could do something more clever there, but it's probably not worth it, at least not now. Finally, while the SSA form is currently only being converted to LLVM IR, there is nothing that prevents us from considering other backends in the future - with the caveat that this form is designed to be first lowered to a lower-level SSA before actual machine code generation commences. So we ought to either use LLVM (the intended path) or we will have to write our own SSA low-level backend. This runs all of the code that the FTL was known to run previously. No change in performance for now. But it does open some exciting possibilities! * JavaScriptCore.xcodeproj/project.pbxproj: * bytecode/Operands.h: (JSC::OperandValueTraits::dump): (JSC::Operands::fill): (Operands): (JSC::Operands::clear): (JSC::Operands::operator==): * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::beginBasicBlock): (JSC::DFG::setLiveValues): (DFG): (JSC::DFG::AbstractState::initialize): (JSC::DFG::AbstractState::endBasicBlock): (JSC::DFG::AbstractState::executeEffects): (JSC::DFG::AbstractState::mergeStateAtTail): (JSC::DFG::AbstractState::merge): * dfg/DFGAbstractState.h: (AbstractState): * dfg/DFGAdjacencyList.h: (JSC::DFG::AdjacencyList::justOneChild): (AdjacencyList): * dfg/DFGBasicBlock.cpp: Added. (DFG): (JSC::DFG::BasicBlock::BasicBlock): (JSC::DFG::BasicBlock::~BasicBlock): (JSC::DFG::BasicBlock::ensureLocals): (JSC::DFG::BasicBlock::isInPhis): (JSC::DFG::BasicBlock::isInBlock): (JSC::DFG::BasicBlock::removePredecessor): (JSC::DFG::BasicBlock::replacePredecessor): (JSC::DFG::BasicBlock::dump): (JSC::DFG::BasicBlock::SSAData::SSAData): (JSC::DFG::BasicBlock::SSAData::~SSAData): * dfg/DFGBasicBlock.h: (BasicBlock): (JSC::DFG::BasicBlock::operator[]): (JSC::DFG::BasicBlock::successor): (JSC::DFG::BasicBlock::successorForCondition): (SSAData): * dfg/DFGBasicBlockInlines.h: (DFG): * dfg/DFGBlockInsertionSet.cpp: Added. (DFG): (JSC::DFG::BlockInsertionSet::BlockInsertionSet): (JSC::DFG::BlockInsertionSet::~BlockInsertionSet): (JSC::DFG::BlockInsertionSet::insert): (JSC::DFG::BlockInsertionSet::insertBefore): (JSC::DFG::BlockInsertionSet::execute): * dfg/DFGBlockInsertionSet.h: Added. (DFG): (BlockInsertionSet): * dfg/DFGCFAPhase.cpp: (JSC::DFG::CFAPhase::run): * dfg/DFGCFGSimplificationPhase.cpp: * dfg/DFGCPSRethreadingPhase.cpp: (JSC::DFG::CPSRethreadingPhase::canonicalizeLocalsInBlock): * dfg/DFGCommon.cpp: (WTF::printInternal): * dfg/DFGCommon.h: (JSC::DFG::doesKill): (DFG): (JSC::DFG::killStatusForDoesKill): * dfg/DFGConstantFoldingPhase.cpp: (JSC::DFG::ConstantFoldingPhase::foldConstants): (JSC::DFG::ConstantFoldingPhase::isCapturedAtOrAfter): * dfg/DFGCriticalEdgeBreakingPhase.cpp: Added. (DFG): (CriticalEdgeBreakingPhase): (JSC::DFG::CriticalEdgeBreakingPhase::CriticalEdgeBreakingPhase): (JSC::DFG::CriticalEdgeBreakingPhase::run): (JSC::DFG::CriticalEdgeBreakingPhase::breakCriticalEdge): (JSC::DFG::performCriticalEdgeBreaking): * dfg/DFGCriticalEdgeBreakingPhase.h: Added. (DFG): * dfg/DFGDCEPhase.cpp: (JSC::DFG::DCEPhase::run): (JSC::DFG::DCEPhase::findTypeCheckRoot): (JSC::DFG::DCEPhase::countNode): (DCEPhase): (JSC::DFG::DCEPhase::countEdge): (JSC::DFG::DCEPhase::eliminateIrrelevantPhantomChildren): * dfg/DFGDriver.cpp: (JSC::DFG::compile): * dfg/DFGEdge.cpp: (JSC::DFG::Edge::dump): * dfg/DFGEdge.h: (JSC::DFG::Edge::Edge): (JSC::DFG::Edge::setNode): (JSC::DFG::Edge::useKindUnchecked): (JSC::DFG::Edge::setUseKind): (JSC::DFG::Edge::setProofStatus): (JSC::DFG::Edge::willNotHaveCheck): (JSC::DFG::Edge::willHaveCheck): (Edge): (JSC::DFG::Edge::killStatusUnchecked): (JSC::DFG::Edge::killStatus): (JSC::DFG::Edge::setKillStatus): (JSC::DFG::Edge::doesKill): (JSC::DFG::Edge::doesNotKill): (JSC::DFG::Edge::shift): (JSC::DFG::Edge::makeWord): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGFlushFormat.cpp: Added. (WTF): (WTF::printInternal): * dfg/DFGFlushFormat.h: Added. (DFG): (JSC::DFG::resultFor): (JSC::DFG::useKindFor): (WTF): * dfg/DFGFlushLivenessAnalysisPhase.cpp: Added. (DFG): (FlushLivenessAnalysisPhase): (JSC::DFG::FlushLivenessAnalysisPhase::FlushLivenessAnalysisPhase): (JSC::DFG::FlushLivenessAnalysisPhase::run): (JSC::DFG::FlushLivenessAnalysisPhase::process): (JSC::DFG::FlushLivenessAnalysisPhase::setForNode): (JSC::DFG::FlushLivenessAnalysisPhase::flushFormat): (JSC::DFG::performFlushLivenessAnalysis): * dfg/DFGFlushLivenessAnalysisPhase.h: Added. (DFG): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::dump): (JSC::DFG::Graph::dumpBlockHeader): (DFG): (JSC::DFG::Graph::addForDepthFirstSort): (JSC::DFG::Graph::getBlocksInDepthFirstOrder): * dfg/DFGGraph.h: (JSC::DFG::Graph::convertToConstant): (JSC::DFG::Graph::valueProfileFor): (Graph): * dfg/DFGInsertionSet.h: (DFG): (JSC::DFG::InsertionSet::execute): * dfg/DFGLivenessAnalysisPhase.cpp: Added. (DFG): (LivenessAnalysisPhase): (JSC::DFG::LivenessAnalysisPhase::LivenessAnalysisPhase): (JSC::DFG::LivenessAnalysisPhase::run): (JSC::DFG::LivenessAnalysisPhase::process): (JSC::DFG::LivenessAnalysisPhase::addChildUse): (JSC::DFG::performLivenessAnalysis): * dfg/DFGLivenessAnalysisPhase.h: Added. (DFG): * dfg/DFGNode.cpp: (JSC::DFG::Node::hasVariableAccessData): (DFG): * dfg/DFGNode.h: (DFG): (Node): (JSC::DFG::Node::hasLocal): (JSC::DFG::Node::variableAccessData): (JSC::DFG::Node::hasPhi): (JSC::DFG::Node::phi): (JSC::DFG::Node::takenBlock): (JSC::DFG::Node::notTakenBlock): (JSC::DFG::Node::successor): (JSC::DFG::Node::successorForCondition): (JSC::DFG::nodeComparator): (JSC::DFG::nodeListDump): (JSC::DFG::nodeMapDump): * dfg/DFGNodeFlags.cpp: (JSC::DFG::dumpNodeFlags): * dfg/DFGNodeType.h: (DFG): * dfg/DFGOSRAvailabilityAnalysisPhase.cpp: Added. (DFG): (OSRAvailabilityAnalysisPhase): (JSC::DFG::OSRAvailabilityAnalysisPhase::OSRAvailabilityAnalysisPhase): (JSC::DFG::OSRAvailabilityAnalysisPhase::run): (JSC::DFG::performOSRAvailabilityAnalysis): * dfg/DFGOSRAvailabilityAnalysisPhase.h: Added. (DFG): * dfg/DFGPlan.cpp: (JSC::DFG::Plan::compileInThreadImpl): * dfg/DFGPredictionInjectionPhase.cpp: (JSC::DFG::PredictionInjectionPhase::run): * dfg/DFGPredictionPropagationPhase.cpp: (JSC::DFG::PredictionPropagationPhase::propagate): * dfg/DFGSSAConversionPhase.cpp: Added. (DFG): (SSAConversionPhase): (JSC::DFG::SSAConversionPhase::SSAConversionPhase): (JSC::DFG::SSAConversionPhase::run): (JSC::DFG::SSAConversionPhase::forwardPhiChildren): (JSC::DFG::SSAConversionPhase::forwardPhi): (JSC::DFG::SSAConversionPhase::forwardPhiEdge): (JSC::DFG::SSAConversionPhase::deduplicateChildren): (JSC::DFG::SSAConversionPhase::addFlushedLocalOp): (JSC::DFG::SSAConversionPhase::addFlushedLocalEdge): (JSC::DFG::performSSAConversion): * dfg/DFGSSAConversionPhase.h: Added. (DFG): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGValidate.cpp: (JSC::DFG::Validate::validate): (Validate): (JSC::DFG::Validate::validateCPS): * dfg/DFGVariableAccessData.h: (JSC::DFG::VariableAccessData::flushFormat): (VariableAccessData): * ftl/FTLCapabilities.cpp: (JSC::FTL::canCompile): * ftl/FTLLowerDFGToLLVM.cpp: (JSC::FTL::LowerDFGToLLVM::LowerDFGToLLVM): (JSC::FTL::LowerDFGToLLVM::lower): (JSC::FTL::LowerDFGToLLVM::createPhiVariables): (JSC::FTL::LowerDFGToLLVM::compileBlock): (JSC::FTL::LowerDFGToLLVM::compileNode): (JSC::FTL::LowerDFGToLLVM::compileUpsilon): (LowerDFGToLLVM): (JSC::FTL::LowerDFGToLLVM::compilePhi): (JSC::FTL::LowerDFGToLLVM::compileJSConstant): (JSC::FTL::LowerDFGToLLVM::compileWeakJSConstant): (JSC::FTL::LowerDFGToLLVM::compileGetArgument): (JSC::FTL::LowerDFGToLLVM::compileGetLocal): (JSC::FTL::LowerDFGToLLVM::compileSetLocal): (JSC::FTL::LowerDFGToLLVM::compileAdd): (JSC::FTL::LowerDFGToLLVM::compileArithSub): (JSC::FTL::LowerDFGToLLVM::compileArithMul): (JSC::FTL::LowerDFGToLLVM::compileArithDiv): (JSC::FTL::LowerDFGToLLVM::compileArithMod): (JSC::FTL::LowerDFGToLLVM::compileArithMinOrMax): (JSC::FTL::LowerDFGToLLVM::compileArithAbs): (JSC::FTL::LowerDFGToLLVM::compileArithNegate): (JSC::FTL::LowerDFGToLLVM::compileBitAnd): (JSC::FTL::LowerDFGToLLVM::compileBitOr): (JSC::FTL::LowerDFGToLLVM::compileBitXor): (JSC::FTL::LowerDFGToLLVM::compileBitRShift): (JSC::FTL::LowerDFGToLLVM::compileBitLShift): (JSC::FTL::LowerDFGToLLVM::compileBitURShift): (JSC::FTL::LowerDFGToLLVM::compileUInt32ToNumber): (JSC::FTL::LowerDFGToLLVM::compileInt32ToDouble): (JSC::FTL::LowerDFGToLLVM::compileGetButterfly): (JSC::FTL::LowerDFGToLLVM::compileGetArrayLength): (JSC::FTL::LowerDFGToLLVM::compileGetByVal): (JSC::FTL::LowerDFGToLLVM::compileGetByOffset): (JSC::FTL::LowerDFGToLLVM::compileGetGlobalVar): (JSC::FTL::LowerDFGToLLVM::compileCompareEqConstant): (JSC::FTL::LowerDFGToLLVM::compileCompareStrictEq): (JSC::FTL::LowerDFGToLLVM::compileCompareStrictEqConstant): (JSC::FTL::LowerDFGToLLVM::compileCompareLess): (JSC::FTL::LowerDFGToLLVM::compileCompareLessEq): (JSC::FTL::LowerDFGToLLVM::compileCompareGreater): (JSC::FTL::LowerDFGToLLVM::compileCompareGreaterEq): (JSC::FTL::LowerDFGToLLVM::compileLogicalNot): (JSC::FTL::LowerDFGToLLVM::speculateBackward): (JSC::FTL::LowerDFGToLLVM::lowInt32): (JSC::FTL::LowerDFGToLLVM::lowCell): (JSC::FTL::LowerDFGToLLVM::lowBoolean): (JSC::FTL::LowerDFGToLLVM::lowDouble): (JSC::FTL::LowerDFGToLLVM::lowJSValue): (JSC::FTL::LowerDFGToLLVM::lowStorage): (JSC::FTL::LowerDFGToLLVM::speculate): (JSC::FTL::LowerDFGToLLVM::speculateBoolean): (JSC::FTL::LowerDFGToLLVM::isLive): (JSC::FTL::LowerDFGToLLVM::use): (JSC::FTL::LowerDFGToLLVM::initializeOSRExitStateForBlock): (JSC::FTL::LowerDFGToLLVM::appendOSRExit): (JSC::FTL::LowerDFGToLLVM::emitOSRExitCall): (JSC::FTL::LowerDFGToLLVM::addExitArgumentForNode): (JSC::FTL::LowerDFGToLLVM::linkOSRExitsAndCompleteInitializationBlocks): (JSC::FTL::LowerDFGToLLVM::setInt32): (JSC::FTL::LowerDFGToLLVM::setJSValue): (JSC::FTL::LowerDFGToLLVM::setBoolean): (JSC::FTL::LowerDFGToLLVM::setStorage): (JSC::FTL::LowerDFGToLLVM::setDouble): (JSC::FTL::LowerDFGToLLVM::isValid): * ftl/FTLLoweredNodeValue.h: Added. (FTL): (LoweredNodeValue): (JSC::FTL::LoweredNodeValue::LoweredNodeValue): (JSC::FTL::LoweredNodeValue::isSet): (JSC::FTL::LoweredNodeValue::operator!): (JSC::FTL::LoweredNodeValue::value): (JSC::FTL::LoweredNodeValue::block): * ftl/FTLValueFromBlock.h: (JSC::FTL::ValueFromBlock::ValueFromBlock): (ValueFromBlock): * ftl/FTLValueSource.cpp: (JSC::FTL::ValueSource::dump): * ftl/FTLValueSource.h: Source/WTF: Reviewed by Mark Hahnenberg. - Extend variadicity of PrintStream and dataLog. - Give HashSet the ability to add a span of things. - Give HashSet the ability to == another HashSet. - Note FIXME's in HashTable concerning copying performance, that affects the way that the DFG now uses HashSets and HashMaps. - Factor out the bulk-insertion logic of JSC::DFG::InsertionSet into WTF::Insertion, so that it can be used in more places. - Create a dumper for lists and maps. * WTF.xcodeproj/project.pbxproj: * wtf/DataLog.h: (WTF): (WTF::dataLog): * wtf/HashSet.h: (HashSet): (WTF): (WTF::::add): (WTF::=): * wtf/HashTable.h: (WTF::::HashTable): (WTF::=): * wtf/Insertion.h: Added. (WTF): (Insertion): (WTF::Insertion::Insertion): (WTF::Insertion::index): (WTF::Insertion::element): (WTF::Insertion::operator<): (WTF::executeInsertions): * wtf/ListDump.h: Added. (WTF): (ListDump): (WTF::ListDump::ListDump): (WTF::ListDump::dump): (MapDump): (WTF::MapDump::MapDump): (WTF::MapDump::dump): (WTF::listDump): (WTF::sortedListDump): (WTF::lessThan): (WTF::mapDump): (WTF::sortedMapDump): * wtf/PrintStream.h: (PrintStream): (WTF::PrintStream::print): Conflicts: Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj Canonical link: https://commits.webkit.org/137058@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153274 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:04:45 +00:00
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
#include <wtf/CommaPrinter.h>
#include <wtf/PrintStream.h>
#include <wtf/StringPrintStream.h>
fourthTier: DFG should have an SSA form for use by FTL https://bugs.webkit.org/show_bug.cgi?id=118338 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. Adds an SSA form to the DFG. We can convert ThreadedCPS form into SSA form after breaking critical edges. The conversion algorithm follows Aycock and Horspool, and the SSA form itself follows something I've done before, where instead of having Phi functions specify input nodes corresponding to block predecessors, we instead have Upsilon functions in the predecessors that specify which value in that block goes into which subsequent Phi. Upsilons don't have to dominate Phis (usually they don't) and they correspond to a non-SSA "mov" into the Phi's "variable". This gives all of the good properties of SSA, while ensuring that a bunch of CFG transformations don't have to be SSA-aware. So far the only DFG phases that are SSA-aware are DCE and CFA. CFG simplification is probably SSA-aware by default, though I haven't tried it. Constant folding probably needs a few tweaks, but is likely ready. Ditto for CSE, though it's not clear that we'd want to use block-local CSE when we could be doing GVN. Currently only the FTL can generate code from the SSA form, and there is no way to convert from SSA to ThreadedCPS or LoadStore. There probably will never be such a capability. In order to handle OSR exit state in the SSA, we place MovHints at Phi points. Other than that, you can reconstruct state-at-exit by forward propagating MovHints. Note that MovHint is the new SetLocal in SSA. SetLocal and GetLocal only survive into SSA if they are on captured variables, or in the case of flushes. A "live SetLocal" will be NodeMustGenerate and will always correspond to a flush. Computing the state-at-exit requires running SSA liveness analysis, OSR availability analysis, and flush liveness analysis. The FTL runs all of these prior to generating code. While OSR exit continues to be tricky, much of the logic is now factored into separate phases and the backend has to do less work to reason about what happened outside of the basic block that is being lowered. Conversion from DFG SSA to LLVM SSA is done by ensuring that we generate code in depth-first order, thus guaranteeing that a node will always be lowered (and hence have a LValue) before any of the blocks dominated by that node's block have code generated. For Upsilon/Phi, we just use alloca's. We could do something more clever there, but it's probably not worth it, at least not now. Finally, while the SSA form is currently only being converted to LLVM IR, there is nothing that prevents us from considering other backends in the future - with the caveat that this form is designed to be first lowered to a lower-level SSA before actual machine code generation commences. So we ought to either use LLVM (the intended path) or we will have to write our own SSA low-level backend. This runs all of the code that the FTL was known to run previously. No change in performance for now. But it does open some exciting possibilities! * JavaScriptCore.xcodeproj/project.pbxproj: * bytecode/Operands.h: (JSC::OperandValueTraits::dump): (JSC::Operands::fill): (Operands): (JSC::Operands::clear): (JSC::Operands::operator==): * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::beginBasicBlock): (JSC::DFG::setLiveValues): (DFG): (JSC::DFG::AbstractState::initialize): (JSC::DFG::AbstractState::endBasicBlock): (JSC::DFG::AbstractState::executeEffects): (JSC::DFG::AbstractState::mergeStateAtTail): (JSC::DFG::AbstractState::merge): * dfg/DFGAbstractState.h: (AbstractState): * dfg/DFGAdjacencyList.h: (JSC::DFG::AdjacencyList::justOneChild): (AdjacencyList): * dfg/DFGBasicBlock.cpp: Added. (DFG): (JSC::DFG::BasicBlock::BasicBlock): (JSC::DFG::BasicBlock::~BasicBlock): (JSC::DFG::BasicBlock::ensureLocals): (JSC::DFG::BasicBlock::isInPhis): (JSC::DFG::BasicBlock::isInBlock): (JSC::DFG::BasicBlock::removePredecessor): (JSC::DFG::BasicBlock::replacePredecessor): (JSC::DFG::BasicBlock::dump): (JSC::DFG::BasicBlock::SSAData::SSAData): (JSC::DFG::BasicBlock::SSAData::~SSAData): * dfg/DFGBasicBlock.h: (BasicBlock): (JSC::DFG::BasicBlock::operator[]): (JSC::DFG::BasicBlock::successor): (JSC::DFG::BasicBlock::successorForCondition): (SSAData): * dfg/DFGBasicBlockInlines.h: (DFG): * dfg/DFGBlockInsertionSet.cpp: Added. (DFG): (JSC::DFG::BlockInsertionSet::BlockInsertionSet): (JSC::DFG::BlockInsertionSet::~BlockInsertionSet): (JSC::DFG::BlockInsertionSet::insert): (JSC::DFG::BlockInsertionSet::insertBefore): (JSC::DFG::BlockInsertionSet::execute): * dfg/DFGBlockInsertionSet.h: Added. (DFG): (BlockInsertionSet): * dfg/DFGCFAPhase.cpp: (JSC::DFG::CFAPhase::run): * dfg/DFGCFGSimplificationPhase.cpp: * dfg/DFGCPSRethreadingPhase.cpp: (JSC::DFG::CPSRethreadingPhase::canonicalizeLocalsInBlock): * dfg/DFGCommon.cpp: (WTF::printInternal): * dfg/DFGCommon.h: (JSC::DFG::doesKill): (DFG): (JSC::DFG::killStatusForDoesKill): * dfg/DFGConstantFoldingPhase.cpp: (JSC::DFG::ConstantFoldingPhase::foldConstants): (JSC::DFG::ConstantFoldingPhase::isCapturedAtOrAfter): * dfg/DFGCriticalEdgeBreakingPhase.cpp: Added. (DFG): (CriticalEdgeBreakingPhase): (JSC::DFG::CriticalEdgeBreakingPhase::CriticalEdgeBreakingPhase): (JSC::DFG::CriticalEdgeBreakingPhase::run): (JSC::DFG::CriticalEdgeBreakingPhase::breakCriticalEdge): (JSC::DFG::performCriticalEdgeBreaking): * dfg/DFGCriticalEdgeBreakingPhase.h: Added. (DFG): * dfg/DFGDCEPhase.cpp: (JSC::DFG::DCEPhase::run): (JSC::DFG::DCEPhase::findTypeCheckRoot): (JSC::DFG::DCEPhase::countNode): (DCEPhase): (JSC::DFG::DCEPhase::countEdge): (JSC::DFG::DCEPhase::eliminateIrrelevantPhantomChildren): * dfg/DFGDriver.cpp: (JSC::DFG::compile): * dfg/DFGEdge.cpp: (JSC::DFG::Edge::dump): * dfg/DFGEdge.h: (JSC::DFG::Edge::Edge): (JSC::DFG::Edge::setNode): (JSC::DFG::Edge::useKindUnchecked): (JSC::DFG::Edge::setUseKind): (JSC::DFG::Edge::setProofStatus): (JSC::DFG::Edge::willNotHaveCheck): (JSC::DFG::Edge::willHaveCheck): (Edge): (JSC::DFG::Edge::killStatusUnchecked): (JSC::DFG::Edge::killStatus): (JSC::DFG::Edge::setKillStatus): (JSC::DFG::Edge::doesKill): (JSC::DFG::Edge::doesNotKill): (JSC::DFG::Edge::shift): (JSC::DFG::Edge::makeWord): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGFlushFormat.cpp: Added. (WTF): (WTF::printInternal): * dfg/DFGFlushFormat.h: Added. (DFG): (JSC::DFG::resultFor): (JSC::DFG::useKindFor): (WTF): * dfg/DFGFlushLivenessAnalysisPhase.cpp: Added. (DFG): (FlushLivenessAnalysisPhase): (JSC::DFG::FlushLivenessAnalysisPhase::FlushLivenessAnalysisPhase): (JSC::DFG::FlushLivenessAnalysisPhase::run): (JSC::DFG::FlushLivenessAnalysisPhase::process): (JSC::DFG::FlushLivenessAnalysisPhase::setForNode): (JSC::DFG::FlushLivenessAnalysisPhase::flushFormat): (JSC::DFG::performFlushLivenessAnalysis): * dfg/DFGFlushLivenessAnalysisPhase.h: Added. (DFG): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::dump): (JSC::DFG::Graph::dumpBlockHeader): (DFG): (JSC::DFG::Graph::addForDepthFirstSort): (JSC::DFG::Graph::getBlocksInDepthFirstOrder): * dfg/DFGGraph.h: (JSC::DFG::Graph::convertToConstant): (JSC::DFG::Graph::valueProfileFor): (Graph): * dfg/DFGInsertionSet.h: (DFG): (JSC::DFG::InsertionSet::execute): * dfg/DFGLivenessAnalysisPhase.cpp: Added. (DFG): (LivenessAnalysisPhase): (JSC::DFG::LivenessAnalysisPhase::LivenessAnalysisPhase): (JSC::DFG::LivenessAnalysisPhase::run): (JSC::DFG::LivenessAnalysisPhase::process): (JSC::DFG::LivenessAnalysisPhase::addChildUse): (JSC::DFG::performLivenessAnalysis): * dfg/DFGLivenessAnalysisPhase.h: Added. (DFG): * dfg/DFGNode.cpp: (JSC::DFG::Node::hasVariableAccessData): (DFG): * dfg/DFGNode.h: (DFG): (Node): (JSC::DFG::Node::hasLocal): (JSC::DFG::Node::variableAccessData): (JSC::DFG::Node::hasPhi): (JSC::DFG::Node::phi): (JSC::DFG::Node::takenBlock): (JSC::DFG::Node::notTakenBlock): (JSC::DFG::Node::successor): (JSC::DFG::Node::successorForCondition): (JSC::DFG::nodeComparator): (JSC::DFG::nodeListDump): (JSC::DFG::nodeMapDump): * dfg/DFGNodeFlags.cpp: (JSC::DFG::dumpNodeFlags): * dfg/DFGNodeType.h: (DFG): * dfg/DFGOSRAvailabilityAnalysisPhase.cpp: Added. (DFG): (OSRAvailabilityAnalysisPhase): (JSC::DFG::OSRAvailabilityAnalysisPhase::OSRAvailabilityAnalysisPhase): (JSC::DFG::OSRAvailabilityAnalysisPhase::run): (JSC::DFG::performOSRAvailabilityAnalysis): * dfg/DFGOSRAvailabilityAnalysisPhase.h: Added. (DFG): * dfg/DFGPlan.cpp: (JSC::DFG::Plan::compileInThreadImpl): * dfg/DFGPredictionInjectionPhase.cpp: (JSC::DFG::PredictionInjectionPhase::run): * dfg/DFGPredictionPropagationPhase.cpp: (JSC::DFG::PredictionPropagationPhase::propagate): * dfg/DFGSSAConversionPhase.cpp: Added. (DFG): (SSAConversionPhase): (JSC::DFG::SSAConversionPhase::SSAConversionPhase): (JSC::DFG::SSAConversionPhase::run): (JSC::DFG::SSAConversionPhase::forwardPhiChildren): (JSC::DFG::SSAConversionPhase::forwardPhi): (JSC::DFG::SSAConversionPhase::forwardPhiEdge): (JSC::DFG::SSAConversionPhase::deduplicateChildren): (JSC::DFG::SSAConversionPhase::addFlushedLocalOp): (JSC::DFG::SSAConversionPhase::addFlushedLocalEdge): (JSC::DFG::performSSAConversion): * dfg/DFGSSAConversionPhase.h: Added. (DFG): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGValidate.cpp: (JSC::DFG::Validate::validate): (Validate): (JSC::DFG::Validate::validateCPS): * dfg/DFGVariableAccessData.h: (JSC::DFG::VariableAccessData::flushFormat): (VariableAccessData): * ftl/FTLCapabilities.cpp: (JSC::FTL::canCompile): * ftl/FTLLowerDFGToLLVM.cpp: (JSC::FTL::LowerDFGToLLVM::LowerDFGToLLVM): (JSC::FTL::LowerDFGToLLVM::lower): (JSC::FTL::LowerDFGToLLVM::createPhiVariables): (JSC::FTL::LowerDFGToLLVM::compileBlock): (JSC::FTL::LowerDFGToLLVM::compileNode): (JSC::FTL::LowerDFGToLLVM::compileUpsilon): (LowerDFGToLLVM): (JSC::FTL::LowerDFGToLLVM::compilePhi): (JSC::FTL::LowerDFGToLLVM::compileJSConstant): (JSC::FTL::LowerDFGToLLVM::compileWeakJSConstant): (JSC::FTL::LowerDFGToLLVM::compileGetArgument): (JSC::FTL::LowerDFGToLLVM::compileGetLocal): (JSC::FTL::LowerDFGToLLVM::compileSetLocal): (JSC::FTL::LowerDFGToLLVM::compileAdd): (JSC::FTL::LowerDFGToLLVM::compileArithSub): (JSC::FTL::LowerDFGToLLVM::compileArithMul): (JSC::FTL::LowerDFGToLLVM::compileArithDiv): (JSC::FTL::LowerDFGToLLVM::compileArithMod): (JSC::FTL::LowerDFGToLLVM::compileArithMinOrMax): (JSC::FTL::LowerDFGToLLVM::compileArithAbs): (JSC::FTL::LowerDFGToLLVM::compileArithNegate): (JSC::FTL::LowerDFGToLLVM::compileBitAnd): (JSC::FTL::LowerDFGToLLVM::compileBitOr): (JSC::FTL::LowerDFGToLLVM::compileBitXor): (JSC::FTL::LowerDFGToLLVM::compileBitRShift): (JSC::FTL::LowerDFGToLLVM::compileBitLShift): (JSC::FTL::LowerDFGToLLVM::compileBitURShift): (JSC::FTL::LowerDFGToLLVM::compileUInt32ToNumber): (JSC::FTL::LowerDFGToLLVM::compileInt32ToDouble): (JSC::FTL::LowerDFGToLLVM::compileGetButterfly): (JSC::FTL::LowerDFGToLLVM::compileGetArrayLength): (JSC::FTL::LowerDFGToLLVM::compileGetByVal): (JSC::FTL::LowerDFGToLLVM::compileGetByOffset): (JSC::FTL::LowerDFGToLLVM::compileGetGlobalVar): (JSC::FTL::LowerDFGToLLVM::compileCompareEqConstant): (JSC::FTL::LowerDFGToLLVM::compileCompareStrictEq): (JSC::FTL::LowerDFGToLLVM::compileCompareStrictEqConstant): (JSC::FTL::LowerDFGToLLVM::compileCompareLess): (JSC::FTL::LowerDFGToLLVM::compileCompareLessEq): (JSC::FTL::LowerDFGToLLVM::compileCompareGreater): (JSC::FTL::LowerDFGToLLVM::compileCompareGreaterEq): (JSC::FTL::LowerDFGToLLVM::compileLogicalNot): (JSC::FTL::LowerDFGToLLVM::speculateBackward): (JSC::FTL::LowerDFGToLLVM::lowInt32): (JSC::FTL::LowerDFGToLLVM::lowCell): (JSC::FTL::LowerDFGToLLVM::lowBoolean): (JSC::FTL::LowerDFGToLLVM::lowDouble): (JSC::FTL::LowerDFGToLLVM::lowJSValue): (JSC::FTL::LowerDFGToLLVM::lowStorage): (JSC::FTL::LowerDFGToLLVM::speculate): (JSC::FTL::LowerDFGToLLVM::speculateBoolean): (JSC::FTL::LowerDFGToLLVM::isLive): (JSC::FTL::LowerDFGToLLVM::use): (JSC::FTL::LowerDFGToLLVM::initializeOSRExitStateForBlock): (JSC::FTL::LowerDFGToLLVM::appendOSRExit): (JSC::FTL::LowerDFGToLLVM::emitOSRExitCall): (JSC::FTL::LowerDFGToLLVM::addExitArgumentForNode): (JSC::FTL::LowerDFGToLLVM::linkOSRExitsAndCompleteInitializationBlocks): (JSC::FTL::LowerDFGToLLVM::setInt32): (JSC::FTL::LowerDFGToLLVM::setJSValue): (JSC::FTL::LowerDFGToLLVM::setBoolean): (JSC::FTL::LowerDFGToLLVM::setStorage): (JSC::FTL::LowerDFGToLLVM::setDouble): (JSC::FTL::LowerDFGToLLVM::isValid): * ftl/FTLLoweredNodeValue.h: Added. (FTL): (LoweredNodeValue): (JSC::FTL::LoweredNodeValue::LoweredNodeValue): (JSC::FTL::LoweredNodeValue::isSet): (JSC::FTL::LoweredNodeValue::operator!): (JSC::FTL::LoweredNodeValue::value): (JSC::FTL::LoweredNodeValue::block): * ftl/FTLValueFromBlock.h: (JSC::FTL::ValueFromBlock::ValueFromBlock): (ValueFromBlock): * ftl/FTLValueSource.cpp: (JSC::FTL::ValueSource::dump): * ftl/FTLValueSource.h: Source/WTF: Reviewed by Mark Hahnenberg. - Extend variadicity of PrintStream and dataLog. - Give HashSet the ability to add a span of things. - Give HashSet the ability to == another HashSet. - Note FIXME's in HashTable concerning copying performance, that affects the way that the DFG now uses HashSets and HashMaps. - Factor out the bulk-insertion logic of JSC::DFG::InsertionSet into WTF::Insertion, so that it can be used in more places. - Create a dumper for lists and maps. * WTF.xcodeproj/project.pbxproj: * wtf/DataLog.h: (WTF): (WTF::dataLog): * wtf/HashSet.h: (HashSet): (WTF): (WTF::::add): (WTF::=): * wtf/HashTable.h: (WTF::::HashTable): (WTF::=): * wtf/Insertion.h: Added. (WTF): (Insertion): (WTF::Insertion::Insertion): (WTF::Insertion::index): (WTF::Insertion::element): (WTF::Insertion::operator<): (WTF::executeInsertions): * wtf/ListDump.h: Added. (WTF): (ListDump): (WTF::ListDump::ListDump): (WTF::ListDump::dump): (MapDump): (WTF::MapDump::MapDump): (WTF::MapDump::dump): (WTF::listDump): (WTF::sortedListDump): (WTF::lessThan): (WTF::mapDump): (WTF::sortedMapDump): * wtf/PrintStream.h: (PrintStream): (WTF::PrintStream::print): Conflicts: Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj Canonical link: https://commits.webkit.org/137058@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153274 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:04:45 +00:00
namespace WTF {
template<typename T>
class ListDump {
public:
ListDump(const T& list, const char* comma)
: m_list(list)
, m_comma(comma)
{
}
void dump(PrintStream& out) const
{
FTL B3 should be able to run richards https://bugs.webkit.org/show_bug.cgi?id=152514 Reviewed by Michael Saboff. Source/JavaScriptCore: This came down to a liveness bug and a register allocation bug. The liveness bug was that the code that determined whether we should go around the fixpoint assumed that BitVector::quickSet() would return true if the bit changed state from false to true. That's not how it works. It returns the old value of the bit, so it will return false if the bit changed from false to true. Since there is already a lot of code that relies on this behavior, I fixed Liveness instead of changing BitVector. The register allocation bug was that we weren't guarding some checks of tmp()'s with checks that the Arg isTmp(). The liveness took a long time to track down, and I needed to add a lot of dumping to do it. It's now possible to dump more of the liveness states, including liveAtHead. I found this extremely helpful, so I removed the code that cleared liveAtHead. * b3/air/AirIteratedRegisterCoalescing.cpp: * b3/air/AirLiveness.h: (JSC::B3::Air::AbstractLiveness::AbstractLiveness): (JSC::B3::Air::AbstractLiveness::Iterable::Iterable): (JSC::B3::Air::AbstractLiveness::Iterable::iterator::iterator): (JSC::B3::Air::AbstractLiveness::Iterable::iterator::operator*): (JSC::B3::Air::AbstractLiveness::Iterable::iterator::operator++): (JSC::B3::Air::AbstractLiveness::Iterable::iterator::operator==): (JSC::B3::Air::AbstractLiveness::Iterable::iterator::operator!=): (JSC::B3::Air::AbstractLiveness::Iterable::begin): (JSC::B3::Air::AbstractLiveness::Iterable::end): (JSC::B3::Air::AbstractLiveness::liveAtHead): (JSC::B3::Air::AbstractLiveness::liveAtTail): * b3/air/AirStackSlot.h: (WTF::printInternal): * ftl/FTLOSRExitCompiler.cpp: (JSC::FTL::compileFTLOSRExit): Source/WTF: Change the list dumping helpers to work with a broader set of list kinds. * wtf/ListDump.h: (WTF::ListDump::dump): (WTF::MapDump::dump): (WTF::sortedMapDump): (WTF::ListDumpInContext::dump): Canonical link: https://commits.webkit.org/170620@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@194382 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-12-23 01:50:19 +00:00
for (auto iter = m_list.begin(); iter != m_list.end(); ++iter)
fourthTier: DFG should have an SSA form for use by FTL https://bugs.webkit.org/show_bug.cgi?id=118338 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. Adds an SSA form to the DFG. We can convert ThreadedCPS form into SSA form after breaking critical edges. The conversion algorithm follows Aycock and Horspool, and the SSA form itself follows something I've done before, where instead of having Phi functions specify input nodes corresponding to block predecessors, we instead have Upsilon functions in the predecessors that specify which value in that block goes into which subsequent Phi. Upsilons don't have to dominate Phis (usually they don't) and they correspond to a non-SSA "mov" into the Phi's "variable". This gives all of the good properties of SSA, while ensuring that a bunch of CFG transformations don't have to be SSA-aware. So far the only DFG phases that are SSA-aware are DCE and CFA. CFG simplification is probably SSA-aware by default, though I haven't tried it. Constant folding probably needs a few tweaks, but is likely ready. Ditto for CSE, though it's not clear that we'd want to use block-local CSE when we could be doing GVN. Currently only the FTL can generate code from the SSA form, and there is no way to convert from SSA to ThreadedCPS or LoadStore. There probably will never be such a capability. In order to handle OSR exit state in the SSA, we place MovHints at Phi points. Other than that, you can reconstruct state-at-exit by forward propagating MovHints. Note that MovHint is the new SetLocal in SSA. SetLocal and GetLocal only survive into SSA if they are on captured variables, or in the case of flushes. A "live SetLocal" will be NodeMustGenerate and will always correspond to a flush. Computing the state-at-exit requires running SSA liveness analysis, OSR availability analysis, and flush liveness analysis. The FTL runs all of these prior to generating code. While OSR exit continues to be tricky, much of the logic is now factored into separate phases and the backend has to do less work to reason about what happened outside of the basic block that is being lowered. Conversion from DFG SSA to LLVM SSA is done by ensuring that we generate code in depth-first order, thus guaranteeing that a node will always be lowered (and hence have a LValue) before any of the blocks dominated by that node's block have code generated. For Upsilon/Phi, we just use alloca's. We could do something more clever there, but it's probably not worth it, at least not now. Finally, while the SSA form is currently only being converted to LLVM IR, there is nothing that prevents us from considering other backends in the future - with the caveat that this form is designed to be first lowered to a lower-level SSA before actual machine code generation commences. So we ought to either use LLVM (the intended path) or we will have to write our own SSA low-level backend. This runs all of the code that the FTL was known to run previously. No change in performance for now. But it does open some exciting possibilities! * JavaScriptCore.xcodeproj/project.pbxproj: * bytecode/Operands.h: (JSC::OperandValueTraits::dump): (JSC::Operands::fill): (Operands): (JSC::Operands::clear): (JSC::Operands::operator==): * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::beginBasicBlock): (JSC::DFG::setLiveValues): (DFG): (JSC::DFG::AbstractState::initialize): (JSC::DFG::AbstractState::endBasicBlock): (JSC::DFG::AbstractState::executeEffects): (JSC::DFG::AbstractState::mergeStateAtTail): (JSC::DFG::AbstractState::merge): * dfg/DFGAbstractState.h: (AbstractState): * dfg/DFGAdjacencyList.h: (JSC::DFG::AdjacencyList::justOneChild): (AdjacencyList): * dfg/DFGBasicBlock.cpp: Added. (DFG): (JSC::DFG::BasicBlock::BasicBlock): (JSC::DFG::BasicBlock::~BasicBlock): (JSC::DFG::BasicBlock::ensureLocals): (JSC::DFG::BasicBlock::isInPhis): (JSC::DFG::BasicBlock::isInBlock): (JSC::DFG::BasicBlock::removePredecessor): (JSC::DFG::BasicBlock::replacePredecessor): (JSC::DFG::BasicBlock::dump): (JSC::DFG::BasicBlock::SSAData::SSAData): (JSC::DFG::BasicBlock::SSAData::~SSAData): * dfg/DFGBasicBlock.h: (BasicBlock): (JSC::DFG::BasicBlock::operator[]): (JSC::DFG::BasicBlock::successor): (JSC::DFG::BasicBlock::successorForCondition): (SSAData): * dfg/DFGBasicBlockInlines.h: (DFG): * dfg/DFGBlockInsertionSet.cpp: Added. (DFG): (JSC::DFG::BlockInsertionSet::BlockInsertionSet): (JSC::DFG::BlockInsertionSet::~BlockInsertionSet): (JSC::DFG::BlockInsertionSet::insert): (JSC::DFG::BlockInsertionSet::insertBefore): (JSC::DFG::BlockInsertionSet::execute): * dfg/DFGBlockInsertionSet.h: Added. (DFG): (BlockInsertionSet): * dfg/DFGCFAPhase.cpp: (JSC::DFG::CFAPhase::run): * dfg/DFGCFGSimplificationPhase.cpp: * dfg/DFGCPSRethreadingPhase.cpp: (JSC::DFG::CPSRethreadingPhase::canonicalizeLocalsInBlock): * dfg/DFGCommon.cpp: (WTF::printInternal): * dfg/DFGCommon.h: (JSC::DFG::doesKill): (DFG): (JSC::DFG::killStatusForDoesKill): * dfg/DFGConstantFoldingPhase.cpp: (JSC::DFG::ConstantFoldingPhase::foldConstants): (JSC::DFG::ConstantFoldingPhase::isCapturedAtOrAfter): * dfg/DFGCriticalEdgeBreakingPhase.cpp: Added. (DFG): (CriticalEdgeBreakingPhase): (JSC::DFG::CriticalEdgeBreakingPhase::CriticalEdgeBreakingPhase): (JSC::DFG::CriticalEdgeBreakingPhase::run): (JSC::DFG::CriticalEdgeBreakingPhase::breakCriticalEdge): (JSC::DFG::performCriticalEdgeBreaking): * dfg/DFGCriticalEdgeBreakingPhase.h: Added. (DFG): * dfg/DFGDCEPhase.cpp: (JSC::DFG::DCEPhase::run): (JSC::DFG::DCEPhase::findTypeCheckRoot): (JSC::DFG::DCEPhase::countNode): (DCEPhase): (JSC::DFG::DCEPhase::countEdge): (JSC::DFG::DCEPhase::eliminateIrrelevantPhantomChildren): * dfg/DFGDriver.cpp: (JSC::DFG::compile): * dfg/DFGEdge.cpp: (JSC::DFG::Edge::dump): * dfg/DFGEdge.h: (JSC::DFG::Edge::Edge): (JSC::DFG::Edge::setNode): (JSC::DFG::Edge::useKindUnchecked): (JSC::DFG::Edge::setUseKind): (JSC::DFG::Edge::setProofStatus): (JSC::DFG::Edge::willNotHaveCheck): (JSC::DFG::Edge::willHaveCheck): (Edge): (JSC::DFG::Edge::killStatusUnchecked): (JSC::DFG::Edge::killStatus): (JSC::DFG::Edge::setKillStatus): (JSC::DFG::Edge::doesKill): (JSC::DFG::Edge::doesNotKill): (JSC::DFG::Edge::shift): (JSC::DFG::Edge::makeWord): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGFlushFormat.cpp: Added. (WTF): (WTF::printInternal): * dfg/DFGFlushFormat.h: Added. (DFG): (JSC::DFG::resultFor): (JSC::DFG::useKindFor): (WTF): * dfg/DFGFlushLivenessAnalysisPhase.cpp: Added. (DFG): (FlushLivenessAnalysisPhase): (JSC::DFG::FlushLivenessAnalysisPhase::FlushLivenessAnalysisPhase): (JSC::DFG::FlushLivenessAnalysisPhase::run): (JSC::DFG::FlushLivenessAnalysisPhase::process): (JSC::DFG::FlushLivenessAnalysisPhase::setForNode): (JSC::DFG::FlushLivenessAnalysisPhase::flushFormat): (JSC::DFG::performFlushLivenessAnalysis): * dfg/DFGFlushLivenessAnalysisPhase.h: Added. (DFG): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::dump): (JSC::DFG::Graph::dumpBlockHeader): (DFG): (JSC::DFG::Graph::addForDepthFirstSort): (JSC::DFG::Graph::getBlocksInDepthFirstOrder): * dfg/DFGGraph.h: (JSC::DFG::Graph::convertToConstant): (JSC::DFG::Graph::valueProfileFor): (Graph): * dfg/DFGInsertionSet.h: (DFG): (JSC::DFG::InsertionSet::execute): * dfg/DFGLivenessAnalysisPhase.cpp: Added. (DFG): (LivenessAnalysisPhase): (JSC::DFG::LivenessAnalysisPhase::LivenessAnalysisPhase): (JSC::DFG::LivenessAnalysisPhase::run): (JSC::DFG::LivenessAnalysisPhase::process): (JSC::DFG::LivenessAnalysisPhase::addChildUse): (JSC::DFG::performLivenessAnalysis): * dfg/DFGLivenessAnalysisPhase.h: Added. (DFG): * dfg/DFGNode.cpp: (JSC::DFG::Node::hasVariableAccessData): (DFG): * dfg/DFGNode.h: (DFG): (Node): (JSC::DFG::Node::hasLocal): (JSC::DFG::Node::variableAccessData): (JSC::DFG::Node::hasPhi): (JSC::DFG::Node::phi): (JSC::DFG::Node::takenBlock): (JSC::DFG::Node::notTakenBlock): (JSC::DFG::Node::successor): (JSC::DFG::Node::successorForCondition): (JSC::DFG::nodeComparator): (JSC::DFG::nodeListDump): (JSC::DFG::nodeMapDump): * dfg/DFGNodeFlags.cpp: (JSC::DFG::dumpNodeFlags): * dfg/DFGNodeType.h: (DFG): * dfg/DFGOSRAvailabilityAnalysisPhase.cpp: Added. (DFG): (OSRAvailabilityAnalysisPhase): (JSC::DFG::OSRAvailabilityAnalysisPhase::OSRAvailabilityAnalysisPhase): (JSC::DFG::OSRAvailabilityAnalysisPhase::run): (JSC::DFG::performOSRAvailabilityAnalysis): * dfg/DFGOSRAvailabilityAnalysisPhase.h: Added. (DFG): * dfg/DFGPlan.cpp: (JSC::DFG::Plan::compileInThreadImpl): * dfg/DFGPredictionInjectionPhase.cpp: (JSC::DFG::PredictionInjectionPhase::run): * dfg/DFGPredictionPropagationPhase.cpp: (JSC::DFG::PredictionPropagationPhase::propagate): * dfg/DFGSSAConversionPhase.cpp: Added. (DFG): (SSAConversionPhase): (JSC::DFG::SSAConversionPhase::SSAConversionPhase): (JSC::DFG::SSAConversionPhase::run): (JSC::DFG::SSAConversionPhase::forwardPhiChildren): (JSC::DFG::SSAConversionPhase::forwardPhi): (JSC::DFG::SSAConversionPhase::forwardPhiEdge): (JSC::DFG::SSAConversionPhase::deduplicateChildren): (JSC::DFG::SSAConversionPhase::addFlushedLocalOp): (JSC::DFG::SSAConversionPhase::addFlushedLocalEdge): (JSC::DFG::performSSAConversion): * dfg/DFGSSAConversionPhase.h: Added. (DFG): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGValidate.cpp: (JSC::DFG::Validate::validate): (Validate): (JSC::DFG::Validate::validateCPS): * dfg/DFGVariableAccessData.h: (JSC::DFG::VariableAccessData::flushFormat): (VariableAccessData): * ftl/FTLCapabilities.cpp: (JSC::FTL::canCompile): * ftl/FTLLowerDFGToLLVM.cpp: (JSC::FTL::LowerDFGToLLVM::LowerDFGToLLVM): (JSC::FTL::LowerDFGToLLVM::lower): (JSC::FTL::LowerDFGToLLVM::createPhiVariables): (JSC::FTL::LowerDFGToLLVM::compileBlock): (JSC::FTL::LowerDFGToLLVM::compileNode): (JSC::FTL::LowerDFGToLLVM::compileUpsilon): (LowerDFGToLLVM): (JSC::FTL::LowerDFGToLLVM::compilePhi): (JSC::FTL::LowerDFGToLLVM::compileJSConstant): (JSC::FTL::LowerDFGToLLVM::compileWeakJSConstant): (JSC::FTL::LowerDFGToLLVM::compileGetArgument): (JSC::FTL::LowerDFGToLLVM::compileGetLocal): (JSC::FTL::LowerDFGToLLVM::compileSetLocal): (JSC::FTL::LowerDFGToLLVM::compileAdd): (JSC::FTL::LowerDFGToLLVM::compileArithSub): (JSC::FTL::LowerDFGToLLVM::compileArithMul): (JSC::FTL::LowerDFGToLLVM::compileArithDiv): (JSC::FTL::LowerDFGToLLVM::compileArithMod): (JSC::FTL::LowerDFGToLLVM::compileArithMinOrMax): (JSC::FTL::LowerDFGToLLVM::compileArithAbs): (JSC::FTL::LowerDFGToLLVM::compileArithNegate): (JSC::FTL::LowerDFGToLLVM::compileBitAnd): (JSC::FTL::LowerDFGToLLVM::compileBitOr): (JSC::FTL::LowerDFGToLLVM::compileBitXor): (JSC::FTL::LowerDFGToLLVM::compileBitRShift): (JSC::FTL::LowerDFGToLLVM::compileBitLShift): (JSC::FTL::LowerDFGToLLVM::compileBitURShift): (JSC::FTL::LowerDFGToLLVM::compileUInt32ToNumber): (JSC::FTL::LowerDFGToLLVM::compileInt32ToDouble): (JSC::FTL::LowerDFGToLLVM::compileGetButterfly): (JSC::FTL::LowerDFGToLLVM::compileGetArrayLength): (JSC::FTL::LowerDFGToLLVM::compileGetByVal): (JSC::FTL::LowerDFGToLLVM::compileGetByOffset): (JSC::FTL::LowerDFGToLLVM::compileGetGlobalVar): (JSC::FTL::LowerDFGToLLVM::compileCompareEqConstant): (JSC::FTL::LowerDFGToLLVM::compileCompareStrictEq): (JSC::FTL::LowerDFGToLLVM::compileCompareStrictEqConstant): (JSC::FTL::LowerDFGToLLVM::compileCompareLess): (JSC::FTL::LowerDFGToLLVM::compileCompareLessEq): (JSC::FTL::LowerDFGToLLVM::compileCompareGreater): (JSC::FTL::LowerDFGToLLVM::compileCompareGreaterEq): (JSC::FTL::LowerDFGToLLVM::compileLogicalNot): (JSC::FTL::LowerDFGToLLVM::speculateBackward): (JSC::FTL::LowerDFGToLLVM::lowInt32): (JSC::FTL::LowerDFGToLLVM::lowCell): (JSC::FTL::LowerDFGToLLVM::lowBoolean): (JSC::FTL::LowerDFGToLLVM::lowDouble): (JSC::FTL::LowerDFGToLLVM::lowJSValue): (JSC::FTL::LowerDFGToLLVM::lowStorage): (JSC::FTL::LowerDFGToLLVM::speculate): (JSC::FTL::LowerDFGToLLVM::speculateBoolean): (JSC::FTL::LowerDFGToLLVM::isLive): (JSC::FTL::LowerDFGToLLVM::use): (JSC::FTL::LowerDFGToLLVM::initializeOSRExitStateForBlock): (JSC::FTL::LowerDFGToLLVM::appendOSRExit): (JSC::FTL::LowerDFGToLLVM::emitOSRExitCall): (JSC::FTL::LowerDFGToLLVM::addExitArgumentForNode): (JSC::FTL::LowerDFGToLLVM::linkOSRExitsAndCompleteInitializationBlocks): (JSC::FTL::LowerDFGToLLVM::setInt32): (JSC::FTL::LowerDFGToLLVM::setJSValue): (JSC::FTL::LowerDFGToLLVM::setBoolean): (JSC::FTL::LowerDFGToLLVM::setStorage): (JSC::FTL::LowerDFGToLLVM::setDouble): (JSC::FTL::LowerDFGToLLVM::isValid): * ftl/FTLLoweredNodeValue.h: Added. (FTL): (LoweredNodeValue): (JSC::FTL::LoweredNodeValue::LoweredNodeValue): (JSC::FTL::LoweredNodeValue::isSet): (JSC::FTL::LoweredNodeValue::operator!): (JSC::FTL::LoweredNodeValue::value): (JSC::FTL::LoweredNodeValue::block): * ftl/FTLValueFromBlock.h: (JSC::FTL::ValueFromBlock::ValueFromBlock): (ValueFromBlock): * ftl/FTLValueSource.cpp: (JSC::FTL::ValueSource::dump): * ftl/FTLValueSource.h: Source/WTF: Reviewed by Mark Hahnenberg. - Extend variadicity of PrintStream and dataLog. - Give HashSet the ability to add a span of things. - Give HashSet the ability to == another HashSet. - Note FIXME's in HashTable concerning copying performance, that affects the way that the DFG now uses HashSets and HashMaps. - Factor out the bulk-insertion logic of JSC::DFG::InsertionSet into WTF::Insertion, so that it can be used in more places. - Create a dumper for lists and maps. * WTF.xcodeproj/project.pbxproj: * wtf/DataLog.h: (WTF): (WTF::dataLog): * wtf/HashSet.h: (HashSet): (WTF): (WTF::::add): (WTF::=): * wtf/HashTable.h: (WTF::::HashTable): (WTF::=): * wtf/Insertion.h: Added. (WTF): (Insertion): (WTF::Insertion::Insertion): (WTF::Insertion::index): (WTF::Insertion::element): (WTF::Insertion::operator<): (WTF::executeInsertions): * wtf/ListDump.h: Added. (WTF): (ListDump): (WTF::ListDump::ListDump): (WTF::ListDump::dump): (MapDump): (WTF::MapDump::MapDump): (WTF::MapDump::dump): (WTF::listDump): (WTF::sortedListDump): (WTF::lessThan): (WTF::mapDump): (WTF::sortedMapDump): * wtf/PrintStream.h: (PrintStream): (WTF::PrintStream::print): Conflicts: Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj Canonical link: https://commits.webkit.org/137058@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153274 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:04:45 +00:00
out.print(m_comma, *iter);
}
private:
const T& m_list;
CommaPrinter m_comma;
};
Create a super rough prototype of B3 https://bugs.webkit.org/show_bug.cgi?id=150280 Reviewed by Benjamin Poulain. Source/JavaScriptCore: This changeset adds the basic scaffolding of the B3 compiler. B3 stands for Bare Bones Backend. It's a low-level SSA-based language-agnostic compiler. The basic structure allows for aggressive C-level optimizations and an awesome portable backend. The backend, called Air (Assembly IR), is a reflective abstraction over our MacroAssembler. The abstraction is defined using a spec file (AirOpcode.opcodes) which describes the various kinds of instructions that we wish to support. Then, the B3::LowerToAir phase, which does our instruction selection, reflectively selects Air opcodes by querying which instruction forms are possible. Air allows for optimal register allocation and stack layout. Currently the register allocator isn't written, but the stack layout is. Of course this isn't done yet. It can only compile simple programs, seen in the "test suite" called "testb3.cpp". There's a lot of optimizations that have to be written and a lot of stuff added to the instruction selector. But it's a neat start. * CMakeLists.txt: * DerivedSources.make: * JavaScriptCore.xcodeproj/project.pbxproj: * assembler/MacroAssembler.cpp: (WTF::printInternal): * assembler/MacroAssembler.h: * b3: Added. * b3/B3AddressMatcher.patterns: Added. * b3/B3ArgumentRegValue.cpp: Added. (JSC::B3::ArgumentRegValue::~ArgumentRegValue): (JSC::B3::ArgumentRegValue::dumpMeta): * b3/B3ArgumentRegValue.h: Added. * b3/B3BasicBlock.cpp: Added. (JSC::B3::BasicBlock::BasicBlock): (JSC::B3::BasicBlock::~BasicBlock): (JSC::B3::BasicBlock::append): (JSC::B3::BasicBlock::addPredecessor): (JSC::B3::BasicBlock::removePredecessor): (JSC::B3::BasicBlock::replacePredecessor): (JSC::B3::BasicBlock::removeNops): (JSC::B3::BasicBlock::dump): (JSC::B3::BasicBlock::deepDump): * b3/B3BasicBlock.h: Added. (JSC::B3::BasicBlock::index): (JSC::B3::BasicBlock::begin): (JSC::B3::BasicBlock::end): (JSC::B3::BasicBlock::size): (JSC::B3::BasicBlock::at): (JSC::B3::BasicBlock::last): (JSC::B3::BasicBlock::values): (JSC::B3::BasicBlock::numPredecessors): (JSC::B3::BasicBlock::predecessor): (JSC::B3::BasicBlock::predecessors): (JSC::B3::BasicBlock::frequency): (JSC::B3::DeepBasicBlockDump::DeepBasicBlockDump): (JSC::B3::DeepBasicBlockDump::dump): (JSC::B3::deepDump): * b3/B3BasicBlockInlines.h: Added. (JSC::B3::BasicBlock::appendNew): (JSC::B3::BasicBlock::numSuccessors): (JSC::B3::BasicBlock::successor): (JSC::B3::BasicBlock::successors): (JSC::B3::BasicBlock::successorBlock): (JSC::B3::BasicBlock::successorBlocks): * b3/B3BasicBlockUtils.h: Added. (JSC::B3::addPredecessor): (JSC::B3::removePredecessor): (JSC::B3::replacePredecessor): (JSC::B3::resetReachability): (JSC::B3::blocksInPreOrder): (JSC::B3::blocksInPostOrder): * b3/B3BlockWorklist.h: Added. * b3/B3CheckSpecial.cpp: Added. (JSC::B3::Air::numB3Args): (JSC::B3::CheckSpecial::CheckSpecial): (JSC::B3::CheckSpecial::~CheckSpecial): (JSC::B3::CheckSpecial::hiddenBranch): (JSC::B3::CheckSpecial::forEachArg): (JSC::B3::CheckSpecial::isValid): (JSC::B3::CheckSpecial::admitsStack): (JSC::B3::CheckSpecial::generate): (JSC::B3::CheckSpecial::dumpImpl): (JSC::B3::CheckSpecial::deepDumpImpl): * b3/B3CheckSpecial.h: Added. * b3/B3CheckValue.cpp: Added. (JSC::B3::CheckValue::~CheckValue): (JSC::B3::CheckValue::dumpMeta): * b3/B3CheckValue.h: Added. * b3/B3Common.cpp: Added. (JSC::B3::shouldDumpIR): (JSC::B3::shouldDumpIRAtEachPhase): (JSC::B3::shouldValidateIR): (JSC::B3::shouldValidateIRAtEachPhase): (JSC::B3::shouldSaveIRBeforePhase): * b3/B3Common.h: Added. (JSC::B3::is64Bit): (JSC::B3::is32Bit): * b3/B3Commutativity.cpp: Added. (WTF::printInternal): * b3/B3Commutativity.h: Added. * b3/B3Const32Value.cpp: Added. (JSC::B3::Const32Value::~Const32Value): (JSC::B3::Const32Value::negConstant): (JSC::B3::Const32Value::addConstant): (JSC::B3::Const32Value::subConstant): (JSC::B3::Const32Value::dumpMeta): * b3/B3Const32Value.h: Added. * b3/B3Const64Value.cpp: Added. (JSC::B3::Const64Value::~Const64Value): (JSC::B3::Const64Value::negConstant): (JSC::B3::Const64Value::addConstant): (JSC::B3::Const64Value::subConstant): (JSC::B3::Const64Value::dumpMeta): * b3/B3Const64Value.h: Added. * b3/B3ConstDoubleValue.cpp: Added. (JSC::B3::ConstDoubleValue::~ConstDoubleValue): (JSC::B3::ConstDoubleValue::negConstant): (JSC::B3::ConstDoubleValue::addConstant): (JSC::B3::ConstDoubleValue::subConstant): (JSC::B3::ConstDoubleValue::dumpMeta): * b3/B3ConstDoubleValue.h: Added. (JSC::B3::ConstDoubleValue::accepts): (JSC::B3::ConstDoubleValue::value): (JSC::B3::ConstDoubleValue::ConstDoubleValue): * b3/B3ConstPtrValue.h: Added. (JSC::B3::ConstPtrValue::value): (JSC::B3::ConstPtrValue::ConstPtrValue): * b3/B3ControlValue.cpp: Added. (JSC::B3::ControlValue::~ControlValue): (JSC::B3::ControlValue::dumpMeta): * b3/B3ControlValue.h: Added. * b3/B3Effects.cpp: Added. (JSC::B3::Effects::dump): * b3/B3Effects.h: Added. (JSC::B3::Effects::mustExecute): * b3/B3FrequencyClass.cpp: Added. (WTF::printInternal): * b3/B3FrequencyClass.h: Added. * b3/B3FrequentedBlock.h: Added. * b3/B3Generate.cpp: Added. (JSC::B3::generate): (JSC::B3::generateToAir): * b3/B3Generate.h: Added. * b3/B3GenericFrequentedBlock.h: Added. (JSC::B3::GenericFrequentedBlock::GenericFrequentedBlock): (JSC::B3::GenericFrequentedBlock::operator==): (JSC::B3::GenericFrequentedBlock::operator!=): (JSC::B3::GenericFrequentedBlock::operator bool): (JSC::B3::GenericFrequentedBlock::block): (JSC::B3::GenericFrequentedBlock::frequency): (JSC::B3::GenericFrequentedBlock::dump): * b3/B3HeapRange.cpp: Added. (JSC::B3::HeapRange::dump): * b3/B3HeapRange.h: Added. (JSC::B3::HeapRange::HeapRange): (JSC::B3::HeapRange::top): (JSC::B3::HeapRange::operator==): (JSC::B3::HeapRange::operator!=): (JSC::B3::HeapRange::operator bool): (JSC::B3::HeapRange::begin): (JSC::B3::HeapRange::end): (JSC::B3::HeapRange::overlaps): * b3/B3IndexMap.h: Added. (JSC::B3::IndexMap::IndexMap): (JSC::B3::IndexMap::resize): (JSC::B3::IndexMap::operator[]): * b3/B3IndexSet.h: Added. (JSC::B3::IndexSet::IndexSet): (JSC::B3::IndexSet::add): (JSC::B3::IndexSet::contains): (JSC::B3::IndexSet::Iterable::Iterable): (JSC::B3::IndexSet::Iterable::iterator::iterator): (JSC::B3::IndexSet::Iterable::iterator::operator*): (JSC::B3::IndexSet::Iterable::iterator::operator++): (JSC::B3::IndexSet::Iterable::iterator::operator==): (JSC::B3::IndexSet::Iterable::iterator::operator!=): (JSC::B3::IndexSet::Iterable::begin): (JSC::B3::IndexSet::Iterable::end): (JSC::B3::IndexSet::values): (JSC::B3::IndexSet::indices): (JSC::B3::IndexSet::dump): * b3/B3InsertionSet.cpp: Added. (JSC::B3::InsertionSet::execute): * b3/B3InsertionSet.h: Added. (JSC::B3::InsertionSet::InsertionSet): (JSC::B3::InsertionSet::code): (JSC::B3::InsertionSet::appendInsertion): (JSC::B3::InsertionSet::insertValue): * b3/B3InsertionSetInlines.h: Added. (JSC::B3::InsertionSet::insert): * b3/B3LowerToAir.cpp: Added. (JSC::B3::Air::LowerToAir::LowerToAir): (JSC::B3::Air::LowerToAir::run): (JSC::B3::Air::LowerToAir::tmp): (JSC::B3::Air::LowerToAir::effectiveAddr): (JSC::B3::Air::LowerToAir::addr): (JSC::B3::Air::LowerToAir::loadAddr): (JSC::B3::Air::LowerToAir::imm): (JSC::B3::Air::LowerToAir::immOrTmp): (JSC::B3::Air::LowerToAir::appendBinOp): (JSC::B3::Air::LowerToAir::tryAppendStoreBinOp): (JSC::B3::Air::LowerToAir::moveForType): (JSC::B3::Air::LowerToAir::relaxedMoveForType): (JSC::B3::Air::LowerToAir::append): (JSC::B3::Air::LowerToAir::AddressSelector::AddressSelector): (JSC::B3::Air::LowerToAir::AddressSelector::acceptRoot): (JSC::B3::Air::LowerToAir::AddressSelector::acceptRootLate): (JSC::B3::Air::LowerToAir::AddressSelector::acceptInternals): (JSC::B3::Air::LowerToAir::AddressSelector::acceptInternalsLate): (JSC::B3::Air::LowerToAir::AddressSelector::acceptOperands): (JSC::B3::Air::LowerToAir::AddressSelector::acceptOperandsLate): (JSC::B3::Air::LowerToAir::AddressSelector::tryAddShift1): (JSC::B3::Air::LowerToAir::AddressSelector::tryAddShift2): (JSC::B3::Air::LowerToAir::AddressSelector::tryAdd): (JSC::B3::Air::LowerToAir::AddressSelector::tryDirect): (JSC::B3::Air::LowerToAir::acceptRoot): (JSC::B3::Air::LowerToAir::acceptRootLate): (JSC::B3::Air::LowerToAir::acceptInternals): (JSC::B3::Air::LowerToAir::acceptInternalsLate): (JSC::B3::Air::LowerToAir::acceptOperands): (JSC::B3::Air::LowerToAir::acceptOperandsLate): (JSC::B3::Air::LowerToAir::tryLoad): (JSC::B3::Air::LowerToAir::tryAdd): (JSC::B3::Air::LowerToAir::tryAnd): (JSC::B3::Air::LowerToAir::tryStoreAddLoad): (JSC::B3::Air::LowerToAir::tryStoreAndLoad): (JSC::B3::Air::LowerToAir::tryStore): (JSC::B3::Air::LowerToAir::tryTruncArgumentReg): (JSC::B3::Air::LowerToAir::tryTrunc): (JSC::B3::Air::LowerToAir::tryArgumentReg): (JSC::B3::Air::LowerToAir::tryConst32): (JSC::B3::Air::LowerToAir::tryConst64): (JSC::B3::Air::LowerToAir::tryIdentity): (JSC::B3::Air::LowerToAir::tryReturn): (JSC::B3::lowerToAir): * b3/B3LowerToAir.h: Added. * b3/B3LoweringMatcher.patterns: Added. * b3/B3MemoryValue.cpp: Added. (JSC::B3::MemoryValue::~MemoryValue): (JSC::B3::MemoryValue::dumpMeta): * b3/B3MemoryValue.h: Added. * b3/B3Opcode.cpp: Added. (WTF::printInternal): * b3/B3Opcode.h: Added. (JSC::B3::isCheckMath): * b3/B3Origin.cpp: Added. (JSC::B3::Origin::dump): * b3/B3Origin.h: Added. (JSC::B3::Origin::Origin): (JSC::B3::Origin::operator bool): (JSC::B3::Origin::data): * b3/B3PatchpointSpecial.cpp: Added. (JSC::B3::PatchpointSpecial::PatchpointSpecial): (JSC::B3::PatchpointSpecial::~PatchpointSpecial): (JSC::B3::PatchpointSpecial::forEachArg): (JSC::B3::PatchpointSpecial::isValid): (JSC::B3::PatchpointSpecial::admitsStack): (JSC::B3::PatchpointSpecial::generate): (JSC::B3::PatchpointSpecial::dumpImpl): (JSC::B3::PatchpointSpecial::deepDumpImpl): * b3/B3PatchpointSpecial.h: Added. * b3/B3PatchpointValue.cpp: Added. (JSC::B3::PatchpointValue::~PatchpointValue): (JSC::B3::PatchpointValue::dumpMeta): * b3/B3PatchpointValue.h: Added. (JSC::B3::PatchpointValue::accepts): (JSC::B3::PatchpointValue::PatchpointValue): * b3/B3PhaseScope.cpp: Added. (JSC::B3::PhaseScope::PhaseScope): (JSC::B3::PhaseScope::~PhaseScope): * b3/B3PhaseScope.h: Added. * b3/B3Procedure.cpp: Added. (JSC::B3::Procedure::Procedure): (JSC::B3::Procedure::~Procedure): (JSC::B3::Procedure::addBlock): (JSC::B3::Procedure::resetReachability): (JSC::B3::Procedure::dump): (JSC::B3::Procedure::blocksInPreOrder): (JSC::B3::Procedure::blocksInPostOrder): * b3/B3Procedure.h: Added. (JSC::B3::Procedure::size): (JSC::B3::Procedure::at): (JSC::B3::Procedure::operator[]): (JSC::B3::Procedure::iterator::iterator): (JSC::B3::Procedure::iterator::operator*): (JSC::B3::Procedure::iterator::operator++): (JSC::B3::Procedure::iterator::operator==): (JSC::B3::Procedure::iterator::operator!=): (JSC::B3::Procedure::iterator::findNext): (JSC::B3::Procedure::begin): (JSC::B3::Procedure::end): (JSC::B3::Procedure::ValuesCollection::ValuesCollection): (JSC::B3::Procedure::ValuesCollection::iterator::iterator): (JSC::B3::Procedure::ValuesCollection::iterator::operator*): (JSC::B3::Procedure::ValuesCollection::iterator::operator++): (JSC::B3::Procedure::ValuesCollection::iterator::operator==): (JSC::B3::Procedure::ValuesCollection::iterator::operator!=): (JSC::B3::Procedure::ValuesCollection::begin): (JSC::B3::Procedure::ValuesCollection::end): (JSC::B3::Procedure::ValuesCollection::size): (JSC::B3::Procedure::ValuesCollection::at): (JSC::B3::Procedure::ValuesCollection::operator[]): (JSC::B3::Procedure::values): (JSC::B3::Procedure::setLastPhaseName): (JSC::B3::Procedure::lastPhaseName): * b3/B3ProcedureInlines.h: Added. (JSC::B3::Procedure::add): * b3/B3ReduceStrength.cpp: Added. (JSC::B3::reduceStrength): * b3/B3ReduceStrength.h: Added. * b3/B3StackSlotKind.cpp: Added. (WTF::printInternal): * b3/B3StackSlotKind.h: Added. * b3/B3StackSlotValue.cpp: Added. (JSC::B3::StackSlotValue::~StackSlotValue): (JSC::B3::StackSlotValue::dumpMeta): * b3/B3StackSlotValue.h: Added. (JSC::B3::StackSlotValue::accepts): (JSC::B3::StackSlotValue::byteSize): (JSC::B3::StackSlotValue::kind): (JSC::B3::StackSlotValue::offsetFromFP): (JSC::B3::StackSlotValue::setOffsetFromFP): (JSC::B3::StackSlotValue::StackSlotValue): * b3/B3Stackmap.cpp: Added. (JSC::B3::Stackmap::Stackmap): (JSC::B3::Stackmap::~Stackmap): (JSC::B3::Stackmap::dump): * b3/B3Stackmap.h: Added. (JSC::B3::Stackmap::constrain): (JSC::B3::Stackmap::reps): (JSC::B3::Stackmap::clobber): (JSC::B3::Stackmap::clobbered): (JSC::B3::Stackmap::setGenerator): * b3/B3StackmapSpecial.cpp: Added. (JSC::B3::StackmapSpecial::StackmapSpecial): (JSC::B3::StackmapSpecial::~StackmapSpecial): (JSC::B3::StackmapSpecial::reportUsedRegisters): (JSC::B3::StackmapSpecial::extraClobberedRegs): (JSC::B3::StackmapSpecial::forEachArgImpl): (JSC::B3::StackmapSpecial::isValidImpl): (JSC::B3::StackmapSpecial::admitsStackImpl): (JSC::B3::StackmapSpecial::appendRepsImpl): (JSC::B3::StackmapSpecial::repForArg): * b3/B3StackmapSpecial.h: Added. * b3/B3SuccessorCollection.h: Added. (JSC::B3::SuccessorCollection::SuccessorCollection): (JSC::B3::SuccessorCollection::size): (JSC::B3::SuccessorCollection::at): (JSC::B3::SuccessorCollection::operator[]): (JSC::B3::SuccessorCollection::iterator::iterator): (JSC::B3::SuccessorCollection::iterator::operator*): (JSC::B3::SuccessorCollection::iterator::operator++): (JSC::B3::SuccessorCollection::iterator::operator==): (JSC::B3::SuccessorCollection::iterator::operator!=): (JSC::B3::SuccessorCollection::begin): (JSC::B3::SuccessorCollection::end): * b3/B3SwitchCase.cpp: Added. (JSC::B3::SwitchCase::dump): * b3/B3SwitchCase.h: Added. (JSC::B3::SwitchCase::SwitchCase): (JSC::B3::SwitchCase::operator bool): (JSC::B3::SwitchCase::caseValue): (JSC::B3::SwitchCase::target): (JSC::B3::SwitchCase::targetBlock): * b3/B3SwitchValue.cpp: Added. (JSC::B3::SwitchValue::~SwitchValue): (JSC::B3::SwitchValue::removeCase): (JSC::B3::SwitchValue::appendCase): (JSC::B3::SwitchValue::dumpMeta): (JSC::B3::SwitchValue::SwitchValue): * b3/B3SwitchValue.h: Added. (JSC::B3::SwitchValue::accepts): (JSC::B3::SwitchValue::numCaseValues): (JSC::B3::SwitchValue::caseValue): (JSC::B3::SwitchValue::caseValues): (JSC::B3::SwitchValue::fallThrough): (JSC::B3::SwitchValue::size): (JSC::B3::SwitchValue::at): (JSC::B3::SwitchValue::operator[]): (JSC::B3::SwitchValue::iterator::iterator): (JSC::B3::SwitchValue::iterator::operator*): (JSC::B3::SwitchValue::iterator::operator++): (JSC::B3::SwitchValue::iterator::operator==): (JSC::B3::SwitchValue::iterator::operator!=): (JSC::B3::SwitchValue::begin): (JSC::B3::SwitchValue::end): * b3/B3Type.cpp: Added. (WTF::printInternal): * b3/B3Type.h: Added. (JSC::B3::isInt): (JSC::B3::isFloat): (JSC::B3::pointerType): * b3/B3UpsilonValue.cpp: Added. (JSC::B3::UpsilonValue::~UpsilonValue): (JSC::B3::UpsilonValue::dumpMeta): * b3/B3UpsilonValue.h: Added. (JSC::B3::UpsilonValue::accepts): (JSC::B3::UpsilonValue::phi): (JSC::B3::UpsilonValue::UpsilonValue): * b3/B3UseCounts.cpp: Added. (JSC::B3::UseCounts::UseCounts): (JSC::B3::UseCounts::~UseCounts): * b3/B3UseCounts.h: Added. (JSC::B3::UseCounts::operator[]): * b3/B3Validate.cpp: Added. (JSC::B3::validate): * b3/B3Validate.h: Added. * b3/B3Value.cpp: Added. (JSC::B3::Value::~Value): (JSC::B3::Value::replaceWithIdentity): (JSC::B3::Value::replaceWithNop): (JSC::B3::Value::dump): (JSC::B3::Value::deepDump): (JSC::B3::Value::negConstant): (JSC::B3::Value::addConstant): (JSC::B3::Value::subConstant): (JSC::B3::Value::effects): (JSC::B3::Value::performSubstitution): (JSC::B3::Value::dumpMeta): (JSC::B3::Value::typeFor): * b3/B3Value.h: Added. (JSC::B3::DeepValueDump::DeepValueDump): (JSC::B3::DeepValueDump::dump): (JSC::B3::deepDump): * b3/B3ValueInlines.h: Added. (JSC::B3::Value::as): (JSC::B3::Value::isConstant): (JSC::B3::Value::hasInt32): (JSC::B3::Value::asInt32): (JSC::B3::Value::hasInt64): (JSC::B3::Value::asInt64): (JSC::B3::Value::hasInt): (JSC::B3::Value::asInt): (JSC::B3::Value::isInt): (JSC::B3::Value::hasIntPtr): (JSC::B3::Value::asIntPtr): (JSC::B3::Value::hasDouble): (JSC::B3::Value::asDouble): (JSC::B3::Value::stackmap): * b3/B3ValueRep.cpp: Added. (JSC::B3::ValueRep::dump): (WTF::printInternal): * b3/B3ValueRep.h: Added. (JSC::B3::ValueRep::ValueRep): (JSC::B3::ValueRep::reg): (JSC::B3::ValueRep::stack): (JSC::B3::ValueRep::stackArgument): (JSC::B3::ValueRep::constant): (JSC::B3::ValueRep::constantDouble): (JSC::B3::ValueRep::kind): (JSC::B3::ValueRep::operator bool): (JSC::B3::ValueRep::offsetFromFP): (JSC::B3::ValueRep::offsetFromSP): (JSC::B3::ValueRep::value): (JSC::B3::ValueRep::doubleValue): * b3/air: Added. * b3/air/AirAllocateStack.cpp: Added. (JSC::B3::Air::allocateStack): * b3/air/AirAllocateStack.h: Added. * b3/air/AirArg.cpp: Added. (JSC::B3::Air::Arg::dump): * b3/air/AirArg.h: Added. (JSC::B3::Air::Arg::isUse): (JSC::B3::Air::Arg::isDef): (JSC::B3::Air::Arg::typeForB3Type): (JSC::B3::Air::Arg::Arg): (JSC::B3::Air::Arg::imm): (JSC::B3::Air::Arg::imm64): (JSC::B3::Air::Arg::addr): (JSC::B3::Air::Arg::stack): (JSC::B3::Air::Arg::callArg): (JSC::B3::Air::Arg::isValidScale): (JSC::B3::Air::Arg::logScale): (JSC::B3::Air::Arg::index): (JSC::B3::Air::Arg::relCond): (JSC::B3::Air::Arg::resCond): (JSC::B3::Air::Arg::special): (JSC::B3::Air::Arg::operator==): (JSC::B3::Air::Arg::operator!=): (JSC::B3::Air::Arg::operator bool): (JSC::B3::Air::Arg::kind): (JSC::B3::Air::Arg::isTmp): (JSC::B3::Air::Arg::isImm): (JSC::B3::Air::Arg::isImm64): (JSC::B3::Air::Arg::isAddr): (JSC::B3::Air::Arg::isStack): (JSC::B3::Air::Arg::isCallArg): (JSC::B3::Air::Arg::isIndex): (JSC::B3::Air::Arg::isRelCond): (JSC::B3::Air::Arg::isResCond): (JSC::B3::Air::Arg::isSpecial): (JSC::B3::Air::Arg::isAlive): (JSC::B3::Air::Arg::tmp): (JSC::B3::Air::Arg::value): (JSC::B3::Air::Arg::pointerValue): (JSC::B3::Air::Arg::base): (JSC::B3::Air::Arg::hasOffset): (JSC::B3::Air::Arg::offset): (JSC::B3::Air::Arg::stackSlot): (JSC::B3::Air::Arg::scale): (JSC::B3::Air::Arg::isGPTmp): (JSC::B3::Air::Arg::isFPTmp): (JSC::B3::Air::Arg::isGP): (JSC::B3::Air::Arg::isFP): (JSC::B3::Air::Arg::hasType): (JSC::B3::Air::Arg::type): (JSC::B3::Air::Arg::isType): (JSC::B3::Air::Arg::isGPR): (JSC::B3::Air::Arg::gpr): (JSC::B3::Air::Arg::isFPR): (JSC::B3::Air::Arg::fpr): (JSC::B3::Air::Arg::isReg): (JSC::B3::Air::Arg::reg): (JSC::B3::Air::Arg::gpTmpIndex): (JSC::B3::Air::Arg::fpTmpIndex): (JSC::B3::Air::Arg::tmpIndex): (JSC::B3::Air::Arg::withOffset): (JSC::B3::Air::Arg::forEachTmpFast): (JSC::B3::Air::Arg::forEachTmp): (JSC::B3::Air::Arg::asTrustedImm32): (JSC::B3::Air::Arg::asTrustedImm64): (JSC::B3::Air::Arg::asTrustedImmPtr): (JSC::B3::Air::Arg::asAddress): (JSC::B3::Air::Arg::asBaseIndex): (JSC::B3::Air::Arg::asRelationalCondition): (JSC::B3::Air::Arg::asResultCondition): (JSC::B3::Air::Arg::isHashTableDeletedValue): (JSC::B3::Air::Arg::hash): (JSC::B3::Air::ArgHash::hash): (JSC::B3::Air::ArgHash::equal): * b3/air/AirBasicBlock.cpp: Added. (JSC::B3::Air::BasicBlock::addPredecessor): (JSC::B3::Air::BasicBlock::removePredecessor): (JSC::B3::Air::BasicBlock::replacePredecessor): (JSC::B3::Air::BasicBlock::dump): (JSC::B3::Air::BasicBlock::deepDump): (JSC::B3::Air::BasicBlock::BasicBlock): * b3/air/AirBasicBlock.h: Added. (JSC::B3::Air::BasicBlock::index): (JSC::B3::Air::BasicBlock::size): (JSC::B3::Air::BasicBlock::begin): (JSC::B3::Air::BasicBlock::end): (JSC::B3::Air::BasicBlock::at): (JSC::B3::Air::BasicBlock::last): (JSC::B3::Air::BasicBlock::appendInst): (JSC::B3::Air::BasicBlock::append): (JSC::B3::Air::BasicBlock::numSuccessors): (JSC::B3::Air::BasicBlock::successor): (JSC::B3::Air::BasicBlock::successors): (JSC::B3::Air::BasicBlock::successorBlock): (JSC::B3::Air::BasicBlock::successorBlocks): (JSC::B3::Air::BasicBlock::numPredecessors): (JSC::B3::Air::BasicBlock::predecessor): (JSC::B3::Air::BasicBlock::predecessors): (JSC::B3::Air::DeepBasicBlockDump::DeepBasicBlockDump): (JSC::B3::Air::DeepBasicBlockDump::dump): (JSC::B3::Air::deepDump): * b3/air/AirCCallSpecial.cpp: Added. (JSC::B3::Air::CCallSpecial::CCallSpecial): (JSC::B3::Air::CCallSpecial::~CCallSpecial): (JSC::B3::Air::CCallSpecial::forEachArg): (JSC::B3::Air::CCallSpecial::isValid): (JSC::B3::Air::CCallSpecial::admitsStack): (JSC::B3::Air::CCallSpecial::reportUsedRegisters): (JSC::B3::Air::CCallSpecial::generate): (JSC::B3::Air::CCallSpecial::extraClobberedRegs): (JSC::B3::Air::CCallSpecial::dumpImpl): (JSC::B3::Air::CCallSpecial::deepDumpImpl): * b3/air/AirCCallSpecial.h: Added. * b3/air/AirCode.cpp: Added. (JSC::B3::Air::Code::Code): (JSC::B3::Air::Code::~Code): (JSC::B3::Air::Code::addBlock): (JSC::B3::Air::Code::addStackSlot): (JSC::B3::Air::Code::addSpecial): (JSC::B3::Air::Code::cCallSpecial): (JSC::B3::Air::Code::resetReachability): (JSC::B3::Air::Code::dump): (JSC::B3::Air::Code::findFirstBlockIndex): (JSC::B3::Air::Code::findNextBlockIndex): (JSC::B3::Air::Code::findNextBlock): * b3/air/AirCode.h: Added. (JSC::B3::Air::Code::newTmp): (JSC::B3::Air::Code::numTmps): (JSC::B3::Air::Code::callArgAreaSize): (JSC::B3::Air::Code::requestCallArgAreaSize): (JSC::B3::Air::Code::frameSize): (JSC::B3::Air::Code::setFrameSize): (JSC::B3::Air::Code::calleeSaveRegisters): (JSC::B3::Air::Code::size): (JSC::B3::Air::Code::at): (JSC::B3::Air::Code::operator[]): (JSC::B3::Air::Code::iterator::iterator): (JSC::B3::Air::Code::iterator::operator*): (JSC::B3::Air::Code::iterator::operator++): (JSC::B3::Air::Code::iterator::operator==): (JSC::B3::Air::Code::iterator::operator!=): (JSC::B3::Air::Code::begin): (JSC::B3::Air::Code::end): (JSC::B3::Air::Code::StackSlotsCollection::StackSlotsCollection): (JSC::B3::Air::Code::StackSlotsCollection::size): (JSC::B3::Air::Code::StackSlotsCollection::at): (JSC::B3::Air::Code::StackSlotsCollection::operator[]): (JSC::B3::Air::Code::StackSlotsCollection::iterator::iterator): (JSC::B3::Air::Code::StackSlotsCollection::iterator::operator*): (JSC::B3::Air::Code::StackSlotsCollection::iterator::operator++): (JSC::B3::Air::Code::StackSlotsCollection::iterator::operator==): (JSC::B3::Air::Code::StackSlotsCollection::iterator::operator!=): (JSC::B3::Air::Code::StackSlotsCollection::begin): (JSC::B3::Air::Code::StackSlotsCollection::end): (JSC::B3::Air::Code::stackSlots): (JSC::B3::Air::Code::SpecialsCollection::SpecialsCollection): (JSC::B3::Air::Code::SpecialsCollection::size): (JSC::B3::Air::Code::SpecialsCollection::at): (JSC::B3::Air::Code::SpecialsCollection::operator[]): (JSC::B3::Air::Code::SpecialsCollection::iterator::iterator): (JSC::B3::Air::Code::SpecialsCollection::iterator::operator*): (JSC::B3::Air::Code::SpecialsCollection::iterator::operator++): (JSC::B3::Air::Code::SpecialsCollection::iterator::operator==): (JSC::B3::Air::Code::SpecialsCollection::iterator::operator!=): (JSC::B3::Air::Code::SpecialsCollection::begin): (JSC::B3::Air::Code::SpecialsCollection::end): (JSC::B3::Air::Code::specials): (JSC::B3::Air::Code::setLastPhaseName): (JSC::B3::Air::Code::lastPhaseName): * b3/air/AirFrequentedBlock.h: Added. * b3/air/AirGenerate.cpp: Added. (JSC::B3::Air::generate): * b3/air/AirGenerate.h: Added. * b3/air/AirGenerated.cpp: Added. * b3/air/AirGenerationContext.h: Added. * b3/air/AirHandleCalleeSaves.cpp: Added. (JSC::B3::Air::handleCalleeSaves): * b3/air/AirHandleCalleeSaves.h: Added. * b3/air/AirInsertionSet.cpp: Added. (JSC::B3::Air::InsertionSet::execute): * b3/air/AirInsertionSet.h: Added. (JSC::B3::Air::InsertionSet::InsertionSet): (JSC::B3::Air::InsertionSet::code): (JSC::B3::Air::InsertionSet::appendInsertion): (JSC::B3::Air::InsertionSet::insertInst): (JSC::B3::Air::InsertionSet::insert): * b3/air/AirInst.cpp: Added. (JSC::B3::Air::Inst::dump): * b3/air/AirInst.h: Added. (JSC::B3::Air::Inst::Inst): (JSC::B3::Air::Inst::opcode): (JSC::B3::Air::Inst::forEachTmpFast): (JSC::B3::Air::Inst::forEachTmp): * b3/air/AirInstInlines.h: Added. (JSC::B3::Air::ForEach<Tmp>::forEach): (JSC::B3::Air::ForEach<Arg>::forEach): (JSC::B3::Air::Inst::forEach): (JSC::B3::Air::Inst::hasSpecial): (JSC::B3::Air::Inst::extraClobberedRegs): (JSC::B3::Air::Inst::reportUsedRegisters): (JSC::B3::Air::isShiftValid): (JSC::B3::Air::isLshift32Valid): * b3/air/AirLiveness.h: Added. (JSC::B3::Air::Liveness::Liveness): (JSC::B3::Air::Liveness::liveAtHead): (JSC::B3::Air::Liveness::liveAtTail): (JSC::B3::Air::Liveness::LocalCalc::LocalCalc): (JSC::B3::Air::Liveness::LocalCalc::live): (JSC::B3::Air::Liveness::LocalCalc::takeLive): (JSC::B3::Air::Liveness::LocalCalc::execute): * b3/air/AirOpcode.opcodes: Added. * b3/air/AirPhaseScope.cpp: Added. (JSC::B3::Air::PhaseScope::PhaseScope): (JSC::B3::Air::PhaseScope::~PhaseScope): * b3/air/AirPhaseScope.h: Added. * b3/air/AirRegisterPriority.cpp: Added. (JSC::B3::Air::gprsInPriorityOrder): (JSC::B3::Air::fprsInPriorityOrder): (JSC::B3::Air::regsInPriorityOrder): * b3/air/AirRegisterPriority.h: Added. (JSC::B3::Air::RegistersInPriorityOrder<GPRInfo>::inPriorityOrder): (JSC::B3::Air::RegistersInPriorityOrder<FPRInfo>::inPriorityOrder): (JSC::B3::Air::regsInPriorityOrder): * b3/air/AirSpecial.cpp: Added. (JSC::B3::Air::Special::Special): (JSC::B3::Air::Special::~Special): (JSC::B3::Air::Special::name): (JSC::B3::Air::Special::dump): (JSC::B3::Air::Special::deepDump): * b3/air/AirSpecial.h: Added. (JSC::B3::Air::DeepSpecialDump::DeepSpecialDump): (JSC::B3::Air::DeepSpecialDump::dump): (JSC::B3::Air::deepDump): * b3/air/AirSpillEverything.cpp: Added. (JSC::B3::Air::spillEverything): * b3/air/AirSpillEverything.h: Added. * b3/air/AirStackSlot.cpp: Added. (JSC::B3::Air::StackSlot::setOffsetFromFP): (JSC::B3::Air::StackSlot::dump): (JSC::B3::Air::StackSlot::deepDump): (JSC::B3::Air::StackSlot::StackSlot): * b3/air/AirStackSlot.h: Added. (JSC::B3::Air::StackSlot::byteSize): (JSC::B3::Air::StackSlot::kind): (JSC::B3::Air::StackSlot::index): (JSC::B3::Air::StackSlot::alignment): (JSC::B3::Air::StackSlot::value): (JSC::B3::Air::StackSlot::offsetFromFP): (JSC::B3::Air::DeepStackSlotDump::DeepStackSlotDump): (JSC::B3::Air::DeepStackSlotDump::dump): (JSC::B3::Air::deepDump): * b3/air/AirTmp.cpp: Added. (JSC::B3::Air::Tmp::dump): * b3/air/AirTmp.h: Added. (JSC::B3::Air::Tmp::Tmp): (JSC::B3::Air::Tmp::gpTmpForIndex): (JSC::B3::Air::Tmp::fpTmpForIndex): (JSC::B3::Air::Tmp::operator bool): (JSC::B3::Air::Tmp::isGP): (JSC::B3::Air::Tmp::isFP): (JSC::B3::Air::Tmp::isGPR): (JSC::B3::Air::Tmp::isFPR): (JSC::B3::Air::Tmp::isReg): (JSC::B3::Air::Tmp::gpr): (JSC::B3::Air::Tmp::fpr): (JSC::B3::Air::Tmp::reg): (JSC::B3::Air::Tmp::hasTmpIndex): (JSC::B3::Air::Tmp::gpTmpIndex): (JSC::B3::Air::Tmp::fpTmpIndex): (JSC::B3::Air::Tmp::tmpIndex): (JSC::B3::Air::Tmp::isAlive): (JSC::B3::Air::Tmp::operator==): (JSC::B3::Air::Tmp::operator!=): (JSC::B3::Air::Tmp::isHashTableDeletedValue): (JSC::B3::Air::Tmp::hash): (JSC::B3::Air::Tmp::encodeGP): (JSC::B3::Air::Tmp::encodeFP): (JSC::B3::Air::Tmp::encodeGPR): (JSC::B3::Air::Tmp::encodeFPR): (JSC::B3::Air::Tmp::encodeGPTmp): (JSC::B3::Air::Tmp::encodeFPTmp): (JSC::B3::Air::Tmp::isEncodedGP): (JSC::B3::Air::Tmp::isEncodedFP): (JSC::B3::Air::Tmp::isEncodedGPR): (JSC::B3::Air::Tmp::isEncodedFPR): (JSC::B3::Air::Tmp::isEncodedGPTmp): (JSC::B3::Air::Tmp::isEncodedFPTmp): (JSC::B3::Air::Tmp::decodeGPR): (JSC::B3::Air::Tmp::decodeFPR): (JSC::B3::Air::Tmp::decodeGPTmp): (JSC::B3::Air::Tmp::decodeFPTmp): (JSC::B3::Air::TmpHash::hash): (JSC::B3::Air::TmpHash::equal): * b3/air/AirTmpInlines.h: Added. (JSC::B3::Air::Tmp::Tmp): * b3/air/AirValidate.cpp: Added. (JSC::B3::Air::validate): * b3/air/AirValidate.h: Added. * b3/air/opcode_generator.rb: Added. * b3/generate_pattern_matcher.rb: Added. * b3/testb3.cpp: Added. (JSC::B3::compileAndRun): (JSC::B3::test42): (JSC::B3::testLoad42): (JSC::B3::testArg): (JSC::B3::testAddArgs): (JSC::B3::testAddArgs32): (JSC::B3::testStore): (JSC::B3::testTrunc): (JSC::B3::testAdd1): (JSC::B3::testStoreAddLoad): (JSC::B3::testStoreAddAndLoad): (JSC::B3::testAdd1Uncommuted): (JSC::B3::testLoadOffset): (JSC::B3::testLoadOffsetNotConstant): (JSC::B3::testLoadOffsetUsingAdd): (JSC::B3::testLoadOffsetUsingAddNotConstant): (JSC::B3::run): (run): (main): * bytecode/CodeBlock.h: (JSC::CodeBlock::specializationKind): * jit/Reg.h: (JSC::Reg::index): (JSC::Reg::isSet): (JSC::Reg::operator bool): (JSC::Reg::isHashTableDeletedValue): (JSC::Reg::AllRegsIterable::iterator::iterator): (JSC::Reg::AllRegsIterable::iterator::operator*): (JSC::Reg::AllRegsIterable::iterator::operator++): (JSC::Reg::AllRegsIterable::iterator::operator==): (JSC::Reg::AllRegsIterable::iterator::operator!=): (JSC::Reg::AllRegsIterable::begin): (JSC::Reg::AllRegsIterable::end): (JSC::Reg::all): (JSC::Reg::invalid): (JSC::Reg::operator!): Deleted. * jit/RegisterAtOffsetList.cpp: (JSC::RegisterAtOffsetList::RegisterAtOffsetList): * jit/RegisterAtOffsetList.h: (JSC::RegisterAtOffsetList::clear): (JSC::RegisterAtOffsetList::size): (JSC::RegisterAtOffsetList::begin): (JSC::RegisterAtOffsetList::end): * jit/RegisterSet.h: (JSC::RegisterSet::operator==): (JSC::RegisterSet::hash): (JSC::RegisterSet::forEach): (JSC::RegisterSet::setAny): Source/WTF: * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/HashSet.h: (WTF::copyToVector): (WTF::=): * wtf/ListDump.h: (WTF::PointerListDump::PointerListDump): (WTF::PointerListDump::dump): (WTF::MapDump::MapDump): (WTF::listDump): (WTF::pointerListDump): (WTF::sortedListDump): * wtf/MathExtras.h: (WTF::leftShiftWithSaturation): (WTF::rangesOverlap): * wtf/Platform.h: * wtf/ScopedLambda.h: Added. (WTF::scopedLambda): * wtf/SharedTask.h: (WTF::createSharedTask): Canonical link: https://commits.webkit.org/168813@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@191705 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-10-28 23:57:04 +00:00
template<typename T>
class PointerListDump {
public:
PointerListDump(const T& list, const char* comma)
: m_list(list)
, m_comma(comma)
{
}
void dump(PrintStream& out) const
{
for (auto iter = m_list.begin(); iter != m_list.end(); ++iter)
out.print(m_comma, pointerDump(*iter));
}
private:
const T& m_list;
CommaPrinter m_comma;
};
fourthTier: DFG should have an SSA form for use by FTL https://bugs.webkit.org/show_bug.cgi?id=118338 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. Adds an SSA form to the DFG. We can convert ThreadedCPS form into SSA form after breaking critical edges. The conversion algorithm follows Aycock and Horspool, and the SSA form itself follows something I've done before, where instead of having Phi functions specify input nodes corresponding to block predecessors, we instead have Upsilon functions in the predecessors that specify which value in that block goes into which subsequent Phi. Upsilons don't have to dominate Phis (usually they don't) and they correspond to a non-SSA "mov" into the Phi's "variable". This gives all of the good properties of SSA, while ensuring that a bunch of CFG transformations don't have to be SSA-aware. So far the only DFG phases that are SSA-aware are DCE and CFA. CFG simplification is probably SSA-aware by default, though I haven't tried it. Constant folding probably needs a few tweaks, but is likely ready. Ditto for CSE, though it's not clear that we'd want to use block-local CSE when we could be doing GVN. Currently only the FTL can generate code from the SSA form, and there is no way to convert from SSA to ThreadedCPS or LoadStore. There probably will never be such a capability. In order to handle OSR exit state in the SSA, we place MovHints at Phi points. Other than that, you can reconstruct state-at-exit by forward propagating MovHints. Note that MovHint is the new SetLocal in SSA. SetLocal and GetLocal only survive into SSA if they are on captured variables, or in the case of flushes. A "live SetLocal" will be NodeMustGenerate and will always correspond to a flush. Computing the state-at-exit requires running SSA liveness analysis, OSR availability analysis, and flush liveness analysis. The FTL runs all of these prior to generating code. While OSR exit continues to be tricky, much of the logic is now factored into separate phases and the backend has to do less work to reason about what happened outside of the basic block that is being lowered. Conversion from DFG SSA to LLVM SSA is done by ensuring that we generate code in depth-first order, thus guaranteeing that a node will always be lowered (and hence have a LValue) before any of the blocks dominated by that node's block have code generated. For Upsilon/Phi, we just use alloca's. We could do something more clever there, but it's probably not worth it, at least not now. Finally, while the SSA form is currently only being converted to LLVM IR, there is nothing that prevents us from considering other backends in the future - with the caveat that this form is designed to be first lowered to a lower-level SSA before actual machine code generation commences. So we ought to either use LLVM (the intended path) or we will have to write our own SSA low-level backend. This runs all of the code that the FTL was known to run previously. No change in performance for now. But it does open some exciting possibilities! * JavaScriptCore.xcodeproj/project.pbxproj: * bytecode/Operands.h: (JSC::OperandValueTraits::dump): (JSC::Operands::fill): (Operands): (JSC::Operands::clear): (JSC::Operands::operator==): * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::beginBasicBlock): (JSC::DFG::setLiveValues): (DFG): (JSC::DFG::AbstractState::initialize): (JSC::DFG::AbstractState::endBasicBlock): (JSC::DFG::AbstractState::executeEffects): (JSC::DFG::AbstractState::mergeStateAtTail): (JSC::DFG::AbstractState::merge): * dfg/DFGAbstractState.h: (AbstractState): * dfg/DFGAdjacencyList.h: (JSC::DFG::AdjacencyList::justOneChild): (AdjacencyList): * dfg/DFGBasicBlock.cpp: Added. (DFG): (JSC::DFG::BasicBlock::BasicBlock): (JSC::DFG::BasicBlock::~BasicBlock): (JSC::DFG::BasicBlock::ensureLocals): (JSC::DFG::BasicBlock::isInPhis): (JSC::DFG::BasicBlock::isInBlock): (JSC::DFG::BasicBlock::removePredecessor): (JSC::DFG::BasicBlock::replacePredecessor): (JSC::DFG::BasicBlock::dump): (JSC::DFG::BasicBlock::SSAData::SSAData): (JSC::DFG::BasicBlock::SSAData::~SSAData): * dfg/DFGBasicBlock.h: (BasicBlock): (JSC::DFG::BasicBlock::operator[]): (JSC::DFG::BasicBlock::successor): (JSC::DFG::BasicBlock::successorForCondition): (SSAData): * dfg/DFGBasicBlockInlines.h: (DFG): * dfg/DFGBlockInsertionSet.cpp: Added. (DFG): (JSC::DFG::BlockInsertionSet::BlockInsertionSet): (JSC::DFG::BlockInsertionSet::~BlockInsertionSet): (JSC::DFG::BlockInsertionSet::insert): (JSC::DFG::BlockInsertionSet::insertBefore): (JSC::DFG::BlockInsertionSet::execute): * dfg/DFGBlockInsertionSet.h: Added. (DFG): (BlockInsertionSet): * dfg/DFGCFAPhase.cpp: (JSC::DFG::CFAPhase::run): * dfg/DFGCFGSimplificationPhase.cpp: * dfg/DFGCPSRethreadingPhase.cpp: (JSC::DFG::CPSRethreadingPhase::canonicalizeLocalsInBlock): * dfg/DFGCommon.cpp: (WTF::printInternal): * dfg/DFGCommon.h: (JSC::DFG::doesKill): (DFG): (JSC::DFG::killStatusForDoesKill): * dfg/DFGConstantFoldingPhase.cpp: (JSC::DFG::ConstantFoldingPhase::foldConstants): (JSC::DFG::ConstantFoldingPhase::isCapturedAtOrAfter): * dfg/DFGCriticalEdgeBreakingPhase.cpp: Added. (DFG): (CriticalEdgeBreakingPhase): (JSC::DFG::CriticalEdgeBreakingPhase::CriticalEdgeBreakingPhase): (JSC::DFG::CriticalEdgeBreakingPhase::run): (JSC::DFG::CriticalEdgeBreakingPhase::breakCriticalEdge): (JSC::DFG::performCriticalEdgeBreaking): * dfg/DFGCriticalEdgeBreakingPhase.h: Added. (DFG): * dfg/DFGDCEPhase.cpp: (JSC::DFG::DCEPhase::run): (JSC::DFG::DCEPhase::findTypeCheckRoot): (JSC::DFG::DCEPhase::countNode): (DCEPhase): (JSC::DFG::DCEPhase::countEdge): (JSC::DFG::DCEPhase::eliminateIrrelevantPhantomChildren): * dfg/DFGDriver.cpp: (JSC::DFG::compile): * dfg/DFGEdge.cpp: (JSC::DFG::Edge::dump): * dfg/DFGEdge.h: (JSC::DFG::Edge::Edge): (JSC::DFG::Edge::setNode): (JSC::DFG::Edge::useKindUnchecked): (JSC::DFG::Edge::setUseKind): (JSC::DFG::Edge::setProofStatus): (JSC::DFG::Edge::willNotHaveCheck): (JSC::DFG::Edge::willHaveCheck): (Edge): (JSC::DFG::Edge::killStatusUnchecked): (JSC::DFG::Edge::killStatus): (JSC::DFG::Edge::setKillStatus): (JSC::DFG::Edge::doesKill): (JSC::DFG::Edge::doesNotKill): (JSC::DFG::Edge::shift): (JSC::DFG::Edge::makeWord): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGFlushFormat.cpp: Added. (WTF): (WTF::printInternal): * dfg/DFGFlushFormat.h: Added. (DFG): (JSC::DFG::resultFor): (JSC::DFG::useKindFor): (WTF): * dfg/DFGFlushLivenessAnalysisPhase.cpp: Added. (DFG): (FlushLivenessAnalysisPhase): (JSC::DFG::FlushLivenessAnalysisPhase::FlushLivenessAnalysisPhase): (JSC::DFG::FlushLivenessAnalysisPhase::run): (JSC::DFG::FlushLivenessAnalysisPhase::process): (JSC::DFG::FlushLivenessAnalysisPhase::setForNode): (JSC::DFG::FlushLivenessAnalysisPhase::flushFormat): (JSC::DFG::performFlushLivenessAnalysis): * dfg/DFGFlushLivenessAnalysisPhase.h: Added. (DFG): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::dump): (JSC::DFG::Graph::dumpBlockHeader): (DFG): (JSC::DFG::Graph::addForDepthFirstSort): (JSC::DFG::Graph::getBlocksInDepthFirstOrder): * dfg/DFGGraph.h: (JSC::DFG::Graph::convertToConstant): (JSC::DFG::Graph::valueProfileFor): (Graph): * dfg/DFGInsertionSet.h: (DFG): (JSC::DFG::InsertionSet::execute): * dfg/DFGLivenessAnalysisPhase.cpp: Added. (DFG): (LivenessAnalysisPhase): (JSC::DFG::LivenessAnalysisPhase::LivenessAnalysisPhase): (JSC::DFG::LivenessAnalysisPhase::run): (JSC::DFG::LivenessAnalysisPhase::process): (JSC::DFG::LivenessAnalysisPhase::addChildUse): (JSC::DFG::performLivenessAnalysis): * dfg/DFGLivenessAnalysisPhase.h: Added. (DFG): * dfg/DFGNode.cpp: (JSC::DFG::Node::hasVariableAccessData): (DFG): * dfg/DFGNode.h: (DFG): (Node): (JSC::DFG::Node::hasLocal): (JSC::DFG::Node::variableAccessData): (JSC::DFG::Node::hasPhi): (JSC::DFG::Node::phi): (JSC::DFG::Node::takenBlock): (JSC::DFG::Node::notTakenBlock): (JSC::DFG::Node::successor): (JSC::DFG::Node::successorForCondition): (JSC::DFG::nodeComparator): (JSC::DFG::nodeListDump): (JSC::DFG::nodeMapDump): * dfg/DFGNodeFlags.cpp: (JSC::DFG::dumpNodeFlags): * dfg/DFGNodeType.h: (DFG): * dfg/DFGOSRAvailabilityAnalysisPhase.cpp: Added. (DFG): (OSRAvailabilityAnalysisPhase): (JSC::DFG::OSRAvailabilityAnalysisPhase::OSRAvailabilityAnalysisPhase): (JSC::DFG::OSRAvailabilityAnalysisPhase::run): (JSC::DFG::performOSRAvailabilityAnalysis): * dfg/DFGOSRAvailabilityAnalysisPhase.h: Added. (DFG): * dfg/DFGPlan.cpp: (JSC::DFG::Plan::compileInThreadImpl): * dfg/DFGPredictionInjectionPhase.cpp: (JSC::DFG::PredictionInjectionPhase::run): * dfg/DFGPredictionPropagationPhase.cpp: (JSC::DFG::PredictionPropagationPhase::propagate): * dfg/DFGSSAConversionPhase.cpp: Added. (DFG): (SSAConversionPhase): (JSC::DFG::SSAConversionPhase::SSAConversionPhase): (JSC::DFG::SSAConversionPhase::run): (JSC::DFG::SSAConversionPhase::forwardPhiChildren): (JSC::DFG::SSAConversionPhase::forwardPhi): (JSC::DFG::SSAConversionPhase::forwardPhiEdge): (JSC::DFG::SSAConversionPhase::deduplicateChildren): (JSC::DFG::SSAConversionPhase::addFlushedLocalOp): (JSC::DFG::SSAConversionPhase::addFlushedLocalEdge): (JSC::DFG::performSSAConversion): * dfg/DFGSSAConversionPhase.h: Added. (DFG): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGValidate.cpp: (JSC::DFG::Validate::validate): (Validate): (JSC::DFG::Validate::validateCPS): * dfg/DFGVariableAccessData.h: (JSC::DFG::VariableAccessData::flushFormat): (VariableAccessData): * ftl/FTLCapabilities.cpp: (JSC::FTL::canCompile): * ftl/FTLLowerDFGToLLVM.cpp: (JSC::FTL::LowerDFGToLLVM::LowerDFGToLLVM): (JSC::FTL::LowerDFGToLLVM::lower): (JSC::FTL::LowerDFGToLLVM::createPhiVariables): (JSC::FTL::LowerDFGToLLVM::compileBlock): (JSC::FTL::LowerDFGToLLVM::compileNode): (JSC::FTL::LowerDFGToLLVM::compileUpsilon): (LowerDFGToLLVM): (JSC::FTL::LowerDFGToLLVM::compilePhi): (JSC::FTL::LowerDFGToLLVM::compileJSConstant): (JSC::FTL::LowerDFGToLLVM::compileWeakJSConstant): (JSC::FTL::LowerDFGToLLVM::compileGetArgument): (JSC::FTL::LowerDFGToLLVM::compileGetLocal): (JSC::FTL::LowerDFGToLLVM::compileSetLocal): (JSC::FTL::LowerDFGToLLVM::compileAdd): (JSC::FTL::LowerDFGToLLVM::compileArithSub): (JSC::FTL::LowerDFGToLLVM::compileArithMul): (JSC::FTL::LowerDFGToLLVM::compileArithDiv): (JSC::FTL::LowerDFGToLLVM::compileArithMod): (JSC::FTL::LowerDFGToLLVM::compileArithMinOrMax): (JSC::FTL::LowerDFGToLLVM::compileArithAbs): (JSC::FTL::LowerDFGToLLVM::compileArithNegate): (JSC::FTL::LowerDFGToLLVM::compileBitAnd): (JSC::FTL::LowerDFGToLLVM::compileBitOr): (JSC::FTL::LowerDFGToLLVM::compileBitXor): (JSC::FTL::LowerDFGToLLVM::compileBitRShift): (JSC::FTL::LowerDFGToLLVM::compileBitLShift): (JSC::FTL::LowerDFGToLLVM::compileBitURShift): (JSC::FTL::LowerDFGToLLVM::compileUInt32ToNumber): (JSC::FTL::LowerDFGToLLVM::compileInt32ToDouble): (JSC::FTL::LowerDFGToLLVM::compileGetButterfly): (JSC::FTL::LowerDFGToLLVM::compileGetArrayLength): (JSC::FTL::LowerDFGToLLVM::compileGetByVal): (JSC::FTL::LowerDFGToLLVM::compileGetByOffset): (JSC::FTL::LowerDFGToLLVM::compileGetGlobalVar): (JSC::FTL::LowerDFGToLLVM::compileCompareEqConstant): (JSC::FTL::LowerDFGToLLVM::compileCompareStrictEq): (JSC::FTL::LowerDFGToLLVM::compileCompareStrictEqConstant): (JSC::FTL::LowerDFGToLLVM::compileCompareLess): (JSC::FTL::LowerDFGToLLVM::compileCompareLessEq): (JSC::FTL::LowerDFGToLLVM::compileCompareGreater): (JSC::FTL::LowerDFGToLLVM::compileCompareGreaterEq): (JSC::FTL::LowerDFGToLLVM::compileLogicalNot): (JSC::FTL::LowerDFGToLLVM::speculateBackward): (JSC::FTL::LowerDFGToLLVM::lowInt32): (JSC::FTL::LowerDFGToLLVM::lowCell): (JSC::FTL::LowerDFGToLLVM::lowBoolean): (JSC::FTL::LowerDFGToLLVM::lowDouble): (JSC::FTL::LowerDFGToLLVM::lowJSValue): (JSC::FTL::LowerDFGToLLVM::lowStorage): (JSC::FTL::LowerDFGToLLVM::speculate): (JSC::FTL::LowerDFGToLLVM::speculateBoolean): (JSC::FTL::LowerDFGToLLVM::isLive): (JSC::FTL::LowerDFGToLLVM::use): (JSC::FTL::LowerDFGToLLVM::initializeOSRExitStateForBlock): (JSC::FTL::LowerDFGToLLVM::appendOSRExit): (JSC::FTL::LowerDFGToLLVM::emitOSRExitCall): (JSC::FTL::LowerDFGToLLVM::addExitArgumentForNode): (JSC::FTL::LowerDFGToLLVM::linkOSRExitsAndCompleteInitializationBlocks): (JSC::FTL::LowerDFGToLLVM::setInt32): (JSC::FTL::LowerDFGToLLVM::setJSValue): (JSC::FTL::LowerDFGToLLVM::setBoolean): (JSC::FTL::LowerDFGToLLVM::setStorage): (JSC::FTL::LowerDFGToLLVM::setDouble): (JSC::FTL::LowerDFGToLLVM::isValid): * ftl/FTLLoweredNodeValue.h: Added. (FTL): (LoweredNodeValue): (JSC::FTL::LoweredNodeValue::LoweredNodeValue): (JSC::FTL::LoweredNodeValue::isSet): (JSC::FTL::LoweredNodeValue::operator!): (JSC::FTL::LoweredNodeValue::value): (JSC::FTL::LoweredNodeValue::block): * ftl/FTLValueFromBlock.h: (JSC::FTL::ValueFromBlock::ValueFromBlock): (ValueFromBlock): * ftl/FTLValueSource.cpp: (JSC::FTL::ValueSource::dump): * ftl/FTLValueSource.h: Source/WTF: Reviewed by Mark Hahnenberg. - Extend variadicity of PrintStream and dataLog. - Give HashSet the ability to add a span of things. - Give HashSet the ability to == another HashSet. - Note FIXME's in HashTable concerning copying performance, that affects the way that the DFG now uses HashSets and HashMaps. - Factor out the bulk-insertion logic of JSC::DFG::InsertionSet into WTF::Insertion, so that it can be used in more places. - Create a dumper for lists and maps. * WTF.xcodeproj/project.pbxproj: * wtf/DataLog.h: (WTF): (WTF::dataLog): * wtf/HashSet.h: (HashSet): (WTF): (WTF::::add): (WTF::=): * wtf/HashTable.h: (WTF::::HashTable): (WTF::=): * wtf/Insertion.h: Added. (WTF): (Insertion): (WTF::Insertion::Insertion): (WTF::Insertion::index): (WTF::Insertion::element): (WTF::Insertion::operator<): (WTF::executeInsertions): * wtf/ListDump.h: Added. (WTF): (ListDump): (WTF::ListDump::ListDump): (WTF::ListDump::dump): (MapDump): (WTF::MapDump::MapDump): (WTF::MapDump::dump): (WTF::listDump): (WTF::sortedListDump): (WTF::lessThan): (WTF::mapDump): (WTF::sortedMapDump): * wtf/PrintStream.h: (PrintStream): (WTF::PrintStream::print): Conflicts: Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj Canonical link: https://commits.webkit.org/137058@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153274 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:04:45 +00:00
template<typename T>
class MapDump {
public:
MapDump(const T& map, const char* arrow, const char* comma)
: m_map(map)
, m_arrow(arrow)
, m_comma(comma)
{
}
void dump(PrintStream& out) const
{
FTL B3 should be able to run richards https://bugs.webkit.org/show_bug.cgi?id=152514 Reviewed by Michael Saboff. Source/JavaScriptCore: This came down to a liveness bug and a register allocation bug. The liveness bug was that the code that determined whether we should go around the fixpoint assumed that BitVector::quickSet() would return true if the bit changed state from false to true. That's not how it works. It returns the old value of the bit, so it will return false if the bit changed from false to true. Since there is already a lot of code that relies on this behavior, I fixed Liveness instead of changing BitVector. The register allocation bug was that we weren't guarding some checks of tmp()'s with checks that the Arg isTmp(). The liveness took a long time to track down, and I needed to add a lot of dumping to do it. It's now possible to dump more of the liveness states, including liveAtHead. I found this extremely helpful, so I removed the code that cleared liveAtHead. * b3/air/AirIteratedRegisterCoalescing.cpp: * b3/air/AirLiveness.h: (JSC::B3::Air::AbstractLiveness::AbstractLiveness): (JSC::B3::Air::AbstractLiveness::Iterable::Iterable): (JSC::B3::Air::AbstractLiveness::Iterable::iterator::iterator): (JSC::B3::Air::AbstractLiveness::Iterable::iterator::operator*): (JSC::B3::Air::AbstractLiveness::Iterable::iterator::operator++): (JSC::B3::Air::AbstractLiveness::Iterable::iterator::operator==): (JSC::B3::Air::AbstractLiveness::Iterable::iterator::operator!=): (JSC::B3::Air::AbstractLiveness::Iterable::begin): (JSC::B3::Air::AbstractLiveness::Iterable::end): (JSC::B3::Air::AbstractLiveness::liveAtHead): (JSC::B3::Air::AbstractLiveness::liveAtTail): * b3/air/AirStackSlot.h: (WTF::printInternal): * ftl/FTLOSRExitCompiler.cpp: (JSC::FTL::compileFTLOSRExit): Source/WTF: Change the list dumping helpers to work with a broader set of list kinds. * wtf/ListDump.h: (WTF::ListDump::dump): (WTF::MapDump::dump): (WTF::sortedMapDump): (WTF::ListDumpInContext::dump): Canonical link: https://commits.webkit.org/170620@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@194382 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-12-23 01:50:19 +00:00
for (auto iter = m_map.begin(); iter != m_map.end(); ++iter)
fourthTier: DFG should have an SSA form for use by FTL https://bugs.webkit.org/show_bug.cgi?id=118338 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. Adds an SSA form to the DFG. We can convert ThreadedCPS form into SSA form after breaking critical edges. The conversion algorithm follows Aycock and Horspool, and the SSA form itself follows something I've done before, where instead of having Phi functions specify input nodes corresponding to block predecessors, we instead have Upsilon functions in the predecessors that specify which value in that block goes into which subsequent Phi. Upsilons don't have to dominate Phis (usually they don't) and they correspond to a non-SSA "mov" into the Phi's "variable". This gives all of the good properties of SSA, while ensuring that a bunch of CFG transformations don't have to be SSA-aware. So far the only DFG phases that are SSA-aware are DCE and CFA. CFG simplification is probably SSA-aware by default, though I haven't tried it. Constant folding probably needs a few tweaks, but is likely ready. Ditto for CSE, though it's not clear that we'd want to use block-local CSE when we could be doing GVN. Currently only the FTL can generate code from the SSA form, and there is no way to convert from SSA to ThreadedCPS or LoadStore. There probably will never be such a capability. In order to handle OSR exit state in the SSA, we place MovHints at Phi points. Other than that, you can reconstruct state-at-exit by forward propagating MovHints. Note that MovHint is the new SetLocal in SSA. SetLocal and GetLocal only survive into SSA if they are on captured variables, or in the case of flushes. A "live SetLocal" will be NodeMustGenerate and will always correspond to a flush. Computing the state-at-exit requires running SSA liveness analysis, OSR availability analysis, and flush liveness analysis. The FTL runs all of these prior to generating code. While OSR exit continues to be tricky, much of the logic is now factored into separate phases and the backend has to do less work to reason about what happened outside of the basic block that is being lowered. Conversion from DFG SSA to LLVM SSA is done by ensuring that we generate code in depth-first order, thus guaranteeing that a node will always be lowered (and hence have a LValue) before any of the blocks dominated by that node's block have code generated. For Upsilon/Phi, we just use alloca's. We could do something more clever there, but it's probably not worth it, at least not now. Finally, while the SSA form is currently only being converted to LLVM IR, there is nothing that prevents us from considering other backends in the future - with the caveat that this form is designed to be first lowered to a lower-level SSA before actual machine code generation commences. So we ought to either use LLVM (the intended path) or we will have to write our own SSA low-level backend. This runs all of the code that the FTL was known to run previously. No change in performance for now. But it does open some exciting possibilities! * JavaScriptCore.xcodeproj/project.pbxproj: * bytecode/Operands.h: (JSC::OperandValueTraits::dump): (JSC::Operands::fill): (Operands): (JSC::Operands::clear): (JSC::Operands::operator==): * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::beginBasicBlock): (JSC::DFG::setLiveValues): (DFG): (JSC::DFG::AbstractState::initialize): (JSC::DFG::AbstractState::endBasicBlock): (JSC::DFG::AbstractState::executeEffects): (JSC::DFG::AbstractState::mergeStateAtTail): (JSC::DFG::AbstractState::merge): * dfg/DFGAbstractState.h: (AbstractState): * dfg/DFGAdjacencyList.h: (JSC::DFG::AdjacencyList::justOneChild): (AdjacencyList): * dfg/DFGBasicBlock.cpp: Added. (DFG): (JSC::DFG::BasicBlock::BasicBlock): (JSC::DFG::BasicBlock::~BasicBlock): (JSC::DFG::BasicBlock::ensureLocals): (JSC::DFG::BasicBlock::isInPhis): (JSC::DFG::BasicBlock::isInBlock): (JSC::DFG::BasicBlock::removePredecessor): (JSC::DFG::BasicBlock::replacePredecessor): (JSC::DFG::BasicBlock::dump): (JSC::DFG::BasicBlock::SSAData::SSAData): (JSC::DFG::BasicBlock::SSAData::~SSAData): * dfg/DFGBasicBlock.h: (BasicBlock): (JSC::DFG::BasicBlock::operator[]): (JSC::DFG::BasicBlock::successor): (JSC::DFG::BasicBlock::successorForCondition): (SSAData): * dfg/DFGBasicBlockInlines.h: (DFG): * dfg/DFGBlockInsertionSet.cpp: Added. (DFG): (JSC::DFG::BlockInsertionSet::BlockInsertionSet): (JSC::DFG::BlockInsertionSet::~BlockInsertionSet): (JSC::DFG::BlockInsertionSet::insert): (JSC::DFG::BlockInsertionSet::insertBefore): (JSC::DFG::BlockInsertionSet::execute): * dfg/DFGBlockInsertionSet.h: Added. (DFG): (BlockInsertionSet): * dfg/DFGCFAPhase.cpp: (JSC::DFG::CFAPhase::run): * dfg/DFGCFGSimplificationPhase.cpp: * dfg/DFGCPSRethreadingPhase.cpp: (JSC::DFG::CPSRethreadingPhase::canonicalizeLocalsInBlock): * dfg/DFGCommon.cpp: (WTF::printInternal): * dfg/DFGCommon.h: (JSC::DFG::doesKill): (DFG): (JSC::DFG::killStatusForDoesKill): * dfg/DFGConstantFoldingPhase.cpp: (JSC::DFG::ConstantFoldingPhase::foldConstants): (JSC::DFG::ConstantFoldingPhase::isCapturedAtOrAfter): * dfg/DFGCriticalEdgeBreakingPhase.cpp: Added. (DFG): (CriticalEdgeBreakingPhase): (JSC::DFG::CriticalEdgeBreakingPhase::CriticalEdgeBreakingPhase): (JSC::DFG::CriticalEdgeBreakingPhase::run): (JSC::DFG::CriticalEdgeBreakingPhase::breakCriticalEdge): (JSC::DFG::performCriticalEdgeBreaking): * dfg/DFGCriticalEdgeBreakingPhase.h: Added. (DFG): * dfg/DFGDCEPhase.cpp: (JSC::DFG::DCEPhase::run): (JSC::DFG::DCEPhase::findTypeCheckRoot): (JSC::DFG::DCEPhase::countNode): (DCEPhase): (JSC::DFG::DCEPhase::countEdge): (JSC::DFG::DCEPhase::eliminateIrrelevantPhantomChildren): * dfg/DFGDriver.cpp: (JSC::DFG::compile): * dfg/DFGEdge.cpp: (JSC::DFG::Edge::dump): * dfg/DFGEdge.h: (JSC::DFG::Edge::Edge): (JSC::DFG::Edge::setNode): (JSC::DFG::Edge::useKindUnchecked): (JSC::DFG::Edge::setUseKind): (JSC::DFG::Edge::setProofStatus): (JSC::DFG::Edge::willNotHaveCheck): (JSC::DFG::Edge::willHaveCheck): (Edge): (JSC::DFG::Edge::killStatusUnchecked): (JSC::DFG::Edge::killStatus): (JSC::DFG::Edge::setKillStatus): (JSC::DFG::Edge::doesKill): (JSC::DFG::Edge::doesNotKill): (JSC::DFG::Edge::shift): (JSC::DFG::Edge::makeWord): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGFlushFormat.cpp: Added. (WTF): (WTF::printInternal): * dfg/DFGFlushFormat.h: Added. (DFG): (JSC::DFG::resultFor): (JSC::DFG::useKindFor): (WTF): * dfg/DFGFlushLivenessAnalysisPhase.cpp: Added. (DFG): (FlushLivenessAnalysisPhase): (JSC::DFG::FlushLivenessAnalysisPhase::FlushLivenessAnalysisPhase): (JSC::DFG::FlushLivenessAnalysisPhase::run): (JSC::DFG::FlushLivenessAnalysisPhase::process): (JSC::DFG::FlushLivenessAnalysisPhase::setForNode): (JSC::DFG::FlushLivenessAnalysisPhase::flushFormat): (JSC::DFG::performFlushLivenessAnalysis): * dfg/DFGFlushLivenessAnalysisPhase.h: Added. (DFG): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::dump): (JSC::DFG::Graph::dumpBlockHeader): (DFG): (JSC::DFG::Graph::addForDepthFirstSort): (JSC::DFG::Graph::getBlocksInDepthFirstOrder): * dfg/DFGGraph.h: (JSC::DFG::Graph::convertToConstant): (JSC::DFG::Graph::valueProfileFor): (Graph): * dfg/DFGInsertionSet.h: (DFG): (JSC::DFG::InsertionSet::execute): * dfg/DFGLivenessAnalysisPhase.cpp: Added. (DFG): (LivenessAnalysisPhase): (JSC::DFG::LivenessAnalysisPhase::LivenessAnalysisPhase): (JSC::DFG::LivenessAnalysisPhase::run): (JSC::DFG::LivenessAnalysisPhase::process): (JSC::DFG::LivenessAnalysisPhase::addChildUse): (JSC::DFG::performLivenessAnalysis): * dfg/DFGLivenessAnalysisPhase.h: Added. (DFG): * dfg/DFGNode.cpp: (JSC::DFG::Node::hasVariableAccessData): (DFG): * dfg/DFGNode.h: (DFG): (Node): (JSC::DFG::Node::hasLocal): (JSC::DFG::Node::variableAccessData): (JSC::DFG::Node::hasPhi): (JSC::DFG::Node::phi): (JSC::DFG::Node::takenBlock): (JSC::DFG::Node::notTakenBlock): (JSC::DFG::Node::successor): (JSC::DFG::Node::successorForCondition): (JSC::DFG::nodeComparator): (JSC::DFG::nodeListDump): (JSC::DFG::nodeMapDump): * dfg/DFGNodeFlags.cpp: (JSC::DFG::dumpNodeFlags): * dfg/DFGNodeType.h: (DFG): * dfg/DFGOSRAvailabilityAnalysisPhase.cpp: Added. (DFG): (OSRAvailabilityAnalysisPhase): (JSC::DFG::OSRAvailabilityAnalysisPhase::OSRAvailabilityAnalysisPhase): (JSC::DFG::OSRAvailabilityAnalysisPhase::run): (JSC::DFG::performOSRAvailabilityAnalysis): * dfg/DFGOSRAvailabilityAnalysisPhase.h: Added. (DFG): * dfg/DFGPlan.cpp: (JSC::DFG::Plan::compileInThreadImpl): * dfg/DFGPredictionInjectionPhase.cpp: (JSC::DFG::PredictionInjectionPhase::run): * dfg/DFGPredictionPropagationPhase.cpp: (JSC::DFG::PredictionPropagationPhase::propagate): * dfg/DFGSSAConversionPhase.cpp: Added. (DFG): (SSAConversionPhase): (JSC::DFG::SSAConversionPhase::SSAConversionPhase): (JSC::DFG::SSAConversionPhase::run): (JSC::DFG::SSAConversionPhase::forwardPhiChildren): (JSC::DFG::SSAConversionPhase::forwardPhi): (JSC::DFG::SSAConversionPhase::forwardPhiEdge): (JSC::DFG::SSAConversionPhase::deduplicateChildren): (JSC::DFG::SSAConversionPhase::addFlushedLocalOp): (JSC::DFG::SSAConversionPhase::addFlushedLocalEdge): (JSC::DFG::performSSAConversion): * dfg/DFGSSAConversionPhase.h: Added. (DFG): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGValidate.cpp: (JSC::DFG::Validate::validate): (Validate): (JSC::DFG::Validate::validateCPS): * dfg/DFGVariableAccessData.h: (JSC::DFG::VariableAccessData::flushFormat): (VariableAccessData): * ftl/FTLCapabilities.cpp: (JSC::FTL::canCompile): * ftl/FTLLowerDFGToLLVM.cpp: (JSC::FTL::LowerDFGToLLVM::LowerDFGToLLVM): (JSC::FTL::LowerDFGToLLVM::lower): (JSC::FTL::LowerDFGToLLVM::createPhiVariables): (JSC::FTL::LowerDFGToLLVM::compileBlock): (JSC::FTL::LowerDFGToLLVM::compileNode): (JSC::FTL::LowerDFGToLLVM::compileUpsilon): (LowerDFGToLLVM): (JSC::FTL::LowerDFGToLLVM::compilePhi): (JSC::FTL::LowerDFGToLLVM::compileJSConstant): (JSC::FTL::LowerDFGToLLVM::compileWeakJSConstant): (JSC::FTL::LowerDFGToLLVM::compileGetArgument): (JSC::FTL::LowerDFGToLLVM::compileGetLocal): (JSC::FTL::LowerDFGToLLVM::compileSetLocal): (JSC::FTL::LowerDFGToLLVM::compileAdd): (JSC::FTL::LowerDFGToLLVM::compileArithSub): (JSC::FTL::LowerDFGToLLVM::compileArithMul): (JSC::FTL::LowerDFGToLLVM::compileArithDiv): (JSC::FTL::LowerDFGToLLVM::compileArithMod): (JSC::FTL::LowerDFGToLLVM::compileArithMinOrMax): (JSC::FTL::LowerDFGToLLVM::compileArithAbs): (JSC::FTL::LowerDFGToLLVM::compileArithNegate): (JSC::FTL::LowerDFGToLLVM::compileBitAnd): (JSC::FTL::LowerDFGToLLVM::compileBitOr): (JSC::FTL::LowerDFGToLLVM::compileBitXor): (JSC::FTL::LowerDFGToLLVM::compileBitRShift): (JSC::FTL::LowerDFGToLLVM::compileBitLShift): (JSC::FTL::LowerDFGToLLVM::compileBitURShift): (JSC::FTL::LowerDFGToLLVM::compileUInt32ToNumber): (JSC::FTL::LowerDFGToLLVM::compileInt32ToDouble): (JSC::FTL::LowerDFGToLLVM::compileGetButterfly): (JSC::FTL::LowerDFGToLLVM::compileGetArrayLength): (JSC::FTL::LowerDFGToLLVM::compileGetByVal): (JSC::FTL::LowerDFGToLLVM::compileGetByOffset): (JSC::FTL::LowerDFGToLLVM::compileGetGlobalVar): (JSC::FTL::LowerDFGToLLVM::compileCompareEqConstant): (JSC::FTL::LowerDFGToLLVM::compileCompareStrictEq): (JSC::FTL::LowerDFGToLLVM::compileCompareStrictEqConstant): (JSC::FTL::LowerDFGToLLVM::compileCompareLess): (JSC::FTL::LowerDFGToLLVM::compileCompareLessEq): (JSC::FTL::LowerDFGToLLVM::compileCompareGreater): (JSC::FTL::LowerDFGToLLVM::compileCompareGreaterEq): (JSC::FTL::LowerDFGToLLVM::compileLogicalNot): (JSC::FTL::LowerDFGToLLVM::speculateBackward): (JSC::FTL::LowerDFGToLLVM::lowInt32): (JSC::FTL::LowerDFGToLLVM::lowCell): (JSC::FTL::LowerDFGToLLVM::lowBoolean): (JSC::FTL::LowerDFGToLLVM::lowDouble): (JSC::FTL::LowerDFGToLLVM::lowJSValue): (JSC::FTL::LowerDFGToLLVM::lowStorage): (JSC::FTL::LowerDFGToLLVM::speculate): (JSC::FTL::LowerDFGToLLVM::speculateBoolean): (JSC::FTL::LowerDFGToLLVM::isLive): (JSC::FTL::LowerDFGToLLVM::use): (JSC::FTL::LowerDFGToLLVM::initializeOSRExitStateForBlock): (JSC::FTL::LowerDFGToLLVM::appendOSRExit): (JSC::FTL::LowerDFGToLLVM::emitOSRExitCall): (JSC::FTL::LowerDFGToLLVM::addExitArgumentForNode): (JSC::FTL::LowerDFGToLLVM::linkOSRExitsAndCompleteInitializationBlocks): (JSC::FTL::LowerDFGToLLVM::setInt32): (JSC::FTL::LowerDFGToLLVM::setJSValue): (JSC::FTL::LowerDFGToLLVM::setBoolean): (JSC::FTL::LowerDFGToLLVM::setStorage): (JSC::FTL::LowerDFGToLLVM::setDouble): (JSC::FTL::LowerDFGToLLVM::isValid): * ftl/FTLLoweredNodeValue.h: Added. (FTL): (LoweredNodeValue): (JSC::FTL::LoweredNodeValue::LoweredNodeValue): (JSC::FTL::LoweredNodeValue::isSet): (JSC::FTL::LoweredNodeValue::operator!): (JSC::FTL::LoweredNodeValue::value): (JSC::FTL::LoweredNodeValue::block): * ftl/FTLValueFromBlock.h: (JSC::FTL::ValueFromBlock::ValueFromBlock): (ValueFromBlock): * ftl/FTLValueSource.cpp: (JSC::FTL::ValueSource::dump): * ftl/FTLValueSource.h: Source/WTF: Reviewed by Mark Hahnenberg. - Extend variadicity of PrintStream and dataLog. - Give HashSet the ability to add a span of things. - Give HashSet the ability to == another HashSet. - Note FIXME's in HashTable concerning copying performance, that affects the way that the DFG now uses HashSets and HashMaps. - Factor out the bulk-insertion logic of JSC::DFG::InsertionSet into WTF::Insertion, so that it can be used in more places. - Create a dumper for lists and maps. * WTF.xcodeproj/project.pbxproj: * wtf/DataLog.h: (WTF): (WTF::dataLog): * wtf/HashSet.h: (HashSet): (WTF): (WTF::::add): (WTF::=): * wtf/HashTable.h: (WTF::::HashTable): (WTF::=): * wtf/Insertion.h: Added. (WTF): (Insertion): (WTF::Insertion::Insertion): (WTF::Insertion::index): (WTF::Insertion::element): (WTF::Insertion::operator<): (WTF::executeInsertions): * wtf/ListDump.h: Added. (WTF): (ListDump): (WTF::ListDump::ListDump): (WTF::ListDump::dump): (MapDump): (WTF::MapDump::MapDump): (WTF::MapDump::dump): (WTF::listDump): (WTF::sortedListDump): (WTF::lessThan): (WTF::mapDump): (WTF::sortedMapDump): * wtf/PrintStream.h: (PrintStream): (WTF::PrintStream::print): Conflicts: Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj Canonical link: https://commits.webkit.org/137058@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153274 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:04:45 +00:00
out.print(m_comma, iter->key, m_arrow, iter->value);
}
private:
const T& m_map;
const char* m_arrow;
CommaPrinter m_comma;
};
template<typename T>
ListDump<T> listDump(const T& list, const char* comma = ", ")
{
return ListDump<T>(list, comma);
}
Create a super rough prototype of B3 https://bugs.webkit.org/show_bug.cgi?id=150280 Reviewed by Benjamin Poulain. Source/JavaScriptCore: This changeset adds the basic scaffolding of the B3 compiler. B3 stands for Bare Bones Backend. It's a low-level SSA-based language-agnostic compiler. The basic structure allows for aggressive C-level optimizations and an awesome portable backend. The backend, called Air (Assembly IR), is a reflective abstraction over our MacroAssembler. The abstraction is defined using a spec file (AirOpcode.opcodes) which describes the various kinds of instructions that we wish to support. Then, the B3::LowerToAir phase, which does our instruction selection, reflectively selects Air opcodes by querying which instruction forms are possible. Air allows for optimal register allocation and stack layout. Currently the register allocator isn't written, but the stack layout is. Of course this isn't done yet. It can only compile simple programs, seen in the "test suite" called "testb3.cpp". There's a lot of optimizations that have to be written and a lot of stuff added to the instruction selector. But it's a neat start. * CMakeLists.txt: * DerivedSources.make: * JavaScriptCore.xcodeproj/project.pbxproj: * assembler/MacroAssembler.cpp: (WTF::printInternal): * assembler/MacroAssembler.h: * b3: Added. * b3/B3AddressMatcher.patterns: Added. * b3/B3ArgumentRegValue.cpp: Added. (JSC::B3::ArgumentRegValue::~ArgumentRegValue): (JSC::B3::ArgumentRegValue::dumpMeta): * b3/B3ArgumentRegValue.h: Added. * b3/B3BasicBlock.cpp: Added. (JSC::B3::BasicBlock::BasicBlock): (JSC::B3::BasicBlock::~BasicBlock): (JSC::B3::BasicBlock::append): (JSC::B3::BasicBlock::addPredecessor): (JSC::B3::BasicBlock::removePredecessor): (JSC::B3::BasicBlock::replacePredecessor): (JSC::B3::BasicBlock::removeNops): (JSC::B3::BasicBlock::dump): (JSC::B3::BasicBlock::deepDump): * b3/B3BasicBlock.h: Added. (JSC::B3::BasicBlock::index): (JSC::B3::BasicBlock::begin): (JSC::B3::BasicBlock::end): (JSC::B3::BasicBlock::size): (JSC::B3::BasicBlock::at): (JSC::B3::BasicBlock::last): (JSC::B3::BasicBlock::values): (JSC::B3::BasicBlock::numPredecessors): (JSC::B3::BasicBlock::predecessor): (JSC::B3::BasicBlock::predecessors): (JSC::B3::BasicBlock::frequency): (JSC::B3::DeepBasicBlockDump::DeepBasicBlockDump): (JSC::B3::DeepBasicBlockDump::dump): (JSC::B3::deepDump): * b3/B3BasicBlockInlines.h: Added. (JSC::B3::BasicBlock::appendNew): (JSC::B3::BasicBlock::numSuccessors): (JSC::B3::BasicBlock::successor): (JSC::B3::BasicBlock::successors): (JSC::B3::BasicBlock::successorBlock): (JSC::B3::BasicBlock::successorBlocks): * b3/B3BasicBlockUtils.h: Added. (JSC::B3::addPredecessor): (JSC::B3::removePredecessor): (JSC::B3::replacePredecessor): (JSC::B3::resetReachability): (JSC::B3::blocksInPreOrder): (JSC::B3::blocksInPostOrder): * b3/B3BlockWorklist.h: Added. * b3/B3CheckSpecial.cpp: Added. (JSC::B3::Air::numB3Args): (JSC::B3::CheckSpecial::CheckSpecial): (JSC::B3::CheckSpecial::~CheckSpecial): (JSC::B3::CheckSpecial::hiddenBranch): (JSC::B3::CheckSpecial::forEachArg): (JSC::B3::CheckSpecial::isValid): (JSC::B3::CheckSpecial::admitsStack): (JSC::B3::CheckSpecial::generate): (JSC::B3::CheckSpecial::dumpImpl): (JSC::B3::CheckSpecial::deepDumpImpl): * b3/B3CheckSpecial.h: Added. * b3/B3CheckValue.cpp: Added. (JSC::B3::CheckValue::~CheckValue): (JSC::B3::CheckValue::dumpMeta): * b3/B3CheckValue.h: Added. * b3/B3Common.cpp: Added. (JSC::B3::shouldDumpIR): (JSC::B3::shouldDumpIRAtEachPhase): (JSC::B3::shouldValidateIR): (JSC::B3::shouldValidateIRAtEachPhase): (JSC::B3::shouldSaveIRBeforePhase): * b3/B3Common.h: Added. (JSC::B3::is64Bit): (JSC::B3::is32Bit): * b3/B3Commutativity.cpp: Added. (WTF::printInternal): * b3/B3Commutativity.h: Added. * b3/B3Const32Value.cpp: Added. (JSC::B3::Const32Value::~Const32Value): (JSC::B3::Const32Value::negConstant): (JSC::B3::Const32Value::addConstant): (JSC::B3::Const32Value::subConstant): (JSC::B3::Const32Value::dumpMeta): * b3/B3Const32Value.h: Added. * b3/B3Const64Value.cpp: Added. (JSC::B3::Const64Value::~Const64Value): (JSC::B3::Const64Value::negConstant): (JSC::B3::Const64Value::addConstant): (JSC::B3::Const64Value::subConstant): (JSC::B3::Const64Value::dumpMeta): * b3/B3Const64Value.h: Added. * b3/B3ConstDoubleValue.cpp: Added. (JSC::B3::ConstDoubleValue::~ConstDoubleValue): (JSC::B3::ConstDoubleValue::negConstant): (JSC::B3::ConstDoubleValue::addConstant): (JSC::B3::ConstDoubleValue::subConstant): (JSC::B3::ConstDoubleValue::dumpMeta): * b3/B3ConstDoubleValue.h: Added. (JSC::B3::ConstDoubleValue::accepts): (JSC::B3::ConstDoubleValue::value): (JSC::B3::ConstDoubleValue::ConstDoubleValue): * b3/B3ConstPtrValue.h: Added. (JSC::B3::ConstPtrValue::value): (JSC::B3::ConstPtrValue::ConstPtrValue): * b3/B3ControlValue.cpp: Added. (JSC::B3::ControlValue::~ControlValue): (JSC::B3::ControlValue::dumpMeta): * b3/B3ControlValue.h: Added. * b3/B3Effects.cpp: Added. (JSC::B3::Effects::dump): * b3/B3Effects.h: Added. (JSC::B3::Effects::mustExecute): * b3/B3FrequencyClass.cpp: Added. (WTF::printInternal): * b3/B3FrequencyClass.h: Added. * b3/B3FrequentedBlock.h: Added. * b3/B3Generate.cpp: Added. (JSC::B3::generate): (JSC::B3::generateToAir): * b3/B3Generate.h: Added. * b3/B3GenericFrequentedBlock.h: Added. (JSC::B3::GenericFrequentedBlock::GenericFrequentedBlock): (JSC::B3::GenericFrequentedBlock::operator==): (JSC::B3::GenericFrequentedBlock::operator!=): (JSC::B3::GenericFrequentedBlock::operator bool): (JSC::B3::GenericFrequentedBlock::block): (JSC::B3::GenericFrequentedBlock::frequency): (JSC::B3::GenericFrequentedBlock::dump): * b3/B3HeapRange.cpp: Added. (JSC::B3::HeapRange::dump): * b3/B3HeapRange.h: Added. (JSC::B3::HeapRange::HeapRange): (JSC::B3::HeapRange::top): (JSC::B3::HeapRange::operator==): (JSC::B3::HeapRange::operator!=): (JSC::B3::HeapRange::operator bool): (JSC::B3::HeapRange::begin): (JSC::B3::HeapRange::end): (JSC::B3::HeapRange::overlaps): * b3/B3IndexMap.h: Added. (JSC::B3::IndexMap::IndexMap): (JSC::B3::IndexMap::resize): (JSC::B3::IndexMap::operator[]): * b3/B3IndexSet.h: Added. (JSC::B3::IndexSet::IndexSet): (JSC::B3::IndexSet::add): (JSC::B3::IndexSet::contains): (JSC::B3::IndexSet::Iterable::Iterable): (JSC::B3::IndexSet::Iterable::iterator::iterator): (JSC::B3::IndexSet::Iterable::iterator::operator*): (JSC::B3::IndexSet::Iterable::iterator::operator++): (JSC::B3::IndexSet::Iterable::iterator::operator==): (JSC::B3::IndexSet::Iterable::iterator::operator!=): (JSC::B3::IndexSet::Iterable::begin): (JSC::B3::IndexSet::Iterable::end): (JSC::B3::IndexSet::values): (JSC::B3::IndexSet::indices): (JSC::B3::IndexSet::dump): * b3/B3InsertionSet.cpp: Added. (JSC::B3::InsertionSet::execute): * b3/B3InsertionSet.h: Added. (JSC::B3::InsertionSet::InsertionSet): (JSC::B3::InsertionSet::code): (JSC::B3::InsertionSet::appendInsertion): (JSC::B3::InsertionSet::insertValue): * b3/B3InsertionSetInlines.h: Added. (JSC::B3::InsertionSet::insert): * b3/B3LowerToAir.cpp: Added. (JSC::B3::Air::LowerToAir::LowerToAir): (JSC::B3::Air::LowerToAir::run): (JSC::B3::Air::LowerToAir::tmp): (JSC::B3::Air::LowerToAir::effectiveAddr): (JSC::B3::Air::LowerToAir::addr): (JSC::B3::Air::LowerToAir::loadAddr): (JSC::B3::Air::LowerToAir::imm): (JSC::B3::Air::LowerToAir::immOrTmp): (JSC::B3::Air::LowerToAir::appendBinOp): (JSC::B3::Air::LowerToAir::tryAppendStoreBinOp): (JSC::B3::Air::LowerToAir::moveForType): (JSC::B3::Air::LowerToAir::relaxedMoveForType): (JSC::B3::Air::LowerToAir::append): (JSC::B3::Air::LowerToAir::AddressSelector::AddressSelector): (JSC::B3::Air::LowerToAir::AddressSelector::acceptRoot): (JSC::B3::Air::LowerToAir::AddressSelector::acceptRootLate): (JSC::B3::Air::LowerToAir::AddressSelector::acceptInternals): (JSC::B3::Air::LowerToAir::AddressSelector::acceptInternalsLate): (JSC::B3::Air::LowerToAir::AddressSelector::acceptOperands): (JSC::B3::Air::LowerToAir::AddressSelector::acceptOperandsLate): (JSC::B3::Air::LowerToAir::AddressSelector::tryAddShift1): (JSC::B3::Air::LowerToAir::AddressSelector::tryAddShift2): (JSC::B3::Air::LowerToAir::AddressSelector::tryAdd): (JSC::B3::Air::LowerToAir::AddressSelector::tryDirect): (JSC::B3::Air::LowerToAir::acceptRoot): (JSC::B3::Air::LowerToAir::acceptRootLate): (JSC::B3::Air::LowerToAir::acceptInternals): (JSC::B3::Air::LowerToAir::acceptInternalsLate): (JSC::B3::Air::LowerToAir::acceptOperands): (JSC::B3::Air::LowerToAir::acceptOperandsLate): (JSC::B3::Air::LowerToAir::tryLoad): (JSC::B3::Air::LowerToAir::tryAdd): (JSC::B3::Air::LowerToAir::tryAnd): (JSC::B3::Air::LowerToAir::tryStoreAddLoad): (JSC::B3::Air::LowerToAir::tryStoreAndLoad): (JSC::B3::Air::LowerToAir::tryStore): (JSC::B3::Air::LowerToAir::tryTruncArgumentReg): (JSC::B3::Air::LowerToAir::tryTrunc): (JSC::B3::Air::LowerToAir::tryArgumentReg): (JSC::B3::Air::LowerToAir::tryConst32): (JSC::B3::Air::LowerToAir::tryConst64): (JSC::B3::Air::LowerToAir::tryIdentity): (JSC::B3::Air::LowerToAir::tryReturn): (JSC::B3::lowerToAir): * b3/B3LowerToAir.h: Added. * b3/B3LoweringMatcher.patterns: Added. * b3/B3MemoryValue.cpp: Added. (JSC::B3::MemoryValue::~MemoryValue): (JSC::B3::MemoryValue::dumpMeta): * b3/B3MemoryValue.h: Added. * b3/B3Opcode.cpp: Added. (WTF::printInternal): * b3/B3Opcode.h: Added. (JSC::B3::isCheckMath): * b3/B3Origin.cpp: Added. (JSC::B3::Origin::dump): * b3/B3Origin.h: Added. (JSC::B3::Origin::Origin): (JSC::B3::Origin::operator bool): (JSC::B3::Origin::data): * b3/B3PatchpointSpecial.cpp: Added. (JSC::B3::PatchpointSpecial::PatchpointSpecial): (JSC::B3::PatchpointSpecial::~PatchpointSpecial): (JSC::B3::PatchpointSpecial::forEachArg): (JSC::B3::PatchpointSpecial::isValid): (JSC::B3::PatchpointSpecial::admitsStack): (JSC::B3::PatchpointSpecial::generate): (JSC::B3::PatchpointSpecial::dumpImpl): (JSC::B3::PatchpointSpecial::deepDumpImpl): * b3/B3PatchpointSpecial.h: Added. * b3/B3PatchpointValue.cpp: Added. (JSC::B3::PatchpointValue::~PatchpointValue): (JSC::B3::PatchpointValue::dumpMeta): * b3/B3PatchpointValue.h: Added. (JSC::B3::PatchpointValue::accepts): (JSC::B3::PatchpointValue::PatchpointValue): * b3/B3PhaseScope.cpp: Added. (JSC::B3::PhaseScope::PhaseScope): (JSC::B3::PhaseScope::~PhaseScope): * b3/B3PhaseScope.h: Added. * b3/B3Procedure.cpp: Added. (JSC::B3::Procedure::Procedure): (JSC::B3::Procedure::~Procedure): (JSC::B3::Procedure::addBlock): (JSC::B3::Procedure::resetReachability): (JSC::B3::Procedure::dump): (JSC::B3::Procedure::blocksInPreOrder): (JSC::B3::Procedure::blocksInPostOrder): * b3/B3Procedure.h: Added. (JSC::B3::Procedure::size): (JSC::B3::Procedure::at): (JSC::B3::Procedure::operator[]): (JSC::B3::Procedure::iterator::iterator): (JSC::B3::Procedure::iterator::operator*): (JSC::B3::Procedure::iterator::operator++): (JSC::B3::Procedure::iterator::operator==): (JSC::B3::Procedure::iterator::operator!=): (JSC::B3::Procedure::iterator::findNext): (JSC::B3::Procedure::begin): (JSC::B3::Procedure::end): (JSC::B3::Procedure::ValuesCollection::ValuesCollection): (JSC::B3::Procedure::ValuesCollection::iterator::iterator): (JSC::B3::Procedure::ValuesCollection::iterator::operator*): (JSC::B3::Procedure::ValuesCollection::iterator::operator++): (JSC::B3::Procedure::ValuesCollection::iterator::operator==): (JSC::B3::Procedure::ValuesCollection::iterator::operator!=): (JSC::B3::Procedure::ValuesCollection::begin): (JSC::B3::Procedure::ValuesCollection::end): (JSC::B3::Procedure::ValuesCollection::size): (JSC::B3::Procedure::ValuesCollection::at): (JSC::B3::Procedure::ValuesCollection::operator[]): (JSC::B3::Procedure::values): (JSC::B3::Procedure::setLastPhaseName): (JSC::B3::Procedure::lastPhaseName): * b3/B3ProcedureInlines.h: Added. (JSC::B3::Procedure::add): * b3/B3ReduceStrength.cpp: Added. (JSC::B3::reduceStrength): * b3/B3ReduceStrength.h: Added. * b3/B3StackSlotKind.cpp: Added. (WTF::printInternal): * b3/B3StackSlotKind.h: Added. * b3/B3StackSlotValue.cpp: Added. (JSC::B3::StackSlotValue::~StackSlotValue): (JSC::B3::StackSlotValue::dumpMeta): * b3/B3StackSlotValue.h: Added. (JSC::B3::StackSlotValue::accepts): (JSC::B3::StackSlotValue::byteSize): (JSC::B3::StackSlotValue::kind): (JSC::B3::StackSlotValue::offsetFromFP): (JSC::B3::StackSlotValue::setOffsetFromFP): (JSC::B3::StackSlotValue::StackSlotValue): * b3/B3Stackmap.cpp: Added. (JSC::B3::Stackmap::Stackmap): (JSC::B3::Stackmap::~Stackmap): (JSC::B3::Stackmap::dump): * b3/B3Stackmap.h: Added. (JSC::B3::Stackmap::constrain): (JSC::B3::Stackmap::reps): (JSC::B3::Stackmap::clobber): (JSC::B3::Stackmap::clobbered): (JSC::B3::Stackmap::setGenerator): * b3/B3StackmapSpecial.cpp: Added. (JSC::B3::StackmapSpecial::StackmapSpecial): (JSC::B3::StackmapSpecial::~StackmapSpecial): (JSC::B3::StackmapSpecial::reportUsedRegisters): (JSC::B3::StackmapSpecial::extraClobberedRegs): (JSC::B3::StackmapSpecial::forEachArgImpl): (JSC::B3::StackmapSpecial::isValidImpl): (JSC::B3::StackmapSpecial::admitsStackImpl): (JSC::B3::StackmapSpecial::appendRepsImpl): (JSC::B3::StackmapSpecial::repForArg): * b3/B3StackmapSpecial.h: Added. * b3/B3SuccessorCollection.h: Added. (JSC::B3::SuccessorCollection::SuccessorCollection): (JSC::B3::SuccessorCollection::size): (JSC::B3::SuccessorCollection::at): (JSC::B3::SuccessorCollection::operator[]): (JSC::B3::SuccessorCollection::iterator::iterator): (JSC::B3::SuccessorCollection::iterator::operator*): (JSC::B3::SuccessorCollection::iterator::operator++): (JSC::B3::SuccessorCollection::iterator::operator==): (JSC::B3::SuccessorCollection::iterator::operator!=): (JSC::B3::SuccessorCollection::begin): (JSC::B3::SuccessorCollection::end): * b3/B3SwitchCase.cpp: Added. (JSC::B3::SwitchCase::dump): * b3/B3SwitchCase.h: Added. (JSC::B3::SwitchCase::SwitchCase): (JSC::B3::SwitchCase::operator bool): (JSC::B3::SwitchCase::caseValue): (JSC::B3::SwitchCase::target): (JSC::B3::SwitchCase::targetBlock): * b3/B3SwitchValue.cpp: Added. (JSC::B3::SwitchValue::~SwitchValue): (JSC::B3::SwitchValue::removeCase): (JSC::B3::SwitchValue::appendCase): (JSC::B3::SwitchValue::dumpMeta): (JSC::B3::SwitchValue::SwitchValue): * b3/B3SwitchValue.h: Added. (JSC::B3::SwitchValue::accepts): (JSC::B3::SwitchValue::numCaseValues): (JSC::B3::SwitchValue::caseValue): (JSC::B3::SwitchValue::caseValues): (JSC::B3::SwitchValue::fallThrough): (JSC::B3::SwitchValue::size): (JSC::B3::SwitchValue::at): (JSC::B3::SwitchValue::operator[]): (JSC::B3::SwitchValue::iterator::iterator): (JSC::B3::SwitchValue::iterator::operator*): (JSC::B3::SwitchValue::iterator::operator++): (JSC::B3::SwitchValue::iterator::operator==): (JSC::B3::SwitchValue::iterator::operator!=): (JSC::B3::SwitchValue::begin): (JSC::B3::SwitchValue::end): * b3/B3Type.cpp: Added. (WTF::printInternal): * b3/B3Type.h: Added. (JSC::B3::isInt): (JSC::B3::isFloat): (JSC::B3::pointerType): * b3/B3UpsilonValue.cpp: Added. (JSC::B3::UpsilonValue::~UpsilonValue): (JSC::B3::UpsilonValue::dumpMeta): * b3/B3UpsilonValue.h: Added. (JSC::B3::UpsilonValue::accepts): (JSC::B3::UpsilonValue::phi): (JSC::B3::UpsilonValue::UpsilonValue): * b3/B3UseCounts.cpp: Added. (JSC::B3::UseCounts::UseCounts): (JSC::B3::UseCounts::~UseCounts): * b3/B3UseCounts.h: Added. (JSC::B3::UseCounts::operator[]): * b3/B3Validate.cpp: Added. (JSC::B3::validate): * b3/B3Validate.h: Added. * b3/B3Value.cpp: Added. (JSC::B3::Value::~Value): (JSC::B3::Value::replaceWithIdentity): (JSC::B3::Value::replaceWithNop): (JSC::B3::Value::dump): (JSC::B3::Value::deepDump): (JSC::B3::Value::negConstant): (JSC::B3::Value::addConstant): (JSC::B3::Value::subConstant): (JSC::B3::Value::effects): (JSC::B3::Value::performSubstitution): (JSC::B3::Value::dumpMeta): (JSC::B3::Value::typeFor): * b3/B3Value.h: Added. (JSC::B3::DeepValueDump::DeepValueDump): (JSC::B3::DeepValueDump::dump): (JSC::B3::deepDump): * b3/B3ValueInlines.h: Added. (JSC::B3::Value::as): (JSC::B3::Value::isConstant): (JSC::B3::Value::hasInt32): (JSC::B3::Value::asInt32): (JSC::B3::Value::hasInt64): (JSC::B3::Value::asInt64): (JSC::B3::Value::hasInt): (JSC::B3::Value::asInt): (JSC::B3::Value::isInt): (JSC::B3::Value::hasIntPtr): (JSC::B3::Value::asIntPtr): (JSC::B3::Value::hasDouble): (JSC::B3::Value::asDouble): (JSC::B3::Value::stackmap): * b3/B3ValueRep.cpp: Added. (JSC::B3::ValueRep::dump): (WTF::printInternal): * b3/B3ValueRep.h: Added. (JSC::B3::ValueRep::ValueRep): (JSC::B3::ValueRep::reg): (JSC::B3::ValueRep::stack): (JSC::B3::ValueRep::stackArgument): (JSC::B3::ValueRep::constant): (JSC::B3::ValueRep::constantDouble): (JSC::B3::ValueRep::kind): (JSC::B3::ValueRep::operator bool): (JSC::B3::ValueRep::offsetFromFP): (JSC::B3::ValueRep::offsetFromSP): (JSC::B3::ValueRep::value): (JSC::B3::ValueRep::doubleValue): * b3/air: Added. * b3/air/AirAllocateStack.cpp: Added. (JSC::B3::Air::allocateStack): * b3/air/AirAllocateStack.h: Added. * b3/air/AirArg.cpp: Added. (JSC::B3::Air::Arg::dump): * b3/air/AirArg.h: Added. (JSC::B3::Air::Arg::isUse): (JSC::B3::Air::Arg::isDef): (JSC::B3::Air::Arg::typeForB3Type): (JSC::B3::Air::Arg::Arg): (JSC::B3::Air::Arg::imm): (JSC::B3::Air::Arg::imm64): (JSC::B3::Air::Arg::addr): (JSC::B3::Air::Arg::stack): (JSC::B3::Air::Arg::callArg): (JSC::B3::Air::Arg::isValidScale): (JSC::B3::Air::Arg::logScale): (JSC::B3::Air::Arg::index): (JSC::B3::Air::Arg::relCond): (JSC::B3::Air::Arg::resCond): (JSC::B3::Air::Arg::special): (JSC::B3::Air::Arg::operator==): (JSC::B3::Air::Arg::operator!=): (JSC::B3::Air::Arg::operator bool): (JSC::B3::Air::Arg::kind): (JSC::B3::Air::Arg::isTmp): (JSC::B3::Air::Arg::isImm): (JSC::B3::Air::Arg::isImm64): (JSC::B3::Air::Arg::isAddr): (JSC::B3::Air::Arg::isStack): (JSC::B3::Air::Arg::isCallArg): (JSC::B3::Air::Arg::isIndex): (JSC::B3::Air::Arg::isRelCond): (JSC::B3::Air::Arg::isResCond): (JSC::B3::Air::Arg::isSpecial): (JSC::B3::Air::Arg::isAlive): (JSC::B3::Air::Arg::tmp): (JSC::B3::Air::Arg::value): (JSC::B3::Air::Arg::pointerValue): (JSC::B3::Air::Arg::base): (JSC::B3::Air::Arg::hasOffset): (JSC::B3::Air::Arg::offset): (JSC::B3::Air::Arg::stackSlot): (JSC::B3::Air::Arg::scale): (JSC::B3::Air::Arg::isGPTmp): (JSC::B3::Air::Arg::isFPTmp): (JSC::B3::Air::Arg::isGP): (JSC::B3::Air::Arg::isFP): (JSC::B3::Air::Arg::hasType): (JSC::B3::Air::Arg::type): (JSC::B3::Air::Arg::isType): (JSC::B3::Air::Arg::isGPR): (JSC::B3::Air::Arg::gpr): (JSC::B3::Air::Arg::isFPR): (JSC::B3::Air::Arg::fpr): (JSC::B3::Air::Arg::isReg): (JSC::B3::Air::Arg::reg): (JSC::B3::Air::Arg::gpTmpIndex): (JSC::B3::Air::Arg::fpTmpIndex): (JSC::B3::Air::Arg::tmpIndex): (JSC::B3::Air::Arg::withOffset): (JSC::B3::Air::Arg::forEachTmpFast): (JSC::B3::Air::Arg::forEachTmp): (JSC::B3::Air::Arg::asTrustedImm32): (JSC::B3::Air::Arg::asTrustedImm64): (JSC::B3::Air::Arg::asTrustedImmPtr): (JSC::B3::Air::Arg::asAddress): (JSC::B3::Air::Arg::asBaseIndex): (JSC::B3::Air::Arg::asRelationalCondition): (JSC::B3::Air::Arg::asResultCondition): (JSC::B3::Air::Arg::isHashTableDeletedValue): (JSC::B3::Air::Arg::hash): (JSC::B3::Air::ArgHash::hash): (JSC::B3::Air::ArgHash::equal): * b3/air/AirBasicBlock.cpp: Added. (JSC::B3::Air::BasicBlock::addPredecessor): (JSC::B3::Air::BasicBlock::removePredecessor): (JSC::B3::Air::BasicBlock::replacePredecessor): (JSC::B3::Air::BasicBlock::dump): (JSC::B3::Air::BasicBlock::deepDump): (JSC::B3::Air::BasicBlock::BasicBlock): * b3/air/AirBasicBlock.h: Added. (JSC::B3::Air::BasicBlock::index): (JSC::B3::Air::BasicBlock::size): (JSC::B3::Air::BasicBlock::begin): (JSC::B3::Air::BasicBlock::end): (JSC::B3::Air::BasicBlock::at): (JSC::B3::Air::BasicBlock::last): (JSC::B3::Air::BasicBlock::appendInst): (JSC::B3::Air::BasicBlock::append): (JSC::B3::Air::BasicBlock::numSuccessors): (JSC::B3::Air::BasicBlock::successor): (JSC::B3::Air::BasicBlock::successors): (JSC::B3::Air::BasicBlock::successorBlock): (JSC::B3::Air::BasicBlock::successorBlocks): (JSC::B3::Air::BasicBlock::numPredecessors): (JSC::B3::Air::BasicBlock::predecessor): (JSC::B3::Air::BasicBlock::predecessors): (JSC::B3::Air::DeepBasicBlockDump::DeepBasicBlockDump): (JSC::B3::Air::DeepBasicBlockDump::dump): (JSC::B3::Air::deepDump): * b3/air/AirCCallSpecial.cpp: Added. (JSC::B3::Air::CCallSpecial::CCallSpecial): (JSC::B3::Air::CCallSpecial::~CCallSpecial): (JSC::B3::Air::CCallSpecial::forEachArg): (JSC::B3::Air::CCallSpecial::isValid): (JSC::B3::Air::CCallSpecial::admitsStack): (JSC::B3::Air::CCallSpecial::reportUsedRegisters): (JSC::B3::Air::CCallSpecial::generate): (JSC::B3::Air::CCallSpecial::extraClobberedRegs): (JSC::B3::Air::CCallSpecial::dumpImpl): (JSC::B3::Air::CCallSpecial::deepDumpImpl): * b3/air/AirCCallSpecial.h: Added. * b3/air/AirCode.cpp: Added. (JSC::B3::Air::Code::Code): (JSC::B3::Air::Code::~Code): (JSC::B3::Air::Code::addBlock): (JSC::B3::Air::Code::addStackSlot): (JSC::B3::Air::Code::addSpecial): (JSC::B3::Air::Code::cCallSpecial): (JSC::B3::Air::Code::resetReachability): (JSC::B3::Air::Code::dump): (JSC::B3::Air::Code::findFirstBlockIndex): (JSC::B3::Air::Code::findNextBlockIndex): (JSC::B3::Air::Code::findNextBlock): * b3/air/AirCode.h: Added. (JSC::B3::Air::Code::newTmp): (JSC::B3::Air::Code::numTmps): (JSC::B3::Air::Code::callArgAreaSize): (JSC::B3::Air::Code::requestCallArgAreaSize): (JSC::B3::Air::Code::frameSize): (JSC::B3::Air::Code::setFrameSize): (JSC::B3::Air::Code::calleeSaveRegisters): (JSC::B3::Air::Code::size): (JSC::B3::Air::Code::at): (JSC::B3::Air::Code::operator[]): (JSC::B3::Air::Code::iterator::iterator): (JSC::B3::Air::Code::iterator::operator*): (JSC::B3::Air::Code::iterator::operator++): (JSC::B3::Air::Code::iterator::operator==): (JSC::B3::Air::Code::iterator::operator!=): (JSC::B3::Air::Code::begin): (JSC::B3::Air::Code::end): (JSC::B3::Air::Code::StackSlotsCollection::StackSlotsCollection): (JSC::B3::Air::Code::StackSlotsCollection::size): (JSC::B3::Air::Code::StackSlotsCollection::at): (JSC::B3::Air::Code::StackSlotsCollection::operator[]): (JSC::B3::Air::Code::StackSlotsCollection::iterator::iterator): (JSC::B3::Air::Code::StackSlotsCollection::iterator::operator*): (JSC::B3::Air::Code::StackSlotsCollection::iterator::operator++): (JSC::B3::Air::Code::StackSlotsCollection::iterator::operator==): (JSC::B3::Air::Code::StackSlotsCollection::iterator::operator!=): (JSC::B3::Air::Code::StackSlotsCollection::begin): (JSC::B3::Air::Code::StackSlotsCollection::end): (JSC::B3::Air::Code::stackSlots): (JSC::B3::Air::Code::SpecialsCollection::SpecialsCollection): (JSC::B3::Air::Code::SpecialsCollection::size): (JSC::B3::Air::Code::SpecialsCollection::at): (JSC::B3::Air::Code::SpecialsCollection::operator[]): (JSC::B3::Air::Code::SpecialsCollection::iterator::iterator): (JSC::B3::Air::Code::SpecialsCollection::iterator::operator*): (JSC::B3::Air::Code::SpecialsCollection::iterator::operator++): (JSC::B3::Air::Code::SpecialsCollection::iterator::operator==): (JSC::B3::Air::Code::SpecialsCollection::iterator::operator!=): (JSC::B3::Air::Code::SpecialsCollection::begin): (JSC::B3::Air::Code::SpecialsCollection::end): (JSC::B3::Air::Code::specials): (JSC::B3::Air::Code::setLastPhaseName): (JSC::B3::Air::Code::lastPhaseName): * b3/air/AirFrequentedBlock.h: Added. * b3/air/AirGenerate.cpp: Added. (JSC::B3::Air::generate): * b3/air/AirGenerate.h: Added. * b3/air/AirGenerated.cpp: Added. * b3/air/AirGenerationContext.h: Added. * b3/air/AirHandleCalleeSaves.cpp: Added. (JSC::B3::Air::handleCalleeSaves): * b3/air/AirHandleCalleeSaves.h: Added. * b3/air/AirInsertionSet.cpp: Added. (JSC::B3::Air::InsertionSet::execute): * b3/air/AirInsertionSet.h: Added. (JSC::B3::Air::InsertionSet::InsertionSet): (JSC::B3::Air::InsertionSet::code): (JSC::B3::Air::InsertionSet::appendInsertion): (JSC::B3::Air::InsertionSet::insertInst): (JSC::B3::Air::InsertionSet::insert): * b3/air/AirInst.cpp: Added. (JSC::B3::Air::Inst::dump): * b3/air/AirInst.h: Added. (JSC::B3::Air::Inst::Inst): (JSC::B3::Air::Inst::opcode): (JSC::B3::Air::Inst::forEachTmpFast): (JSC::B3::Air::Inst::forEachTmp): * b3/air/AirInstInlines.h: Added. (JSC::B3::Air::ForEach<Tmp>::forEach): (JSC::B3::Air::ForEach<Arg>::forEach): (JSC::B3::Air::Inst::forEach): (JSC::B3::Air::Inst::hasSpecial): (JSC::B3::Air::Inst::extraClobberedRegs): (JSC::B3::Air::Inst::reportUsedRegisters): (JSC::B3::Air::isShiftValid): (JSC::B3::Air::isLshift32Valid): * b3/air/AirLiveness.h: Added. (JSC::B3::Air::Liveness::Liveness): (JSC::B3::Air::Liveness::liveAtHead): (JSC::B3::Air::Liveness::liveAtTail): (JSC::B3::Air::Liveness::LocalCalc::LocalCalc): (JSC::B3::Air::Liveness::LocalCalc::live): (JSC::B3::Air::Liveness::LocalCalc::takeLive): (JSC::B3::Air::Liveness::LocalCalc::execute): * b3/air/AirOpcode.opcodes: Added. * b3/air/AirPhaseScope.cpp: Added. (JSC::B3::Air::PhaseScope::PhaseScope): (JSC::B3::Air::PhaseScope::~PhaseScope): * b3/air/AirPhaseScope.h: Added. * b3/air/AirRegisterPriority.cpp: Added. (JSC::B3::Air::gprsInPriorityOrder): (JSC::B3::Air::fprsInPriorityOrder): (JSC::B3::Air::regsInPriorityOrder): * b3/air/AirRegisterPriority.h: Added. (JSC::B3::Air::RegistersInPriorityOrder<GPRInfo>::inPriorityOrder): (JSC::B3::Air::RegistersInPriorityOrder<FPRInfo>::inPriorityOrder): (JSC::B3::Air::regsInPriorityOrder): * b3/air/AirSpecial.cpp: Added. (JSC::B3::Air::Special::Special): (JSC::B3::Air::Special::~Special): (JSC::B3::Air::Special::name): (JSC::B3::Air::Special::dump): (JSC::B3::Air::Special::deepDump): * b3/air/AirSpecial.h: Added. (JSC::B3::Air::DeepSpecialDump::DeepSpecialDump): (JSC::B3::Air::DeepSpecialDump::dump): (JSC::B3::Air::deepDump): * b3/air/AirSpillEverything.cpp: Added. (JSC::B3::Air::spillEverything): * b3/air/AirSpillEverything.h: Added. * b3/air/AirStackSlot.cpp: Added. (JSC::B3::Air::StackSlot::setOffsetFromFP): (JSC::B3::Air::StackSlot::dump): (JSC::B3::Air::StackSlot::deepDump): (JSC::B3::Air::StackSlot::StackSlot): * b3/air/AirStackSlot.h: Added. (JSC::B3::Air::StackSlot::byteSize): (JSC::B3::Air::StackSlot::kind): (JSC::B3::Air::StackSlot::index): (JSC::B3::Air::StackSlot::alignment): (JSC::B3::Air::StackSlot::value): (JSC::B3::Air::StackSlot::offsetFromFP): (JSC::B3::Air::DeepStackSlotDump::DeepStackSlotDump): (JSC::B3::Air::DeepStackSlotDump::dump): (JSC::B3::Air::deepDump): * b3/air/AirTmp.cpp: Added. (JSC::B3::Air::Tmp::dump): * b3/air/AirTmp.h: Added. (JSC::B3::Air::Tmp::Tmp): (JSC::B3::Air::Tmp::gpTmpForIndex): (JSC::B3::Air::Tmp::fpTmpForIndex): (JSC::B3::Air::Tmp::operator bool): (JSC::B3::Air::Tmp::isGP): (JSC::B3::Air::Tmp::isFP): (JSC::B3::Air::Tmp::isGPR): (JSC::B3::Air::Tmp::isFPR): (JSC::B3::Air::Tmp::isReg): (JSC::B3::Air::Tmp::gpr): (JSC::B3::Air::Tmp::fpr): (JSC::B3::Air::Tmp::reg): (JSC::B3::Air::Tmp::hasTmpIndex): (JSC::B3::Air::Tmp::gpTmpIndex): (JSC::B3::Air::Tmp::fpTmpIndex): (JSC::B3::Air::Tmp::tmpIndex): (JSC::B3::Air::Tmp::isAlive): (JSC::B3::Air::Tmp::operator==): (JSC::B3::Air::Tmp::operator!=): (JSC::B3::Air::Tmp::isHashTableDeletedValue): (JSC::B3::Air::Tmp::hash): (JSC::B3::Air::Tmp::encodeGP): (JSC::B3::Air::Tmp::encodeFP): (JSC::B3::Air::Tmp::encodeGPR): (JSC::B3::Air::Tmp::encodeFPR): (JSC::B3::Air::Tmp::encodeGPTmp): (JSC::B3::Air::Tmp::encodeFPTmp): (JSC::B3::Air::Tmp::isEncodedGP): (JSC::B3::Air::Tmp::isEncodedFP): (JSC::B3::Air::Tmp::isEncodedGPR): (JSC::B3::Air::Tmp::isEncodedFPR): (JSC::B3::Air::Tmp::isEncodedGPTmp): (JSC::B3::Air::Tmp::isEncodedFPTmp): (JSC::B3::Air::Tmp::decodeGPR): (JSC::B3::Air::Tmp::decodeFPR): (JSC::B3::Air::Tmp::decodeGPTmp): (JSC::B3::Air::Tmp::decodeFPTmp): (JSC::B3::Air::TmpHash::hash): (JSC::B3::Air::TmpHash::equal): * b3/air/AirTmpInlines.h: Added. (JSC::B3::Air::Tmp::Tmp): * b3/air/AirValidate.cpp: Added. (JSC::B3::Air::validate): * b3/air/AirValidate.h: Added. * b3/air/opcode_generator.rb: Added. * b3/generate_pattern_matcher.rb: Added. * b3/testb3.cpp: Added. (JSC::B3::compileAndRun): (JSC::B3::test42): (JSC::B3::testLoad42): (JSC::B3::testArg): (JSC::B3::testAddArgs): (JSC::B3::testAddArgs32): (JSC::B3::testStore): (JSC::B3::testTrunc): (JSC::B3::testAdd1): (JSC::B3::testStoreAddLoad): (JSC::B3::testStoreAddAndLoad): (JSC::B3::testAdd1Uncommuted): (JSC::B3::testLoadOffset): (JSC::B3::testLoadOffsetNotConstant): (JSC::B3::testLoadOffsetUsingAdd): (JSC::B3::testLoadOffsetUsingAddNotConstant): (JSC::B3::run): (run): (main): * bytecode/CodeBlock.h: (JSC::CodeBlock::specializationKind): * jit/Reg.h: (JSC::Reg::index): (JSC::Reg::isSet): (JSC::Reg::operator bool): (JSC::Reg::isHashTableDeletedValue): (JSC::Reg::AllRegsIterable::iterator::iterator): (JSC::Reg::AllRegsIterable::iterator::operator*): (JSC::Reg::AllRegsIterable::iterator::operator++): (JSC::Reg::AllRegsIterable::iterator::operator==): (JSC::Reg::AllRegsIterable::iterator::operator!=): (JSC::Reg::AllRegsIterable::begin): (JSC::Reg::AllRegsIterable::end): (JSC::Reg::all): (JSC::Reg::invalid): (JSC::Reg::operator!): Deleted. * jit/RegisterAtOffsetList.cpp: (JSC::RegisterAtOffsetList::RegisterAtOffsetList): * jit/RegisterAtOffsetList.h: (JSC::RegisterAtOffsetList::clear): (JSC::RegisterAtOffsetList::size): (JSC::RegisterAtOffsetList::begin): (JSC::RegisterAtOffsetList::end): * jit/RegisterSet.h: (JSC::RegisterSet::operator==): (JSC::RegisterSet::hash): (JSC::RegisterSet::forEach): (JSC::RegisterSet::setAny): Source/WTF: * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/HashSet.h: (WTF::copyToVector): (WTF::=): * wtf/ListDump.h: (WTF::PointerListDump::PointerListDump): (WTF::PointerListDump::dump): (WTF::MapDump::MapDump): (WTF::listDump): (WTF::pointerListDump): (WTF::sortedListDump): * wtf/MathExtras.h: (WTF::leftShiftWithSaturation): (WTF::rangesOverlap): * wtf/Platform.h: * wtf/ScopedLambda.h: Added. (WTF::scopedLambda): * wtf/SharedTask.h: (WTF::createSharedTask): Canonical link: https://commits.webkit.org/168813@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@191705 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-10-28 23:57:04 +00:00
template<typename T>
PointerListDump<T> pointerListDump(const T& list, const char* comma = ", ")
{
return PointerListDump<T>(list, comma);
}
fourthTier: DFG should have an SSA form for use by FTL https://bugs.webkit.org/show_bug.cgi?id=118338 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. Adds an SSA form to the DFG. We can convert ThreadedCPS form into SSA form after breaking critical edges. The conversion algorithm follows Aycock and Horspool, and the SSA form itself follows something I've done before, where instead of having Phi functions specify input nodes corresponding to block predecessors, we instead have Upsilon functions in the predecessors that specify which value in that block goes into which subsequent Phi. Upsilons don't have to dominate Phis (usually they don't) and they correspond to a non-SSA "mov" into the Phi's "variable". This gives all of the good properties of SSA, while ensuring that a bunch of CFG transformations don't have to be SSA-aware. So far the only DFG phases that are SSA-aware are DCE and CFA. CFG simplification is probably SSA-aware by default, though I haven't tried it. Constant folding probably needs a few tweaks, but is likely ready. Ditto for CSE, though it's not clear that we'd want to use block-local CSE when we could be doing GVN. Currently only the FTL can generate code from the SSA form, and there is no way to convert from SSA to ThreadedCPS or LoadStore. There probably will never be such a capability. In order to handle OSR exit state in the SSA, we place MovHints at Phi points. Other than that, you can reconstruct state-at-exit by forward propagating MovHints. Note that MovHint is the new SetLocal in SSA. SetLocal and GetLocal only survive into SSA if they are on captured variables, or in the case of flushes. A "live SetLocal" will be NodeMustGenerate and will always correspond to a flush. Computing the state-at-exit requires running SSA liveness analysis, OSR availability analysis, and flush liveness analysis. The FTL runs all of these prior to generating code. While OSR exit continues to be tricky, much of the logic is now factored into separate phases and the backend has to do less work to reason about what happened outside of the basic block that is being lowered. Conversion from DFG SSA to LLVM SSA is done by ensuring that we generate code in depth-first order, thus guaranteeing that a node will always be lowered (and hence have a LValue) before any of the blocks dominated by that node's block have code generated. For Upsilon/Phi, we just use alloca's. We could do something more clever there, but it's probably not worth it, at least not now. Finally, while the SSA form is currently only being converted to LLVM IR, there is nothing that prevents us from considering other backends in the future - with the caveat that this form is designed to be first lowered to a lower-level SSA before actual machine code generation commences. So we ought to either use LLVM (the intended path) or we will have to write our own SSA low-level backend. This runs all of the code that the FTL was known to run previously. No change in performance for now. But it does open some exciting possibilities! * JavaScriptCore.xcodeproj/project.pbxproj: * bytecode/Operands.h: (JSC::OperandValueTraits::dump): (JSC::Operands::fill): (Operands): (JSC::Operands::clear): (JSC::Operands::operator==): * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::beginBasicBlock): (JSC::DFG::setLiveValues): (DFG): (JSC::DFG::AbstractState::initialize): (JSC::DFG::AbstractState::endBasicBlock): (JSC::DFG::AbstractState::executeEffects): (JSC::DFG::AbstractState::mergeStateAtTail): (JSC::DFG::AbstractState::merge): * dfg/DFGAbstractState.h: (AbstractState): * dfg/DFGAdjacencyList.h: (JSC::DFG::AdjacencyList::justOneChild): (AdjacencyList): * dfg/DFGBasicBlock.cpp: Added. (DFG): (JSC::DFG::BasicBlock::BasicBlock): (JSC::DFG::BasicBlock::~BasicBlock): (JSC::DFG::BasicBlock::ensureLocals): (JSC::DFG::BasicBlock::isInPhis): (JSC::DFG::BasicBlock::isInBlock): (JSC::DFG::BasicBlock::removePredecessor): (JSC::DFG::BasicBlock::replacePredecessor): (JSC::DFG::BasicBlock::dump): (JSC::DFG::BasicBlock::SSAData::SSAData): (JSC::DFG::BasicBlock::SSAData::~SSAData): * dfg/DFGBasicBlock.h: (BasicBlock): (JSC::DFG::BasicBlock::operator[]): (JSC::DFG::BasicBlock::successor): (JSC::DFG::BasicBlock::successorForCondition): (SSAData): * dfg/DFGBasicBlockInlines.h: (DFG): * dfg/DFGBlockInsertionSet.cpp: Added. (DFG): (JSC::DFG::BlockInsertionSet::BlockInsertionSet): (JSC::DFG::BlockInsertionSet::~BlockInsertionSet): (JSC::DFG::BlockInsertionSet::insert): (JSC::DFG::BlockInsertionSet::insertBefore): (JSC::DFG::BlockInsertionSet::execute): * dfg/DFGBlockInsertionSet.h: Added. (DFG): (BlockInsertionSet): * dfg/DFGCFAPhase.cpp: (JSC::DFG::CFAPhase::run): * dfg/DFGCFGSimplificationPhase.cpp: * dfg/DFGCPSRethreadingPhase.cpp: (JSC::DFG::CPSRethreadingPhase::canonicalizeLocalsInBlock): * dfg/DFGCommon.cpp: (WTF::printInternal): * dfg/DFGCommon.h: (JSC::DFG::doesKill): (DFG): (JSC::DFG::killStatusForDoesKill): * dfg/DFGConstantFoldingPhase.cpp: (JSC::DFG::ConstantFoldingPhase::foldConstants): (JSC::DFG::ConstantFoldingPhase::isCapturedAtOrAfter): * dfg/DFGCriticalEdgeBreakingPhase.cpp: Added. (DFG): (CriticalEdgeBreakingPhase): (JSC::DFG::CriticalEdgeBreakingPhase::CriticalEdgeBreakingPhase): (JSC::DFG::CriticalEdgeBreakingPhase::run): (JSC::DFG::CriticalEdgeBreakingPhase::breakCriticalEdge): (JSC::DFG::performCriticalEdgeBreaking): * dfg/DFGCriticalEdgeBreakingPhase.h: Added. (DFG): * dfg/DFGDCEPhase.cpp: (JSC::DFG::DCEPhase::run): (JSC::DFG::DCEPhase::findTypeCheckRoot): (JSC::DFG::DCEPhase::countNode): (DCEPhase): (JSC::DFG::DCEPhase::countEdge): (JSC::DFG::DCEPhase::eliminateIrrelevantPhantomChildren): * dfg/DFGDriver.cpp: (JSC::DFG::compile): * dfg/DFGEdge.cpp: (JSC::DFG::Edge::dump): * dfg/DFGEdge.h: (JSC::DFG::Edge::Edge): (JSC::DFG::Edge::setNode): (JSC::DFG::Edge::useKindUnchecked): (JSC::DFG::Edge::setUseKind): (JSC::DFG::Edge::setProofStatus): (JSC::DFG::Edge::willNotHaveCheck): (JSC::DFG::Edge::willHaveCheck): (Edge): (JSC::DFG::Edge::killStatusUnchecked): (JSC::DFG::Edge::killStatus): (JSC::DFG::Edge::setKillStatus): (JSC::DFG::Edge::doesKill): (JSC::DFG::Edge::doesNotKill): (JSC::DFG::Edge::shift): (JSC::DFG::Edge::makeWord): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGFlushFormat.cpp: Added. (WTF): (WTF::printInternal): * dfg/DFGFlushFormat.h: Added. (DFG): (JSC::DFG::resultFor): (JSC::DFG::useKindFor): (WTF): * dfg/DFGFlushLivenessAnalysisPhase.cpp: Added. (DFG): (FlushLivenessAnalysisPhase): (JSC::DFG::FlushLivenessAnalysisPhase::FlushLivenessAnalysisPhase): (JSC::DFG::FlushLivenessAnalysisPhase::run): (JSC::DFG::FlushLivenessAnalysisPhase::process): (JSC::DFG::FlushLivenessAnalysisPhase::setForNode): (JSC::DFG::FlushLivenessAnalysisPhase::flushFormat): (JSC::DFG::performFlushLivenessAnalysis): * dfg/DFGFlushLivenessAnalysisPhase.h: Added. (DFG): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::dump): (JSC::DFG::Graph::dumpBlockHeader): (DFG): (JSC::DFG::Graph::addForDepthFirstSort): (JSC::DFG::Graph::getBlocksInDepthFirstOrder): * dfg/DFGGraph.h: (JSC::DFG::Graph::convertToConstant): (JSC::DFG::Graph::valueProfileFor): (Graph): * dfg/DFGInsertionSet.h: (DFG): (JSC::DFG::InsertionSet::execute): * dfg/DFGLivenessAnalysisPhase.cpp: Added. (DFG): (LivenessAnalysisPhase): (JSC::DFG::LivenessAnalysisPhase::LivenessAnalysisPhase): (JSC::DFG::LivenessAnalysisPhase::run): (JSC::DFG::LivenessAnalysisPhase::process): (JSC::DFG::LivenessAnalysisPhase::addChildUse): (JSC::DFG::performLivenessAnalysis): * dfg/DFGLivenessAnalysisPhase.h: Added. (DFG): * dfg/DFGNode.cpp: (JSC::DFG::Node::hasVariableAccessData): (DFG): * dfg/DFGNode.h: (DFG): (Node): (JSC::DFG::Node::hasLocal): (JSC::DFG::Node::variableAccessData): (JSC::DFG::Node::hasPhi): (JSC::DFG::Node::phi): (JSC::DFG::Node::takenBlock): (JSC::DFG::Node::notTakenBlock): (JSC::DFG::Node::successor): (JSC::DFG::Node::successorForCondition): (JSC::DFG::nodeComparator): (JSC::DFG::nodeListDump): (JSC::DFG::nodeMapDump): * dfg/DFGNodeFlags.cpp: (JSC::DFG::dumpNodeFlags): * dfg/DFGNodeType.h: (DFG): * dfg/DFGOSRAvailabilityAnalysisPhase.cpp: Added. (DFG): (OSRAvailabilityAnalysisPhase): (JSC::DFG::OSRAvailabilityAnalysisPhase::OSRAvailabilityAnalysisPhase): (JSC::DFG::OSRAvailabilityAnalysisPhase::run): (JSC::DFG::performOSRAvailabilityAnalysis): * dfg/DFGOSRAvailabilityAnalysisPhase.h: Added. (DFG): * dfg/DFGPlan.cpp: (JSC::DFG::Plan::compileInThreadImpl): * dfg/DFGPredictionInjectionPhase.cpp: (JSC::DFG::PredictionInjectionPhase::run): * dfg/DFGPredictionPropagationPhase.cpp: (JSC::DFG::PredictionPropagationPhase::propagate): * dfg/DFGSSAConversionPhase.cpp: Added. (DFG): (SSAConversionPhase): (JSC::DFG::SSAConversionPhase::SSAConversionPhase): (JSC::DFG::SSAConversionPhase::run): (JSC::DFG::SSAConversionPhase::forwardPhiChildren): (JSC::DFG::SSAConversionPhase::forwardPhi): (JSC::DFG::SSAConversionPhase::forwardPhiEdge): (JSC::DFG::SSAConversionPhase::deduplicateChildren): (JSC::DFG::SSAConversionPhase::addFlushedLocalOp): (JSC::DFG::SSAConversionPhase::addFlushedLocalEdge): (JSC::DFG::performSSAConversion): * dfg/DFGSSAConversionPhase.h: Added. (DFG): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGValidate.cpp: (JSC::DFG::Validate::validate): (Validate): (JSC::DFG::Validate::validateCPS): * dfg/DFGVariableAccessData.h: (JSC::DFG::VariableAccessData::flushFormat): (VariableAccessData): * ftl/FTLCapabilities.cpp: (JSC::FTL::canCompile): * ftl/FTLLowerDFGToLLVM.cpp: (JSC::FTL::LowerDFGToLLVM::LowerDFGToLLVM): (JSC::FTL::LowerDFGToLLVM::lower): (JSC::FTL::LowerDFGToLLVM::createPhiVariables): (JSC::FTL::LowerDFGToLLVM::compileBlock): (JSC::FTL::LowerDFGToLLVM::compileNode): (JSC::FTL::LowerDFGToLLVM::compileUpsilon): (LowerDFGToLLVM): (JSC::FTL::LowerDFGToLLVM::compilePhi): (JSC::FTL::LowerDFGToLLVM::compileJSConstant): (JSC::FTL::LowerDFGToLLVM::compileWeakJSConstant): (JSC::FTL::LowerDFGToLLVM::compileGetArgument): (JSC::FTL::LowerDFGToLLVM::compileGetLocal): (JSC::FTL::LowerDFGToLLVM::compileSetLocal): (JSC::FTL::LowerDFGToLLVM::compileAdd): (JSC::FTL::LowerDFGToLLVM::compileArithSub): (JSC::FTL::LowerDFGToLLVM::compileArithMul): (JSC::FTL::LowerDFGToLLVM::compileArithDiv): (JSC::FTL::LowerDFGToLLVM::compileArithMod): (JSC::FTL::LowerDFGToLLVM::compileArithMinOrMax): (JSC::FTL::LowerDFGToLLVM::compileArithAbs): (JSC::FTL::LowerDFGToLLVM::compileArithNegate): (JSC::FTL::LowerDFGToLLVM::compileBitAnd): (JSC::FTL::LowerDFGToLLVM::compileBitOr): (JSC::FTL::LowerDFGToLLVM::compileBitXor): (JSC::FTL::LowerDFGToLLVM::compileBitRShift): (JSC::FTL::LowerDFGToLLVM::compileBitLShift): (JSC::FTL::LowerDFGToLLVM::compileBitURShift): (JSC::FTL::LowerDFGToLLVM::compileUInt32ToNumber): (JSC::FTL::LowerDFGToLLVM::compileInt32ToDouble): (JSC::FTL::LowerDFGToLLVM::compileGetButterfly): (JSC::FTL::LowerDFGToLLVM::compileGetArrayLength): (JSC::FTL::LowerDFGToLLVM::compileGetByVal): (JSC::FTL::LowerDFGToLLVM::compileGetByOffset): (JSC::FTL::LowerDFGToLLVM::compileGetGlobalVar): (JSC::FTL::LowerDFGToLLVM::compileCompareEqConstant): (JSC::FTL::LowerDFGToLLVM::compileCompareStrictEq): (JSC::FTL::LowerDFGToLLVM::compileCompareStrictEqConstant): (JSC::FTL::LowerDFGToLLVM::compileCompareLess): (JSC::FTL::LowerDFGToLLVM::compileCompareLessEq): (JSC::FTL::LowerDFGToLLVM::compileCompareGreater): (JSC::FTL::LowerDFGToLLVM::compileCompareGreaterEq): (JSC::FTL::LowerDFGToLLVM::compileLogicalNot): (JSC::FTL::LowerDFGToLLVM::speculateBackward): (JSC::FTL::LowerDFGToLLVM::lowInt32): (JSC::FTL::LowerDFGToLLVM::lowCell): (JSC::FTL::LowerDFGToLLVM::lowBoolean): (JSC::FTL::LowerDFGToLLVM::lowDouble): (JSC::FTL::LowerDFGToLLVM::lowJSValue): (JSC::FTL::LowerDFGToLLVM::lowStorage): (JSC::FTL::LowerDFGToLLVM::speculate): (JSC::FTL::LowerDFGToLLVM::speculateBoolean): (JSC::FTL::LowerDFGToLLVM::isLive): (JSC::FTL::LowerDFGToLLVM::use): (JSC::FTL::LowerDFGToLLVM::initializeOSRExitStateForBlock): (JSC::FTL::LowerDFGToLLVM::appendOSRExit): (JSC::FTL::LowerDFGToLLVM::emitOSRExitCall): (JSC::FTL::LowerDFGToLLVM::addExitArgumentForNode): (JSC::FTL::LowerDFGToLLVM::linkOSRExitsAndCompleteInitializationBlocks): (JSC::FTL::LowerDFGToLLVM::setInt32): (JSC::FTL::LowerDFGToLLVM::setJSValue): (JSC::FTL::LowerDFGToLLVM::setBoolean): (JSC::FTL::LowerDFGToLLVM::setStorage): (JSC::FTL::LowerDFGToLLVM::setDouble): (JSC::FTL::LowerDFGToLLVM::isValid): * ftl/FTLLoweredNodeValue.h: Added. (FTL): (LoweredNodeValue): (JSC::FTL::LoweredNodeValue::LoweredNodeValue): (JSC::FTL::LoweredNodeValue::isSet): (JSC::FTL::LoweredNodeValue::operator!): (JSC::FTL::LoweredNodeValue::value): (JSC::FTL::LoweredNodeValue::block): * ftl/FTLValueFromBlock.h: (JSC::FTL::ValueFromBlock::ValueFromBlock): (ValueFromBlock): * ftl/FTLValueSource.cpp: (JSC::FTL::ValueSource::dump): * ftl/FTLValueSource.h: Source/WTF: Reviewed by Mark Hahnenberg. - Extend variadicity of PrintStream and dataLog. - Give HashSet the ability to add a span of things. - Give HashSet the ability to == another HashSet. - Note FIXME's in HashTable concerning copying performance, that affects the way that the DFG now uses HashSets and HashMaps. - Factor out the bulk-insertion logic of JSC::DFG::InsertionSet into WTF::Insertion, so that it can be used in more places. - Create a dumper for lists and maps. * WTF.xcodeproj/project.pbxproj: * wtf/DataLog.h: (WTF): (WTF::dataLog): * wtf/HashSet.h: (HashSet): (WTF): (WTF::::add): (WTF::=): * wtf/HashTable.h: (WTF::::HashTable): (WTF::=): * wtf/Insertion.h: Added. (WTF): (Insertion): (WTF::Insertion::Insertion): (WTF::Insertion::index): (WTF::Insertion::element): (WTF::Insertion::operator<): (WTF::executeInsertions): * wtf/ListDump.h: Added. (WTF): (ListDump): (WTF::ListDump::ListDump): (WTF::ListDump::dump): (MapDump): (WTF::MapDump::MapDump): (WTF::MapDump::dump): (WTF::listDump): (WTF::sortedListDump): (WTF::lessThan): (WTF::mapDump): (WTF::sortedMapDump): * wtf/PrintStream.h: (PrintStream): (WTF::PrintStream::print): Conflicts: Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj Canonical link: https://commits.webkit.org/137058@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153274 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:04:45 +00:00
template<typename T, typename Comparator>
CString sortedListDump(const T& list, const Comparator& comparator, const char* comma = ", ")
{
Vector<typename T::ValueType> myList;
myList.appendRange(list.begin(), list.end());
std::sort(myList.begin(), myList.end(), comparator);
StringPrintStream out;
CommaPrinter commaPrinter(comma);
for (unsigned i = 0; i < myList.size(); ++i)
out.print(commaPrinter, myList[i]);
return out.toCString();
}
template<typename T>
CString sortedListDump(const T& list, const char* comma = ", ")
{
return sortedListDump(list, std::less<typename T::ValueType>(), comma);
fourthTier: DFG should have an SSA form for use by FTL https://bugs.webkit.org/show_bug.cgi?id=118338 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. Adds an SSA form to the DFG. We can convert ThreadedCPS form into SSA form after breaking critical edges. The conversion algorithm follows Aycock and Horspool, and the SSA form itself follows something I've done before, where instead of having Phi functions specify input nodes corresponding to block predecessors, we instead have Upsilon functions in the predecessors that specify which value in that block goes into which subsequent Phi. Upsilons don't have to dominate Phis (usually they don't) and they correspond to a non-SSA "mov" into the Phi's "variable". This gives all of the good properties of SSA, while ensuring that a bunch of CFG transformations don't have to be SSA-aware. So far the only DFG phases that are SSA-aware are DCE and CFA. CFG simplification is probably SSA-aware by default, though I haven't tried it. Constant folding probably needs a few tweaks, but is likely ready. Ditto for CSE, though it's not clear that we'd want to use block-local CSE when we could be doing GVN. Currently only the FTL can generate code from the SSA form, and there is no way to convert from SSA to ThreadedCPS or LoadStore. There probably will never be such a capability. In order to handle OSR exit state in the SSA, we place MovHints at Phi points. Other than that, you can reconstruct state-at-exit by forward propagating MovHints. Note that MovHint is the new SetLocal in SSA. SetLocal and GetLocal only survive into SSA if they are on captured variables, or in the case of flushes. A "live SetLocal" will be NodeMustGenerate and will always correspond to a flush. Computing the state-at-exit requires running SSA liveness analysis, OSR availability analysis, and flush liveness analysis. The FTL runs all of these prior to generating code. While OSR exit continues to be tricky, much of the logic is now factored into separate phases and the backend has to do less work to reason about what happened outside of the basic block that is being lowered. Conversion from DFG SSA to LLVM SSA is done by ensuring that we generate code in depth-first order, thus guaranteeing that a node will always be lowered (and hence have a LValue) before any of the blocks dominated by that node's block have code generated. For Upsilon/Phi, we just use alloca's. We could do something more clever there, but it's probably not worth it, at least not now. Finally, while the SSA form is currently only being converted to LLVM IR, there is nothing that prevents us from considering other backends in the future - with the caveat that this form is designed to be first lowered to a lower-level SSA before actual machine code generation commences. So we ought to either use LLVM (the intended path) or we will have to write our own SSA low-level backend. This runs all of the code that the FTL was known to run previously. No change in performance for now. But it does open some exciting possibilities! * JavaScriptCore.xcodeproj/project.pbxproj: * bytecode/Operands.h: (JSC::OperandValueTraits::dump): (JSC::Operands::fill): (Operands): (JSC::Operands::clear): (JSC::Operands::operator==): * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::beginBasicBlock): (JSC::DFG::setLiveValues): (DFG): (JSC::DFG::AbstractState::initialize): (JSC::DFG::AbstractState::endBasicBlock): (JSC::DFG::AbstractState::executeEffects): (JSC::DFG::AbstractState::mergeStateAtTail): (JSC::DFG::AbstractState::merge): * dfg/DFGAbstractState.h: (AbstractState): * dfg/DFGAdjacencyList.h: (JSC::DFG::AdjacencyList::justOneChild): (AdjacencyList): * dfg/DFGBasicBlock.cpp: Added. (DFG): (JSC::DFG::BasicBlock::BasicBlock): (JSC::DFG::BasicBlock::~BasicBlock): (JSC::DFG::BasicBlock::ensureLocals): (JSC::DFG::BasicBlock::isInPhis): (JSC::DFG::BasicBlock::isInBlock): (JSC::DFG::BasicBlock::removePredecessor): (JSC::DFG::BasicBlock::replacePredecessor): (JSC::DFG::BasicBlock::dump): (JSC::DFG::BasicBlock::SSAData::SSAData): (JSC::DFG::BasicBlock::SSAData::~SSAData): * dfg/DFGBasicBlock.h: (BasicBlock): (JSC::DFG::BasicBlock::operator[]): (JSC::DFG::BasicBlock::successor): (JSC::DFG::BasicBlock::successorForCondition): (SSAData): * dfg/DFGBasicBlockInlines.h: (DFG): * dfg/DFGBlockInsertionSet.cpp: Added. (DFG): (JSC::DFG::BlockInsertionSet::BlockInsertionSet): (JSC::DFG::BlockInsertionSet::~BlockInsertionSet): (JSC::DFG::BlockInsertionSet::insert): (JSC::DFG::BlockInsertionSet::insertBefore): (JSC::DFG::BlockInsertionSet::execute): * dfg/DFGBlockInsertionSet.h: Added. (DFG): (BlockInsertionSet): * dfg/DFGCFAPhase.cpp: (JSC::DFG::CFAPhase::run): * dfg/DFGCFGSimplificationPhase.cpp: * dfg/DFGCPSRethreadingPhase.cpp: (JSC::DFG::CPSRethreadingPhase::canonicalizeLocalsInBlock): * dfg/DFGCommon.cpp: (WTF::printInternal): * dfg/DFGCommon.h: (JSC::DFG::doesKill): (DFG): (JSC::DFG::killStatusForDoesKill): * dfg/DFGConstantFoldingPhase.cpp: (JSC::DFG::ConstantFoldingPhase::foldConstants): (JSC::DFG::ConstantFoldingPhase::isCapturedAtOrAfter): * dfg/DFGCriticalEdgeBreakingPhase.cpp: Added. (DFG): (CriticalEdgeBreakingPhase): (JSC::DFG::CriticalEdgeBreakingPhase::CriticalEdgeBreakingPhase): (JSC::DFG::CriticalEdgeBreakingPhase::run): (JSC::DFG::CriticalEdgeBreakingPhase::breakCriticalEdge): (JSC::DFG::performCriticalEdgeBreaking): * dfg/DFGCriticalEdgeBreakingPhase.h: Added. (DFG): * dfg/DFGDCEPhase.cpp: (JSC::DFG::DCEPhase::run): (JSC::DFG::DCEPhase::findTypeCheckRoot): (JSC::DFG::DCEPhase::countNode): (DCEPhase): (JSC::DFG::DCEPhase::countEdge): (JSC::DFG::DCEPhase::eliminateIrrelevantPhantomChildren): * dfg/DFGDriver.cpp: (JSC::DFG::compile): * dfg/DFGEdge.cpp: (JSC::DFG::Edge::dump): * dfg/DFGEdge.h: (JSC::DFG::Edge::Edge): (JSC::DFG::Edge::setNode): (JSC::DFG::Edge::useKindUnchecked): (JSC::DFG::Edge::setUseKind): (JSC::DFG::Edge::setProofStatus): (JSC::DFG::Edge::willNotHaveCheck): (JSC::DFG::Edge::willHaveCheck): (Edge): (JSC::DFG::Edge::killStatusUnchecked): (JSC::DFG::Edge::killStatus): (JSC::DFG::Edge::setKillStatus): (JSC::DFG::Edge::doesKill): (JSC::DFG::Edge::doesNotKill): (JSC::DFG::Edge::shift): (JSC::DFG::Edge::makeWord): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGFlushFormat.cpp: Added. (WTF): (WTF::printInternal): * dfg/DFGFlushFormat.h: Added. (DFG): (JSC::DFG::resultFor): (JSC::DFG::useKindFor): (WTF): * dfg/DFGFlushLivenessAnalysisPhase.cpp: Added. (DFG): (FlushLivenessAnalysisPhase): (JSC::DFG::FlushLivenessAnalysisPhase::FlushLivenessAnalysisPhase): (JSC::DFG::FlushLivenessAnalysisPhase::run): (JSC::DFG::FlushLivenessAnalysisPhase::process): (JSC::DFG::FlushLivenessAnalysisPhase::setForNode): (JSC::DFG::FlushLivenessAnalysisPhase::flushFormat): (JSC::DFG::performFlushLivenessAnalysis): * dfg/DFGFlushLivenessAnalysisPhase.h: Added. (DFG): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::dump): (JSC::DFG::Graph::dumpBlockHeader): (DFG): (JSC::DFG::Graph::addForDepthFirstSort): (JSC::DFG::Graph::getBlocksInDepthFirstOrder): * dfg/DFGGraph.h: (JSC::DFG::Graph::convertToConstant): (JSC::DFG::Graph::valueProfileFor): (Graph): * dfg/DFGInsertionSet.h: (DFG): (JSC::DFG::InsertionSet::execute): * dfg/DFGLivenessAnalysisPhase.cpp: Added. (DFG): (LivenessAnalysisPhase): (JSC::DFG::LivenessAnalysisPhase::LivenessAnalysisPhase): (JSC::DFG::LivenessAnalysisPhase::run): (JSC::DFG::LivenessAnalysisPhase::process): (JSC::DFG::LivenessAnalysisPhase::addChildUse): (JSC::DFG::performLivenessAnalysis): * dfg/DFGLivenessAnalysisPhase.h: Added. (DFG): * dfg/DFGNode.cpp: (JSC::DFG::Node::hasVariableAccessData): (DFG): * dfg/DFGNode.h: (DFG): (Node): (JSC::DFG::Node::hasLocal): (JSC::DFG::Node::variableAccessData): (JSC::DFG::Node::hasPhi): (JSC::DFG::Node::phi): (JSC::DFG::Node::takenBlock): (JSC::DFG::Node::notTakenBlock): (JSC::DFG::Node::successor): (JSC::DFG::Node::successorForCondition): (JSC::DFG::nodeComparator): (JSC::DFG::nodeListDump): (JSC::DFG::nodeMapDump): * dfg/DFGNodeFlags.cpp: (JSC::DFG::dumpNodeFlags): * dfg/DFGNodeType.h: (DFG): * dfg/DFGOSRAvailabilityAnalysisPhase.cpp: Added. (DFG): (OSRAvailabilityAnalysisPhase): (JSC::DFG::OSRAvailabilityAnalysisPhase::OSRAvailabilityAnalysisPhase): (JSC::DFG::OSRAvailabilityAnalysisPhase::run): (JSC::DFG::performOSRAvailabilityAnalysis): * dfg/DFGOSRAvailabilityAnalysisPhase.h: Added. (DFG): * dfg/DFGPlan.cpp: (JSC::DFG::Plan::compileInThreadImpl): * dfg/DFGPredictionInjectionPhase.cpp: (JSC::DFG::PredictionInjectionPhase::run): * dfg/DFGPredictionPropagationPhase.cpp: (JSC::DFG::PredictionPropagationPhase::propagate): * dfg/DFGSSAConversionPhase.cpp: Added. (DFG): (SSAConversionPhase): (JSC::DFG::SSAConversionPhase::SSAConversionPhase): (JSC::DFG::SSAConversionPhase::run): (JSC::DFG::SSAConversionPhase::forwardPhiChildren): (JSC::DFG::SSAConversionPhase::forwardPhi): (JSC::DFG::SSAConversionPhase::forwardPhiEdge): (JSC::DFG::SSAConversionPhase::deduplicateChildren): (JSC::DFG::SSAConversionPhase::addFlushedLocalOp): (JSC::DFG::SSAConversionPhase::addFlushedLocalEdge): (JSC::DFG::performSSAConversion): * dfg/DFGSSAConversionPhase.h: Added. (DFG): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGValidate.cpp: (JSC::DFG::Validate::validate): (Validate): (JSC::DFG::Validate::validateCPS): * dfg/DFGVariableAccessData.h: (JSC::DFG::VariableAccessData::flushFormat): (VariableAccessData): * ftl/FTLCapabilities.cpp: (JSC::FTL::canCompile): * ftl/FTLLowerDFGToLLVM.cpp: (JSC::FTL::LowerDFGToLLVM::LowerDFGToLLVM): (JSC::FTL::LowerDFGToLLVM::lower): (JSC::FTL::LowerDFGToLLVM::createPhiVariables): (JSC::FTL::LowerDFGToLLVM::compileBlock): (JSC::FTL::LowerDFGToLLVM::compileNode): (JSC::FTL::LowerDFGToLLVM::compileUpsilon): (LowerDFGToLLVM): (JSC::FTL::LowerDFGToLLVM::compilePhi): (JSC::FTL::LowerDFGToLLVM::compileJSConstant): (JSC::FTL::LowerDFGToLLVM::compileWeakJSConstant): (JSC::FTL::LowerDFGToLLVM::compileGetArgument): (JSC::FTL::LowerDFGToLLVM::compileGetLocal): (JSC::FTL::LowerDFGToLLVM::compileSetLocal): (JSC::FTL::LowerDFGToLLVM::compileAdd): (JSC::FTL::LowerDFGToLLVM::compileArithSub): (JSC::FTL::LowerDFGToLLVM::compileArithMul): (JSC::FTL::LowerDFGToLLVM::compileArithDiv): (JSC::FTL::LowerDFGToLLVM::compileArithMod): (JSC::FTL::LowerDFGToLLVM::compileArithMinOrMax): (JSC::FTL::LowerDFGToLLVM::compileArithAbs): (JSC::FTL::LowerDFGToLLVM::compileArithNegate): (JSC::FTL::LowerDFGToLLVM::compileBitAnd): (JSC::FTL::LowerDFGToLLVM::compileBitOr): (JSC::FTL::LowerDFGToLLVM::compileBitXor): (JSC::FTL::LowerDFGToLLVM::compileBitRShift): (JSC::FTL::LowerDFGToLLVM::compileBitLShift): (JSC::FTL::LowerDFGToLLVM::compileBitURShift): (JSC::FTL::LowerDFGToLLVM::compileUInt32ToNumber): (JSC::FTL::LowerDFGToLLVM::compileInt32ToDouble): (JSC::FTL::LowerDFGToLLVM::compileGetButterfly): (JSC::FTL::LowerDFGToLLVM::compileGetArrayLength): (JSC::FTL::LowerDFGToLLVM::compileGetByVal): (JSC::FTL::LowerDFGToLLVM::compileGetByOffset): (JSC::FTL::LowerDFGToLLVM::compileGetGlobalVar): (JSC::FTL::LowerDFGToLLVM::compileCompareEqConstant): (JSC::FTL::LowerDFGToLLVM::compileCompareStrictEq): (JSC::FTL::LowerDFGToLLVM::compileCompareStrictEqConstant): (JSC::FTL::LowerDFGToLLVM::compileCompareLess): (JSC::FTL::LowerDFGToLLVM::compileCompareLessEq): (JSC::FTL::LowerDFGToLLVM::compileCompareGreater): (JSC::FTL::LowerDFGToLLVM::compileCompareGreaterEq): (JSC::FTL::LowerDFGToLLVM::compileLogicalNot): (JSC::FTL::LowerDFGToLLVM::speculateBackward): (JSC::FTL::LowerDFGToLLVM::lowInt32): (JSC::FTL::LowerDFGToLLVM::lowCell): (JSC::FTL::LowerDFGToLLVM::lowBoolean): (JSC::FTL::LowerDFGToLLVM::lowDouble): (JSC::FTL::LowerDFGToLLVM::lowJSValue): (JSC::FTL::LowerDFGToLLVM::lowStorage): (JSC::FTL::LowerDFGToLLVM::speculate): (JSC::FTL::LowerDFGToLLVM::speculateBoolean): (JSC::FTL::LowerDFGToLLVM::isLive): (JSC::FTL::LowerDFGToLLVM::use): (JSC::FTL::LowerDFGToLLVM::initializeOSRExitStateForBlock): (JSC::FTL::LowerDFGToLLVM::appendOSRExit): (JSC::FTL::LowerDFGToLLVM::emitOSRExitCall): (JSC::FTL::LowerDFGToLLVM::addExitArgumentForNode): (JSC::FTL::LowerDFGToLLVM::linkOSRExitsAndCompleteInitializationBlocks): (JSC::FTL::LowerDFGToLLVM::setInt32): (JSC::FTL::LowerDFGToLLVM::setJSValue): (JSC::FTL::LowerDFGToLLVM::setBoolean): (JSC::FTL::LowerDFGToLLVM::setStorage): (JSC::FTL::LowerDFGToLLVM::setDouble): (JSC::FTL::LowerDFGToLLVM::isValid): * ftl/FTLLoweredNodeValue.h: Added. (FTL): (LoweredNodeValue): (JSC::FTL::LoweredNodeValue::LoweredNodeValue): (JSC::FTL::LoweredNodeValue::isSet): (JSC::FTL::LoweredNodeValue::operator!): (JSC::FTL::LoweredNodeValue::value): (JSC::FTL::LoweredNodeValue::block): * ftl/FTLValueFromBlock.h: (JSC::FTL::ValueFromBlock::ValueFromBlock): (ValueFromBlock): * ftl/FTLValueSource.cpp: (JSC::FTL::ValueSource::dump): * ftl/FTLValueSource.h: Source/WTF: Reviewed by Mark Hahnenberg. - Extend variadicity of PrintStream and dataLog. - Give HashSet the ability to add a span of things. - Give HashSet the ability to == another HashSet. - Note FIXME's in HashTable concerning copying performance, that affects the way that the DFG now uses HashSets and HashMaps. - Factor out the bulk-insertion logic of JSC::DFG::InsertionSet into WTF::Insertion, so that it can be used in more places. - Create a dumper for lists and maps. * WTF.xcodeproj/project.pbxproj: * wtf/DataLog.h: (WTF): (WTF::dataLog): * wtf/HashSet.h: (HashSet): (WTF): (WTF::::add): (WTF::=): * wtf/HashTable.h: (WTF::::HashTable): (WTF::=): * wtf/Insertion.h: Added. (WTF): (Insertion): (WTF::Insertion::Insertion): (WTF::Insertion::index): (WTF::Insertion::element): (WTF::Insertion::operator<): (WTF::executeInsertions): * wtf/ListDump.h: Added. (WTF): (ListDump): (WTF::ListDump::ListDump): (WTF::ListDump::dump): (MapDump): (WTF::MapDump::MapDump): (WTF::MapDump::dump): (WTF::listDump): (WTF::sortedListDump): (WTF::lessThan): (WTF::mapDump): (WTF::sortedMapDump): * wtf/PrintStream.h: (PrintStream): (WTF::PrintStream::print): Conflicts: Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj Canonical link: https://commits.webkit.org/137058@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153274 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:04:45 +00:00
}
template<typename T>
MapDump<T> mapDump(const T& map, const char* arrow = "=>", const char* comma = ", ")
{
return MapDump<T>(map, arrow, comma);
}
template<typename T, typename Comparator>
CString sortedMapDump(const T& map, const Comparator& comparator, const char* arrow = "=>", const char* comma = ", ")
{
Vector<typename T::KeyType> keys;
FTL B3 should be able to run richards https://bugs.webkit.org/show_bug.cgi?id=152514 Reviewed by Michael Saboff. Source/JavaScriptCore: This came down to a liveness bug and a register allocation bug. The liveness bug was that the code that determined whether we should go around the fixpoint assumed that BitVector::quickSet() would return true if the bit changed state from false to true. That's not how it works. It returns the old value of the bit, so it will return false if the bit changed from false to true. Since there is already a lot of code that relies on this behavior, I fixed Liveness instead of changing BitVector. The register allocation bug was that we weren't guarding some checks of tmp()'s with checks that the Arg isTmp(). The liveness took a long time to track down, and I needed to add a lot of dumping to do it. It's now possible to dump more of the liveness states, including liveAtHead. I found this extremely helpful, so I removed the code that cleared liveAtHead. * b3/air/AirIteratedRegisterCoalescing.cpp: * b3/air/AirLiveness.h: (JSC::B3::Air::AbstractLiveness::AbstractLiveness): (JSC::B3::Air::AbstractLiveness::Iterable::Iterable): (JSC::B3::Air::AbstractLiveness::Iterable::iterator::iterator): (JSC::B3::Air::AbstractLiveness::Iterable::iterator::operator*): (JSC::B3::Air::AbstractLiveness::Iterable::iterator::operator++): (JSC::B3::Air::AbstractLiveness::Iterable::iterator::operator==): (JSC::B3::Air::AbstractLiveness::Iterable::iterator::operator!=): (JSC::B3::Air::AbstractLiveness::Iterable::begin): (JSC::B3::Air::AbstractLiveness::Iterable::end): (JSC::B3::Air::AbstractLiveness::liveAtHead): (JSC::B3::Air::AbstractLiveness::liveAtTail): * b3/air/AirStackSlot.h: (WTF::printInternal): * ftl/FTLOSRExitCompiler.cpp: (JSC::FTL::compileFTLOSRExit): Source/WTF: Change the list dumping helpers to work with a broader set of list kinds. * wtf/ListDump.h: (WTF::ListDump::dump): (WTF::MapDump::dump): (WTF::sortedMapDump): (WTF::ListDumpInContext::dump): Canonical link: https://commits.webkit.org/170620@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@194382 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-12-23 01:50:19 +00:00
for (auto iter = map.begin(); iter != map.end(); ++iter)
fourthTier: DFG should have an SSA form for use by FTL https://bugs.webkit.org/show_bug.cgi?id=118338 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. Adds an SSA form to the DFG. We can convert ThreadedCPS form into SSA form after breaking critical edges. The conversion algorithm follows Aycock and Horspool, and the SSA form itself follows something I've done before, where instead of having Phi functions specify input nodes corresponding to block predecessors, we instead have Upsilon functions in the predecessors that specify which value in that block goes into which subsequent Phi. Upsilons don't have to dominate Phis (usually they don't) and they correspond to a non-SSA "mov" into the Phi's "variable". This gives all of the good properties of SSA, while ensuring that a bunch of CFG transformations don't have to be SSA-aware. So far the only DFG phases that are SSA-aware are DCE and CFA. CFG simplification is probably SSA-aware by default, though I haven't tried it. Constant folding probably needs a few tweaks, but is likely ready. Ditto for CSE, though it's not clear that we'd want to use block-local CSE when we could be doing GVN. Currently only the FTL can generate code from the SSA form, and there is no way to convert from SSA to ThreadedCPS or LoadStore. There probably will never be such a capability. In order to handle OSR exit state in the SSA, we place MovHints at Phi points. Other than that, you can reconstruct state-at-exit by forward propagating MovHints. Note that MovHint is the new SetLocal in SSA. SetLocal and GetLocal only survive into SSA if they are on captured variables, or in the case of flushes. A "live SetLocal" will be NodeMustGenerate and will always correspond to a flush. Computing the state-at-exit requires running SSA liveness analysis, OSR availability analysis, and flush liveness analysis. The FTL runs all of these prior to generating code. While OSR exit continues to be tricky, much of the logic is now factored into separate phases and the backend has to do less work to reason about what happened outside of the basic block that is being lowered. Conversion from DFG SSA to LLVM SSA is done by ensuring that we generate code in depth-first order, thus guaranteeing that a node will always be lowered (and hence have a LValue) before any of the blocks dominated by that node's block have code generated. For Upsilon/Phi, we just use alloca's. We could do something more clever there, but it's probably not worth it, at least not now. Finally, while the SSA form is currently only being converted to LLVM IR, there is nothing that prevents us from considering other backends in the future - with the caveat that this form is designed to be first lowered to a lower-level SSA before actual machine code generation commences. So we ought to either use LLVM (the intended path) or we will have to write our own SSA low-level backend. This runs all of the code that the FTL was known to run previously. No change in performance for now. But it does open some exciting possibilities! * JavaScriptCore.xcodeproj/project.pbxproj: * bytecode/Operands.h: (JSC::OperandValueTraits::dump): (JSC::Operands::fill): (Operands): (JSC::Operands::clear): (JSC::Operands::operator==): * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::beginBasicBlock): (JSC::DFG::setLiveValues): (DFG): (JSC::DFG::AbstractState::initialize): (JSC::DFG::AbstractState::endBasicBlock): (JSC::DFG::AbstractState::executeEffects): (JSC::DFG::AbstractState::mergeStateAtTail): (JSC::DFG::AbstractState::merge): * dfg/DFGAbstractState.h: (AbstractState): * dfg/DFGAdjacencyList.h: (JSC::DFG::AdjacencyList::justOneChild): (AdjacencyList): * dfg/DFGBasicBlock.cpp: Added. (DFG): (JSC::DFG::BasicBlock::BasicBlock): (JSC::DFG::BasicBlock::~BasicBlock): (JSC::DFG::BasicBlock::ensureLocals): (JSC::DFG::BasicBlock::isInPhis): (JSC::DFG::BasicBlock::isInBlock): (JSC::DFG::BasicBlock::removePredecessor): (JSC::DFG::BasicBlock::replacePredecessor): (JSC::DFG::BasicBlock::dump): (JSC::DFG::BasicBlock::SSAData::SSAData): (JSC::DFG::BasicBlock::SSAData::~SSAData): * dfg/DFGBasicBlock.h: (BasicBlock): (JSC::DFG::BasicBlock::operator[]): (JSC::DFG::BasicBlock::successor): (JSC::DFG::BasicBlock::successorForCondition): (SSAData): * dfg/DFGBasicBlockInlines.h: (DFG): * dfg/DFGBlockInsertionSet.cpp: Added. (DFG): (JSC::DFG::BlockInsertionSet::BlockInsertionSet): (JSC::DFG::BlockInsertionSet::~BlockInsertionSet): (JSC::DFG::BlockInsertionSet::insert): (JSC::DFG::BlockInsertionSet::insertBefore): (JSC::DFG::BlockInsertionSet::execute): * dfg/DFGBlockInsertionSet.h: Added. (DFG): (BlockInsertionSet): * dfg/DFGCFAPhase.cpp: (JSC::DFG::CFAPhase::run): * dfg/DFGCFGSimplificationPhase.cpp: * dfg/DFGCPSRethreadingPhase.cpp: (JSC::DFG::CPSRethreadingPhase::canonicalizeLocalsInBlock): * dfg/DFGCommon.cpp: (WTF::printInternal): * dfg/DFGCommon.h: (JSC::DFG::doesKill): (DFG): (JSC::DFG::killStatusForDoesKill): * dfg/DFGConstantFoldingPhase.cpp: (JSC::DFG::ConstantFoldingPhase::foldConstants): (JSC::DFG::ConstantFoldingPhase::isCapturedAtOrAfter): * dfg/DFGCriticalEdgeBreakingPhase.cpp: Added. (DFG): (CriticalEdgeBreakingPhase): (JSC::DFG::CriticalEdgeBreakingPhase::CriticalEdgeBreakingPhase): (JSC::DFG::CriticalEdgeBreakingPhase::run): (JSC::DFG::CriticalEdgeBreakingPhase::breakCriticalEdge): (JSC::DFG::performCriticalEdgeBreaking): * dfg/DFGCriticalEdgeBreakingPhase.h: Added. (DFG): * dfg/DFGDCEPhase.cpp: (JSC::DFG::DCEPhase::run): (JSC::DFG::DCEPhase::findTypeCheckRoot): (JSC::DFG::DCEPhase::countNode): (DCEPhase): (JSC::DFG::DCEPhase::countEdge): (JSC::DFG::DCEPhase::eliminateIrrelevantPhantomChildren): * dfg/DFGDriver.cpp: (JSC::DFG::compile): * dfg/DFGEdge.cpp: (JSC::DFG::Edge::dump): * dfg/DFGEdge.h: (JSC::DFG::Edge::Edge): (JSC::DFG::Edge::setNode): (JSC::DFG::Edge::useKindUnchecked): (JSC::DFG::Edge::setUseKind): (JSC::DFG::Edge::setProofStatus): (JSC::DFG::Edge::willNotHaveCheck): (JSC::DFG::Edge::willHaveCheck): (Edge): (JSC::DFG::Edge::killStatusUnchecked): (JSC::DFG::Edge::killStatus): (JSC::DFG::Edge::setKillStatus): (JSC::DFG::Edge::doesKill): (JSC::DFG::Edge::doesNotKill): (JSC::DFG::Edge::shift): (JSC::DFG::Edge::makeWord): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGFlushFormat.cpp: Added. (WTF): (WTF::printInternal): * dfg/DFGFlushFormat.h: Added. (DFG): (JSC::DFG::resultFor): (JSC::DFG::useKindFor): (WTF): * dfg/DFGFlushLivenessAnalysisPhase.cpp: Added. (DFG): (FlushLivenessAnalysisPhase): (JSC::DFG::FlushLivenessAnalysisPhase::FlushLivenessAnalysisPhase): (JSC::DFG::FlushLivenessAnalysisPhase::run): (JSC::DFG::FlushLivenessAnalysisPhase::process): (JSC::DFG::FlushLivenessAnalysisPhase::setForNode): (JSC::DFG::FlushLivenessAnalysisPhase::flushFormat): (JSC::DFG::performFlushLivenessAnalysis): * dfg/DFGFlushLivenessAnalysisPhase.h: Added. (DFG): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::dump): (JSC::DFG::Graph::dumpBlockHeader): (DFG): (JSC::DFG::Graph::addForDepthFirstSort): (JSC::DFG::Graph::getBlocksInDepthFirstOrder): * dfg/DFGGraph.h: (JSC::DFG::Graph::convertToConstant): (JSC::DFG::Graph::valueProfileFor): (Graph): * dfg/DFGInsertionSet.h: (DFG): (JSC::DFG::InsertionSet::execute): * dfg/DFGLivenessAnalysisPhase.cpp: Added. (DFG): (LivenessAnalysisPhase): (JSC::DFG::LivenessAnalysisPhase::LivenessAnalysisPhase): (JSC::DFG::LivenessAnalysisPhase::run): (JSC::DFG::LivenessAnalysisPhase::process): (JSC::DFG::LivenessAnalysisPhase::addChildUse): (JSC::DFG::performLivenessAnalysis): * dfg/DFGLivenessAnalysisPhase.h: Added. (DFG): * dfg/DFGNode.cpp: (JSC::DFG::Node::hasVariableAccessData): (DFG): * dfg/DFGNode.h: (DFG): (Node): (JSC::DFG::Node::hasLocal): (JSC::DFG::Node::variableAccessData): (JSC::DFG::Node::hasPhi): (JSC::DFG::Node::phi): (JSC::DFG::Node::takenBlock): (JSC::DFG::Node::notTakenBlock): (JSC::DFG::Node::successor): (JSC::DFG::Node::successorForCondition): (JSC::DFG::nodeComparator): (JSC::DFG::nodeListDump): (JSC::DFG::nodeMapDump): * dfg/DFGNodeFlags.cpp: (JSC::DFG::dumpNodeFlags): * dfg/DFGNodeType.h: (DFG): * dfg/DFGOSRAvailabilityAnalysisPhase.cpp: Added. (DFG): (OSRAvailabilityAnalysisPhase): (JSC::DFG::OSRAvailabilityAnalysisPhase::OSRAvailabilityAnalysisPhase): (JSC::DFG::OSRAvailabilityAnalysisPhase::run): (JSC::DFG::performOSRAvailabilityAnalysis): * dfg/DFGOSRAvailabilityAnalysisPhase.h: Added. (DFG): * dfg/DFGPlan.cpp: (JSC::DFG::Plan::compileInThreadImpl): * dfg/DFGPredictionInjectionPhase.cpp: (JSC::DFG::PredictionInjectionPhase::run): * dfg/DFGPredictionPropagationPhase.cpp: (JSC::DFG::PredictionPropagationPhase::propagate): * dfg/DFGSSAConversionPhase.cpp: Added. (DFG): (SSAConversionPhase): (JSC::DFG::SSAConversionPhase::SSAConversionPhase): (JSC::DFG::SSAConversionPhase::run): (JSC::DFG::SSAConversionPhase::forwardPhiChildren): (JSC::DFG::SSAConversionPhase::forwardPhi): (JSC::DFG::SSAConversionPhase::forwardPhiEdge): (JSC::DFG::SSAConversionPhase::deduplicateChildren): (JSC::DFG::SSAConversionPhase::addFlushedLocalOp): (JSC::DFG::SSAConversionPhase::addFlushedLocalEdge): (JSC::DFG::performSSAConversion): * dfg/DFGSSAConversionPhase.h: Added. (DFG): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGValidate.cpp: (JSC::DFG::Validate::validate): (Validate): (JSC::DFG::Validate::validateCPS): * dfg/DFGVariableAccessData.h: (JSC::DFG::VariableAccessData::flushFormat): (VariableAccessData): * ftl/FTLCapabilities.cpp: (JSC::FTL::canCompile): * ftl/FTLLowerDFGToLLVM.cpp: (JSC::FTL::LowerDFGToLLVM::LowerDFGToLLVM): (JSC::FTL::LowerDFGToLLVM::lower): (JSC::FTL::LowerDFGToLLVM::createPhiVariables): (JSC::FTL::LowerDFGToLLVM::compileBlock): (JSC::FTL::LowerDFGToLLVM::compileNode): (JSC::FTL::LowerDFGToLLVM::compileUpsilon): (LowerDFGToLLVM): (JSC::FTL::LowerDFGToLLVM::compilePhi): (JSC::FTL::LowerDFGToLLVM::compileJSConstant): (JSC::FTL::LowerDFGToLLVM::compileWeakJSConstant): (JSC::FTL::LowerDFGToLLVM::compileGetArgument): (JSC::FTL::LowerDFGToLLVM::compileGetLocal): (JSC::FTL::LowerDFGToLLVM::compileSetLocal): (JSC::FTL::LowerDFGToLLVM::compileAdd): (JSC::FTL::LowerDFGToLLVM::compileArithSub): (JSC::FTL::LowerDFGToLLVM::compileArithMul): (JSC::FTL::LowerDFGToLLVM::compileArithDiv): (JSC::FTL::LowerDFGToLLVM::compileArithMod): (JSC::FTL::LowerDFGToLLVM::compileArithMinOrMax): (JSC::FTL::LowerDFGToLLVM::compileArithAbs): (JSC::FTL::LowerDFGToLLVM::compileArithNegate): (JSC::FTL::LowerDFGToLLVM::compileBitAnd): (JSC::FTL::LowerDFGToLLVM::compileBitOr): (JSC::FTL::LowerDFGToLLVM::compileBitXor): (JSC::FTL::LowerDFGToLLVM::compileBitRShift): (JSC::FTL::LowerDFGToLLVM::compileBitLShift): (JSC::FTL::LowerDFGToLLVM::compileBitURShift): (JSC::FTL::LowerDFGToLLVM::compileUInt32ToNumber): (JSC::FTL::LowerDFGToLLVM::compileInt32ToDouble): (JSC::FTL::LowerDFGToLLVM::compileGetButterfly): (JSC::FTL::LowerDFGToLLVM::compileGetArrayLength): (JSC::FTL::LowerDFGToLLVM::compileGetByVal): (JSC::FTL::LowerDFGToLLVM::compileGetByOffset): (JSC::FTL::LowerDFGToLLVM::compileGetGlobalVar): (JSC::FTL::LowerDFGToLLVM::compileCompareEqConstant): (JSC::FTL::LowerDFGToLLVM::compileCompareStrictEq): (JSC::FTL::LowerDFGToLLVM::compileCompareStrictEqConstant): (JSC::FTL::LowerDFGToLLVM::compileCompareLess): (JSC::FTL::LowerDFGToLLVM::compileCompareLessEq): (JSC::FTL::LowerDFGToLLVM::compileCompareGreater): (JSC::FTL::LowerDFGToLLVM::compileCompareGreaterEq): (JSC::FTL::LowerDFGToLLVM::compileLogicalNot): (JSC::FTL::LowerDFGToLLVM::speculateBackward): (JSC::FTL::LowerDFGToLLVM::lowInt32): (JSC::FTL::LowerDFGToLLVM::lowCell): (JSC::FTL::LowerDFGToLLVM::lowBoolean): (JSC::FTL::LowerDFGToLLVM::lowDouble): (JSC::FTL::LowerDFGToLLVM::lowJSValue): (JSC::FTL::LowerDFGToLLVM::lowStorage): (JSC::FTL::LowerDFGToLLVM::speculate): (JSC::FTL::LowerDFGToLLVM::speculateBoolean): (JSC::FTL::LowerDFGToLLVM::isLive): (JSC::FTL::LowerDFGToLLVM::use): (JSC::FTL::LowerDFGToLLVM::initializeOSRExitStateForBlock): (JSC::FTL::LowerDFGToLLVM::appendOSRExit): (JSC::FTL::LowerDFGToLLVM::emitOSRExitCall): (JSC::FTL::LowerDFGToLLVM::addExitArgumentForNode): (JSC::FTL::LowerDFGToLLVM::linkOSRExitsAndCompleteInitializationBlocks): (JSC::FTL::LowerDFGToLLVM::setInt32): (JSC::FTL::LowerDFGToLLVM::setJSValue): (JSC::FTL::LowerDFGToLLVM::setBoolean): (JSC::FTL::LowerDFGToLLVM::setStorage): (JSC::FTL::LowerDFGToLLVM::setDouble): (JSC::FTL::LowerDFGToLLVM::isValid): * ftl/FTLLoweredNodeValue.h: Added. (FTL): (LoweredNodeValue): (JSC::FTL::LoweredNodeValue::LoweredNodeValue): (JSC::FTL::LoweredNodeValue::isSet): (JSC::FTL::LoweredNodeValue::operator!): (JSC::FTL::LoweredNodeValue::value): (JSC::FTL::LoweredNodeValue::block): * ftl/FTLValueFromBlock.h: (JSC::FTL::ValueFromBlock::ValueFromBlock): (ValueFromBlock): * ftl/FTLValueSource.cpp: (JSC::FTL::ValueSource::dump): * ftl/FTLValueSource.h: Source/WTF: Reviewed by Mark Hahnenberg. - Extend variadicity of PrintStream and dataLog. - Give HashSet the ability to add a span of things. - Give HashSet the ability to == another HashSet. - Note FIXME's in HashTable concerning copying performance, that affects the way that the DFG now uses HashSets and HashMaps. - Factor out the bulk-insertion logic of JSC::DFG::InsertionSet into WTF::Insertion, so that it can be used in more places. - Create a dumper for lists and maps. * WTF.xcodeproj/project.pbxproj: * wtf/DataLog.h: (WTF): (WTF::dataLog): * wtf/HashSet.h: (HashSet): (WTF): (WTF::::add): (WTF::=): * wtf/HashTable.h: (WTF::::HashTable): (WTF::=): * wtf/Insertion.h: Added. (WTF): (Insertion): (WTF::Insertion::Insertion): (WTF::Insertion::index): (WTF::Insertion::element): (WTF::Insertion::operator<): (WTF::executeInsertions): * wtf/ListDump.h: Added. (WTF): (ListDump): (WTF::ListDump::ListDump): (WTF::ListDump::dump): (MapDump): (WTF::MapDump::MapDump): (WTF::MapDump::dump): (WTF::listDump): (WTF::sortedListDump): (WTF::lessThan): (WTF::mapDump): (WTF::sortedMapDump): * wtf/PrintStream.h: (PrintStream): (WTF::PrintStream::print): Conflicts: Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj Canonical link: https://commits.webkit.org/137058@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153274 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:04:45 +00:00
keys.append(iter->key);
std::sort(keys.begin(), keys.end(), comparator);
StringPrintStream out;
CommaPrinter commaPrinter(comma);
for (unsigned i = 0; i < keys.size(); ++i)
out.print(commaPrinter, keys[i], arrow, map.get(keys[i]));
return out.toCString();
}
Merge r169795, r169819, r169864, r169902, r169949, r169950, r170016, r170017, r170060, r170064 from ftlopt. 2014-06-17 Filip Pizlo <fpizlo@apple.com> Source/JavaScriptCore: [ftlopt] Fold constant Phis https://bugs.webkit.org/show_bug.cgi?id=133967 Reviewed by Mark Hahnenberg. It's surprising but we didn't really do this before. Or, rather, we only did it incidentally when we would likely crash if it ever happened. Making this work required cleaning up the validater a bit, so I did that too. I also added mayExit() validation for nodes that didn't have origin.forExit (i.e. nodes that end up in the Phi header of basic blocks). But this required beefing up mayExit() a bit. * dfg/DFGAbstractInterpreterInlines.h: (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects): * dfg/DFGAdjacencyList.h: (JSC::DFG::AdjacencyList::isEmpty): * dfg/DFGConstantFoldingPhase.cpp: (JSC::DFG::ConstantFoldingPhase::run): (JSC::DFG::ConstantFoldingPhase::foldConstants): (JSC::DFG::ConstantFoldingPhase::fixUpsilons): * dfg/DFGInPlaceAbstractState.h: * dfg/DFGLICMPhase.cpp: (JSC::DFG::LICMPhase::run): (JSC::DFG::LICMPhase::attemptHoist): * dfg/DFGMayExit.cpp: (JSC::DFG::mayExit): * dfg/DFGValidate.cpp: (JSC::DFG::Validate::validate): (JSC::DFG::Validate::validateSSA): 2014-06-17 Filip Pizlo <fpizlo@apple.com> [ftlopt] Get rid of NodeDoesNotExit and also get rid of StoreEliminationPhase https://bugs.webkit.org/show_bug.cgi?id=133985 Reviewed by Michael Saboff and Mark Hahnenberg. Store elimination phase has never been very profitable, and now that LLVM can do dead store elimination for us, this phase is just completely pointless. This phase is also the primary user of NodeDoesNotExit, which is a flag that the CFA computes. It computes it poorly and we often get bugs in it. It's also a lot of code to maintain. This patch does introduce a new mayExit() calculator that is independent of the CFA and should be enough for most of the previous NodeDoesNotExit users. Currently it's only used for assertions in the DFG backend, but we could use it if we ever brought back any of the other optimizations that previously relied upon NodeDoesNotExit. This is performance-neutral, except for SunSpider, where it's a speed-up. * CMakeLists.txt: * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj: * JavaScriptCore.xcodeproj/project.pbxproj: * dfg/DFGAbstractInterpreter.h: (JSC::DFG::AbstractInterpreter::filterEdgeByUse): (JSC::DFG::AbstractInterpreter::filterByType): * dfg/DFGAbstractInterpreterInlines.h: (JSC::DFG::AbstractInterpreter<AbstractStateType>::startExecuting): (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects): * dfg/DFGCSEPhase.cpp: (JSC::DFG::CSEPhase::CSEPhase): (JSC::DFG::CSEPhase::invalidationPointElimination): (JSC::DFG::CSEPhase::setLocalStoreElimination): (JSC::DFG::CSEPhase::performNodeCSE): (JSC::DFG::CSEPhase::performBlockCSE): (JSC::DFG::performCSE): (JSC::DFG::CSEPhase::globalVarStoreElimination): Deleted. (JSC::DFG::CSEPhase::scopedVarStoreElimination): Deleted. (JSC::DFG::CSEPhase::putStructureStoreElimination): Deleted. (JSC::DFG::CSEPhase::putByOffsetStoreElimination): Deleted. (JSC::DFG::CSEPhase::SetLocalStoreEliminationResult::SetLocalStoreEliminationResult): Deleted. (JSC::DFG::performStoreElimination): Deleted. * dfg/DFGCSEPhase.h: * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::resetExitStates): Deleted. * dfg/DFGGraph.h: * dfg/DFGMayExit.cpp: Added. (JSC::DFG::mayExit): * dfg/DFGMayExit.h: Added. * dfg/DFGNode.h: (JSC::DFG::Node::mergeFlags): (JSC::DFG::Node::filterFlags): (JSC::DFG::Node::setCanExit): Deleted. (JSC::DFG::Node::canExit): Deleted. * dfg/DFGNodeFlags.cpp: (JSC::DFG::dumpNodeFlags): * dfg/DFGNodeFlags.h: * dfg/DFGNodeType.h: * dfg/DFGPlan.cpp: (JSC::DFG::Plan::compileInThreadImpl): * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::terminateSpeculativeExecution): (JSC::DFG::SpeculativeJIT::bail): (JSC::DFG::SpeculativeJIT::compileCurrentBlock): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): 2014-06-15 Filip Pizlo <fpizlo@apple.com> [ftlopt] Remove the DFG optimization fixpoint and remove some obvious reasons why we previously benefited from it https://bugs.webkit.org/show_bug.cgi?id=133931 Reviewed by Oliver Hunt. * dfg/DFGAbstractInterpreterInlines.h: (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects): Trigger constant-folding for GetMyArgumentByVal (which means turning it into GetLocalUnlinked) and correct the handling of Upsilon so we don't fold them away. * dfg/DFGConstantFoldingPhase.cpp: (JSC::DFG::ConstantFoldingPhase::foldConstants): Implement constant-folding for GetMyArgumentByVal. * dfg/DFGPlan.cpp: (JSC::DFG::Plan::compileInThreadImpl): Remove the fixpoint. 2014-06-15 Filip Pizlo <fpizlo@apple.com> [ftlopt] DFG OSR entry should have a crystal-clear story for when it's safe to enter at a block with a set of values https://bugs.webkit.org/show_bug.cgi?id=133935 Reviewed by Oliver Hunt. * bytecode/Operands.h: (JSC::Operands::Operands): (JSC::Operands::ensureLocals): * dfg/DFGAbstractValue.cpp: (JSC::DFG::AbstractValue::filter): Now we can compute intersections of abstract values! * dfg/DFGAbstractValue.h: (JSC::DFG::AbstractValue::makeFullTop): Completeness. (JSC::DFG::AbstractValue::bytecodeTop): Completeness. (JSC::DFG::AbstractValue::fullTop): Completeness. We end up using this one. * dfg/DFGBasicBlock.cpp: (JSC::DFG::BasicBlock::BasicBlock): (JSC::DFG::BasicBlock::ensureLocals): * dfg/DFGBasicBlock.h: Remember the intersection of all things ever proven. * dfg/DFGCFAPhase.cpp: (JSC::DFG::CFAPhase::run): Compute the intersection. * dfg/DFGConstantFoldingPhase.cpp: (JSC::DFG::ConstantFoldingPhase::foldConstants): No need for the weirdo merge check since this fixes the root of the problem. * dfg/DFGGraph.cpp: (JSC::DFG::Graph::dumpBlockHeader): Better dumping. (JSC::DFG::Graph::dump): Better dumping. * dfg/DFGJITCompiler.h: (JSC::DFG::JITCompiler::noticeOSREntry): Use the intersected abstract value. * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::compileCurrentBlock): Assert if the intersected state indicates the block shouldn't execute. 2014-06-12 Filip Pizlo <fpizlo@apple.com> [ftlopt] A DFG inlined ById access variant should not speak of a chain, but only of what structures to test the base for, whether to use a constant as an alternate base for the actual access, and what structures to check on what additional cell constants https://bugs.webkit.org/show_bug.cgi?id=133821 Reviewed by Mark Hahnenberg. This allows us to efficiently cache accesses that differ only in the prototypes on the path from the base to the prototype that has the field. It also simplifies a bunch of code - IntendedStructureChain is now just an intermediate data structure. * CMakeLists.txt: * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj: * JavaScriptCore.xcodeproj/project.pbxproj: * bytecode/ConstantStructureCheck.cpp: Added. (JSC::ConstantStructureCheck::dumpInContext): (JSC::ConstantStructureCheck::dump): (JSC::structureFor): (JSC::areCompatible): (JSC::mergeInto): * bytecode/ConstantStructureCheck.h: Added. (JSC::ConstantStructureCheck::ConstantStructureCheck): (JSC::ConstantStructureCheck::operator!): (JSC::ConstantStructureCheck::constant): (JSC::ConstantStructureCheck::structure): * bytecode/GetByIdStatus.cpp: (JSC::GetByIdStatus::computeForStubInfo): * bytecode/GetByIdVariant.cpp: (JSC::GetByIdVariant::GetByIdVariant): (JSC::GetByIdVariant::operator=): (JSC::GetByIdVariant::attemptToMerge): (JSC::GetByIdVariant::dumpInContext): * bytecode/GetByIdVariant.h: (JSC::GetByIdVariant::constantChecks): (JSC::GetByIdVariant::alternateBase): (JSC::GetByIdVariant::GetByIdVariant): Deleted. (JSC::GetByIdVariant::chain): Deleted. * bytecode/PutByIdVariant.cpp: (JSC::PutByIdVariant::dumpInContext): * bytecode/PutByIdVariant.h: (JSC::PutByIdVariant::transition): (JSC::PutByIdVariant::constantChecks): (JSC::PutByIdVariant::structureChain): Deleted. * dfg/DFGAbstractInterpreterInlines.h: (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::emitChecks): (JSC::DFG::ByteCodeParser::handleGetById): (JSC::DFG::ByteCodeParser::handlePutById): (JSC::DFG::ByteCodeParser::cellConstantWithStructureCheck): Deleted. (JSC::DFG::ByteCodeParser::structureChainIsStillValid): Deleted. (JSC::DFG::ByteCodeParser::emitPrototypeChecks): Deleted. * dfg/DFGConstantFoldingPhase.cpp: (JSC::DFG::ConstantFoldingPhase::foldConstants): (JSC::DFG::ConstantFoldingPhase::emitGetByOffset): (JSC::DFG::ConstantFoldingPhase::emitPutByOffset): (JSC::DFG::ConstantFoldingPhase::addStructureTransitionCheck): * dfg/DFGDesiredStructureChains.cpp: Removed. * dfg/DFGDesiredStructureChains.h: Removed. * dfg/DFGGraph.h: (JSC::DFG::Graph::watchpoints): (JSC::DFG::Graph::chains): Deleted. * dfg/DFGPlan.cpp: (JSC::DFG::Plan::isStillValid): (JSC::DFG::Plan::checkLivenessAndVisitChildren): (JSC::DFG::Plan::cancel): * dfg/DFGPlan.h: * ftl/FTLLowerDFGToLLVM.cpp: (JSC::FTL::LowerDFGToLLVM::compileMultiGetByOffset): * runtime/IntendedStructureChain.cpp: (JSC::IntendedStructureChain::gatherChecks): * runtime/IntendedStructureChain.h: (JSC::IntendedStructureChain::at): (JSC::IntendedStructureChain::operator[]): 2014-06-12 Filip Pizlo <fpizlo@apple.com> [ftlopt] Constant folding and strength reduction should work in SSA https://bugs.webkit.org/show_bug.cgi?id=133839 Reviewed by Oliver Hunt. * dfg/DFGAtTailAbstractState.cpp: (JSC::DFG::AtTailAbstractState::AtTailAbstractState): (JSC::DFG::AtTailAbstractState::forNode): * dfg/DFGAtTailAbstractState.h: * dfg/DFGConstantFoldingPhase.cpp: (JSC::DFG::ConstantFoldingPhase::foldConstants): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::convertToConstant): * dfg/DFGIntegerCheckCombiningPhase.cpp: (JSC::DFG::IntegerCheckCombiningPhase::rangeKeyAndAddend): Fix an unrelated regression that this uncovered. * dfg/DFGLICMPhase.cpp: (JSC::DFG::LICMPhase::LICMPhase): * dfg/DFGPlan.cpp: (JSC::DFG::Plan::compileInThreadImpl): 2014-06-11 Filip Pizlo <fpizlo@apple.com> [ftlopt] DFG get_by_id should inline chain accesses with a slightly polymorphic base https://bugs.webkit.org/show_bug.cgi?id=133751 Reviewed by Mark Hahnenberg. * bytecode/GetByIdStatus.cpp: (JSC::GetByIdStatus::appendVariant): (JSC::GetByIdStatus::computeForStubInfo): * bytecode/GetByIdVariant.cpp: (JSC::GetByIdVariant::attemptToMerge): * bytecode/GetByIdVariant.h: * bytecode/PutByIdStatus.cpp: (JSC::PutByIdStatus::computeFor): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::emitPrototypeChecks): (JSC::DFG::ByteCodeParser::handleGetById): (JSC::DFG::ByteCodeParser::handlePutById): * runtime/IntendedStructureChain.cpp: (JSC::IntendedStructureChain::IntendedStructureChain): (JSC::IntendedStructureChain::isStillValid): (JSC::IntendedStructureChain::isNormalized): (JSC::IntendedStructureChain::terminalPrototype): (JSC::IntendedStructureChain::operator==): (JSC::IntendedStructureChain::visitChildren): (JSC::IntendedStructureChain::dumpInContext): (JSC::IntendedStructureChain::chain): Deleted. * runtime/IntendedStructureChain.h: (JSC::IntendedStructureChain::prototype): (JSC::IntendedStructureChain::operator!=): (JSC::IntendedStructureChain::head): Deleted. 2014-06-11 Matthew Mirman <mmirman@apple.com> Readded native calling to the FTL and Split the DFG nodes Call and Construct into NativeCall and NativeConstruct to better represent their semantics. https://bugs.webkit.org/show_bug.cgi?id=133660 Reviewed by Filip Pizlo. * dfg/DFGAbstractInterpreterInlines.h: (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects): Added NativeCall and NativeConstruct case * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::addCall): added NativeCall case. (JSC::DFG::ByteCodeParser::handleCall): set to return NativeCall or NativeConstruct instead of Call or Construct in the presence of a native function. * dfg/DFGClobberize.h: (JSC::DFG::clobberize): added NativeCall and NativeConstruct case. * dfg/DFGDoesGC.cpp: (JSC::DFG::doesGC): added NativeCall and NativeConstruct case. * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): added NativeCall and NativeConstruct case. * dfg/DFGNode.h: (JSC::DFG::Node::hasHeapPrediction): added NativeCall and NativeConstruct case. (JSC::DFG::Node::canBeKnownFunction): changed to NativeCall and NativeConstruct. (JSC::DFG::Node::hasKnownFunction): changed to NativeCall and NativeConstruct. * dfg/DFGNodeType.h: added NativeCall and NativeConstruct. * dfg/DFGPredictionPropagationPhase.cpp: (JSC::DFG::PredictionPropagationPhase::propagate): added NativeCall and NativeConstruct case. * dfg/DFGSafeToExecute.h: (JSC::DFG::safeToExecute): added NativeCall and NativeConstruct case. * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::emitCall): ditto (JSC::DFG::SpeculativeJIT::compile): ditto * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::emitCall): ditto (JSC::DFG::SpeculativeJIT::compile): ditto * ftl/FTLCapabilities.cpp: (JSC::FTL::canCompile): ditto * ftl/FTLLowerDFGToLLVM.cpp: (JSC::FTL::LowerDFGToLLVM::lower): ditto (JSC::FTL::LowerDFGToLLVM::compileNode): ditto. (JSC::FTL::LowerDFGToLLVM::compileNativeCallOrConstruct): Added. (JSC::FTL::LowerDFGToLLVM::compileCallOrConstruct): removed NativeCall and NativeConstruct functionality. (JSC::FTL::LowerDFGToLLVM::didOverflowStack): added NativeCall and NativeConstruct case. * runtime/JSCJSValue.h: added JS_EXPORT_PRIVATE to toInteger as it is apparently needed. 2014-06-11 Matthew Mirman <mmirman@apple.com> Ensured Native Calls and Construct and associated checks are only emitted during ftl mode. https://bugs.webkit.org/show_bug.cgi?id=133718 Reviewed by Filip Pizlo. * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::handleCall): Added check for ftl mode before attaching the native function to Call or Construct. 2014-06-10 Filip Pizlo <fpizlo@apple.com> [ftlopt] DFG should use its own notion of JSValue, which we should call FrozenValue, that will carry around a copy of its structure https://bugs.webkit.org/show_bug.cgi?id=133426 Reviewed by Geoffrey Garen. The impetus for this was to provide some sense and reason to race conditions arising from cell constants having their structure changed on the main thread - this is harmess because we defend against it, but when it goes wrong, it can be difficult to reproduce because it requires a race. Giving the DFG the ability to "freeze" a cell's structure fixes this. But this patch goes quite a bit further, and completely rationalizes how the DFG reasons about constants. It no longer relies on the CodeBlock constant pool at all, which allows for a more object-oriented approach: for example a Node that has a constant can tell you what constant it has without needing a CodeBlock. * CMakeLists.txt: * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj: * JavaScriptCore.xcodeproj/project.pbxproj: * bytecode/CallLinkStatus.cpp: (JSC::CallLinkStatus::computeExitSiteData): * bytecode/ExitKind.cpp: (JSC::exitKindToString): (JSC::exitKindIsCountable): * bytecode/ExitKind.h: (JSC::isWatchpoint): Deleted. * bytecode/GetByIdStatus.cpp: (JSC::GetByIdStatus::hasExitSite): * bytecode/PutByIdStatus.cpp: (JSC::PutByIdStatus::hasExitSite): * dfg/DFGAbstractInterpreter.h: (JSC::DFG::AbstractInterpreter::filterByValue): (JSC::DFG::AbstractInterpreter::setBuiltInConstant): (JSC::DFG::AbstractInterpreter::setConstant): * dfg/DFGAbstractInterpreterInlines.h: (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects): (JSC::DFG::AbstractInterpreter<AbstractStateType>::filterByValue): * dfg/DFGAbstractValue.cpp: (JSC::DFG::AbstractValue::setOSREntryValue): (JSC::DFG::AbstractValue::set): (JSC::DFG::AbstractValue::filterByValue): (JSC::DFG::AbstractValue::setMostSpecific): Deleted. * dfg/DFGAbstractValue.h: * dfg/DFGArgumentsSimplificationPhase.cpp: (JSC::DFG::ArgumentsSimplificationPhase::run): * dfg/DFGBackwardsPropagationPhase.cpp: (JSC::DFG::BackwardsPropagationPhase::isNotNegZero): (JSC::DFG::BackwardsPropagationPhase::isNotPosZero): (JSC::DFG::BackwardsPropagationPhase::isWithinPowerOfTwoForConstant): (JSC::DFG::BackwardsPropagationPhase::isWithinPowerOfTwo): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::ByteCodeParser): (JSC::DFG::ByteCodeParser::getDirect): (JSC::DFG::ByteCodeParser::get): (JSC::DFG::ByteCodeParser::getLocal): (JSC::DFG::ByteCodeParser::setLocal): (JSC::DFG::ByteCodeParser::setArgument): (JSC::DFG::ByteCodeParser::jsConstant): (JSC::DFG::ByteCodeParser::weakJSConstant): (JSC::DFG::ByteCodeParser::cellConstantWithStructureCheck): (JSC::DFG::ByteCodeParser::InlineStackEntry::remapOperand): (JSC::DFG::ByteCodeParser::handleCall): (JSC::DFG::ByteCodeParser::emitFunctionChecks): (JSC::DFG::ByteCodeParser::handleInlining): (JSC::DFG::ByteCodeParser::handleMinMax): (JSC::DFG::ByteCodeParser::handleIntrinsic): (JSC::DFG::ByteCodeParser::handleConstantInternalFunction): (JSC::DFG::ByteCodeParser::handleGetById): (JSC::DFG::ByteCodeParser::prepareToParseBlock): (JSC::DFG::ByteCodeParser::parseBlock): (JSC::DFG::ByteCodeParser::buildOperandMapsIfNecessary): (JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry): (JSC::DFG::ByteCodeParser::parseCodeBlock): (JSC::DFG::ByteCodeParser::addConstant): Deleted. (JSC::DFG::ByteCodeParser::getJSConstantForValue): Deleted. (JSC::DFG::ByteCodeParser::getJSConstant): Deleted. (JSC::DFG::ByteCodeParser::isJSConstant): Deleted. (JSC::DFG::ByteCodeParser::isInt32Constant): Deleted. (JSC::DFG::ByteCodeParser::valueOfJSConstant): Deleted. (JSC::DFG::ByteCodeParser::valueOfInt32Constant): Deleted. (JSC::DFG::ByteCodeParser::constantUndefined): Deleted. (JSC::DFG::ByteCodeParser::constantNull): Deleted. (JSC::DFG::ByteCodeParser::one): Deleted. (JSC::DFG::ByteCodeParser::constantNaN): Deleted. (JSC::DFG::ByteCodeParser::cellConstant): Deleted. (JSC::DFG::ByteCodeParser::inferredConstant): Deleted. (JSC::DFG::ByteCodeParser::ConstantRecord::ConstantRecord): Deleted. * dfg/DFGCFGSimplificationPhase.cpp: (JSC::DFG::CFGSimplificationPhase::run): * dfg/DFGCSEPhase.cpp: (JSC::DFG::CSEPhase::constantCSE): (JSC::DFG::CSEPhase::checkFunctionElimination): (JSC::DFG::CSEPhase::performNodeCSE): (JSC::DFG::CSEPhase::weakConstantCSE): Deleted. * dfg/DFGClobberize.h: (JSC::DFG::clobberize): * dfg/DFGCommon.h: * dfg/DFGConstantFoldingPhase.cpp: (JSC::DFG::ConstantFoldingPhase::foldConstants): (JSC::DFG::ConstantFoldingPhase::emitGetByOffset): (JSC::DFG::ConstantFoldingPhase::addStructureTransitionCheck): * dfg/DFGDoesGC.cpp: (JSC::DFG::doesGC): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): (JSC::DFG::FixupPhase::fixupMakeRope): (JSC::DFG::FixupPhase::truncateConstantToInt32): (JSC::DFG::FixupPhase::attemptToMakeGetTypedArrayByteLength): (JSC::DFG::FixupPhase::injectTypeConversionsForEdge): * dfg/DFGFrozenValue.cpp: Added. (JSC::DFG::FrozenValue::emptySingleton): (JSC::DFG::FrozenValue::dumpInContext): (JSC::DFG::FrozenValue::dump): * dfg/DFGFrozenValue.h: Added. (JSC::DFG::FrozenValue::FrozenValue): (JSC::DFG::FrozenValue::operator!): (JSC::DFG::FrozenValue::value): (JSC::DFG::FrozenValue::structure): (JSC::DFG::FrozenValue::strengthenTo): (JSC::DFG::FrozenValue::strength): (JSC::DFG::FrozenValue::freeze): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::Graph): (JSC::DFG::Graph::dump): (JSC::DFG::Graph::tryGetActivation): (JSC::DFG::Graph::tryGetFoldableView): (JSC::DFG::Graph::registerFrozenValues): (JSC::DFG::Graph::visitChildren): (JSC::DFG::Graph::freezeFragile): (JSC::DFG::Graph::freeze): (JSC::DFG::Graph::freezeStrong): (JSC::DFG::Graph::convertToConstant): (JSC::DFG::Graph::convertToStrongConstant): (JSC::DFG::Graph::assertIsWatched): * dfg/DFGGraph.h: (JSC::DFG::Graph::addImmediateShouldSpeculateInt32): (JSC::DFG::Graph::convertToConstant): Deleted. (JSC::DFG::Graph::constantRegisterForConstant): Deleted. (JSC::DFG::Graph::getJSConstantSpeculation): Deleted. (JSC::DFG::Graph::isConstant): Deleted. (JSC::DFG::Graph::isJSConstant): Deleted. (JSC::DFG::Graph::isInt32Constant): Deleted. (JSC::DFG::Graph::isDoubleConstant): Deleted. (JSC::DFG::Graph::isNumberConstant): Deleted. (JSC::DFG::Graph::isBooleanConstant): Deleted. (JSC::DFG::Graph::isCellConstant): Deleted. (JSC::DFG::Graph::isFunctionConstant): Deleted. (JSC::DFG::Graph::isInternalFunctionConstant): Deleted. (JSC::DFG::Graph::valueOfJSConstant): Deleted. (JSC::DFG::Graph::valueOfInt32Constant): Deleted. (JSC::DFG::Graph::valueOfNumberConstant): Deleted. (JSC::DFG::Graph::valueOfBooleanConstant): Deleted. (JSC::DFG::Graph::valueOfFunctionConstant): Deleted. (JSC::DFG::Graph::mulImmediateShouldSpeculateInt32): Deleted. * dfg/DFGInPlaceAbstractState.cpp: (JSC::DFG::InPlaceAbstractState::initialize): * dfg/DFGInsertionSet.h: (JSC::DFG::InsertionSet::insertConstant): (JSC::DFG::InsertionSet::insertConstantForUse): * dfg/DFGIntegerCheckCombiningPhase.cpp: (JSC::DFG::IntegerCheckCombiningPhase::rangeKeyAndAddend): * dfg/DFGJITCompiler.cpp: (JSC::DFG::JITCompiler::link): * dfg/DFGLazyJSValue.cpp: (JSC::DFG::LazyJSValue::getValue): (JSC::DFG::LazyJSValue::strictEqual): (JSC::DFG::LazyJSValue::dumpInContext): * dfg/DFGLazyJSValue.h: (JSC::DFG::LazyJSValue::LazyJSValue): (JSC::DFG::LazyJSValue::tryGetValue): (JSC::DFG::LazyJSValue::value): (JSC::DFG::LazyJSValue::switchLookupValue): * dfg/DFGMinifiedNode.cpp: (JSC::DFG::MinifiedNode::fromNode): * dfg/DFGMinifiedNode.h: (JSC::DFG::belongsInMinifiedGraph): (JSC::DFG::MinifiedNode::hasConstant): (JSC::DFG::MinifiedNode::constant): (JSC::DFG::MinifiedNode::hasConstantNumber): Deleted. (JSC::DFG::MinifiedNode::constantNumber): Deleted. (JSC::DFG::MinifiedNode::hasWeakConstant): Deleted. (JSC::DFG::MinifiedNode::weakConstant): Deleted. * dfg/DFGNode.h: (JSC::DFG::Node::hasConstant): (JSC::DFG::Node::constant): (JSC::DFG::Node::convertToConstant): (JSC::DFG::Node::asJSValue): (JSC::DFG::Node::isInt32Constant): (JSC::DFG::Node::asInt32): (JSC::DFG::Node::asUInt32): (JSC::DFG::Node::isDoubleConstant): (JSC::DFG::Node::isNumberConstant): (JSC::DFG::Node::asNumber): (JSC::DFG::Node::isMachineIntConstant): (JSC::DFG::Node::asMachineInt): (JSC::DFG::Node::isBooleanConstant): (JSC::DFG::Node::asBoolean): (JSC::DFG::Node::isCellConstant): (JSC::DFG::Node::asCell): (JSC::DFG::Node::dynamicCastConstant): (JSC::DFG::Node::function): (JSC::DFG::Node::isWeakConstant): Deleted. (JSC::DFG::Node::constantNumber): Deleted. (JSC::DFG::Node::convertToWeakConstant): Deleted. (JSC::DFG::Node::weakConstant): Deleted. (JSC::DFG::Node::valueOfJSConstant): Deleted. * dfg/DFGNodeType.h: * dfg/DFGOSRExitCompiler.cpp: * dfg/DFGPredictionPropagationPhase.cpp: (JSC::DFG::PredictionPropagationPhase::propagate): * dfg/DFGSafeToExecute.h: (JSC::DFG::safeToExecute): * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::silentSavePlanForGPR): (JSC::DFG::SpeculativeJIT::silentSavePlanForFPR): (JSC::DFG::SpeculativeJIT::silentFill): (JSC::DFG::SpeculativeJIT::compileIn): (JSC::DFG::SpeculativeJIT::compilePeepHoleBooleanBranch): (JSC::DFG::SpeculativeJIT::compilePeepHoleInt32Branch): (JSC::DFG::SpeculativeJIT::compileCurrentBlock): (JSC::DFG::SpeculativeJIT::compileDoubleRep): (JSC::DFG::SpeculativeJIT::jumpForTypedArrayOutOfBounds): (JSC::DFG::SpeculativeJIT::compilePutByValForIntTypedArray): (JSC::DFG::SpeculativeJIT::compileAdd): (JSC::DFG::SpeculativeJIT::compileArithSub): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (JSC::DFG::SpeculativeJIT::valueOfJSConstantAsImm64): (JSC::DFG::SpeculativeJIT::initConstantInfo): (JSC::DFG::SpeculativeJIT::isConstant): Deleted. (JSC::DFG::SpeculativeJIT::isJSConstant): Deleted. (JSC::DFG::SpeculativeJIT::isInt32Constant): Deleted. (JSC::DFG::SpeculativeJIT::isDoubleConstant): Deleted. (JSC::DFG::SpeculativeJIT::isNumberConstant): Deleted. (JSC::DFG::SpeculativeJIT::isBooleanConstant): Deleted. (JSC::DFG::SpeculativeJIT::isFunctionConstant): Deleted. (JSC::DFG::SpeculativeJIT::valueOfInt32Constant): Deleted. (JSC::DFG::SpeculativeJIT::valueOfNumberConstant): Deleted. (JSC::DFG::SpeculativeJIT::addressOfDoubleConstant): Deleted. (JSC::DFG::SpeculativeJIT::valueOfJSConstant): Deleted. (JSC::DFG::SpeculativeJIT::valueOfBooleanConstant): Deleted. (JSC::DFG::SpeculativeJIT::valueOfFunctionConstant): Deleted. (JSC::DFG::SpeculativeJIT::isNullConstant): Deleted. (JSC::DFG::SpeculativeJIT::isInteger): Deleted. * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::fillJSValue): (JSC::DFG::SpeculativeJIT::fillSpeculateInt32Internal): (JSC::DFG::SpeculativeJIT::fillSpeculateDouble): (JSC::DFG::SpeculativeJIT::fillSpeculateCell): (JSC::DFG::SpeculativeJIT::fillSpeculateBoolean): (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::fillJSValue): (JSC::DFG::SpeculativeJIT::fillSpeculateInt32Internal): (JSC::DFG::SpeculativeJIT::fillSpeculateInt52): (JSC::DFG::SpeculativeJIT::fillSpeculateDouble): (JSC::DFG::SpeculativeJIT::fillSpeculateCell): (JSC::DFG::SpeculativeJIT::fillSpeculateBoolean): (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGStrengthReductionPhase.cpp: (JSC::DFG::StrengthReductionPhase::handleNode): * dfg/DFGValidate.cpp: (JSC::DFG::Validate::validate): * dfg/DFGValueStrength.cpp: Added. (WTF::printInternal): * dfg/DFGValueStrength.h: Added. (JSC::DFG::merge): * dfg/DFGVariableEventStream.cpp: (JSC::DFG::VariableEventStream::tryToSetConstantRecovery): (JSC::DFG::VariableEventStream::reconstruct): * dfg/DFGVariableEventStream.h: * dfg/DFGWatchableStructureWatchingPhase.cpp: (JSC::DFG::WatchableStructureWatchingPhase::run): (JSC::DFG::WatchableStructureWatchingPhase::tryWatch): * dfg/DFGWatchpointCollectionPhase.cpp: (JSC::DFG::WatchpointCollectionPhase::handle): * ftl/FTLCapabilities.cpp: (JSC::FTL::canCompile): * ftl/FTLLink.cpp: (JSC::FTL::link): * ftl/FTLLowerDFGToLLVM.cpp: (JSC::FTL::LowerDFGToLLVM::compileNode): (JSC::FTL::LowerDFGToLLVM::compileDoubleConstant): (JSC::FTL::LowerDFGToLLVM::compileInt52Constant): (JSC::FTL::LowerDFGToLLVM::compileCheckStructure): (JSC::FTL::LowerDFGToLLVM::compileCheckFunction): (JSC::FTL::LowerDFGToLLVM::compileCompareEqConstant): (JSC::FTL::LowerDFGToLLVM::compileCompareStrictEqConstant): (JSC::FTL::LowerDFGToLLVM::lowInt32): (JSC::FTL::LowerDFGToLLVM::lowCell): (JSC::FTL::LowerDFGToLLVM::lowBoolean): (JSC::FTL::LowerDFGToLLVM::lowJSValue): (JSC::FTL::LowerDFGToLLVM::tryToSetConstantExitArgument): (JSC::FTL::LowerDFGToLLVM::compileWeakJSConstant): Deleted. * ftl/FTLOSRExitCompiler.cpp: (JSC::FTL::compileStub): * runtime/JSCJSValue.cpp: (JSC::JSValue::dumpInContext): (JSC::JSValue::dumpInContextAssumingStructure): * runtime/JSCJSValue.h: LayoutTests: [ftlopt] A DFG inlined ById access variant should not speak of a chain, but only of what structures to test the base for, whether to use a constant as an alternate base for the actual access, and what structures to check on what additional cell constants https://bugs.webkit.org/show_bug.cgi?id=133821 Reviewed by Mark Hahnenberg. * js/regress/poly-chain-access-different-prototypes-expected.txt: Added. * js/regress/poly-chain-access-different-prototypes-simple-expected.txt: Added. * js/regress/poly-chain-access-different-prototypes-simple.html: Added. * js/regress/poly-chain-access-different-prototypes.html: Added. * js/regress/script-tests/poly-chain-access-different-prototypes-simple.js: Added. * js/regress/script-tests/poly-chain-access-different-prototypes.js: Added. 2014-06-11 Filip Pizlo <fpizlo@apple.com> [ftlopt] DFG get_by_id should inline chain accesses with a slightly polymorphic base https://bugs.webkit.org/show_bug.cgi?id=133751 Reviewed by Mark Hahnenberg. * js/regress/poly-chain-access-expected.txt: Added. * js/regress/poly-chain-access-simpler-expected.txt: Added. * js/regress/poly-chain-access-simpler.html: Added. * js/regress/poly-chain-access.html: Added. * js/regress/script-tests/poly-chain-access-simpler.js: Added. * js/regress/script-tests/poly-chain-access.js: Added. Canonical link: https://commits.webkit.org/153192@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@171613 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-07-25 20:55:17 +00:00
template<typename T, typename U>
class ListDumpInContext {
public:
ListDumpInContext(const T& list, U* context, const char* comma)
: m_list(list)
, m_context(context)
, m_comma(comma)
{
}
void dump(PrintStream& out) const
{
FTL B3 should be able to run richards https://bugs.webkit.org/show_bug.cgi?id=152514 Reviewed by Michael Saboff. Source/JavaScriptCore: This came down to a liveness bug and a register allocation bug. The liveness bug was that the code that determined whether we should go around the fixpoint assumed that BitVector::quickSet() would return true if the bit changed state from false to true. That's not how it works. It returns the old value of the bit, so it will return false if the bit changed from false to true. Since there is already a lot of code that relies on this behavior, I fixed Liveness instead of changing BitVector. The register allocation bug was that we weren't guarding some checks of tmp()'s with checks that the Arg isTmp(). The liveness took a long time to track down, and I needed to add a lot of dumping to do it. It's now possible to dump more of the liveness states, including liveAtHead. I found this extremely helpful, so I removed the code that cleared liveAtHead. * b3/air/AirIteratedRegisterCoalescing.cpp: * b3/air/AirLiveness.h: (JSC::B3::Air::AbstractLiveness::AbstractLiveness): (JSC::B3::Air::AbstractLiveness::Iterable::Iterable): (JSC::B3::Air::AbstractLiveness::Iterable::iterator::iterator): (JSC::B3::Air::AbstractLiveness::Iterable::iterator::operator*): (JSC::B3::Air::AbstractLiveness::Iterable::iterator::operator++): (JSC::B3::Air::AbstractLiveness::Iterable::iterator::operator==): (JSC::B3::Air::AbstractLiveness::Iterable::iterator::operator!=): (JSC::B3::Air::AbstractLiveness::Iterable::begin): (JSC::B3::Air::AbstractLiveness::Iterable::end): (JSC::B3::Air::AbstractLiveness::liveAtHead): (JSC::B3::Air::AbstractLiveness::liveAtTail): * b3/air/AirStackSlot.h: (WTF::printInternal): * ftl/FTLOSRExitCompiler.cpp: (JSC::FTL::compileFTLOSRExit): Source/WTF: Change the list dumping helpers to work with a broader set of list kinds. * wtf/ListDump.h: (WTF::ListDump::dump): (WTF::MapDump::dump): (WTF::sortedMapDump): (WTF::ListDumpInContext::dump): Canonical link: https://commits.webkit.org/170620@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@194382 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-12-23 01:50:19 +00:00
for (auto iter = m_list.begin(); iter != m_list.end(); ++iter)
Merge r169795, r169819, r169864, r169902, r169949, r169950, r170016, r170017, r170060, r170064 from ftlopt. 2014-06-17 Filip Pizlo <fpizlo@apple.com> Source/JavaScriptCore: [ftlopt] Fold constant Phis https://bugs.webkit.org/show_bug.cgi?id=133967 Reviewed by Mark Hahnenberg. It's surprising but we didn't really do this before. Or, rather, we only did it incidentally when we would likely crash if it ever happened. Making this work required cleaning up the validater a bit, so I did that too. I also added mayExit() validation for nodes that didn't have origin.forExit (i.e. nodes that end up in the Phi header of basic blocks). But this required beefing up mayExit() a bit. * dfg/DFGAbstractInterpreterInlines.h: (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects): * dfg/DFGAdjacencyList.h: (JSC::DFG::AdjacencyList::isEmpty): * dfg/DFGConstantFoldingPhase.cpp: (JSC::DFG::ConstantFoldingPhase::run): (JSC::DFG::ConstantFoldingPhase::foldConstants): (JSC::DFG::ConstantFoldingPhase::fixUpsilons): * dfg/DFGInPlaceAbstractState.h: * dfg/DFGLICMPhase.cpp: (JSC::DFG::LICMPhase::run): (JSC::DFG::LICMPhase::attemptHoist): * dfg/DFGMayExit.cpp: (JSC::DFG::mayExit): * dfg/DFGValidate.cpp: (JSC::DFG::Validate::validate): (JSC::DFG::Validate::validateSSA): 2014-06-17 Filip Pizlo <fpizlo@apple.com> [ftlopt] Get rid of NodeDoesNotExit and also get rid of StoreEliminationPhase https://bugs.webkit.org/show_bug.cgi?id=133985 Reviewed by Michael Saboff and Mark Hahnenberg. Store elimination phase has never been very profitable, and now that LLVM can do dead store elimination for us, this phase is just completely pointless. This phase is also the primary user of NodeDoesNotExit, which is a flag that the CFA computes. It computes it poorly and we often get bugs in it. It's also a lot of code to maintain. This patch does introduce a new mayExit() calculator that is independent of the CFA and should be enough for most of the previous NodeDoesNotExit users. Currently it's only used for assertions in the DFG backend, but we could use it if we ever brought back any of the other optimizations that previously relied upon NodeDoesNotExit. This is performance-neutral, except for SunSpider, where it's a speed-up. * CMakeLists.txt: * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj: * JavaScriptCore.xcodeproj/project.pbxproj: * dfg/DFGAbstractInterpreter.h: (JSC::DFG::AbstractInterpreter::filterEdgeByUse): (JSC::DFG::AbstractInterpreter::filterByType): * dfg/DFGAbstractInterpreterInlines.h: (JSC::DFG::AbstractInterpreter<AbstractStateType>::startExecuting): (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects): * dfg/DFGCSEPhase.cpp: (JSC::DFG::CSEPhase::CSEPhase): (JSC::DFG::CSEPhase::invalidationPointElimination): (JSC::DFG::CSEPhase::setLocalStoreElimination): (JSC::DFG::CSEPhase::performNodeCSE): (JSC::DFG::CSEPhase::performBlockCSE): (JSC::DFG::performCSE): (JSC::DFG::CSEPhase::globalVarStoreElimination): Deleted. (JSC::DFG::CSEPhase::scopedVarStoreElimination): Deleted. (JSC::DFG::CSEPhase::putStructureStoreElimination): Deleted. (JSC::DFG::CSEPhase::putByOffsetStoreElimination): Deleted. (JSC::DFG::CSEPhase::SetLocalStoreEliminationResult::SetLocalStoreEliminationResult): Deleted. (JSC::DFG::performStoreElimination): Deleted. * dfg/DFGCSEPhase.h: * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::resetExitStates): Deleted. * dfg/DFGGraph.h: * dfg/DFGMayExit.cpp: Added. (JSC::DFG::mayExit): * dfg/DFGMayExit.h: Added. * dfg/DFGNode.h: (JSC::DFG::Node::mergeFlags): (JSC::DFG::Node::filterFlags): (JSC::DFG::Node::setCanExit): Deleted. (JSC::DFG::Node::canExit): Deleted. * dfg/DFGNodeFlags.cpp: (JSC::DFG::dumpNodeFlags): * dfg/DFGNodeFlags.h: * dfg/DFGNodeType.h: * dfg/DFGPlan.cpp: (JSC::DFG::Plan::compileInThreadImpl): * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::terminateSpeculativeExecution): (JSC::DFG::SpeculativeJIT::bail): (JSC::DFG::SpeculativeJIT::compileCurrentBlock): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): 2014-06-15 Filip Pizlo <fpizlo@apple.com> [ftlopt] Remove the DFG optimization fixpoint and remove some obvious reasons why we previously benefited from it https://bugs.webkit.org/show_bug.cgi?id=133931 Reviewed by Oliver Hunt. * dfg/DFGAbstractInterpreterInlines.h: (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects): Trigger constant-folding for GetMyArgumentByVal (which means turning it into GetLocalUnlinked) and correct the handling of Upsilon so we don't fold them away. * dfg/DFGConstantFoldingPhase.cpp: (JSC::DFG::ConstantFoldingPhase::foldConstants): Implement constant-folding for GetMyArgumentByVal. * dfg/DFGPlan.cpp: (JSC::DFG::Plan::compileInThreadImpl): Remove the fixpoint. 2014-06-15 Filip Pizlo <fpizlo@apple.com> [ftlopt] DFG OSR entry should have a crystal-clear story for when it's safe to enter at a block with a set of values https://bugs.webkit.org/show_bug.cgi?id=133935 Reviewed by Oliver Hunt. * bytecode/Operands.h: (JSC::Operands::Operands): (JSC::Operands::ensureLocals): * dfg/DFGAbstractValue.cpp: (JSC::DFG::AbstractValue::filter): Now we can compute intersections of abstract values! * dfg/DFGAbstractValue.h: (JSC::DFG::AbstractValue::makeFullTop): Completeness. (JSC::DFG::AbstractValue::bytecodeTop): Completeness. (JSC::DFG::AbstractValue::fullTop): Completeness. We end up using this one. * dfg/DFGBasicBlock.cpp: (JSC::DFG::BasicBlock::BasicBlock): (JSC::DFG::BasicBlock::ensureLocals): * dfg/DFGBasicBlock.h: Remember the intersection of all things ever proven. * dfg/DFGCFAPhase.cpp: (JSC::DFG::CFAPhase::run): Compute the intersection. * dfg/DFGConstantFoldingPhase.cpp: (JSC::DFG::ConstantFoldingPhase::foldConstants): No need for the weirdo merge check since this fixes the root of the problem. * dfg/DFGGraph.cpp: (JSC::DFG::Graph::dumpBlockHeader): Better dumping. (JSC::DFG::Graph::dump): Better dumping. * dfg/DFGJITCompiler.h: (JSC::DFG::JITCompiler::noticeOSREntry): Use the intersected abstract value. * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::compileCurrentBlock): Assert if the intersected state indicates the block shouldn't execute. 2014-06-12 Filip Pizlo <fpizlo@apple.com> [ftlopt] A DFG inlined ById access variant should not speak of a chain, but only of what structures to test the base for, whether to use a constant as an alternate base for the actual access, and what structures to check on what additional cell constants https://bugs.webkit.org/show_bug.cgi?id=133821 Reviewed by Mark Hahnenberg. This allows us to efficiently cache accesses that differ only in the prototypes on the path from the base to the prototype that has the field. It also simplifies a bunch of code - IntendedStructureChain is now just an intermediate data structure. * CMakeLists.txt: * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj: * JavaScriptCore.xcodeproj/project.pbxproj: * bytecode/ConstantStructureCheck.cpp: Added. (JSC::ConstantStructureCheck::dumpInContext): (JSC::ConstantStructureCheck::dump): (JSC::structureFor): (JSC::areCompatible): (JSC::mergeInto): * bytecode/ConstantStructureCheck.h: Added. (JSC::ConstantStructureCheck::ConstantStructureCheck): (JSC::ConstantStructureCheck::operator!): (JSC::ConstantStructureCheck::constant): (JSC::ConstantStructureCheck::structure): * bytecode/GetByIdStatus.cpp: (JSC::GetByIdStatus::computeForStubInfo): * bytecode/GetByIdVariant.cpp: (JSC::GetByIdVariant::GetByIdVariant): (JSC::GetByIdVariant::operator=): (JSC::GetByIdVariant::attemptToMerge): (JSC::GetByIdVariant::dumpInContext): * bytecode/GetByIdVariant.h: (JSC::GetByIdVariant::constantChecks): (JSC::GetByIdVariant::alternateBase): (JSC::GetByIdVariant::GetByIdVariant): Deleted. (JSC::GetByIdVariant::chain): Deleted. * bytecode/PutByIdVariant.cpp: (JSC::PutByIdVariant::dumpInContext): * bytecode/PutByIdVariant.h: (JSC::PutByIdVariant::transition): (JSC::PutByIdVariant::constantChecks): (JSC::PutByIdVariant::structureChain): Deleted. * dfg/DFGAbstractInterpreterInlines.h: (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::emitChecks): (JSC::DFG::ByteCodeParser::handleGetById): (JSC::DFG::ByteCodeParser::handlePutById): (JSC::DFG::ByteCodeParser::cellConstantWithStructureCheck): Deleted. (JSC::DFG::ByteCodeParser::structureChainIsStillValid): Deleted. (JSC::DFG::ByteCodeParser::emitPrototypeChecks): Deleted. * dfg/DFGConstantFoldingPhase.cpp: (JSC::DFG::ConstantFoldingPhase::foldConstants): (JSC::DFG::ConstantFoldingPhase::emitGetByOffset): (JSC::DFG::ConstantFoldingPhase::emitPutByOffset): (JSC::DFG::ConstantFoldingPhase::addStructureTransitionCheck): * dfg/DFGDesiredStructureChains.cpp: Removed. * dfg/DFGDesiredStructureChains.h: Removed. * dfg/DFGGraph.h: (JSC::DFG::Graph::watchpoints): (JSC::DFG::Graph::chains): Deleted. * dfg/DFGPlan.cpp: (JSC::DFG::Plan::isStillValid): (JSC::DFG::Plan::checkLivenessAndVisitChildren): (JSC::DFG::Plan::cancel): * dfg/DFGPlan.h: * ftl/FTLLowerDFGToLLVM.cpp: (JSC::FTL::LowerDFGToLLVM::compileMultiGetByOffset): * runtime/IntendedStructureChain.cpp: (JSC::IntendedStructureChain::gatherChecks): * runtime/IntendedStructureChain.h: (JSC::IntendedStructureChain::at): (JSC::IntendedStructureChain::operator[]): 2014-06-12 Filip Pizlo <fpizlo@apple.com> [ftlopt] Constant folding and strength reduction should work in SSA https://bugs.webkit.org/show_bug.cgi?id=133839 Reviewed by Oliver Hunt. * dfg/DFGAtTailAbstractState.cpp: (JSC::DFG::AtTailAbstractState::AtTailAbstractState): (JSC::DFG::AtTailAbstractState::forNode): * dfg/DFGAtTailAbstractState.h: * dfg/DFGConstantFoldingPhase.cpp: (JSC::DFG::ConstantFoldingPhase::foldConstants): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::convertToConstant): * dfg/DFGIntegerCheckCombiningPhase.cpp: (JSC::DFG::IntegerCheckCombiningPhase::rangeKeyAndAddend): Fix an unrelated regression that this uncovered. * dfg/DFGLICMPhase.cpp: (JSC::DFG::LICMPhase::LICMPhase): * dfg/DFGPlan.cpp: (JSC::DFG::Plan::compileInThreadImpl): 2014-06-11 Filip Pizlo <fpizlo@apple.com> [ftlopt] DFG get_by_id should inline chain accesses with a slightly polymorphic base https://bugs.webkit.org/show_bug.cgi?id=133751 Reviewed by Mark Hahnenberg. * bytecode/GetByIdStatus.cpp: (JSC::GetByIdStatus::appendVariant): (JSC::GetByIdStatus::computeForStubInfo): * bytecode/GetByIdVariant.cpp: (JSC::GetByIdVariant::attemptToMerge): * bytecode/GetByIdVariant.h: * bytecode/PutByIdStatus.cpp: (JSC::PutByIdStatus::computeFor): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::emitPrototypeChecks): (JSC::DFG::ByteCodeParser::handleGetById): (JSC::DFG::ByteCodeParser::handlePutById): * runtime/IntendedStructureChain.cpp: (JSC::IntendedStructureChain::IntendedStructureChain): (JSC::IntendedStructureChain::isStillValid): (JSC::IntendedStructureChain::isNormalized): (JSC::IntendedStructureChain::terminalPrototype): (JSC::IntendedStructureChain::operator==): (JSC::IntendedStructureChain::visitChildren): (JSC::IntendedStructureChain::dumpInContext): (JSC::IntendedStructureChain::chain): Deleted. * runtime/IntendedStructureChain.h: (JSC::IntendedStructureChain::prototype): (JSC::IntendedStructureChain::operator!=): (JSC::IntendedStructureChain::head): Deleted. 2014-06-11 Matthew Mirman <mmirman@apple.com> Readded native calling to the FTL and Split the DFG nodes Call and Construct into NativeCall and NativeConstruct to better represent their semantics. https://bugs.webkit.org/show_bug.cgi?id=133660 Reviewed by Filip Pizlo. * dfg/DFGAbstractInterpreterInlines.h: (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects): Added NativeCall and NativeConstruct case * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::addCall): added NativeCall case. (JSC::DFG::ByteCodeParser::handleCall): set to return NativeCall or NativeConstruct instead of Call or Construct in the presence of a native function. * dfg/DFGClobberize.h: (JSC::DFG::clobberize): added NativeCall and NativeConstruct case. * dfg/DFGDoesGC.cpp: (JSC::DFG::doesGC): added NativeCall and NativeConstruct case. * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): added NativeCall and NativeConstruct case. * dfg/DFGNode.h: (JSC::DFG::Node::hasHeapPrediction): added NativeCall and NativeConstruct case. (JSC::DFG::Node::canBeKnownFunction): changed to NativeCall and NativeConstruct. (JSC::DFG::Node::hasKnownFunction): changed to NativeCall and NativeConstruct. * dfg/DFGNodeType.h: added NativeCall and NativeConstruct. * dfg/DFGPredictionPropagationPhase.cpp: (JSC::DFG::PredictionPropagationPhase::propagate): added NativeCall and NativeConstruct case. * dfg/DFGSafeToExecute.h: (JSC::DFG::safeToExecute): added NativeCall and NativeConstruct case. * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::emitCall): ditto (JSC::DFG::SpeculativeJIT::compile): ditto * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::emitCall): ditto (JSC::DFG::SpeculativeJIT::compile): ditto * ftl/FTLCapabilities.cpp: (JSC::FTL::canCompile): ditto * ftl/FTLLowerDFGToLLVM.cpp: (JSC::FTL::LowerDFGToLLVM::lower): ditto (JSC::FTL::LowerDFGToLLVM::compileNode): ditto. (JSC::FTL::LowerDFGToLLVM::compileNativeCallOrConstruct): Added. (JSC::FTL::LowerDFGToLLVM::compileCallOrConstruct): removed NativeCall and NativeConstruct functionality. (JSC::FTL::LowerDFGToLLVM::didOverflowStack): added NativeCall and NativeConstruct case. * runtime/JSCJSValue.h: added JS_EXPORT_PRIVATE to toInteger as it is apparently needed. 2014-06-11 Matthew Mirman <mmirman@apple.com> Ensured Native Calls and Construct and associated checks are only emitted during ftl mode. https://bugs.webkit.org/show_bug.cgi?id=133718 Reviewed by Filip Pizlo. * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::handleCall): Added check for ftl mode before attaching the native function to Call or Construct. 2014-06-10 Filip Pizlo <fpizlo@apple.com> [ftlopt] DFG should use its own notion of JSValue, which we should call FrozenValue, that will carry around a copy of its structure https://bugs.webkit.org/show_bug.cgi?id=133426 Reviewed by Geoffrey Garen. The impetus for this was to provide some sense and reason to race conditions arising from cell constants having their structure changed on the main thread - this is harmess because we defend against it, but when it goes wrong, it can be difficult to reproduce because it requires a race. Giving the DFG the ability to "freeze" a cell's structure fixes this. But this patch goes quite a bit further, and completely rationalizes how the DFG reasons about constants. It no longer relies on the CodeBlock constant pool at all, which allows for a more object-oriented approach: for example a Node that has a constant can tell you what constant it has without needing a CodeBlock. * CMakeLists.txt: * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj: * JavaScriptCore.xcodeproj/project.pbxproj: * bytecode/CallLinkStatus.cpp: (JSC::CallLinkStatus::computeExitSiteData): * bytecode/ExitKind.cpp: (JSC::exitKindToString): (JSC::exitKindIsCountable): * bytecode/ExitKind.h: (JSC::isWatchpoint): Deleted. * bytecode/GetByIdStatus.cpp: (JSC::GetByIdStatus::hasExitSite): * bytecode/PutByIdStatus.cpp: (JSC::PutByIdStatus::hasExitSite): * dfg/DFGAbstractInterpreter.h: (JSC::DFG::AbstractInterpreter::filterByValue): (JSC::DFG::AbstractInterpreter::setBuiltInConstant): (JSC::DFG::AbstractInterpreter::setConstant): * dfg/DFGAbstractInterpreterInlines.h: (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects): (JSC::DFG::AbstractInterpreter<AbstractStateType>::filterByValue): * dfg/DFGAbstractValue.cpp: (JSC::DFG::AbstractValue::setOSREntryValue): (JSC::DFG::AbstractValue::set): (JSC::DFG::AbstractValue::filterByValue): (JSC::DFG::AbstractValue::setMostSpecific): Deleted. * dfg/DFGAbstractValue.h: * dfg/DFGArgumentsSimplificationPhase.cpp: (JSC::DFG::ArgumentsSimplificationPhase::run): * dfg/DFGBackwardsPropagationPhase.cpp: (JSC::DFG::BackwardsPropagationPhase::isNotNegZero): (JSC::DFG::BackwardsPropagationPhase::isNotPosZero): (JSC::DFG::BackwardsPropagationPhase::isWithinPowerOfTwoForConstant): (JSC::DFG::BackwardsPropagationPhase::isWithinPowerOfTwo): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::ByteCodeParser): (JSC::DFG::ByteCodeParser::getDirect): (JSC::DFG::ByteCodeParser::get): (JSC::DFG::ByteCodeParser::getLocal): (JSC::DFG::ByteCodeParser::setLocal): (JSC::DFG::ByteCodeParser::setArgument): (JSC::DFG::ByteCodeParser::jsConstant): (JSC::DFG::ByteCodeParser::weakJSConstant): (JSC::DFG::ByteCodeParser::cellConstantWithStructureCheck): (JSC::DFG::ByteCodeParser::InlineStackEntry::remapOperand): (JSC::DFG::ByteCodeParser::handleCall): (JSC::DFG::ByteCodeParser::emitFunctionChecks): (JSC::DFG::ByteCodeParser::handleInlining): (JSC::DFG::ByteCodeParser::handleMinMax): (JSC::DFG::ByteCodeParser::handleIntrinsic): (JSC::DFG::ByteCodeParser::handleConstantInternalFunction): (JSC::DFG::ByteCodeParser::handleGetById): (JSC::DFG::ByteCodeParser::prepareToParseBlock): (JSC::DFG::ByteCodeParser::parseBlock): (JSC::DFG::ByteCodeParser::buildOperandMapsIfNecessary): (JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry): (JSC::DFG::ByteCodeParser::parseCodeBlock): (JSC::DFG::ByteCodeParser::addConstant): Deleted. (JSC::DFG::ByteCodeParser::getJSConstantForValue): Deleted. (JSC::DFG::ByteCodeParser::getJSConstant): Deleted. (JSC::DFG::ByteCodeParser::isJSConstant): Deleted. (JSC::DFG::ByteCodeParser::isInt32Constant): Deleted. (JSC::DFG::ByteCodeParser::valueOfJSConstant): Deleted. (JSC::DFG::ByteCodeParser::valueOfInt32Constant): Deleted. (JSC::DFG::ByteCodeParser::constantUndefined): Deleted. (JSC::DFG::ByteCodeParser::constantNull): Deleted. (JSC::DFG::ByteCodeParser::one): Deleted. (JSC::DFG::ByteCodeParser::constantNaN): Deleted. (JSC::DFG::ByteCodeParser::cellConstant): Deleted. (JSC::DFG::ByteCodeParser::inferredConstant): Deleted. (JSC::DFG::ByteCodeParser::ConstantRecord::ConstantRecord): Deleted. * dfg/DFGCFGSimplificationPhase.cpp: (JSC::DFG::CFGSimplificationPhase::run): * dfg/DFGCSEPhase.cpp: (JSC::DFG::CSEPhase::constantCSE): (JSC::DFG::CSEPhase::checkFunctionElimination): (JSC::DFG::CSEPhase::performNodeCSE): (JSC::DFG::CSEPhase::weakConstantCSE): Deleted. * dfg/DFGClobberize.h: (JSC::DFG::clobberize): * dfg/DFGCommon.h: * dfg/DFGConstantFoldingPhase.cpp: (JSC::DFG::ConstantFoldingPhase::foldConstants): (JSC::DFG::ConstantFoldingPhase::emitGetByOffset): (JSC::DFG::ConstantFoldingPhase::addStructureTransitionCheck): * dfg/DFGDoesGC.cpp: (JSC::DFG::doesGC): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): (JSC::DFG::FixupPhase::fixupMakeRope): (JSC::DFG::FixupPhase::truncateConstantToInt32): (JSC::DFG::FixupPhase::attemptToMakeGetTypedArrayByteLength): (JSC::DFG::FixupPhase::injectTypeConversionsForEdge): * dfg/DFGFrozenValue.cpp: Added. (JSC::DFG::FrozenValue::emptySingleton): (JSC::DFG::FrozenValue::dumpInContext): (JSC::DFG::FrozenValue::dump): * dfg/DFGFrozenValue.h: Added. (JSC::DFG::FrozenValue::FrozenValue): (JSC::DFG::FrozenValue::operator!): (JSC::DFG::FrozenValue::value): (JSC::DFG::FrozenValue::structure): (JSC::DFG::FrozenValue::strengthenTo): (JSC::DFG::FrozenValue::strength): (JSC::DFG::FrozenValue::freeze): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::Graph): (JSC::DFG::Graph::dump): (JSC::DFG::Graph::tryGetActivation): (JSC::DFG::Graph::tryGetFoldableView): (JSC::DFG::Graph::registerFrozenValues): (JSC::DFG::Graph::visitChildren): (JSC::DFG::Graph::freezeFragile): (JSC::DFG::Graph::freeze): (JSC::DFG::Graph::freezeStrong): (JSC::DFG::Graph::convertToConstant): (JSC::DFG::Graph::convertToStrongConstant): (JSC::DFG::Graph::assertIsWatched): * dfg/DFGGraph.h: (JSC::DFG::Graph::addImmediateShouldSpeculateInt32): (JSC::DFG::Graph::convertToConstant): Deleted. (JSC::DFG::Graph::constantRegisterForConstant): Deleted. (JSC::DFG::Graph::getJSConstantSpeculation): Deleted. (JSC::DFG::Graph::isConstant): Deleted. (JSC::DFG::Graph::isJSConstant): Deleted. (JSC::DFG::Graph::isInt32Constant): Deleted. (JSC::DFG::Graph::isDoubleConstant): Deleted. (JSC::DFG::Graph::isNumberConstant): Deleted. (JSC::DFG::Graph::isBooleanConstant): Deleted. (JSC::DFG::Graph::isCellConstant): Deleted. (JSC::DFG::Graph::isFunctionConstant): Deleted. (JSC::DFG::Graph::isInternalFunctionConstant): Deleted. (JSC::DFG::Graph::valueOfJSConstant): Deleted. (JSC::DFG::Graph::valueOfInt32Constant): Deleted. (JSC::DFG::Graph::valueOfNumberConstant): Deleted. (JSC::DFG::Graph::valueOfBooleanConstant): Deleted. (JSC::DFG::Graph::valueOfFunctionConstant): Deleted. (JSC::DFG::Graph::mulImmediateShouldSpeculateInt32): Deleted. * dfg/DFGInPlaceAbstractState.cpp: (JSC::DFG::InPlaceAbstractState::initialize): * dfg/DFGInsertionSet.h: (JSC::DFG::InsertionSet::insertConstant): (JSC::DFG::InsertionSet::insertConstantForUse): * dfg/DFGIntegerCheckCombiningPhase.cpp: (JSC::DFG::IntegerCheckCombiningPhase::rangeKeyAndAddend): * dfg/DFGJITCompiler.cpp: (JSC::DFG::JITCompiler::link): * dfg/DFGLazyJSValue.cpp: (JSC::DFG::LazyJSValue::getValue): (JSC::DFG::LazyJSValue::strictEqual): (JSC::DFG::LazyJSValue::dumpInContext): * dfg/DFGLazyJSValue.h: (JSC::DFG::LazyJSValue::LazyJSValue): (JSC::DFG::LazyJSValue::tryGetValue): (JSC::DFG::LazyJSValue::value): (JSC::DFG::LazyJSValue::switchLookupValue): * dfg/DFGMinifiedNode.cpp: (JSC::DFG::MinifiedNode::fromNode): * dfg/DFGMinifiedNode.h: (JSC::DFG::belongsInMinifiedGraph): (JSC::DFG::MinifiedNode::hasConstant): (JSC::DFG::MinifiedNode::constant): (JSC::DFG::MinifiedNode::hasConstantNumber): Deleted. (JSC::DFG::MinifiedNode::constantNumber): Deleted. (JSC::DFG::MinifiedNode::hasWeakConstant): Deleted. (JSC::DFG::MinifiedNode::weakConstant): Deleted. * dfg/DFGNode.h: (JSC::DFG::Node::hasConstant): (JSC::DFG::Node::constant): (JSC::DFG::Node::convertToConstant): (JSC::DFG::Node::asJSValue): (JSC::DFG::Node::isInt32Constant): (JSC::DFG::Node::asInt32): (JSC::DFG::Node::asUInt32): (JSC::DFG::Node::isDoubleConstant): (JSC::DFG::Node::isNumberConstant): (JSC::DFG::Node::asNumber): (JSC::DFG::Node::isMachineIntConstant): (JSC::DFG::Node::asMachineInt): (JSC::DFG::Node::isBooleanConstant): (JSC::DFG::Node::asBoolean): (JSC::DFG::Node::isCellConstant): (JSC::DFG::Node::asCell): (JSC::DFG::Node::dynamicCastConstant): (JSC::DFG::Node::function): (JSC::DFG::Node::isWeakConstant): Deleted. (JSC::DFG::Node::constantNumber): Deleted. (JSC::DFG::Node::convertToWeakConstant): Deleted. (JSC::DFG::Node::weakConstant): Deleted. (JSC::DFG::Node::valueOfJSConstant): Deleted. * dfg/DFGNodeType.h: * dfg/DFGOSRExitCompiler.cpp: * dfg/DFGPredictionPropagationPhase.cpp: (JSC::DFG::PredictionPropagationPhase::propagate): * dfg/DFGSafeToExecute.h: (JSC::DFG::safeToExecute): * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::silentSavePlanForGPR): (JSC::DFG::SpeculativeJIT::silentSavePlanForFPR): (JSC::DFG::SpeculativeJIT::silentFill): (JSC::DFG::SpeculativeJIT::compileIn): (JSC::DFG::SpeculativeJIT::compilePeepHoleBooleanBranch): (JSC::DFG::SpeculativeJIT::compilePeepHoleInt32Branch): (JSC::DFG::SpeculativeJIT::compileCurrentBlock): (JSC::DFG::SpeculativeJIT::compileDoubleRep): (JSC::DFG::SpeculativeJIT::jumpForTypedArrayOutOfBounds): (JSC::DFG::SpeculativeJIT::compilePutByValForIntTypedArray): (JSC::DFG::SpeculativeJIT::compileAdd): (JSC::DFG::SpeculativeJIT::compileArithSub): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (JSC::DFG::SpeculativeJIT::valueOfJSConstantAsImm64): (JSC::DFG::SpeculativeJIT::initConstantInfo): (JSC::DFG::SpeculativeJIT::isConstant): Deleted. (JSC::DFG::SpeculativeJIT::isJSConstant): Deleted. (JSC::DFG::SpeculativeJIT::isInt32Constant): Deleted. (JSC::DFG::SpeculativeJIT::isDoubleConstant): Deleted. (JSC::DFG::SpeculativeJIT::isNumberConstant): Deleted. (JSC::DFG::SpeculativeJIT::isBooleanConstant): Deleted. (JSC::DFG::SpeculativeJIT::isFunctionConstant): Deleted. (JSC::DFG::SpeculativeJIT::valueOfInt32Constant): Deleted. (JSC::DFG::SpeculativeJIT::valueOfNumberConstant): Deleted. (JSC::DFG::SpeculativeJIT::addressOfDoubleConstant): Deleted. (JSC::DFG::SpeculativeJIT::valueOfJSConstant): Deleted. (JSC::DFG::SpeculativeJIT::valueOfBooleanConstant): Deleted. (JSC::DFG::SpeculativeJIT::valueOfFunctionConstant): Deleted. (JSC::DFG::SpeculativeJIT::isNullConstant): Deleted. (JSC::DFG::SpeculativeJIT::isInteger): Deleted. * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::fillJSValue): (JSC::DFG::SpeculativeJIT::fillSpeculateInt32Internal): (JSC::DFG::SpeculativeJIT::fillSpeculateDouble): (JSC::DFG::SpeculativeJIT::fillSpeculateCell): (JSC::DFG::SpeculativeJIT::fillSpeculateBoolean): (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::fillJSValue): (JSC::DFG::SpeculativeJIT::fillSpeculateInt32Internal): (JSC::DFG::SpeculativeJIT::fillSpeculateInt52): (JSC::DFG::SpeculativeJIT::fillSpeculateDouble): (JSC::DFG::SpeculativeJIT::fillSpeculateCell): (JSC::DFG::SpeculativeJIT::fillSpeculateBoolean): (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGStrengthReductionPhase.cpp: (JSC::DFG::StrengthReductionPhase::handleNode): * dfg/DFGValidate.cpp: (JSC::DFG::Validate::validate): * dfg/DFGValueStrength.cpp: Added. (WTF::printInternal): * dfg/DFGValueStrength.h: Added. (JSC::DFG::merge): * dfg/DFGVariableEventStream.cpp: (JSC::DFG::VariableEventStream::tryToSetConstantRecovery): (JSC::DFG::VariableEventStream::reconstruct): * dfg/DFGVariableEventStream.h: * dfg/DFGWatchableStructureWatchingPhase.cpp: (JSC::DFG::WatchableStructureWatchingPhase::run): (JSC::DFG::WatchableStructureWatchingPhase::tryWatch): * dfg/DFGWatchpointCollectionPhase.cpp: (JSC::DFG::WatchpointCollectionPhase::handle): * ftl/FTLCapabilities.cpp: (JSC::FTL::canCompile): * ftl/FTLLink.cpp: (JSC::FTL::link): * ftl/FTLLowerDFGToLLVM.cpp: (JSC::FTL::LowerDFGToLLVM::compileNode): (JSC::FTL::LowerDFGToLLVM::compileDoubleConstant): (JSC::FTL::LowerDFGToLLVM::compileInt52Constant): (JSC::FTL::LowerDFGToLLVM::compileCheckStructure): (JSC::FTL::LowerDFGToLLVM::compileCheckFunction): (JSC::FTL::LowerDFGToLLVM::compileCompareEqConstant): (JSC::FTL::LowerDFGToLLVM::compileCompareStrictEqConstant): (JSC::FTL::LowerDFGToLLVM::lowInt32): (JSC::FTL::LowerDFGToLLVM::lowCell): (JSC::FTL::LowerDFGToLLVM::lowBoolean): (JSC::FTL::LowerDFGToLLVM::lowJSValue): (JSC::FTL::LowerDFGToLLVM::tryToSetConstantExitArgument): (JSC::FTL::LowerDFGToLLVM::compileWeakJSConstant): Deleted. * ftl/FTLOSRExitCompiler.cpp: (JSC::FTL::compileStub): * runtime/JSCJSValue.cpp: (JSC::JSValue::dumpInContext): (JSC::JSValue::dumpInContextAssumingStructure): * runtime/JSCJSValue.h: LayoutTests: [ftlopt] A DFG inlined ById access variant should not speak of a chain, but only of what structures to test the base for, whether to use a constant as an alternate base for the actual access, and what structures to check on what additional cell constants https://bugs.webkit.org/show_bug.cgi?id=133821 Reviewed by Mark Hahnenberg. * js/regress/poly-chain-access-different-prototypes-expected.txt: Added. * js/regress/poly-chain-access-different-prototypes-simple-expected.txt: Added. * js/regress/poly-chain-access-different-prototypes-simple.html: Added. * js/regress/poly-chain-access-different-prototypes.html: Added. * js/regress/script-tests/poly-chain-access-different-prototypes-simple.js: Added. * js/regress/script-tests/poly-chain-access-different-prototypes.js: Added. 2014-06-11 Filip Pizlo <fpizlo@apple.com> [ftlopt] DFG get_by_id should inline chain accesses with a slightly polymorphic base https://bugs.webkit.org/show_bug.cgi?id=133751 Reviewed by Mark Hahnenberg. * js/regress/poly-chain-access-expected.txt: Added. * js/regress/poly-chain-access-simpler-expected.txt: Added. * js/regress/poly-chain-access-simpler.html: Added. * js/regress/poly-chain-access.html: Added. * js/regress/script-tests/poly-chain-access-simpler.js: Added. * js/regress/script-tests/poly-chain-access.js: Added. Canonical link: https://commits.webkit.org/153192@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@171613 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-07-25 20:55:17 +00:00
out.print(m_comma, inContext(*iter, m_context));
}
private:
const T& m_list;
U* m_context;
CommaPrinter m_comma;
};
template<typename T, typename U>
ListDumpInContext<T, U> listDumpInContext(
const T& list, U* context, const char* comma = ", ")
{
return ListDumpInContext<T, U>(list, context, comma);
}
fourthTier: DFG should have an SSA form for use by FTL https://bugs.webkit.org/show_bug.cgi?id=118338 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. Adds an SSA form to the DFG. We can convert ThreadedCPS form into SSA form after breaking critical edges. The conversion algorithm follows Aycock and Horspool, and the SSA form itself follows something I've done before, where instead of having Phi functions specify input nodes corresponding to block predecessors, we instead have Upsilon functions in the predecessors that specify which value in that block goes into which subsequent Phi. Upsilons don't have to dominate Phis (usually they don't) and they correspond to a non-SSA "mov" into the Phi's "variable". This gives all of the good properties of SSA, while ensuring that a bunch of CFG transformations don't have to be SSA-aware. So far the only DFG phases that are SSA-aware are DCE and CFA. CFG simplification is probably SSA-aware by default, though I haven't tried it. Constant folding probably needs a few tweaks, but is likely ready. Ditto for CSE, though it's not clear that we'd want to use block-local CSE when we could be doing GVN. Currently only the FTL can generate code from the SSA form, and there is no way to convert from SSA to ThreadedCPS or LoadStore. There probably will never be such a capability. In order to handle OSR exit state in the SSA, we place MovHints at Phi points. Other than that, you can reconstruct state-at-exit by forward propagating MovHints. Note that MovHint is the new SetLocal in SSA. SetLocal and GetLocal only survive into SSA if they are on captured variables, or in the case of flushes. A "live SetLocal" will be NodeMustGenerate and will always correspond to a flush. Computing the state-at-exit requires running SSA liveness analysis, OSR availability analysis, and flush liveness analysis. The FTL runs all of these prior to generating code. While OSR exit continues to be tricky, much of the logic is now factored into separate phases and the backend has to do less work to reason about what happened outside of the basic block that is being lowered. Conversion from DFG SSA to LLVM SSA is done by ensuring that we generate code in depth-first order, thus guaranteeing that a node will always be lowered (and hence have a LValue) before any of the blocks dominated by that node's block have code generated. For Upsilon/Phi, we just use alloca's. We could do something more clever there, but it's probably not worth it, at least not now. Finally, while the SSA form is currently only being converted to LLVM IR, there is nothing that prevents us from considering other backends in the future - with the caveat that this form is designed to be first lowered to a lower-level SSA before actual machine code generation commences. So we ought to either use LLVM (the intended path) or we will have to write our own SSA low-level backend. This runs all of the code that the FTL was known to run previously. No change in performance for now. But it does open some exciting possibilities! * JavaScriptCore.xcodeproj/project.pbxproj: * bytecode/Operands.h: (JSC::OperandValueTraits::dump): (JSC::Operands::fill): (Operands): (JSC::Operands::clear): (JSC::Operands::operator==): * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::beginBasicBlock): (JSC::DFG::setLiveValues): (DFG): (JSC::DFG::AbstractState::initialize): (JSC::DFG::AbstractState::endBasicBlock): (JSC::DFG::AbstractState::executeEffects): (JSC::DFG::AbstractState::mergeStateAtTail): (JSC::DFG::AbstractState::merge): * dfg/DFGAbstractState.h: (AbstractState): * dfg/DFGAdjacencyList.h: (JSC::DFG::AdjacencyList::justOneChild): (AdjacencyList): * dfg/DFGBasicBlock.cpp: Added. (DFG): (JSC::DFG::BasicBlock::BasicBlock): (JSC::DFG::BasicBlock::~BasicBlock): (JSC::DFG::BasicBlock::ensureLocals): (JSC::DFG::BasicBlock::isInPhis): (JSC::DFG::BasicBlock::isInBlock): (JSC::DFG::BasicBlock::removePredecessor): (JSC::DFG::BasicBlock::replacePredecessor): (JSC::DFG::BasicBlock::dump): (JSC::DFG::BasicBlock::SSAData::SSAData): (JSC::DFG::BasicBlock::SSAData::~SSAData): * dfg/DFGBasicBlock.h: (BasicBlock): (JSC::DFG::BasicBlock::operator[]): (JSC::DFG::BasicBlock::successor): (JSC::DFG::BasicBlock::successorForCondition): (SSAData): * dfg/DFGBasicBlockInlines.h: (DFG): * dfg/DFGBlockInsertionSet.cpp: Added. (DFG): (JSC::DFG::BlockInsertionSet::BlockInsertionSet): (JSC::DFG::BlockInsertionSet::~BlockInsertionSet): (JSC::DFG::BlockInsertionSet::insert): (JSC::DFG::BlockInsertionSet::insertBefore): (JSC::DFG::BlockInsertionSet::execute): * dfg/DFGBlockInsertionSet.h: Added. (DFG): (BlockInsertionSet): * dfg/DFGCFAPhase.cpp: (JSC::DFG::CFAPhase::run): * dfg/DFGCFGSimplificationPhase.cpp: * dfg/DFGCPSRethreadingPhase.cpp: (JSC::DFG::CPSRethreadingPhase::canonicalizeLocalsInBlock): * dfg/DFGCommon.cpp: (WTF::printInternal): * dfg/DFGCommon.h: (JSC::DFG::doesKill): (DFG): (JSC::DFG::killStatusForDoesKill): * dfg/DFGConstantFoldingPhase.cpp: (JSC::DFG::ConstantFoldingPhase::foldConstants): (JSC::DFG::ConstantFoldingPhase::isCapturedAtOrAfter): * dfg/DFGCriticalEdgeBreakingPhase.cpp: Added. (DFG): (CriticalEdgeBreakingPhase): (JSC::DFG::CriticalEdgeBreakingPhase::CriticalEdgeBreakingPhase): (JSC::DFG::CriticalEdgeBreakingPhase::run): (JSC::DFG::CriticalEdgeBreakingPhase::breakCriticalEdge): (JSC::DFG::performCriticalEdgeBreaking): * dfg/DFGCriticalEdgeBreakingPhase.h: Added. (DFG): * dfg/DFGDCEPhase.cpp: (JSC::DFG::DCEPhase::run): (JSC::DFG::DCEPhase::findTypeCheckRoot): (JSC::DFG::DCEPhase::countNode): (DCEPhase): (JSC::DFG::DCEPhase::countEdge): (JSC::DFG::DCEPhase::eliminateIrrelevantPhantomChildren): * dfg/DFGDriver.cpp: (JSC::DFG::compile): * dfg/DFGEdge.cpp: (JSC::DFG::Edge::dump): * dfg/DFGEdge.h: (JSC::DFG::Edge::Edge): (JSC::DFG::Edge::setNode): (JSC::DFG::Edge::useKindUnchecked): (JSC::DFG::Edge::setUseKind): (JSC::DFG::Edge::setProofStatus): (JSC::DFG::Edge::willNotHaveCheck): (JSC::DFG::Edge::willHaveCheck): (Edge): (JSC::DFG::Edge::killStatusUnchecked): (JSC::DFG::Edge::killStatus): (JSC::DFG::Edge::setKillStatus): (JSC::DFG::Edge::doesKill): (JSC::DFG::Edge::doesNotKill): (JSC::DFG::Edge::shift): (JSC::DFG::Edge::makeWord): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGFlushFormat.cpp: Added. (WTF): (WTF::printInternal): * dfg/DFGFlushFormat.h: Added. (DFG): (JSC::DFG::resultFor): (JSC::DFG::useKindFor): (WTF): * dfg/DFGFlushLivenessAnalysisPhase.cpp: Added. (DFG): (FlushLivenessAnalysisPhase): (JSC::DFG::FlushLivenessAnalysisPhase::FlushLivenessAnalysisPhase): (JSC::DFG::FlushLivenessAnalysisPhase::run): (JSC::DFG::FlushLivenessAnalysisPhase::process): (JSC::DFG::FlushLivenessAnalysisPhase::setForNode): (JSC::DFG::FlushLivenessAnalysisPhase::flushFormat): (JSC::DFG::performFlushLivenessAnalysis): * dfg/DFGFlushLivenessAnalysisPhase.h: Added. (DFG): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::dump): (JSC::DFG::Graph::dumpBlockHeader): (DFG): (JSC::DFG::Graph::addForDepthFirstSort): (JSC::DFG::Graph::getBlocksInDepthFirstOrder): * dfg/DFGGraph.h: (JSC::DFG::Graph::convertToConstant): (JSC::DFG::Graph::valueProfileFor): (Graph): * dfg/DFGInsertionSet.h: (DFG): (JSC::DFG::InsertionSet::execute): * dfg/DFGLivenessAnalysisPhase.cpp: Added. (DFG): (LivenessAnalysisPhase): (JSC::DFG::LivenessAnalysisPhase::LivenessAnalysisPhase): (JSC::DFG::LivenessAnalysisPhase::run): (JSC::DFG::LivenessAnalysisPhase::process): (JSC::DFG::LivenessAnalysisPhase::addChildUse): (JSC::DFG::performLivenessAnalysis): * dfg/DFGLivenessAnalysisPhase.h: Added. (DFG): * dfg/DFGNode.cpp: (JSC::DFG::Node::hasVariableAccessData): (DFG): * dfg/DFGNode.h: (DFG): (Node): (JSC::DFG::Node::hasLocal): (JSC::DFG::Node::variableAccessData): (JSC::DFG::Node::hasPhi): (JSC::DFG::Node::phi): (JSC::DFG::Node::takenBlock): (JSC::DFG::Node::notTakenBlock): (JSC::DFG::Node::successor): (JSC::DFG::Node::successorForCondition): (JSC::DFG::nodeComparator): (JSC::DFG::nodeListDump): (JSC::DFG::nodeMapDump): * dfg/DFGNodeFlags.cpp: (JSC::DFG::dumpNodeFlags): * dfg/DFGNodeType.h: (DFG): * dfg/DFGOSRAvailabilityAnalysisPhase.cpp: Added. (DFG): (OSRAvailabilityAnalysisPhase): (JSC::DFG::OSRAvailabilityAnalysisPhase::OSRAvailabilityAnalysisPhase): (JSC::DFG::OSRAvailabilityAnalysisPhase::run): (JSC::DFG::performOSRAvailabilityAnalysis): * dfg/DFGOSRAvailabilityAnalysisPhase.h: Added. (DFG): * dfg/DFGPlan.cpp: (JSC::DFG::Plan::compileInThreadImpl): * dfg/DFGPredictionInjectionPhase.cpp: (JSC::DFG::PredictionInjectionPhase::run): * dfg/DFGPredictionPropagationPhase.cpp: (JSC::DFG::PredictionPropagationPhase::propagate): * dfg/DFGSSAConversionPhase.cpp: Added. (DFG): (SSAConversionPhase): (JSC::DFG::SSAConversionPhase::SSAConversionPhase): (JSC::DFG::SSAConversionPhase::run): (JSC::DFG::SSAConversionPhase::forwardPhiChildren): (JSC::DFG::SSAConversionPhase::forwardPhi): (JSC::DFG::SSAConversionPhase::forwardPhiEdge): (JSC::DFG::SSAConversionPhase::deduplicateChildren): (JSC::DFG::SSAConversionPhase::addFlushedLocalOp): (JSC::DFG::SSAConversionPhase::addFlushedLocalEdge): (JSC::DFG::performSSAConversion): * dfg/DFGSSAConversionPhase.h: Added. (DFG): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGValidate.cpp: (JSC::DFG::Validate::validate): (Validate): (JSC::DFG::Validate::validateCPS): * dfg/DFGVariableAccessData.h: (JSC::DFG::VariableAccessData::flushFormat): (VariableAccessData): * ftl/FTLCapabilities.cpp: (JSC::FTL::canCompile): * ftl/FTLLowerDFGToLLVM.cpp: (JSC::FTL::LowerDFGToLLVM::LowerDFGToLLVM): (JSC::FTL::LowerDFGToLLVM::lower): (JSC::FTL::LowerDFGToLLVM::createPhiVariables): (JSC::FTL::LowerDFGToLLVM::compileBlock): (JSC::FTL::LowerDFGToLLVM::compileNode): (JSC::FTL::LowerDFGToLLVM::compileUpsilon): (LowerDFGToLLVM): (JSC::FTL::LowerDFGToLLVM::compilePhi): (JSC::FTL::LowerDFGToLLVM::compileJSConstant): (JSC::FTL::LowerDFGToLLVM::compileWeakJSConstant): (JSC::FTL::LowerDFGToLLVM::compileGetArgument): (JSC::FTL::LowerDFGToLLVM::compileGetLocal): (JSC::FTL::LowerDFGToLLVM::compileSetLocal): (JSC::FTL::LowerDFGToLLVM::compileAdd): (JSC::FTL::LowerDFGToLLVM::compileArithSub): (JSC::FTL::LowerDFGToLLVM::compileArithMul): (JSC::FTL::LowerDFGToLLVM::compileArithDiv): (JSC::FTL::LowerDFGToLLVM::compileArithMod): (JSC::FTL::LowerDFGToLLVM::compileArithMinOrMax): (JSC::FTL::LowerDFGToLLVM::compileArithAbs): (JSC::FTL::LowerDFGToLLVM::compileArithNegate): (JSC::FTL::LowerDFGToLLVM::compileBitAnd): (JSC::FTL::LowerDFGToLLVM::compileBitOr): (JSC::FTL::LowerDFGToLLVM::compileBitXor): (JSC::FTL::LowerDFGToLLVM::compileBitRShift): (JSC::FTL::LowerDFGToLLVM::compileBitLShift): (JSC::FTL::LowerDFGToLLVM::compileBitURShift): (JSC::FTL::LowerDFGToLLVM::compileUInt32ToNumber): (JSC::FTL::LowerDFGToLLVM::compileInt32ToDouble): (JSC::FTL::LowerDFGToLLVM::compileGetButterfly): (JSC::FTL::LowerDFGToLLVM::compileGetArrayLength): (JSC::FTL::LowerDFGToLLVM::compileGetByVal): (JSC::FTL::LowerDFGToLLVM::compileGetByOffset): (JSC::FTL::LowerDFGToLLVM::compileGetGlobalVar): (JSC::FTL::LowerDFGToLLVM::compileCompareEqConstant): (JSC::FTL::LowerDFGToLLVM::compileCompareStrictEq): (JSC::FTL::LowerDFGToLLVM::compileCompareStrictEqConstant): (JSC::FTL::LowerDFGToLLVM::compileCompareLess): (JSC::FTL::LowerDFGToLLVM::compileCompareLessEq): (JSC::FTL::LowerDFGToLLVM::compileCompareGreater): (JSC::FTL::LowerDFGToLLVM::compileCompareGreaterEq): (JSC::FTL::LowerDFGToLLVM::compileLogicalNot): (JSC::FTL::LowerDFGToLLVM::speculateBackward): (JSC::FTL::LowerDFGToLLVM::lowInt32): (JSC::FTL::LowerDFGToLLVM::lowCell): (JSC::FTL::LowerDFGToLLVM::lowBoolean): (JSC::FTL::LowerDFGToLLVM::lowDouble): (JSC::FTL::LowerDFGToLLVM::lowJSValue): (JSC::FTL::LowerDFGToLLVM::lowStorage): (JSC::FTL::LowerDFGToLLVM::speculate): (JSC::FTL::LowerDFGToLLVM::speculateBoolean): (JSC::FTL::LowerDFGToLLVM::isLive): (JSC::FTL::LowerDFGToLLVM::use): (JSC::FTL::LowerDFGToLLVM::initializeOSRExitStateForBlock): (JSC::FTL::LowerDFGToLLVM::appendOSRExit): (JSC::FTL::LowerDFGToLLVM::emitOSRExitCall): (JSC::FTL::LowerDFGToLLVM::addExitArgumentForNode): (JSC::FTL::LowerDFGToLLVM::linkOSRExitsAndCompleteInitializationBlocks): (JSC::FTL::LowerDFGToLLVM::setInt32): (JSC::FTL::LowerDFGToLLVM::setJSValue): (JSC::FTL::LowerDFGToLLVM::setBoolean): (JSC::FTL::LowerDFGToLLVM::setStorage): (JSC::FTL::LowerDFGToLLVM::setDouble): (JSC::FTL::LowerDFGToLLVM::isValid): * ftl/FTLLoweredNodeValue.h: Added. (FTL): (LoweredNodeValue): (JSC::FTL::LoweredNodeValue::LoweredNodeValue): (JSC::FTL::LoweredNodeValue::isSet): (JSC::FTL::LoweredNodeValue::operator!): (JSC::FTL::LoweredNodeValue::value): (JSC::FTL::LoweredNodeValue::block): * ftl/FTLValueFromBlock.h: (JSC::FTL::ValueFromBlock::ValueFromBlock): (ValueFromBlock): * ftl/FTLValueSource.cpp: (JSC::FTL::ValueSource::dump): * ftl/FTLValueSource.h: Source/WTF: Reviewed by Mark Hahnenberg. - Extend variadicity of PrintStream and dataLog. - Give HashSet the ability to add a span of things. - Give HashSet the ability to == another HashSet. - Note FIXME's in HashTable concerning copying performance, that affects the way that the DFG now uses HashSets and HashMaps. - Factor out the bulk-insertion logic of JSC::DFG::InsertionSet into WTF::Insertion, so that it can be used in more places. - Create a dumper for lists and maps. * WTF.xcodeproj/project.pbxproj: * wtf/DataLog.h: (WTF): (WTF::dataLog): * wtf/HashSet.h: (HashSet): (WTF): (WTF::::add): (WTF::=): * wtf/HashTable.h: (WTF::::HashTable): (WTF::=): * wtf/Insertion.h: Added. (WTF): (Insertion): (WTF::Insertion::Insertion): (WTF::Insertion::index): (WTF::Insertion::element): (WTF::Insertion::operator<): (WTF::executeInsertions): * wtf/ListDump.h: Added. (WTF): (ListDump): (WTF::ListDump::ListDump): (WTF::ListDump::dump): (MapDump): (WTF::MapDump::MapDump): (WTF::MapDump::dump): (WTF::listDump): (WTF::sortedListDump): (WTF::lessThan): (WTF::mapDump): (WTF::sortedMapDump): * wtf/PrintStream.h: (PrintStream): (WTF::PrintStream::print): Conflicts: Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj Canonical link: https://commits.webkit.org/137058@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153274 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:04:45 +00:00
} // namespace WTF
using WTF::listDump;
The GC should be optionally concurrent and disabled by default https://bugs.webkit.org/show_bug.cgi?id=164454 Reviewed by Geoffrey Garen. Source/JavaScriptCore: This started out as a patch to have the GC scan the stack at the end, and then the outage happened and I decided to pick a more aggresive target: give the GC a concurrent mode that can be enabled at runtime, and whose only effect is that it turns on the ResumeTheWorldScope. This gives our GC a really intuitive workflow: by default, the GC thread is running solo with the world stopped and the parallel markers converged and waiting. We have a parallel work scope to enable the parallel markers and now we have a ResumeTheWorldScope that will optionally resume the world and then stop it again. It's easy to make a concurrent GC that always instantly crashes. I can't promise that this one won't do that when you run it. I set a specific goal: I wanted to do >10 concurrent GCs in debug mode with generations, optimizing JITs, and parallel marking disabled. To reach this milestone, I needed to do a bunch of stuff: - The mutator needs a separate mark stack for the barrier, since it will mutate this stack concurrently to the collector's slot visitors. - The use of CellState to indicate whether an object is being scanned the first time or a subsequent time was racy. It fails spectacularly when a barrier is fired at the same time as visitChildren is running or if the barrier runs at the same time as the GC marks the same object. So, I split SlotVisitor's mark stacks. It's now the case that you know why you're being scanned by looking at which stack you came off of. - All of root marking must be in the collector fixpoint. I renamed markRoots to markToFixpoint. They say concurrency is hard, but the collector looks more intuitive this way. We never gained anything from forcing people to make a choice between scanning something in the fixpoint versus outside of it. Because root scanning is cheap, we can afford to do it repeatedly, which means all root scanning can now do constraint-based marking (like: I'll mark you if that thing is marked). - JSObject::visitChildren's scanning of the butterfly raced with property additions, indexed storage transitions and resizing, and a bunch of miscellaneous dirty butterfly reshaping functions - like the one that flattens a dictionary and some sneaky ArrayStorage transformations. Many of these can be fixed by using store-store fences in the mutator and load-load fences in the collector. I've adopted the rule that the collector must always see either a butterfly and structure that match or a newer butterfly with an older structure, where their age is just one transition apart. This can be achieved with fences. For the cases where it breaks down, I added a lock to every JSCell. This is a full-fledged WTF lock that we sneak into two available bits in the indexingType. See the WTF ChangeLog for details. The mutator fencing rules are as follows: - Store-store fence before and after setting the butterfly. - Store-store fence before setting structure if you had changed the shape of the butterfly. - Store-store fence after initializing all fields in an allocation. - A dictionary Structure can change in strange ways while the GC is trying to scan it. So, JSObject::visitChildren will now grab the object's structure's lock if the object's structure is a dictionary. Dictionary structures are 1:1 with their object, so this does not reduce GC parallelism (super unlikely that the GC will simultaneously scan an object from two threads). - The GC can blow away a Structure's property table at any time. As a small consolation, it's now holding the Structure's lock when it does so. But there was tons of code in Structure that uses DeferGC to prevent the GC from blowing away the property table. This doesn't work with concurrent GC, since DeferGC only means that the GC won't run its safepoint (i.e. stop-the-world code) in the DeferGC region. It will still do marking and it was the Structure::visitChildren that would delete the table. It turns out that Structure's reliance on the property table not being deleted was the product of code rot. We already had functions that would materialize the table on demand. We were simply making the mistake of saying: structure->materializePropertyMap(); ... structure->propertyTable()->things Instead of saying: PropertyTable* table = structure->ensurePropertyTable(); ... table->things Switching the code to use the latter idiom allowed me to simplify the code a lot while fixing the race. - The LLInt's get_by_val handling was broken because the indexing shape constants were wrong. Once I started putting more things into the IndexingType, that started causing crashes for me. So I fixed LLInt. That turned out to be a lot of work, since that code had rotted in subtle ways. This is a speed-up in SunSpider, probably because of the LLInt fix. This is neutral on Octane and Kraken. It's a smaller slow-down on LongSpider, but I think we can ignore that (we don't view LongSpider as an official benchmark). By default, the concurrent GC is disabled: in all of the places where it would have resumed the world to run marking concurrently to the mutator, it will just skip the resume step. When you enable concurrent GC (--useConcurrentGC=true), it can sometimes run Octane/splay to completion. It seems to perform quite well: on my machine, it improves both splay-throughput and splay-latency. It's probably unstable for other programs. * API/JSVirtualMachine.mm: (-[JSVirtualMachine isOldExternalObject:]): * assembler/MacroAssemblerARMv7.h: (JSC::MacroAssemblerARMv7::storeFence): * bytecode/InlineAccess.cpp: (JSC::InlineAccess::dumpCacheSizesAndCrash): (JSC::InlineAccess::generateSelfPropertyAccess): (JSC::InlineAccess::generateArrayLength): * bytecode/ObjectAllocationProfile.h: (JSC::ObjectAllocationProfile::offsetOfInlineCapacity): (JSC::ObjectAllocationProfile::ObjectAllocationProfile): (JSC::ObjectAllocationProfile::initialize): (JSC::ObjectAllocationProfile::inlineCapacity): (JSC::ObjectAllocationProfile::clear): * bytecode/PolymorphicAccess.cpp: (JSC::AccessCase::generateWithGuard): (JSC::AccessCase::generateImpl): * dfg/DFGArrayifySlowPathGenerator.h: * dfg/DFGClobberize.h: (JSC::DFG::clobberize): * dfg/DFGOSRExitCompiler32_64.cpp: (JSC::DFG::OSRExitCompiler::compileExit): * dfg/DFGOSRExitCompiler64.cpp: (JSC::DFG::OSRExitCompiler::compileExit): * dfg/DFGOperations.cpp: * dfg/DFGPlan.cpp: (JSC::DFG::Plan::markCodeBlocks): (JSC::DFG::Plan::rememberCodeBlocks): * dfg/DFGPlan.h: * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::emitAllocateRawObject): (JSC::DFG::SpeculativeJIT::checkArray): (JSC::DFG::SpeculativeJIT::arrayify): (JSC::DFG::SpeculativeJIT::compileMakeRope): (JSC::DFG::SpeculativeJIT::compileNewFunctionCommon): (JSC::DFG::SpeculativeJIT::compileCreateActivation): (JSC::DFG::SpeculativeJIT::compileCreateDirectArguments): (JSC::DFG::SpeculativeJIT::compileSpread): (JSC::DFG::SpeculativeJIT::compileAllocatePropertyStorage): (JSC::DFG::SpeculativeJIT::compileReallocatePropertyStorage): (JSC::DFG::SpeculativeJIT::compileNewStringObject): (JSC::DFG::SpeculativeJIT::compileNewTypedArray): (JSC::DFG::SpeculativeJIT::compileStoreBarrier): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): (JSC::DFG::SpeculativeJIT::compileAllocateNewArrayWithSize): * dfg/DFGTierUpCheckInjectionPhase.cpp: (JSC::DFG::TierUpCheckInjectionPhase::run): * dfg/DFGWorklist.cpp: (JSC::DFG::Worklist::markCodeBlocks): (JSC::DFG::Worklist::rememberCodeBlocks): (JSC::DFG::markCodeBlocks): (JSC::DFG::completeAllPlansForVM): (JSC::DFG::rememberCodeBlocks): * dfg/DFGWorklist.h: * ftl/FTLAbstractHeapRepository.cpp: (JSC::FTL::AbstractHeapRepository::AbstractHeapRepository): (JSC::FTL::AbstractHeapRepository::computeRangesAndDecorateInstructions): * ftl/FTLAbstractHeapRepository.h: * ftl/FTLJITCode.cpp: (JSC::FTL::JITCode::~JITCode): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::compilePutStructure): (JSC::FTL::DFG::LowerDFGToB3::compileCreateActivation): (JSC::FTL::DFG::LowerDFGToB3::compileNewFunction): (JSC::FTL::DFG::LowerDFGToB3::compileCreateDirectArguments): (JSC::FTL::DFG::LowerDFGToB3::compileCreateRest): (JSC::FTL::DFG::LowerDFGToB3::compileNewObject): (JSC::FTL::DFG::LowerDFGToB3::compileNewArray): (JSC::FTL::DFG::LowerDFGToB3::compileNewArrayWithSpread): (JSC::FTL::DFG::LowerDFGToB3::compileSpread): (JSC::FTL::DFG::LowerDFGToB3::compileNewArrayBuffer): (JSC::FTL::DFG::LowerDFGToB3::compileNewArrayWithSize): (JSC::FTL::DFG::LowerDFGToB3::compileNewTypedArray): (JSC::FTL::DFG::LowerDFGToB3::compileMakeRope): (JSC::FTL::DFG::LowerDFGToB3::compileMultiPutByOffset): (JSC::FTL::DFG::LowerDFGToB3::compileMaterializeNewObject): (JSC::FTL::DFG::LowerDFGToB3::compileMaterializeCreateActivation): (JSC::FTL::DFG::LowerDFGToB3::splatWords): (JSC::FTL::DFG::LowerDFGToB3::allocatePropertyStorage): (JSC::FTL::DFG::LowerDFGToB3::reallocatePropertyStorage): (JSC::FTL::DFG::LowerDFGToB3::allocateObject): (JSC::FTL::DFG::LowerDFGToB3::isArrayType): (JSC::FTL::DFG::LowerDFGToB3::emitStoreBarrier): (JSC::FTL::DFG::LowerDFGToB3::mutatorFence): (JSC::FTL::DFG::LowerDFGToB3::setButterfly): * ftl/FTLOSRExitCompiler.cpp: (JSC::FTL::compileStub): * ftl/FTLOutput.cpp: (JSC::FTL::Output::signExt32ToPtr): (JSC::FTL::Output::fence): * ftl/FTLOutput.h: * heap/CellState.h: * heap/GCSegmentedArray.h: * heap/Heap.cpp: (JSC::Heap::ResumeTheWorldScope::ResumeTheWorldScope): (JSC::Heap::ResumeTheWorldScope::~ResumeTheWorldScope): (JSC::Heap::Heap): (JSC::Heap::~Heap): (JSC::Heap::harvestWeakReferences): (JSC::Heap::finalizeUnconditionalFinalizers): (JSC::Heap::completeAllJITPlans): (JSC::Heap::markToFixpoint): (JSC::Heap::gatherStackRoots): (JSC::Heap::beginMarking): (JSC::Heap::visitConservativeRoots): (JSC::Heap::visitCompilerWorklistWeakReferences): (JSC::Heap::updateObjectCounts): (JSC::Heap::endMarking): (JSC::Heap::addToRememberedSet): (JSC::Heap::collectInThread): (JSC::Heap::stopTheWorld): (JSC::Heap::resumeTheWorld): (JSC::Heap::setGCDidJIT): (JSC::Heap::setNeedFinalize): (JSC::Heap::setMutatorWaiting): (JSC::Heap::clearMutatorWaiting): (JSC::Heap::finalize): (JSC::Heap::flushWriteBarrierBuffer): (JSC::Heap::writeBarrierSlowPath): (JSC::Heap::canCollect): (JSC::Heap::reportExtraMemoryVisited): (JSC::Heap::reportExternalMemoryVisited): (JSC::Heap::notifyIsSafeToCollect): (JSC::Heap::markRoots): Deleted. (JSC::Heap::visitExternalRememberedSet): Deleted. (JSC::Heap::visitSmallStrings): Deleted. (JSC::Heap::visitProtectedObjects): Deleted. (JSC::Heap::visitArgumentBuffers): Deleted. (JSC::Heap::visitException): Deleted. (JSC::Heap::visitStrongHandles): Deleted. (JSC::Heap::visitHandleStack): Deleted. (JSC::Heap::visitSamplingProfiler): Deleted. (JSC::Heap::visitTypeProfiler): Deleted. (JSC::Heap::visitShadowChicken): Deleted. (JSC::Heap::traceCodeBlocksAndJITStubRoutines): Deleted. (JSC::Heap::visitWeakHandles): Deleted. (JSC::Heap::flushOldStructureIDTables): Deleted. (JSC::Heap::stopAllocation): Deleted. * heap/Heap.h: (JSC::Heap::collectorSlotVisitor): (JSC::Heap::mutatorMarkStack): (JSC::Heap::mutatorShouldBeFenced): (JSC::Heap::addressOfMutatorShouldBeFenced): (JSC::Heap::slotVisitor): Deleted. (JSC::Heap::notifyIsSafeToCollect): Deleted. (JSC::Heap::barrierShouldBeFenced): Deleted. (JSC::Heap::addressOfBarrierShouldBeFenced): Deleted. * heap/MarkStack.cpp: (JSC::MarkStackArray::transferTo): * heap/MarkStack.h: * heap/MarkedAllocator.cpp: (JSC::MarkedAllocator::tryAllocateIn): * heap/MarkedBlock.cpp: (JSC::MarkedBlock::MarkedBlock): (JSC::MarkedBlock::Handle::specializedSweep): (JSC::MarkedBlock::Handle::sweep): (JSC::MarkedBlock::Handle::sweepHelperSelectMarksMode): (JSC::MarkedBlock::Handle::stopAllocating): (JSC::MarkedBlock::Handle::resumeAllocating): (JSC::MarkedBlock::aboutToMarkSlow): (JSC::MarkedBlock::Handle::didConsumeFreeList): (JSC::SetNewlyAllocatedFunctor::SetNewlyAllocatedFunctor): Deleted. (JSC::SetNewlyAllocatedFunctor::operator()): Deleted. * heap/MarkedBlock.h: * heap/MarkedSpace.cpp: (JSC::MarkedSpace::resumeAllocating): * heap/SlotVisitor.cpp: (JSC::SlotVisitor::SlotVisitor): (JSC::SlotVisitor::~SlotVisitor): (JSC::SlotVisitor::reset): (JSC::SlotVisitor::clearMarkStacks): (JSC::SlotVisitor::appendJSCellOrAuxiliary): (JSC::SlotVisitor::setMarkedAndAppendToMarkStack): (JSC::SlotVisitor::appendToMarkStack): (JSC::SlotVisitor::appendToMutatorMarkStack): (JSC::SlotVisitor::visitChildren): (JSC::SlotVisitor::donateKnownParallel): (JSC::SlotVisitor::drain): (JSC::SlotVisitor::drainFromShared): (JSC::SlotVisitor::containsOpaqueRoot): (JSC::SlotVisitor::donateAndDrain): (JSC::SlotVisitor::mergeOpaqueRoots): (JSC::SlotVisitor::dump): (JSC::SlotVisitor::clearMarkStack): Deleted. (JSC::SlotVisitor::opaqueRootCount): Deleted. * heap/SlotVisitor.h: (JSC::SlotVisitor::collectorMarkStack): (JSC::SlotVisitor::mutatorMarkStack): (JSC::SlotVisitor::isEmpty): (JSC::SlotVisitor::bytesVisited): (JSC::SlotVisitor::markStack): Deleted. (JSC::SlotVisitor::bytesCopied): Deleted. * heap/SlotVisitorInlines.h: (JSC::SlotVisitor::reportExtraMemoryVisited): (JSC::SlotVisitor::reportExternalMemoryVisited): * jit/AssemblyHelpers.cpp: (JSC::AssemblyHelpers::emitStoreStructureWithTypeInfo): * jit/AssemblyHelpers.h: (JSC::AssemblyHelpers::emitStoreStructureWithTypeInfo): (JSC::AssemblyHelpers::barrierStoreLoadFence): (JSC::AssemblyHelpers::mutatorFence): (JSC::AssemblyHelpers::storeButterfly): (JSC::AssemblyHelpers::jumpIfMutatorFenceNotNeeded): (JSC::AssemblyHelpers::emitInitializeInlineStorage): (JSC::AssemblyHelpers::emitInitializeOutOfLineStorage): (JSC::AssemblyHelpers::jumpIfBarrierStoreLoadFenceNotNeeded): Deleted. * jit/JITInlines.h: (JSC::JIT::emitArrayProfilingSiteWithCell): * jit/JITOperations.cpp: * jit/JITPropertyAccess.cpp: (JSC::JIT::emit_op_put_to_scope): (JSC::JIT::emit_op_put_to_arguments): * llint/LLIntData.cpp: (JSC::LLInt::Data::performAssertions): * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/ButterflyInlines.h: (JSC::Butterfly::create): (JSC::Butterfly::createOrGrowPropertyStorage): * runtime/ConcurrentJITLock.h: (JSC::GCSafeConcurrentJITLocker::NoDefer::NoDefer): Deleted. * runtime/GenericArgumentsInlines.h: (JSC::GenericArguments<Type>::getOwnPropertySlotByIndex): (JSC::GenericArguments<Type>::putByIndex): * runtime/IndexingType.h: * runtime/JSArray.cpp: (JSC::JSArray::unshiftCountSlowCase): (JSC::JSArray::unshiftCountWithArrayStorage): * runtime/JSCell.h: (JSC::JSCell::InternalLocker::InternalLocker): (JSC::JSCell::InternalLocker::~InternalLocker): (JSC::JSCell::atomicCompareExchangeCellStateWeakRelaxed): (JSC::JSCell::atomicCompareExchangeCellStateStrong): (JSC::JSCell::indexingTypeAndMiscOffset): (JSC::JSCell::indexingTypeOffset): Deleted. * runtime/JSCellInlines.h: (JSC::JSCell::JSCell): (JSC::JSCell::finishCreation): (JSC::JSCell::indexingTypeAndMisc): (JSC::JSCell::indexingType): (JSC::JSCell::setStructure): (JSC::JSCell::callDestructor): (JSC::JSCell::lockInternalLock): (JSC::JSCell::unlockInternalLock): * runtime/JSObject.cpp: (JSC::JSObject::visitButterfly): (JSC::JSObject::visitChildren): (JSC::JSFinalObject::visitChildren): (JSC::JSObject::enterDictionaryIndexingModeWhenArrayStorageAlreadyExists): (JSC::JSObject::createInitialUndecided): (JSC::JSObject::createInitialInt32): (JSC::JSObject::createInitialDouble): (JSC::JSObject::createInitialContiguous): (JSC::JSObject::createArrayStorage): (JSC::JSObject::convertUndecidedToArrayStorage): (JSC::JSObject::convertInt32ToArrayStorage): (JSC::JSObject::convertDoubleToArrayStorage): (JSC::JSObject::convertContiguousToArrayStorage): (JSC::JSObject::deleteProperty): (JSC::JSObject::defineOwnIndexedProperty): (JSC::JSObject::increaseVectorLength): (JSC::JSObject::ensureLengthSlow): (JSC::JSObject::reallocateAndShrinkButterfly): (JSC::JSObject::allocateMoreOutOfLineStorage): (JSC::JSObject::shiftButterflyAfterFlattening): (JSC::JSObject::growOutOfLineStorage): Deleted. * runtime/JSObject.h: (JSC::JSFinalObject::JSFinalObject): (JSC::JSObject::setButterfly): (JSC::JSObject::getOwnNonIndexPropertySlot): (JSC::JSObject::fillCustomGetterPropertySlot): (JSC::JSObject::getOwnPropertySlot): (JSC::JSObject::getPropertySlot): (JSC::JSObject::setStructureAndButterfly): Deleted. (JSC::JSObject::setButterflyWithoutChangingStructure): Deleted. (JSC::JSObject::putDirectInternal): Deleted. (JSC::JSObject::putDirectWithoutTransition): Deleted. * runtime/JSObjectInlines.h: (JSC::JSObject::getPropertySlot): (JSC::JSObject::getNonIndexPropertySlot): (JSC::JSObject::putDirectWithoutTransition): (JSC::JSObject::putDirectInternal): * runtime/Options.h: * runtime/SparseArrayValueMap.h: * runtime/Structure.cpp: (JSC::Structure::dumpStatistics): (JSC::Structure::findStructuresAndMapForMaterialization): (JSC::Structure::materializePropertyTable): (JSC::Structure::addNewPropertyTransition): (JSC::Structure::changePrototypeTransition): (JSC::Structure::attributeChangeTransition): (JSC::Structure::toDictionaryTransition): (JSC::Structure::takePropertyTableOrCloneIfPinned): (JSC::Structure::nonPropertyTransition): (JSC::Structure::isSealed): (JSC::Structure::isFrozen): (JSC::Structure::flattenDictionaryStructure): (JSC::Structure::pin): (JSC::Structure::pinForCaching): (JSC::Structure::willStoreValueSlow): (JSC::Structure::copyPropertyTableForPinning): (JSC::Structure::add): (JSC::Structure::remove): (JSC::Structure::getPropertyNamesFromStructure): (JSC::Structure::visitChildren): (JSC::Structure::materializePropertyMap): Deleted. (JSC::Structure::addPropertyWithoutTransition): Deleted. (JSC::Structure::removePropertyWithoutTransition): Deleted. (JSC::Structure::copyPropertyTable): Deleted. (JSC::Structure::createPropertyMap): Deleted. (JSC::PropertyTable::checkConsistency): Deleted. (JSC::Structure::checkConsistency): Deleted. * runtime/Structure.h: * runtime/StructureIDBlob.h: (JSC::StructureIDBlob::StructureIDBlob): (JSC::StructureIDBlob::indexingTypeIncludingHistory): (JSC::StructureIDBlob::setIndexingTypeIncludingHistory): (JSC::StructureIDBlob::indexingTypeIncludingHistoryOffset): (JSC::StructureIDBlob::indexingType): Deleted. (JSC::StructureIDBlob::setIndexingType): Deleted. (JSC::StructureIDBlob::indexingTypeOffset): Deleted. * runtime/StructureInlines.h: (JSC::Structure::get): (JSC::Structure::checkOffsetConsistency): (JSC::Structure::checkConsistency): (JSC::Structure::add): (JSC::Structure::remove): (JSC::Structure::addPropertyWithoutTransition): (JSC::Structure::removePropertyWithoutTransition): (JSC::Structure::setPropertyTable): (JSC::Structure::putWillGrowOutOfLineStorage): Deleted. (JSC::Structure::propertyTable): Deleted. (JSC::Structure::suggestedNewOutOfLineStorageCapacity): Deleted. Source/WTF: The reason why I went to such great pains to make WTF::Lock fit in two bits is that I knew that I would eventually need to stuff one into some miscellaneous bits of the JSCell header. That time has come, because the concurrent GC has numerous race conditions in visitChildren that can be trivially fixed if each object just has an internal lock. Some cell types might use it to simply protect their entire visitChildren function and anything that mutates the fields it touches, while other cell types might use it as a "lock of last resort" to handle corner cases of an otherwise wait-free or lock-free algorithm. Right now, it's used to protect certain transformations involving indexing storage. To make this happen, I factored the WTF::Lock algorithm into a LockAlgorithm struct that is templatized on lock type (uint8_t for WTF::Lock), the isHeldBit value (1 for WTF::Lock), and the hasParkedBit value (2 for WTF::Lock). This could have been done as a templatized Lock class that basically contains Atomic<LockType>. You could then make any field into a lock by bitwise_casting it to TemplateLock<field type, bit1, bit2>. But this felt too dirty, so instead, LockAlgorithm has static methods that take Atomic<LockType>& as their first argument. I think that this makes it more natural to project a LockAlgorithm onto an existing Atomic<> field. Sadly, some places have to cast their non-Atomic<> field to Atomic<> in order for this to work. Like so many other things we do, this just shows that the C++ style of labeling fields that are subject to atomic ops as atomic is counterproductive. Maybe some day I'll change LockAlgorithm to use our other Atomics API, which does not require Atomic<>. WTF::Lock now uses LockAlgorithm. The slow paths are still outlined. I don't feel too bad about the LockAlgorithm.h header being included in so many places because we change that algorithm so infrequently. Also, I added a hasElapsed(time) function. This function makes it so much more natural to write timeslicing code, which the concurrent GC has to do a lot of. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/ListDump.h: * wtf/Lock.cpp: (WTF::LockBase::lockSlow): (WTF::LockBase::unlockSlow): (WTF::LockBase::unlockFairlySlow): (WTF::LockBase::unlockSlowImpl): Deleted. * wtf/Lock.h: (WTF::LockBase::lock): (WTF::LockBase::tryLock): (WTF::LockBase::unlock): (WTF::LockBase::unlockFairly): (WTF::LockBase::isHeld): (): Deleted. * wtf/LockAlgorithm.h: Added. (WTF::LockAlgorithm::lockFastAssumingZero): (WTF::LockAlgorithm::lockFast): (WTF::LockAlgorithm::lock): (WTF::LockAlgorithm::tryLock): (WTF::LockAlgorithm::unlockFastAssumingZero): (WTF::LockAlgorithm::unlockFast): (WTF::LockAlgorithm::unlock): (WTF::LockAlgorithm::unlockFairly): (WTF::LockAlgorithm::isLocked): (WTF::LockAlgorithm::lockSlow): (WTF::LockAlgorithm::unlockSlow): * wtf/TimeWithDynamicClockType.cpp: (WTF::hasElapsed): * wtf/TimeWithDynamicClockType.h: Canonical link: https://commits.webkit.org/182434@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208720 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-11-15 01:49:22 +00:00
using WTF::listDumpInContext;
fourthTier: DFG should have an SSA form for use by FTL https://bugs.webkit.org/show_bug.cgi?id=118338 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. Adds an SSA form to the DFG. We can convert ThreadedCPS form into SSA form after breaking critical edges. The conversion algorithm follows Aycock and Horspool, and the SSA form itself follows something I've done before, where instead of having Phi functions specify input nodes corresponding to block predecessors, we instead have Upsilon functions in the predecessors that specify which value in that block goes into which subsequent Phi. Upsilons don't have to dominate Phis (usually they don't) and they correspond to a non-SSA "mov" into the Phi's "variable". This gives all of the good properties of SSA, while ensuring that a bunch of CFG transformations don't have to be SSA-aware. So far the only DFG phases that are SSA-aware are DCE and CFA. CFG simplification is probably SSA-aware by default, though I haven't tried it. Constant folding probably needs a few tweaks, but is likely ready. Ditto for CSE, though it's not clear that we'd want to use block-local CSE when we could be doing GVN. Currently only the FTL can generate code from the SSA form, and there is no way to convert from SSA to ThreadedCPS or LoadStore. There probably will never be such a capability. In order to handle OSR exit state in the SSA, we place MovHints at Phi points. Other than that, you can reconstruct state-at-exit by forward propagating MovHints. Note that MovHint is the new SetLocal in SSA. SetLocal and GetLocal only survive into SSA if they are on captured variables, or in the case of flushes. A "live SetLocal" will be NodeMustGenerate and will always correspond to a flush. Computing the state-at-exit requires running SSA liveness analysis, OSR availability analysis, and flush liveness analysis. The FTL runs all of these prior to generating code. While OSR exit continues to be tricky, much of the logic is now factored into separate phases and the backend has to do less work to reason about what happened outside of the basic block that is being lowered. Conversion from DFG SSA to LLVM SSA is done by ensuring that we generate code in depth-first order, thus guaranteeing that a node will always be lowered (and hence have a LValue) before any of the blocks dominated by that node's block have code generated. For Upsilon/Phi, we just use alloca's. We could do something more clever there, but it's probably not worth it, at least not now. Finally, while the SSA form is currently only being converted to LLVM IR, there is nothing that prevents us from considering other backends in the future - with the caveat that this form is designed to be first lowered to a lower-level SSA before actual machine code generation commences. So we ought to either use LLVM (the intended path) or we will have to write our own SSA low-level backend. This runs all of the code that the FTL was known to run previously. No change in performance for now. But it does open some exciting possibilities! * JavaScriptCore.xcodeproj/project.pbxproj: * bytecode/Operands.h: (JSC::OperandValueTraits::dump): (JSC::Operands::fill): (Operands): (JSC::Operands::clear): (JSC::Operands::operator==): * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::beginBasicBlock): (JSC::DFG::setLiveValues): (DFG): (JSC::DFG::AbstractState::initialize): (JSC::DFG::AbstractState::endBasicBlock): (JSC::DFG::AbstractState::executeEffects): (JSC::DFG::AbstractState::mergeStateAtTail): (JSC::DFG::AbstractState::merge): * dfg/DFGAbstractState.h: (AbstractState): * dfg/DFGAdjacencyList.h: (JSC::DFG::AdjacencyList::justOneChild): (AdjacencyList): * dfg/DFGBasicBlock.cpp: Added. (DFG): (JSC::DFG::BasicBlock::BasicBlock): (JSC::DFG::BasicBlock::~BasicBlock): (JSC::DFG::BasicBlock::ensureLocals): (JSC::DFG::BasicBlock::isInPhis): (JSC::DFG::BasicBlock::isInBlock): (JSC::DFG::BasicBlock::removePredecessor): (JSC::DFG::BasicBlock::replacePredecessor): (JSC::DFG::BasicBlock::dump): (JSC::DFG::BasicBlock::SSAData::SSAData): (JSC::DFG::BasicBlock::SSAData::~SSAData): * dfg/DFGBasicBlock.h: (BasicBlock): (JSC::DFG::BasicBlock::operator[]): (JSC::DFG::BasicBlock::successor): (JSC::DFG::BasicBlock::successorForCondition): (SSAData): * dfg/DFGBasicBlockInlines.h: (DFG): * dfg/DFGBlockInsertionSet.cpp: Added. (DFG): (JSC::DFG::BlockInsertionSet::BlockInsertionSet): (JSC::DFG::BlockInsertionSet::~BlockInsertionSet): (JSC::DFG::BlockInsertionSet::insert): (JSC::DFG::BlockInsertionSet::insertBefore): (JSC::DFG::BlockInsertionSet::execute): * dfg/DFGBlockInsertionSet.h: Added. (DFG): (BlockInsertionSet): * dfg/DFGCFAPhase.cpp: (JSC::DFG::CFAPhase::run): * dfg/DFGCFGSimplificationPhase.cpp: * dfg/DFGCPSRethreadingPhase.cpp: (JSC::DFG::CPSRethreadingPhase::canonicalizeLocalsInBlock): * dfg/DFGCommon.cpp: (WTF::printInternal): * dfg/DFGCommon.h: (JSC::DFG::doesKill): (DFG): (JSC::DFG::killStatusForDoesKill): * dfg/DFGConstantFoldingPhase.cpp: (JSC::DFG::ConstantFoldingPhase::foldConstants): (JSC::DFG::ConstantFoldingPhase::isCapturedAtOrAfter): * dfg/DFGCriticalEdgeBreakingPhase.cpp: Added. (DFG): (CriticalEdgeBreakingPhase): (JSC::DFG::CriticalEdgeBreakingPhase::CriticalEdgeBreakingPhase): (JSC::DFG::CriticalEdgeBreakingPhase::run): (JSC::DFG::CriticalEdgeBreakingPhase::breakCriticalEdge): (JSC::DFG::performCriticalEdgeBreaking): * dfg/DFGCriticalEdgeBreakingPhase.h: Added. (DFG): * dfg/DFGDCEPhase.cpp: (JSC::DFG::DCEPhase::run): (JSC::DFG::DCEPhase::findTypeCheckRoot): (JSC::DFG::DCEPhase::countNode): (DCEPhase): (JSC::DFG::DCEPhase::countEdge): (JSC::DFG::DCEPhase::eliminateIrrelevantPhantomChildren): * dfg/DFGDriver.cpp: (JSC::DFG::compile): * dfg/DFGEdge.cpp: (JSC::DFG::Edge::dump): * dfg/DFGEdge.h: (JSC::DFG::Edge::Edge): (JSC::DFG::Edge::setNode): (JSC::DFG::Edge::useKindUnchecked): (JSC::DFG::Edge::setUseKind): (JSC::DFG::Edge::setProofStatus): (JSC::DFG::Edge::willNotHaveCheck): (JSC::DFG::Edge::willHaveCheck): (Edge): (JSC::DFG::Edge::killStatusUnchecked): (JSC::DFG::Edge::killStatus): (JSC::DFG::Edge::setKillStatus): (JSC::DFG::Edge::doesKill): (JSC::DFG::Edge::doesNotKill): (JSC::DFG::Edge::shift): (JSC::DFG::Edge::makeWord): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGFlushFormat.cpp: Added. (WTF): (WTF::printInternal): * dfg/DFGFlushFormat.h: Added. (DFG): (JSC::DFG::resultFor): (JSC::DFG::useKindFor): (WTF): * dfg/DFGFlushLivenessAnalysisPhase.cpp: Added. (DFG): (FlushLivenessAnalysisPhase): (JSC::DFG::FlushLivenessAnalysisPhase::FlushLivenessAnalysisPhase): (JSC::DFG::FlushLivenessAnalysisPhase::run): (JSC::DFG::FlushLivenessAnalysisPhase::process): (JSC::DFG::FlushLivenessAnalysisPhase::setForNode): (JSC::DFG::FlushLivenessAnalysisPhase::flushFormat): (JSC::DFG::performFlushLivenessAnalysis): * dfg/DFGFlushLivenessAnalysisPhase.h: Added. (DFG): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::dump): (JSC::DFG::Graph::dumpBlockHeader): (DFG): (JSC::DFG::Graph::addForDepthFirstSort): (JSC::DFG::Graph::getBlocksInDepthFirstOrder): * dfg/DFGGraph.h: (JSC::DFG::Graph::convertToConstant): (JSC::DFG::Graph::valueProfileFor): (Graph): * dfg/DFGInsertionSet.h: (DFG): (JSC::DFG::InsertionSet::execute): * dfg/DFGLivenessAnalysisPhase.cpp: Added. (DFG): (LivenessAnalysisPhase): (JSC::DFG::LivenessAnalysisPhase::LivenessAnalysisPhase): (JSC::DFG::LivenessAnalysisPhase::run): (JSC::DFG::LivenessAnalysisPhase::process): (JSC::DFG::LivenessAnalysisPhase::addChildUse): (JSC::DFG::performLivenessAnalysis): * dfg/DFGLivenessAnalysisPhase.h: Added. (DFG): * dfg/DFGNode.cpp: (JSC::DFG::Node::hasVariableAccessData): (DFG): * dfg/DFGNode.h: (DFG): (Node): (JSC::DFG::Node::hasLocal): (JSC::DFG::Node::variableAccessData): (JSC::DFG::Node::hasPhi): (JSC::DFG::Node::phi): (JSC::DFG::Node::takenBlock): (JSC::DFG::Node::notTakenBlock): (JSC::DFG::Node::successor): (JSC::DFG::Node::successorForCondition): (JSC::DFG::nodeComparator): (JSC::DFG::nodeListDump): (JSC::DFG::nodeMapDump): * dfg/DFGNodeFlags.cpp: (JSC::DFG::dumpNodeFlags): * dfg/DFGNodeType.h: (DFG): * dfg/DFGOSRAvailabilityAnalysisPhase.cpp: Added. (DFG): (OSRAvailabilityAnalysisPhase): (JSC::DFG::OSRAvailabilityAnalysisPhase::OSRAvailabilityAnalysisPhase): (JSC::DFG::OSRAvailabilityAnalysisPhase::run): (JSC::DFG::performOSRAvailabilityAnalysis): * dfg/DFGOSRAvailabilityAnalysisPhase.h: Added. (DFG): * dfg/DFGPlan.cpp: (JSC::DFG::Plan::compileInThreadImpl): * dfg/DFGPredictionInjectionPhase.cpp: (JSC::DFG::PredictionInjectionPhase::run): * dfg/DFGPredictionPropagationPhase.cpp: (JSC::DFG::PredictionPropagationPhase::propagate): * dfg/DFGSSAConversionPhase.cpp: Added. (DFG): (SSAConversionPhase): (JSC::DFG::SSAConversionPhase::SSAConversionPhase): (JSC::DFG::SSAConversionPhase::run): (JSC::DFG::SSAConversionPhase::forwardPhiChildren): (JSC::DFG::SSAConversionPhase::forwardPhi): (JSC::DFG::SSAConversionPhase::forwardPhiEdge): (JSC::DFG::SSAConversionPhase::deduplicateChildren): (JSC::DFG::SSAConversionPhase::addFlushedLocalOp): (JSC::DFG::SSAConversionPhase::addFlushedLocalEdge): (JSC::DFG::performSSAConversion): * dfg/DFGSSAConversionPhase.h: Added. (DFG): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGValidate.cpp: (JSC::DFG::Validate::validate): (Validate): (JSC::DFG::Validate::validateCPS): * dfg/DFGVariableAccessData.h: (JSC::DFG::VariableAccessData::flushFormat): (VariableAccessData): * ftl/FTLCapabilities.cpp: (JSC::FTL::canCompile): * ftl/FTLLowerDFGToLLVM.cpp: (JSC::FTL::LowerDFGToLLVM::LowerDFGToLLVM): (JSC::FTL::LowerDFGToLLVM::lower): (JSC::FTL::LowerDFGToLLVM::createPhiVariables): (JSC::FTL::LowerDFGToLLVM::compileBlock): (JSC::FTL::LowerDFGToLLVM::compileNode): (JSC::FTL::LowerDFGToLLVM::compileUpsilon): (LowerDFGToLLVM): (JSC::FTL::LowerDFGToLLVM::compilePhi): (JSC::FTL::LowerDFGToLLVM::compileJSConstant): (JSC::FTL::LowerDFGToLLVM::compileWeakJSConstant): (JSC::FTL::LowerDFGToLLVM::compileGetArgument): (JSC::FTL::LowerDFGToLLVM::compileGetLocal): (JSC::FTL::LowerDFGToLLVM::compileSetLocal): (JSC::FTL::LowerDFGToLLVM::compileAdd): (JSC::FTL::LowerDFGToLLVM::compileArithSub): (JSC::FTL::LowerDFGToLLVM::compileArithMul): (JSC::FTL::LowerDFGToLLVM::compileArithDiv): (JSC::FTL::LowerDFGToLLVM::compileArithMod): (JSC::FTL::LowerDFGToLLVM::compileArithMinOrMax): (JSC::FTL::LowerDFGToLLVM::compileArithAbs): (JSC::FTL::LowerDFGToLLVM::compileArithNegate): (JSC::FTL::LowerDFGToLLVM::compileBitAnd): (JSC::FTL::LowerDFGToLLVM::compileBitOr): (JSC::FTL::LowerDFGToLLVM::compileBitXor): (JSC::FTL::LowerDFGToLLVM::compileBitRShift): (JSC::FTL::LowerDFGToLLVM::compileBitLShift): (JSC::FTL::LowerDFGToLLVM::compileBitURShift): (JSC::FTL::LowerDFGToLLVM::compileUInt32ToNumber): (JSC::FTL::LowerDFGToLLVM::compileInt32ToDouble): (JSC::FTL::LowerDFGToLLVM::compileGetButterfly): (JSC::FTL::LowerDFGToLLVM::compileGetArrayLength): (JSC::FTL::LowerDFGToLLVM::compileGetByVal): (JSC::FTL::LowerDFGToLLVM::compileGetByOffset): (JSC::FTL::LowerDFGToLLVM::compileGetGlobalVar): (JSC::FTL::LowerDFGToLLVM::compileCompareEqConstant): (JSC::FTL::LowerDFGToLLVM::compileCompareStrictEq): (JSC::FTL::LowerDFGToLLVM::compileCompareStrictEqConstant): (JSC::FTL::LowerDFGToLLVM::compileCompareLess): (JSC::FTL::LowerDFGToLLVM::compileCompareLessEq): (JSC::FTL::LowerDFGToLLVM::compileCompareGreater): (JSC::FTL::LowerDFGToLLVM::compileCompareGreaterEq): (JSC::FTL::LowerDFGToLLVM::compileLogicalNot): (JSC::FTL::LowerDFGToLLVM::speculateBackward): (JSC::FTL::LowerDFGToLLVM::lowInt32): (JSC::FTL::LowerDFGToLLVM::lowCell): (JSC::FTL::LowerDFGToLLVM::lowBoolean): (JSC::FTL::LowerDFGToLLVM::lowDouble): (JSC::FTL::LowerDFGToLLVM::lowJSValue): (JSC::FTL::LowerDFGToLLVM::lowStorage): (JSC::FTL::LowerDFGToLLVM::speculate): (JSC::FTL::LowerDFGToLLVM::speculateBoolean): (JSC::FTL::LowerDFGToLLVM::isLive): (JSC::FTL::LowerDFGToLLVM::use): (JSC::FTL::LowerDFGToLLVM::initializeOSRExitStateForBlock): (JSC::FTL::LowerDFGToLLVM::appendOSRExit): (JSC::FTL::LowerDFGToLLVM::emitOSRExitCall): (JSC::FTL::LowerDFGToLLVM::addExitArgumentForNode): (JSC::FTL::LowerDFGToLLVM::linkOSRExitsAndCompleteInitializationBlocks): (JSC::FTL::LowerDFGToLLVM::setInt32): (JSC::FTL::LowerDFGToLLVM::setJSValue): (JSC::FTL::LowerDFGToLLVM::setBoolean): (JSC::FTL::LowerDFGToLLVM::setStorage): (JSC::FTL::LowerDFGToLLVM::setDouble): (JSC::FTL::LowerDFGToLLVM::isValid): * ftl/FTLLoweredNodeValue.h: Added. (FTL): (LoweredNodeValue): (JSC::FTL::LoweredNodeValue::LoweredNodeValue): (JSC::FTL::LoweredNodeValue::isSet): (JSC::FTL::LoweredNodeValue::operator!): (JSC::FTL::LoweredNodeValue::value): (JSC::FTL::LoweredNodeValue::block): * ftl/FTLValueFromBlock.h: (JSC::FTL::ValueFromBlock::ValueFromBlock): (ValueFromBlock): * ftl/FTLValueSource.cpp: (JSC::FTL::ValueSource::dump): * ftl/FTLValueSource.h: Source/WTF: Reviewed by Mark Hahnenberg. - Extend variadicity of PrintStream and dataLog. - Give HashSet the ability to add a span of things. - Give HashSet the ability to == another HashSet. - Note FIXME's in HashTable concerning copying performance, that affects the way that the DFG now uses HashSets and HashMaps. - Factor out the bulk-insertion logic of JSC::DFG::InsertionSet into WTF::Insertion, so that it can be used in more places. - Create a dumper for lists and maps. * WTF.xcodeproj/project.pbxproj: * wtf/DataLog.h: (WTF): (WTF::dataLog): * wtf/HashSet.h: (HashSet): (WTF): (WTF::::add): (WTF::=): * wtf/HashTable.h: (WTF::::HashTable): (WTF::=): * wtf/Insertion.h: Added. (WTF): (Insertion): (WTF::Insertion::Insertion): (WTF::Insertion::index): (WTF::Insertion::element): (WTF::Insertion::operator<): (WTF::executeInsertions): * wtf/ListDump.h: Added. (WTF): (ListDump): (WTF::ListDump::ListDump): (WTF::ListDump::dump): (MapDump): (WTF::MapDump::MapDump): (WTF::MapDump::dump): (WTF::listDump): (WTF::sortedListDump): (WTF::lessThan): (WTF::mapDump): (WTF::sortedMapDump): * wtf/PrintStream.h: (PrintStream): (WTF::PrintStream::print): Conflicts: Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj Canonical link: https://commits.webkit.org/137058@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153274 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:04:45 +00:00
using WTF::mapDump;
The GC should be optionally concurrent and disabled by default https://bugs.webkit.org/show_bug.cgi?id=164454 Reviewed by Geoffrey Garen. Source/JavaScriptCore: This started out as a patch to have the GC scan the stack at the end, and then the outage happened and I decided to pick a more aggresive target: give the GC a concurrent mode that can be enabled at runtime, and whose only effect is that it turns on the ResumeTheWorldScope. This gives our GC a really intuitive workflow: by default, the GC thread is running solo with the world stopped and the parallel markers converged and waiting. We have a parallel work scope to enable the parallel markers and now we have a ResumeTheWorldScope that will optionally resume the world and then stop it again. It's easy to make a concurrent GC that always instantly crashes. I can't promise that this one won't do that when you run it. I set a specific goal: I wanted to do >10 concurrent GCs in debug mode with generations, optimizing JITs, and parallel marking disabled. To reach this milestone, I needed to do a bunch of stuff: - The mutator needs a separate mark stack for the barrier, since it will mutate this stack concurrently to the collector's slot visitors. - The use of CellState to indicate whether an object is being scanned the first time or a subsequent time was racy. It fails spectacularly when a barrier is fired at the same time as visitChildren is running or if the barrier runs at the same time as the GC marks the same object. So, I split SlotVisitor's mark stacks. It's now the case that you know why you're being scanned by looking at which stack you came off of. - All of root marking must be in the collector fixpoint. I renamed markRoots to markToFixpoint. They say concurrency is hard, but the collector looks more intuitive this way. We never gained anything from forcing people to make a choice between scanning something in the fixpoint versus outside of it. Because root scanning is cheap, we can afford to do it repeatedly, which means all root scanning can now do constraint-based marking (like: I'll mark you if that thing is marked). - JSObject::visitChildren's scanning of the butterfly raced with property additions, indexed storage transitions and resizing, and a bunch of miscellaneous dirty butterfly reshaping functions - like the one that flattens a dictionary and some sneaky ArrayStorage transformations. Many of these can be fixed by using store-store fences in the mutator and load-load fences in the collector. I've adopted the rule that the collector must always see either a butterfly and structure that match or a newer butterfly with an older structure, where their age is just one transition apart. This can be achieved with fences. For the cases where it breaks down, I added a lock to every JSCell. This is a full-fledged WTF lock that we sneak into two available bits in the indexingType. See the WTF ChangeLog for details. The mutator fencing rules are as follows: - Store-store fence before and after setting the butterfly. - Store-store fence before setting structure if you had changed the shape of the butterfly. - Store-store fence after initializing all fields in an allocation. - A dictionary Structure can change in strange ways while the GC is trying to scan it. So, JSObject::visitChildren will now grab the object's structure's lock if the object's structure is a dictionary. Dictionary structures are 1:1 with their object, so this does not reduce GC parallelism (super unlikely that the GC will simultaneously scan an object from two threads). - The GC can blow away a Structure's property table at any time. As a small consolation, it's now holding the Structure's lock when it does so. But there was tons of code in Structure that uses DeferGC to prevent the GC from blowing away the property table. This doesn't work with concurrent GC, since DeferGC only means that the GC won't run its safepoint (i.e. stop-the-world code) in the DeferGC region. It will still do marking and it was the Structure::visitChildren that would delete the table. It turns out that Structure's reliance on the property table not being deleted was the product of code rot. We already had functions that would materialize the table on demand. We were simply making the mistake of saying: structure->materializePropertyMap(); ... structure->propertyTable()->things Instead of saying: PropertyTable* table = structure->ensurePropertyTable(); ... table->things Switching the code to use the latter idiom allowed me to simplify the code a lot while fixing the race. - The LLInt's get_by_val handling was broken because the indexing shape constants were wrong. Once I started putting more things into the IndexingType, that started causing crashes for me. So I fixed LLInt. That turned out to be a lot of work, since that code had rotted in subtle ways. This is a speed-up in SunSpider, probably because of the LLInt fix. This is neutral on Octane and Kraken. It's a smaller slow-down on LongSpider, but I think we can ignore that (we don't view LongSpider as an official benchmark). By default, the concurrent GC is disabled: in all of the places where it would have resumed the world to run marking concurrently to the mutator, it will just skip the resume step. When you enable concurrent GC (--useConcurrentGC=true), it can sometimes run Octane/splay to completion. It seems to perform quite well: on my machine, it improves both splay-throughput and splay-latency. It's probably unstable for other programs. * API/JSVirtualMachine.mm: (-[JSVirtualMachine isOldExternalObject:]): * assembler/MacroAssemblerARMv7.h: (JSC::MacroAssemblerARMv7::storeFence): * bytecode/InlineAccess.cpp: (JSC::InlineAccess::dumpCacheSizesAndCrash): (JSC::InlineAccess::generateSelfPropertyAccess): (JSC::InlineAccess::generateArrayLength): * bytecode/ObjectAllocationProfile.h: (JSC::ObjectAllocationProfile::offsetOfInlineCapacity): (JSC::ObjectAllocationProfile::ObjectAllocationProfile): (JSC::ObjectAllocationProfile::initialize): (JSC::ObjectAllocationProfile::inlineCapacity): (JSC::ObjectAllocationProfile::clear): * bytecode/PolymorphicAccess.cpp: (JSC::AccessCase::generateWithGuard): (JSC::AccessCase::generateImpl): * dfg/DFGArrayifySlowPathGenerator.h: * dfg/DFGClobberize.h: (JSC::DFG::clobberize): * dfg/DFGOSRExitCompiler32_64.cpp: (JSC::DFG::OSRExitCompiler::compileExit): * dfg/DFGOSRExitCompiler64.cpp: (JSC::DFG::OSRExitCompiler::compileExit): * dfg/DFGOperations.cpp: * dfg/DFGPlan.cpp: (JSC::DFG::Plan::markCodeBlocks): (JSC::DFG::Plan::rememberCodeBlocks): * dfg/DFGPlan.h: * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::emitAllocateRawObject): (JSC::DFG::SpeculativeJIT::checkArray): (JSC::DFG::SpeculativeJIT::arrayify): (JSC::DFG::SpeculativeJIT::compileMakeRope): (JSC::DFG::SpeculativeJIT::compileNewFunctionCommon): (JSC::DFG::SpeculativeJIT::compileCreateActivation): (JSC::DFG::SpeculativeJIT::compileCreateDirectArguments): (JSC::DFG::SpeculativeJIT::compileSpread): (JSC::DFG::SpeculativeJIT::compileAllocatePropertyStorage): (JSC::DFG::SpeculativeJIT::compileReallocatePropertyStorage): (JSC::DFG::SpeculativeJIT::compileNewStringObject): (JSC::DFG::SpeculativeJIT::compileNewTypedArray): (JSC::DFG::SpeculativeJIT::compileStoreBarrier): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): (JSC::DFG::SpeculativeJIT::compileAllocateNewArrayWithSize): * dfg/DFGTierUpCheckInjectionPhase.cpp: (JSC::DFG::TierUpCheckInjectionPhase::run): * dfg/DFGWorklist.cpp: (JSC::DFG::Worklist::markCodeBlocks): (JSC::DFG::Worklist::rememberCodeBlocks): (JSC::DFG::markCodeBlocks): (JSC::DFG::completeAllPlansForVM): (JSC::DFG::rememberCodeBlocks): * dfg/DFGWorklist.h: * ftl/FTLAbstractHeapRepository.cpp: (JSC::FTL::AbstractHeapRepository::AbstractHeapRepository): (JSC::FTL::AbstractHeapRepository::computeRangesAndDecorateInstructions): * ftl/FTLAbstractHeapRepository.h: * ftl/FTLJITCode.cpp: (JSC::FTL::JITCode::~JITCode): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::compilePutStructure): (JSC::FTL::DFG::LowerDFGToB3::compileCreateActivation): (JSC::FTL::DFG::LowerDFGToB3::compileNewFunction): (JSC::FTL::DFG::LowerDFGToB3::compileCreateDirectArguments): (JSC::FTL::DFG::LowerDFGToB3::compileCreateRest): (JSC::FTL::DFG::LowerDFGToB3::compileNewObject): (JSC::FTL::DFG::LowerDFGToB3::compileNewArray): (JSC::FTL::DFG::LowerDFGToB3::compileNewArrayWithSpread): (JSC::FTL::DFG::LowerDFGToB3::compileSpread): (JSC::FTL::DFG::LowerDFGToB3::compileNewArrayBuffer): (JSC::FTL::DFG::LowerDFGToB3::compileNewArrayWithSize): (JSC::FTL::DFG::LowerDFGToB3::compileNewTypedArray): (JSC::FTL::DFG::LowerDFGToB3::compileMakeRope): (JSC::FTL::DFG::LowerDFGToB3::compileMultiPutByOffset): (JSC::FTL::DFG::LowerDFGToB3::compileMaterializeNewObject): (JSC::FTL::DFG::LowerDFGToB3::compileMaterializeCreateActivation): (JSC::FTL::DFG::LowerDFGToB3::splatWords): (JSC::FTL::DFG::LowerDFGToB3::allocatePropertyStorage): (JSC::FTL::DFG::LowerDFGToB3::reallocatePropertyStorage): (JSC::FTL::DFG::LowerDFGToB3::allocateObject): (JSC::FTL::DFG::LowerDFGToB3::isArrayType): (JSC::FTL::DFG::LowerDFGToB3::emitStoreBarrier): (JSC::FTL::DFG::LowerDFGToB3::mutatorFence): (JSC::FTL::DFG::LowerDFGToB3::setButterfly): * ftl/FTLOSRExitCompiler.cpp: (JSC::FTL::compileStub): * ftl/FTLOutput.cpp: (JSC::FTL::Output::signExt32ToPtr): (JSC::FTL::Output::fence): * ftl/FTLOutput.h: * heap/CellState.h: * heap/GCSegmentedArray.h: * heap/Heap.cpp: (JSC::Heap::ResumeTheWorldScope::ResumeTheWorldScope): (JSC::Heap::ResumeTheWorldScope::~ResumeTheWorldScope): (JSC::Heap::Heap): (JSC::Heap::~Heap): (JSC::Heap::harvestWeakReferences): (JSC::Heap::finalizeUnconditionalFinalizers): (JSC::Heap::completeAllJITPlans): (JSC::Heap::markToFixpoint): (JSC::Heap::gatherStackRoots): (JSC::Heap::beginMarking): (JSC::Heap::visitConservativeRoots): (JSC::Heap::visitCompilerWorklistWeakReferences): (JSC::Heap::updateObjectCounts): (JSC::Heap::endMarking): (JSC::Heap::addToRememberedSet): (JSC::Heap::collectInThread): (JSC::Heap::stopTheWorld): (JSC::Heap::resumeTheWorld): (JSC::Heap::setGCDidJIT): (JSC::Heap::setNeedFinalize): (JSC::Heap::setMutatorWaiting): (JSC::Heap::clearMutatorWaiting): (JSC::Heap::finalize): (JSC::Heap::flushWriteBarrierBuffer): (JSC::Heap::writeBarrierSlowPath): (JSC::Heap::canCollect): (JSC::Heap::reportExtraMemoryVisited): (JSC::Heap::reportExternalMemoryVisited): (JSC::Heap::notifyIsSafeToCollect): (JSC::Heap::markRoots): Deleted. (JSC::Heap::visitExternalRememberedSet): Deleted. (JSC::Heap::visitSmallStrings): Deleted. (JSC::Heap::visitProtectedObjects): Deleted. (JSC::Heap::visitArgumentBuffers): Deleted. (JSC::Heap::visitException): Deleted. (JSC::Heap::visitStrongHandles): Deleted. (JSC::Heap::visitHandleStack): Deleted. (JSC::Heap::visitSamplingProfiler): Deleted. (JSC::Heap::visitTypeProfiler): Deleted. (JSC::Heap::visitShadowChicken): Deleted. (JSC::Heap::traceCodeBlocksAndJITStubRoutines): Deleted. (JSC::Heap::visitWeakHandles): Deleted. (JSC::Heap::flushOldStructureIDTables): Deleted. (JSC::Heap::stopAllocation): Deleted. * heap/Heap.h: (JSC::Heap::collectorSlotVisitor): (JSC::Heap::mutatorMarkStack): (JSC::Heap::mutatorShouldBeFenced): (JSC::Heap::addressOfMutatorShouldBeFenced): (JSC::Heap::slotVisitor): Deleted. (JSC::Heap::notifyIsSafeToCollect): Deleted. (JSC::Heap::barrierShouldBeFenced): Deleted. (JSC::Heap::addressOfBarrierShouldBeFenced): Deleted. * heap/MarkStack.cpp: (JSC::MarkStackArray::transferTo): * heap/MarkStack.h: * heap/MarkedAllocator.cpp: (JSC::MarkedAllocator::tryAllocateIn): * heap/MarkedBlock.cpp: (JSC::MarkedBlock::MarkedBlock): (JSC::MarkedBlock::Handle::specializedSweep): (JSC::MarkedBlock::Handle::sweep): (JSC::MarkedBlock::Handle::sweepHelperSelectMarksMode): (JSC::MarkedBlock::Handle::stopAllocating): (JSC::MarkedBlock::Handle::resumeAllocating): (JSC::MarkedBlock::aboutToMarkSlow): (JSC::MarkedBlock::Handle::didConsumeFreeList): (JSC::SetNewlyAllocatedFunctor::SetNewlyAllocatedFunctor): Deleted. (JSC::SetNewlyAllocatedFunctor::operator()): Deleted. * heap/MarkedBlock.h: * heap/MarkedSpace.cpp: (JSC::MarkedSpace::resumeAllocating): * heap/SlotVisitor.cpp: (JSC::SlotVisitor::SlotVisitor): (JSC::SlotVisitor::~SlotVisitor): (JSC::SlotVisitor::reset): (JSC::SlotVisitor::clearMarkStacks): (JSC::SlotVisitor::appendJSCellOrAuxiliary): (JSC::SlotVisitor::setMarkedAndAppendToMarkStack): (JSC::SlotVisitor::appendToMarkStack): (JSC::SlotVisitor::appendToMutatorMarkStack): (JSC::SlotVisitor::visitChildren): (JSC::SlotVisitor::donateKnownParallel): (JSC::SlotVisitor::drain): (JSC::SlotVisitor::drainFromShared): (JSC::SlotVisitor::containsOpaqueRoot): (JSC::SlotVisitor::donateAndDrain): (JSC::SlotVisitor::mergeOpaqueRoots): (JSC::SlotVisitor::dump): (JSC::SlotVisitor::clearMarkStack): Deleted. (JSC::SlotVisitor::opaqueRootCount): Deleted. * heap/SlotVisitor.h: (JSC::SlotVisitor::collectorMarkStack): (JSC::SlotVisitor::mutatorMarkStack): (JSC::SlotVisitor::isEmpty): (JSC::SlotVisitor::bytesVisited): (JSC::SlotVisitor::markStack): Deleted. (JSC::SlotVisitor::bytesCopied): Deleted. * heap/SlotVisitorInlines.h: (JSC::SlotVisitor::reportExtraMemoryVisited): (JSC::SlotVisitor::reportExternalMemoryVisited): * jit/AssemblyHelpers.cpp: (JSC::AssemblyHelpers::emitStoreStructureWithTypeInfo): * jit/AssemblyHelpers.h: (JSC::AssemblyHelpers::emitStoreStructureWithTypeInfo): (JSC::AssemblyHelpers::barrierStoreLoadFence): (JSC::AssemblyHelpers::mutatorFence): (JSC::AssemblyHelpers::storeButterfly): (JSC::AssemblyHelpers::jumpIfMutatorFenceNotNeeded): (JSC::AssemblyHelpers::emitInitializeInlineStorage): (JSC::AssemblyHelpers::emitInitializeOutOfLineStorage): (JSC::AssemblyHelpers::jumpIfBarrierStoreLoadFenceNotNeeded): Deleted. * jit/JITInlines.h: (JSC::JIT::emitArrayProfilingSiteWithCell): * jit/JITOperations.cpp: * jit/JITPropertyAccess.cpp: (JSC::JIT::emit_op_put_to_scope): (JSC::JIT::emit_op_put_to_arguments): * llint/LLIntData.cpp: (JSC::LLInt::Data::performAssertions): * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/ButterflyInlines.h: (JSC::Butterfly::create): (JSC::Butterfly::createOrGrowPropertyStorage): * runtime/ConcurrentJITLock.h: (JSC::GCSafeConcurrentJITLocker::NoDefer::NoDefer): Deleted. * runtime/GenericArgumentsInlines.h: (JSC::GenericArguments<Type>::getOwnPropertySlotByIndex): (JSC::GenericArguments<Type>::putByIndex): * runtime/IndexingType.h: * runtime/JSArray.cpp: (JSC::JSArray::unshiftCountSlowCase): (JSC::JSArray::unshiftCountWithArrayStorage): * runtime/JSCell.h: (JSC::JSCell::InternalLocker::InternalLocker): (JSC::JSCell::InternalLocker::~InternalLocker): (JSC::JSCell::atomicCompareExchangeCellStateWeakRelaxed): (JSC::JSCell::atomicCompareExchangeCellStateStrong): (JSC::JSCell::indexingTypeAndMiscOffset): (JSC::JSCell::indexingTypeOffset): Deleted. * runtime/JSCellInlines.h: (JSC::JSCell::JSCell): (JSC::JSCell::finishCreation): (JSC::JSCell::indexingTypeAndMisc): (JSC::JSCell::indexingType): (JSC::JSCell::setStructure): (JSC::JSCell::callDestructor): (JSC::JSCell::lockInternalLock): (JSC::JSCell::unlockInternalLock): * runtime/JSObject.cpp: (JSC::JSObject::visitButterfly): (JSC::JSObject::visitChildren): (JSC::JSFinalObject::visitChildren): (JSC::JSObject::enterDictionaryIndexingModeWhenArrayStorageAlreadyExists): (JSC::JSObject::createInitialUndecided): (JSC::JSObject::createInitialInt32): (JSC::JSObject::createInitialDouble): (JSC::JSObject::createInitialContiguous): (JSC::JSObject::createArrayStorage): (JSC::JSObject::convertUndecidedToArrayStorage): (JSC::JSObject::convertInt32ToArrayStorage): (JSC::JSObject::convertDoubleToArrayStorage): (JSC::JSObject::convertContiguousToArrayStorage): (JSC::JSObject::deleteProperty): (JSC::JSObject::defineOwnIndexedProperty): (JSC::JSObject::increaseVectorLength): (JSC::JSObject::ensureLengthSlow): (JSC::JSObject::reallocateAndShrinkButterfly): (JSC::JSObject::allocateMoreOutOfLineStorage): (JSC::JSObject::shiftButterflyAfterFlattening): (JSC::JSObject::growOutOfLineStorage): Deleted. * runtime/JSObject.h: (JSC::JSFinalObject::JSFinalObject): (JSC::JSObject::setButterfly): (JSC::JSObject::getOwnNonIndexPropertySlot): (JSC::JSObject::fillCustomGetterPropertySlot): (JSC::JSObject::getOwnPropertySlot): (JSC::JSObject::getPropertySlot): (JSC::JSObject::setStructureAndButterfly): Deleted. (JSC::JSObject::setButterflyWithoutChangingStructure): Deleted. (JSC::JSObject::putDirectInternal): Deleted. (JSC::JSObject::putDirectWithoutTransition): Deleted. * runtime/JSObjectInlines.h: (JSC::JSObject::getPropertySlot): (JSC::JSObject::getNonIndexPropertySlot): (JSC::JSObject::putDirectWithoutTransition): (JSC::JSObject::putDirectInternal): * runtime/Options.h: * runtime/SparseArrayValueMap.h: * runtime/Structure.cpp: (JSC::Structure::dumpStatistics): (JSC::Structure::findStructuresAndMapForMaterialization): (JSC::Structure::materializePropertyTable): (JSC::Structure::addNewPropertyTransition): (JSC::Structure::changePrototypeTransition): (JSC::Structure::attributeChangeTransition): (JSC::Structure::toDictionaryTransition): (JSC::Structure::takePropertyTableOrCloneIfPinned): (JSC::Structure::nonPropertyTransition): (JSC::Structure::isSealed): (JSC::Structure::isFrozen): (JSC::Structure::flattenDictionaryStructure): (JSC::Structure::pin): (JSC::Structure::pinForCaching): (JSC::Structure::willStoreValueSlow): (JSC::Structure::copyPropertyTableForPinning): (JSC::Structure::add): (JSC::Structure::remove): (JSC::Structure::getPropertyNamesFromStructure): (JSC::Structure::visitChildren): (JSC::Structure::materializePropertyMap): Deleted. (JSC::Structure::addPropertyWithoutTransition): Deleted. (JSC::Structure::removePropertyWithoutTransition): Deleted. (JSC::Structure::copyPropertyTable): Deleted. (JSC::Structure::createPropertyMap): Deleted. (JSC::PropertyTable::checkConsistency): Deleted. (JSC::Structure::checkConsistency): Deleted. * runtime/Structure.h: * runtime/StructureIDBlob.h: (JSC::StructureIDBlob::StructureIDBlob): (JSC::StructureIDBlob::indexingTypeIncludingHistory): (JSC::StructureIDBlob::setIndexingTypeIncludingHistory): (JSC::StructureIDBlob::indexingTypeIncludingHistoryOffset): (JSC::StructureIDBlob::indexingType): Deleted. (JSC::StructureIDBlob::setIndexingType): Deleted. (JSC::StructureIDBlob::indexingTypeOffset): Deleted. * runtime/StructureInlines.h: (JSC::Structure::get): (JSC::Structure::checkOffsetConsistency): (JSC::Structure::checkConsistency): (JSC::Structure::add): (JSC::Structure::remove): (JSC::Structure::addPropertyWithoutTransition): (JSC::Structure::removePropertyWithoutTransition): (JSC::Structure::setPropertyTable): (JSC::Structure::putWillGrowOutOfLineStorage): Deleted. (JSC::Structure::propertyTable): Deleted. (JSC::Structure::suggestedNewOutOfLineStorageCapacity): Deleted. Source/WTF: The reason why I went to such great pains to make WTF::Lock fit in two bits is that I knew that I would eventually need to stuff one into some miscellaneous bits of the JSCell header. That time has come, because the concurrent GC has numerous race conditions in visitChildren that can be trivially fixed if each object just has an internal lock. Some cell types might use it to simply protect their entire visitChildren function and anything that mutates the fields it touches, while other cell types might use it as a "lock of last resort" to handle corner cases of an otherwise wait-free or lock-free algorithm. Right now, it's used to protect certain transformations involving indexing storage. To make this happen, I factored the WTF::Lock algorithm into a LockAlgorithm struct that is templatized on lock type (uint8_t for WTF::Lock), the isHeldBit value (1 for WTF::Lock), and the hasParkedBit value (2 for WTF::Lock). This could have been done as a templatized Lock class that basically contains Atomic<LockType>. You could then make any field into a lock by bitwise_casting it to TemplateLock<field type, bit1, bit2>. But this felt too dirty, so instead, LockAlgorithm has static methods that take Atomic<LockType>& as their first argument. I think that this makes it more natural to project a LockAlgorithm onto an existing Atomic<> field. Sadly, some places have to cast their non-Atomic<> field to Atomic<> in order for this to work. Like so many other things we do, this just shows that the C++ style of labeling fields that are subject to atomic ops as atomic is counterproductive. Maybe some day I'll change LockAlgorithm to use our other Atomics API, which does not require Atomic<>. WTF::Lock now uses LockAlgorithm. The slow paths are still outlined. I don't feel too bad about the LockAlgorithm.h header being included in so many places because we change that algorithm so infrequently. Also, I added a hasElapsed(time) function. This function makes it so much more natural to write timeslicing code, which the concurrent GC has to do a lot of. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/ListDump.h: * wtf/Lock.cpp: (WTF::LockBase::lockSlow): (WTF::LockBase::unlockSlow): (WTF::LockBase::unlockFairlySlow): (WTF::LockBase::unlockSlowImpl): Deleted. * wtf/Lock.h: (WTF::LockBase::lock): (WTF::LockBase::tryLock): (WTF::LockBase::unlock): (WTF::LockBase::unlockFairly): (WTF::LockBase::isHeld): (): Deleted. * wtf/LockAlgorithm.h: Added. (WTF::LockAlgorithm::lockFastAssumingZero): (WTF::LockAlgorithm::lockFast): (WTF::LockAlgorithm::lock): (WTF::LockAlgorithm::tryLock): (WTF::LockAlgorithm::unlockFastAssumingZero): (WTF::LockAlgorithm::unlockFast): (WTF::LockAlgorithm::unlock): (WTF::LockAlgorithm::unlockFairly): (WTF::LockAlgorithm::isLocked): (WTF::LockAlgorithm::lockSlow): (WTF::LockAlgorithm::unlockSlow): * wtf/TimeWithDynamicClockType.cpp: (WTF::hasElapsed): * wtf/TimeWithDynamicClockType.h: Canonical link: https://commits.webkit.org/182434@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208720 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-11-15 01:49:22 +00:00
using WTF::pointerListDump;
using WTF::sortedListDump;
fourthTier: DFG should have an SSA form for use by FTL https://bugs.webkit.org/show_bug.cgi?id=118338 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. Adds an SSA form to the DFG. We can convert ThreadedCPS form into SSA form after breaking critical edges. The conversion algorithm follows Aycock and Horspool, and the SSA form itself follows something I've done before, where instead of having Phi functions specify input nodes corresponding to block predecessors, we instead have Upsilon functions in the predecessors that specify which value in that block goes into which subsequent Phi. Upsilons don't have to dominate Phis (usually they don't) and they correspond to a non-SSA "mov" into the Phi's "variable". This gives all of the good properties of SSA, while ensuring that a bunch of CFG transformations don't have to be SSA-aware. So far the only DFG phases that are SSA-aware are DCE and CFA. CFG simplification is probably SSA-aware by default, though I haven't tried it. Constant folding probably needs a few tweaks, but is likely ready. Ditto for CSE, though it's not clear that we'd want to use block-local CSE when we could be doing GVN. Currently only the FTL can generate code from the SSA form, and there is no way to convert from SSA to ThreadedCPS or LoadStore. There probably will never be such a capability. In order to handle OSR exit state in the SSA, we place MovHints at Phi points. Other than that, you can reconstruct state-at-exit by forward propagating MovHints. Note that MovHint is the new SetLocal in SSA. SetLocal and GetLocal only survive into SSA if they are on captured variables, or in the case of flushes. A "live SetLocal" will be NodeMustGenerate and will always correspond to a flush. Computing the state-at-exit requires running SSA liveness analysis, OSR availability analysis, and flush liveness analysis. The FTL runs all of these prior to generating code. While OSR exit continues to be tricky, much of the logic is now factored into separate phases and the backend has to do less work to reason about what happened outside of the basic block that is being lowered. Conversion from DFG SSA to LLVM SSA is done by ensuring that we generate code in depth-first order, thus guaranteeing that a node will always be lowered (and hence have a LValue) before any of the blocks dominated by that node's block have code generated. For Upsilon/Phi, we just use alloca's. We could do something more clever there, but it's probably not worth it, at least not now. Finally, while the SSA form is currently only being converted to LLVM IR, there is nothing that prevents us from considering other backends in the future - with the caveat that this form is designed to be first lowered to a lower-level SSA before actual machine code generation commences. So we ought to either use LLVM (the intended path) or we will have to write our own SSA low-level backend. This runs all of the code that the FTL was known to run previously. No change in performance for now. But it does open some exciting possibilities! * JavaScriptCore.xcodeproj/project.pbxproj: * bytecode/Operands.h: (JSC::OperandValueTraits::dump): (JSC::Operands::fill): (Operands): (JSC::Operands::clear): (JSC::Operands::operator==): * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::beginBasicBlock): (JSC::DFG::setLiveValues): (DFG): (JSC::DFG::AbstractState::initialize): (JSC::DFG::AbstractState::endBasicBlock): (JSC::DFG::AbstractState::executeEffects): (JSC::DFG::AbstractState::mergeStateAtTail): (JSC::DFG::AbstractState::merge): * dfg/DFGAbstractState.h: (AbstractState): * dfg/DFGAdjacencyList.h: (JSC::DFG::AdjacencyList::justOneChild): (AdjacencyList): * dfg/DFGBasicBlock.cpp: Added. (DFG): (JSC::DFG::BasicBlock::BasicBlock): (JSC::DFG::BasicBlock::~BasicBlock): (JSC::DFG::BasicBlock::ensureLocals): (JSC::DFG::BasicBlock::isInPhis): (JSC::DFG::BasicBlock::isInBlock): (JSC::DFG::BasicBlock::removePredecessor): (JSC::DFG::BasicBlock::replacePredecessor): (JSC::DFG::BasicBlock::dump): (JSC::DFG::BasicBlock::SSAData::SSAData): (JSC::DFG::BasicBlock::SSAData::~SSAData): * dfg/DFGBasicBlock.h: (BasicBlock): (JSC::DFG::BasicBlock::operator[]): (JSC::DFG::BasicBlock::successor): (JSC::DFG::BasicBlock::successorForCondition): (SSAData): * dfg/DFGBasicBlockInlines.h: (DFG): * dfg/DFGBlockInsertionSet.cpp: Added. (DFG): (JSC::DFG::BlockInsertionSet::BlockInsertionSet): (JSC::DFG::BlockInsertionSet::~BlockInsertionSet): (JSC::DFG::BlockInsertionSet::insert): (JSC::DFG::BlockInsertionSet::insertBefore): (JSC::DFG::BlockInsertionSet::execute): * dfg/DFGBlockInsertionSet.h: Added. (DFG): (BlockInsertionSet): * dfg/DFGCFAPhase.cpp: (JSC::DFG::CFAPhase::run): * dfg/DFGCFGSimplificationPhase.cpp: * dfg/DFGCPSRethreadingPhase.cpp: (JSC::DFG::CPSRethreadingPhase::canonicalizeLocalsInBlock): * dfg/DFGCommon.cpp: (WTF::printInternal): * dfg/DFGCommon.h: (JSC::DFG::doesKill): (DFG): (JSC::DFG::killStatusForDoesKill): * dfg/DFGConstantFoldingPhase.cpp: (JSC::DFG::ConstantFoldingPhase::foldConstants): (JSC::DFG::ConstantFoldingPhase::isCapturedAtOrAfter): * dfg/DFGCriticalEdgeBreakingPhase.cpp: Added. (DFG): (CriticalEdgeBreakingPhase): (JSC::DFG::CriticalEdgeBreakingPhase::CriticalEdgeBreakingPhase): (JSC::DFG::CriticalEdgeBreakingPhase::run): (JSC::DFG::CriticalEdgeBreakingPhase::breakCriticalEdge): (JSC::DFG::performCriticalEdgeBreaking): * dfg/DFGCriticalEdgeBreakingPhase.h: Added. (DFG): * dfg/DFGDCEPhase.cpp: (JSC::DFG::DCEPhase::run): (JSC::DFG::DCEPhase::findTypeCheckRoot): (JSC::DFG::DCEPhase::countNode): (DCEPhase): (JSC::DFG::DCEPhase::countEdge): (JSC::DFG::DCEPhase::eliminateIrrelevantPhantomChildren): * dfg/DFGDriver.cpp: (JSC::DFG::compile): * dfg/DFGEdge.cpp: (JSC::DFG::Edge::dump): * dfg/DFGEdge.h: (JSC::DFG::Edge::Edge): (JSC::DFG::Edge::setNode): (JSC::DFG::Edge::useKindUnchecked): (JSC::DFG::Edge::setUseKind): (JSC::DFG::Edge::setProofStatus): (JSC::DFG::Edge::willNotHaveCheck): (JSC::DFG::Edge::willHaveCheck): (Edge): (JSC::DFG::Edge::killStatusUnchecked): (JSC::DFG::Edge::killStatus): (JSC::DFG::Edge::setKillStatus): (JSC::DFG::Edge::doesKill): (JSC::DFG::Edge::doesNotKill): (JSC::DFG::Edge::shift): (JSC::DFG::Edge::makeWord): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGFlushFormat.cpp: Added. (WTF): (WTF::printInternal): * dfg/DFGFlushFormat.h: Added. (DFG): (JSC::DFG::resultFor): (JSC::DFG::useKindFor): (WTF): * dfg/DFGFlushLivenessAnalysisPhase.cpp: Added. (DFG): (FlushLivenessAnalysisPhase): (JSC::DFG::FlushLivenessAnalysisPhase::FlushLivenessAnalysisPhase): (JSC::DFG::FlushLivenessAnalysisPhase::run): (JSC::DFG::FlushLivenessAnalysisPhase::process): (JSC::DFG::FlushLivenessAnalysisPhase::setForNode): (JSC::DFG::FlushLivenessAnalysisPhase::flushFormat): (JSC::DFG::performFlushLivenessAnalysis): * dfg/DFGFlushLivenessAnalysisPhase.h: Added. (DFG): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::dump): (JSC::DFG::Graph::dumpBlockHeader): (DFG): (JSC::DFG::Graph::addForDepthFirstSort): (JSC::DFG::Graph::getBlocksInDepthFirstOrder): * dfg/DFGGraph.h: (JSC::DFG::Graph::convertToConstant): (JSC::DFG::Graph::valueProfileFor): (Graph): * dfg/DFGInsertionSet.h: (DFG): (JSC::DFG::InsertionSet::execute): * dfg/DFGLivenessAnalysisPhase.cpp: Added. (DFG): (LivenessAnalysisPhase): (JSC::DFG::LivenessAnalysisPhase::LivenessAnalysisPhase): (JSC::DFG::LivenessAnalysisPhase::run): (JSC::DFG::LivenessAnalysisPhase::process): (JSC::DFG::LivenessAnalysisPhase::addChildUse): (JSC::DFG::performLivenessAnalysis): * dfg/DFGLivenessAnalysisPhase.h: Added. (DFG): * dfg/DFGNode.cpp: (JSC::DFG::Node::hasVariableAccessData): (DFG): * dfg/DFGNode.h: (DFG): (Node): (JSC::DFG::Node::hasLocal): (JSC::DFG::Node::variableAccessData): (JSC::DFG::Node::hasPhi): (JSC::DFG::Node::phi): (JSC::DFG::Node::takenBlock): (JSC::DFG::Node::notTakenBlock): (JSC::DFG::Node::successor): (JSC::DFG::Node::successorForCondition): (JSC::DFG::nodeComparator): (JSC::DFG::nodeListDump): (JSC::DFG::nodeMapDump): * dfg/DFGNodeFlags.cpp: (JSC::DFG::dumpNodeFlags): * dfg/DFGNodeType.h: (DFG): * dfg/DFGOSRAvailabilityAnalysisPhase.cpp: Added. (DFG): (OSRAvailabilityAnalysisPhase): (JSC::DFG::OSRAvailabilityAnalysisPhase::OSRAvailabilityAnalysisPhase): (JSC::DFG::OSRAvailabilityAnalysisPhase::run): (JSC::DFG::performOSRAvailabilityAnalysis): * dfg/DFGOSRAvailabilityAnalysisPhase.h: Added. (DFG): * dfg/DFGPlan.cpp: (JSC::DFG::Plan::compileInThreadImpl): * dfg/DFGPredictionInjectionPhase.cpp: (JSC::DFG::PredictionInjectionPhase::run): * dfg/DFGPredictionPropagationPhase.cpp: (JSC::DFG::PredictionPropagationPhase::propagate): * dfg/DFGSSAConversionPhase.cpp: Added. (DFG): (SSAConversionPhase): (JSC::DFG::SSAConversionPhase::SSAConversionPhase): (JSC::DFG::SSAConversionPhase::run): (JSC::DFG::SSAConversionPhase::forwardPhiChildren): (JSC::DFG::SSAConversionPhase::forwardPhi): (JSC::DFG::SSAConversionPhase::forwardPhiEdge): (JSC::DFG::SSAConversionPhase::deduplicateChildren): (JSC::DFG::SSAConversionPhase::addFlushedLocalOp): (JSC::DFG::SSAConversionPhase::addFlushedLocalEdge): (JSC::DFG::performSSAConversion): * dfg/DFGSSAConversionPhase.h: Added. (DFG): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGValidate.cpp: (JSC::DFG::Validate::validate): (Validate): (JSC::DFG::Validate::validateCPS): * dfg/DFGVariableAccessData.h: (JSC::DFG::VariableAccessData::flushFormat): (VariableAccessData): * ftl/FTLCapabilities.cpp: (JSC::FTL::canCompile): * ftl/FTLLowerDFGToLLVM.cpp: (JSC::FTL::LowerDFGToLLVM::LowerDFGToLLVM): (JSC::FTL::LowerDFGToLLVM::lower): (JSC::FTL::LowerDFGToLLVM::createPhiVariables): (JSC::FTL::LowerDFGToLLVM::compileBlock): (JSC::FTL::LowerDFGToLLVM::compileNode): (JSC::FTL::LowerDFGToLLVM::compileUpsilon): (LowerDFGToLLVM): (JSC::FTL::LowerDFGToLLVM::compilePhi): (JSC::FTL::LowerDFGToLLVM::compileJSConstant): (JSC::FTL::LowerDFGToLLVM::compileWeakJSConstant): (JSC::FTL::LowerDFGToLLVM::compileGetArgument): (JSC::FTL::LowerDFGToLLVM::compileGetLocal): (JSC::FTL::LowerDFGToLLVM::compileSetLocal): (JSC::FTL::LowerDFGToLLVM::compileAdd): (JSC::FTL::LowerDFGToLLVM::compileArithSub): (JSC::FTL::LowerDFGToLLVM::compileArithMul): (JSC::FTL::LowerDFGToLLVM::compileArithDiv): (JSC::FTL::LowerDFGToLLVM::compileArithMod): (JSC::FTL::LowerDFGToLLVM::compileArithMinOrMax): (JSC::FTL::LowerDFGToLLVM::compileArithAbs): (JSC::FTL::LowerDFGToLLVM::compileArithNegate): (JSC::FTL::LowerDFGToLLVM::compileBitAnd): (JSC::FTL::LowerDFGToLLVM::compileBitOr): (JSC::FTL::LowerDFGToLLVM::compileBitXor): (JSC::FTL::LowerDFGToLLVM::compileBitRShift): (JSC::FTL::LowerDFGToLLVM::compileBitLShift): (JSC::FTL::LowerDFGToLLVM::compileBitURShift): (JSC::FTL::LowerDFGToLLVM::compileUInt32ToNumber): (JSC::FTL::LowerDFGToLLVM::compileInt32ToDouble): (JSC::FTL::LowerDFGToLLVM::compileGetButterfly): (JSC::FTL::LowerDFGToLLVM::compileGetArrayLength): (JSC::FTL::LowerDFGToLLVM::compileGetByVal): (JSC::FTL::LowerDFGToLLVM::compileGetByOffset): (JSC::FTL::LowerDFGToLLVM::compileGetGlobalVar): (JSC::FTL::LowerDFGToLLVM::compileCompareEqConstant): (JSC::FTL::LowerDFGToLLVM::compileCompareStrictEq): (JSC::FTL::LowerDFGToLLVM::compileCompareStrictEqConstant): (JSC::FTL::LowerDFGToLLVM::compileCompareLess): (JSC::FTL::LowerDFGToLLVM::compileCompareLessEq): (JSC::FTL::LowerDFGToLLVM::compileCompareGreater): (JSC::FTL::LowerDFGToLLVM::compileCompareGreaterEq): (JSC::FTL::LowerDFGToLLVM::compileLogicalNot): (JSC::FTL::LowerDFGToLLVM::speculateBackward): (JSC::FTL::LowerDFGToLLVM::lowInt32): (JSC::FTL::LowerDFGToLLVM::lowCell): (JSC::FTL::LowerDFGToLLVM::lowBoolean): (JSC::FTL::LowerDFGToLLVM::lowDouble): (JSC::FTL::LowerDFGToLLVM::lowJSValue): (JSC::FTL::LowerDFGToLLVM::lowStorage): (JSC::FTL::LowerDFGToLLVM::speculate): (JSC::FTL::LowerDFGToLLVM::speculateBoolean): (JSC::FTL::LowerDFGToLLVM::isLive): (JSC::FTL::LowerDFGToLLVM::use): (JSC::FTL::LowerDFGToLLVM::initializeOSRExitStateForBlock): (JSC::FTL::LowerDFGToLLVM::appendOSRExit): (JSC::FTL::LowerDFGToLLVM::emitOSRExitCall): (JSC::FTL::LowerDFGToLLVM::addExitArgumentForNode): (JSC::FTL::LowerDFGToLLVM::linkOSRExitsAndCompleteInitializationBlocks): (JSC::FTL::LowerDFGToLLVM::setInt32): (JSC::FTL::LowerDFGToLLVM::setJSValue): (JSC::FTL::LowerDFGToLLVM::setBoolean): (JSC::FTL::LowerDFGToLLVM::setStorage): (JSC::FTL::LowerDFGToLLVM::setDouble): (JSC::FTL::LowerDFGToLLVM::isValid): * ftl/FTLLoweredNodeValue.h: Added. (FTL): (LoweredNodeValue): (JSC::FTL::LoweredNodeValue::LoweredNodeValue): (JSC::FTL::LoweredNodeValue::isSet): (JSC::FTL::LoweredNodeValue::operator!): (JSC::FTL::LoweredNodeValue::value): (JSC::FTL::LoweredNodeValue::block): * ftl/FTLValueFromBlock.h: (JSC::FTL::ValueFromBlock::ValueFromBlock): (ValueFromBlock): * ftl/FTLValueSource.cpp: (JSC::FTL::ValueSource::dump): * ftl/FTLValueSource.h: Source/WTF: Reviewed by Mark Hahnenberg. - Extend variadicity of PrintStream and dataLog. - Give HashSet the ability to add a span of things. - Give HashSet the ability to == another HashSet. - Note FIXME's in HashTable concerning copying performance, that affects the way that the DFG now uses HashSets and HashMaps. - Factor out the bulk-insertion logic of JSC::DFG::InsertionSet into WTF::Insertion, so that it can be used in more places. - Create a dumper for lists and maps. * WTF.xcodeproj/project.pbxproj: * wtf/DataLog.h: (WTF): (WTF::dataLog): * wtf/HashSet.h: (HashSet): (WTF): (WTF::::add): (WTF::=): * wtf/HashTable.h: (WTF::::HashTable): (WTF::=): * wtf/Insertion.h: Added. (WTF): (Insertion): (WTF::Insertion::Insertion): (WTF::Insertion::index): (WTF::Insertion::element): (WTF::Insertion::operator<): (WTF::executeInsertions): * wtf/ListDump.h: Added. (WTF): (ListDump): (WTF::ListDump::ListDump): (WTF::ListDump::dump): (MapDump): (WTF::MapDump::MapDump): (WTF::MapDump::dump): (WTF::listDump): (WTF::sortedListDump): (WTF::lessThan): (WTF::mapDump): (WTF::sortedMapDump): * wtf/PrintStream.h: (PrintStream): (WTF::PrintStream::print): Conflicts: Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj Canonical link: https://commits.webkit.org/137058@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153274 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:04:45 +00:00
using WTF::sortedMapDump;