Title: [221637] trunk/Source/_javascript_Core
Revision
221637
Author
sbar...@apple.com
Date
2017-09-05 14:30:05 -0700 (Tue, 05 Sep 2017)

Log Message

Make the distinction between entrypoints and CFG roots more clear by naming things better
https://bugs.webkit.org/show_bug.cgi?id=176336

Reviewed by Mark Lam and Keith Miller and Michael Saboff.

This patch does renaming to make the distinction between Graph::m_entrypoints
and Graph::m_numberOfEntrypoints more clear. The source of confusion is that
Graph::m_entrypoints.size() is not equivalent to Graph::m_numberOfEntrypoints.
Graph::m_entrypoints is really just the CFG roots. In CPS, this vector has
size >= 1. In SSA, the size is always 1. This patch renames Graph::m_entrypoints
to Graph::m_roots. To be consistent, this patch also renames Graph's m_entrypointToArguments
field to m_rootToArguments.

Graph::m_numberOfEntrypoints retains its name. This field is only used in SSA
when compiling with EntrySwitch. It represents the logical number of entrypoints
the compilation will end up with. Each EntrySwitch has m_numberOfEntrypoints
cases.

* dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::parseBlock):
(JSC::DFG::ByteCodeParser::parseCodeBlock):
* dfg/DFGCFG.h:
(JSC::DFG::CFG::roots):
(JSC::DFG::CPSCFG::CPSCFG):
* dfg/DFGCPSRethreadingPhase.cpp:
(JSC::DFG::CPSRethreadingPhase::specialCaseArguments):
* dfg/DFGDCEPhase.cpp:
(JSC::DFG::DCEPhase::run):
* dfg/DFGGraph.cpp:
(JSC::DFG::Graph::dump):
(JSC::DFG::Graph::determineReachability):
(JSC::DFG::Graph::blocksInPreOrder):
(JSC::DFG::Graph::blocksInPostOrder):
(JSC::DFG::Graph::methodOfGettingAValueProfileFor):
* dfg/DFGGraph.h:
(JSC::DFG::Graph::isRoot):
(JSC::DFG::Graph::isEntrypoint): Deleted.
* dfg/DFGInPlaceAbstractState.cpp:
(JSC::DFG::InPlaceAbstractState::initialize):
* dfg/DFGLoopPreHeaderCreationPhase.cpp:
(JSC::DFG::createPreHeader):
* dfg/DFGMaximalFlushInsertionPhase.cpp:
(JSC::DFG::MaximalFlushInsertionPhase::run):
(JSC::DFG::MaximalFlushInsertionPhase::treatRegularBlock):
* dfg/DFGOSREntrypointCreationPhase.cpp:
(JSC::DFG::OSREntrypointCreationPhase::run):
* dfg/DFGPredictionInjectionPhase.cpp:
(JSC::DFG::PredictionInjectionPhase::run):
* dfg/DFGSSAConversionPhase.cpp:
(JSC::DFG::SSAConversionPhase::run):
* dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::checkArgumentTypes):
(JSC::DFG::SpeculativeJIT::linkOSREntries):
* dfg/DFGTypeCheckHoistingPhase.cpp:
(JSC::DFG::TypeCheckHoistingPhase::run):
* dfg/DFGValidate.cpp:

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (221636 => 221637)


--- trunk/Source/_javascript_Core/ChangeLog	2017-09-05 21:18:24 UTC (rev 221636)
+++ trunk/Source/_javascript_Core/ChangeLog	2017-09-05 21:30:05 UTC (rev 221637)
@@ -1,3 +1,62 @@
+2017-09-05  Saam Barati  <sbar...@apple.com>
+
+        Make the distinction between entrypoints and CFG roots more clear by naming things better
+        https://bugs.webkit.org/show_bug.cgi?id=176336
+
+        Reviewed by Mark Lam and Keith Miller and Michael Saboff.
+
+        This patch does renaming to make the distinction between Graph::m_entrypoints
+        and Graph::m_numberOfEntrypoints more clear. The source of confusion is that
+        Graph::m_entrypoints.size() is not equivalent to Graph::m_numberOfEntrypoints.
+        Graph::m_entrypoints is really just the CFG roots. In CPS, this vector has
+        size >= 1. In SSA, the size is always 1. This patch renames Graph::m_entrypoints
+        to Graph::m_roots. To be consistent, this patch also renames Graph's m_entrypointToArguments
+        field to m_rootToArguments.
+        
+        Graph::m_numberOfEntrypoints retains its name. This field is only used in SSA
+        when compiling with EntrySwitch. It represents the logical number of entrypoints
+        the compilation will end up with. Each EntrySwitch has m_numberOfEntrypoints
+        cases.
+
+        * dfg/DFGByteCodeParser.cpp:
+        (JSC::DFG::ByteCodeParser::parseBlock):
+        (JSC::DFG::ByteCodeParser::parseCodeBlock):
+        * dfg/DFGCFG.h:
+        (JSC::DFG::CFG::roots):
+        (JSC::DFG::CPSCFG::CPSCFG):
+        * dfg/DFGCPSRethreadingPhase.cpp:
+        (JSC::DFG::CPSRethreadingPhase::specialCaseArguments):
+        * dfg/DFGDCEPhase.cpp:
+        (JSC::DFG::DCEPhase::run):
+        * dfg/DFGGraph.cpp:
+        (JSC::DFG::Graph::dump):
+        (JSC::DFG::Graph::determineReachability):
+        (JSC::DFG::Graph::blocksInPreOrder):
+        (JSC::DFG::Graph::blocksInPostOrder):
+        (JSC::DFG::Graph::methodOfGettingAValueProfileFor):
+        * dfg/DFGGraph.h:
+        (JSC::DFG::Graph::isRoot):
+        (JSC::DFG::Graph::isEntrypoint): Deleted.
+        * dfg/DFGInPlaceAbstractState.cpp:
+        (JSC::DFG::InPlaceAbstractState::initialize):
+        * dfg/DFGLoopPreHeaderCreationPhase.cpp:
+        (JSC::DFG::createPreHeader):
+        * dfg/DFGMaximalFlushInsertionPhase.cpp:
+        (JSC::DFG::MaximalFlushInsertionPhase::run):
+        (JSC::DFG::MaximalFlushInsertionPhase::treatRegularBlock):
+        * dfg/DFGOSREntrypointCreationPhase.cpp:
+        (JSC::DFG::OSREntrypointCreationPhase::run):
+        * dfg/DFGPredictionInjectionPhase.cpp:
+        (JSC::DFG::PredictionInjectionPhase::run):
+        * dfg/DFGSSAConversionPhase.cpp:
+        (JSC::DFG::SSAConversionPhase::run):
+        * dfg/DFGSpeculativeJIT.cpp:
+        (JSC::DFG::SpeculativeJIT::checkArgumentTypes):
+        (JSC::DFG::SpeculativeJIT::linkOSREntries):
+        * dfg/DFGTypeCheckHoistingPhase.cpp:
+        (JSC::DFG::TypeCheckHoistingPhase::run):
+        * dfg/DFGValidate.cpp:
+
 2017-09-05  Joseph Pecoraro  <pecor...@apple.com>
 
         test262: Completion values for control flow do not match the spec

Modified: trunk/Source/_javascript_Core/dfg/DFGByteCodeParser.cpp (221636 => 221637)


--- trunk/Source/_javascript_Core/dfg/DFGByteCodeParser.cpp	2017-09-05 21:18:24 UTC (rev 221636)
+++ trunk/Source/_javascript_Core/dfg/DFGByteCodeParser.cpp	2017-09-05 21:30:05 UTC (rev 221637)
@@ -4168,7 +4168,7 @@
     // us to track if a use of an argument may use the actual argument passed, as
     // opposed to using a value we set explicitly.
     if (m_currentBlock == m_graph.block(0) && !inlineCallFrame()) {
-        auto addResult = m_graph.m_entrypointToArguments.add(m_currentBlock, ArgumentsVector());
+        auto addResult = m_graph.m_rootToArguments.add(m_currentBlock, ArgumentsVector());
         RELEASE_ASSERT(addResult.isNewEntry);
         ArgumentsVector& entrypointArguments = addResult.iterator->value;
         entrypointArguments.resize(m_numArguments);
@@ -5276,7 +5276,7 @@
 
             // We're now committed to compiling this as an entrypoint.
             m_currentBlock->isCatchEntrypoint = true;
-            m_graph.m_entrypoints.append(m_currentBlock);
+            m_graph.m_roots.append(m_currentBlock);
 
             Vector<SpeculatedType> argumentPredictions(m_numArguments);
             Vector<SpeculatedType> localPredictions;
@@ -5341,7 +5341,7 @@
             addToGraph(ExitOK);
 
             {
-                auto addResult = m_graph.m_entrypointToArguments.add(m_currentBlock, ArgumentsVector());
+                auto addResult = m_graph.m_rootToArguments.add(m_currentBlock, ArgumentsVector());
                 RELEASE_ASSERT(addResult.isNewEntry);
                 ArgumentsVector& entrypointArguments = addResult.iterator->value;
                 entrypointArguments.resize(m_numArguments);
@@ -6400,7 +6400,7 @@
                     // The first block is definitely an OSR target.
                     if (!m_graph.numBlocks()) {
                         block->isOSRTarget = true;
-                        m_graph.m_entrypoints.append(block.ptr());
+                        m_graph.m_roots.append(block.ptr());
                     }
                     m_graph.appendBlock(WTFMove(block));
                     prepareToParseBlock();

Modified: trunk/Source/_javascript_Core/dfg/DFGCFG.h (221636 => 221637)


--- trunk/Source/_javascript_Core/dfg/DFGCFG.h	2017-09-05 21:18:24 UTC (rev 221636)
+++ trunk/Source/_javascript_Core/dfg/DFGCFG.h	2017-09-05 21:30:05 UTC (rev 221637)
@@ -58,7 +58,7 @@
     List roots()
     {
         List result;
-        for (BasicBlock* root : m_graph.m_entrypoints)
+        for (BasicBlock* root : m_graph.m_roots)
             result.append(root);
         return result;
     }
@@ -89,7 +89,7 @@
     CPSCFG(Graph& graph)
         : SingleRootGraph<CFG>(*graph.m_ssaCFG)
     {
-        ASSERT(graph.m_entrypoints.size());
+        ASSERT(graph.m_roots.size());
     }
 };
 

Modified: trunk/Source/_javascript_Core/dfg/DFGCPSRethreadingPhase.cpp (221636 => 221637)


--- trunk/Source/_javascript_Core/dfg/DFGCPSRethreadingPhase.cpp	2017-09-05 21:18:24 UTC (rev 221636)
+++ trunk/Source/_javascript_Core/dfg/DFGCPSRethreadingPhase.cpp	2017-09-05 21:30:05 UTC (rev 221637)
@@ -370,7 +370,7 @@
         // special-cased. We could have instead used two different node types - one for the arguments
         // at the prologue case, and another for the other uses. But this seemed like IR overkill.
 
-        for (auto& pair : m_graph.m_entrypointToArguments) {
+        for (auto& pair : m_graph.m_rootToArguments) {
             BasicBlock* entrypoint = pair.key;
             const ArgumentsVector& arguments = pair.value;
             for (unsigned i = arguments.size(); i--;)

Modified: trunk/Source/_javascript_Core/dfg/DFGDCEPhase.cpp (221636 => 221637)


--- trunk/Source/_javascript_Core/dfg/DFGDCEPhase.cpp	2017-09-05 21:18:24 UTC (rev 221636)
+++ trunk/Source/_javascript_Core/dfg/DFGDCEPhase.cpp	2017-09-05 21:30:05 UTC (rev 221637)
@@ -53,7 +53,7 @@
         for (BasicBlock* block : m_graph.blocksInPreOrder())
             fixupBlock(block);
         
-        for (auto& argumentsVector : m_graph.m_entrypointToArguments.values())
+        for (auto& argumentsVector : m_graph.m_rootToArguments.values())
             cleanVariables(argumentsVector);
 
         // Just do a basic Phantom/Check clean-up.

Modified: trunk/Source/_javascript_Core/dfg/DFGGraph.cpp (221636 => 221637)


--- trunk/Source/_javascript_Core/dfg/DFGGraph.cpp	2017-09-05 21:18:24 UTC (rev 221636)
+++ trunk/Source/_javascript_Core/dfg/DFGGraph.cpp	2017-09-05 21:30:05 UTC (rev 221637)
@@ -525,7 +525,7 @@
             out.print("  Argument formats for entrypoint index: ", entrypointIndex, " : ", listDump(m_argumentFormats[entrypointIndex]), "\n");
     }
     else {
-        for (auto pair : m_entrypointToArguments)
+        for (auto pair : m_rootToArguments)
             out.print("  Arguments for block#", pair.key->index, ": ", listDump(pair.value), "\n");
     }
     out.print("\n");
@@ -664,7 +664,7 @@
 void Graph::determineReachability()
 {
     Vector<BasicBlock*, 16> worklist;
-    for (BasicBlock* entrypoint : m_entrypoints) {
+    for (BasicBlock* entrypoint : m_roots) {
         entrypoint->isReachable = true;
         worklist.append(entrypoint);
     }
@@ -878,7 +878,7 @@
 {
     BlockList result;
     BlockWorklist worklist;
-    for (BasicBlock* entrypoint : m_entrypoints)
+    for (BasicBlock* entrypoint : m_roots)
         worklist.push(entrypoint);
     while (BasicBlock* block = worklist.pop()) {
         result.append(block);
@@ -916,7 +916,7 @@
 {
     BlockList result;
     PostOrderBlockWorklist worklist;
-    for (BasicBlock* entrypoint : m_entrypoints)
+    for (BasicBlock* entrypoint : m_roots)
         worklist.push(entrypoint);
     while (BlockWithOrder item = worklist.pop()) {
         switch (item.order) {
@@ -1628,7 +1628,7 @@
             if (node->accessesStack(*this)) {
                 if (m_form != SSA && node->local().isArgument()) {
                     int argument = node->local().toArgument();
-                    Node* argumentNode = m_entrypointToArguments.find(block(0))->value[argument];
+                    Node* argumentNode = m_rootToArguments.find(block(0))->value[argument];
                     // FIXME: We should match SetArgument nodes at other entrypoints as well:
                     // https://bugs.webkit.org/show_bug.cgi?id=175841
                     if (argumentNode && node->variableAccessData() == argumentNode->variableAccessData())

Modified: trunk/Source/_javascript_Core/dfg/DFGGraph.h (221636 => 221637)


--- trunk/Source/_javascript_Core/dfg/DFGGraph.h	2017-09-05 21:18:24 UTC (rev 221636)
+++ trunk/Source/_javascript_Core/dfg/DFGGraph.h	2017-09-05 21:30:05 UTC (rev 221637)
@@ -949,23 +949,23 @@
 
     void clearCPSCFGData();
 
-    bool isEntrypoint(BasicBlock* block) const
+    bool isRoot(BasicBlock* block) const
     {
         ASSERT_WITH_MESSAGE(!m_isInSSAConversion, "This is not written to work during SSA conversion.");
 
         if (m_form == SSA) {
-            ASSERT(m_entrypoints.size() == 1);
-            ASSERT(m_entrypoints.contains(this->block(0)));
+            ASSERT(m_roots.size() == 1);
+            ASSERT(m_roots.contains(this->block(0)));
             return block == this->block(0);
         }
 
-        if (m_entrypoints.size() <= 4) {
-            bool result = m_entrypoints.contains(block);
-            ASSERT(result == m_entrypointToArguments.contains(block));
+        if (m_roots.size() <= 4) {
+            bool result = m_roots.contains(block);
+            ASSERT(result == m_rootToArguments.contains(block));
             return result;
         }
-        bool result = m_entrypointToArguments.contains(block);
-        ASSERT(result == m_entrypoints.contains(block));
+        bool result = m_rootToArguments.contains(block);
+        ASSERT(result == m_roots.contains(block));
         return result;
     }
 
@@ -975,7 +975,7 @@
     CodeBlock* m_profiledBlock;
     
     Vector<RefPtr<BasicBlock>, 8> m_blocks;
-    Vector<BasicBlock*, 1> m_entrypoints;
+    Vector<BasicBlock*, 1> m_roots;
     Vector<Edge, 16> m_varArgChildren;
 
     HashMap<EncodedJSValue, FrozenValue*, EncodedJSValueHash, EncodedJSValueHashTraits> m_frozenValueMap;
@@ -988,7 +988,7 @@
     // In CPS, this is all of the SetArgument nodes for the arguments in the machine code block
     // that survived DCE. All of them except maybe "this" will survive DCE, because of the Flush
     // nodes. In SSA, this has no meaning. It's empty.
-    HashMap<BasicBlock*, ArgumentsVector> m_entrypointToArguments;
+    HashMap<BasicBlock*, ArgumentsVector> m_rootToArguments;
 
     // In SSA, this is the argument speculation that we've locked in for an entrypoint block.
     //
@@ -1021,9 +1021,9 @@
     HashMap<unsigned, unsigned> m_entrypointIndexToCatchBytecodeOffset;
 
     // This is the number of logical entrypoints that we're compiling. This is only used
-    // in SSA. Each EntrySwitch node must have numberOfEntrypoints cases. Note, this is
-    // not the same as m_entrypoints.size(). m_entrypoints.size() represents the number
-    // of roots in the CFG. In SSA, m_entrypoints.size() == 1.
+    // in SSA. Each EntrySwitch node must have m_numberOfEntrypoints cases. Note, this is
+    // not the same as m_roots.size(). m_roots.size() represents the number of roots in
+    // the CFG. In SSA, m_roots.size() == 1 even if we're compiling more than one entrypoint.
     unsigned m_numberOfEntrypoints { UINT_MAX };
 
     SegmentedVector<VariableAccessData, 16> m_variableAccessData;

Modified: trunk/Source/_javascript_Core/dfg/DFGInPlaceAbstractState.cpp (221636 => 221637)


--- trunk/Source/_javascript_Core/dfg/DFGInPlaceAbstractState.cpp	2017-09-05 21:18:24 UTC (rev 221636)
+++ trunk/Source/_javascript_Core/dfg/DFGInPlaceAbstractState.cpp	2017-09-05 21:30:05 UTC (rev 221637)
@@ -93,7 +93,7 @@
 
 void InPlaceAbstractState::initialize()
 {
-    for (BasicBlock* entrypoint : m_graph.m_entrypoints) {
+    for (BasicBlock* entrypoint : m_graph.m_roots) {
         entrypoint->cfaShouldRevisit = true;
         entrypoint->cfaHasVisited = false;
         entrypoint->cfaFoundConstants = false;
@@ -106,7 +106,7 @@
                 entrypoint->valuesAtTail.argument(i).clear();
             }
         } else {
-            const ArgumentsVector& arguments = m_graph.m_entrypointToArguments.find(entrypoint)->value;
+            const ArgumentsVector& arguments = m_graph.m_rootToArguments.find(entrypoint)->value;
             for (size_t i = 0; i < entrypoint->valuesAtHead.numberOfArguments(); ++i) {
                 entrypoint->valuesAtTail.argument(i).clear();
 
@@ -146,8 +146,8 @@
     }
 
     for (BasicBlock* block : m_graph.blocksInNaturalOrder()) {
-        if (m_graph.isEntrypoint(block)) {
-            // We bootstrapped the entrypoints above.
+        if (m_graph.isRoot(block)) {
+            // We bootstrapped the CFG roots above.
             continue;
         }
 

Modified: trunk/Source/_javascript_Core/dfg/DFGLoopPreHeaderCreationPhase.cpp (221636 => 221637)


--- trunk/Source/_javascript_Core/dfg/DFGLoopPreHeaderCreationPhase.cpp	2017-09-05 21:18:24 UTC (rev 221636)
+++ trunk/Source/_javascript_Core/dfg/DFGLoopPreHeaderCreationPhase.cpp	2017-09-05 21:30:05 UTC (rev 221637)
@@ -41,7 +41,7 @@
 
 BasicBlock* createPreHeader(Graph& graph, BlockInsertionSet& insertionSet, BasicBlock* block)
 {
-    ASSERT_WITH_MESSAGE(!graph.isEntrypoint(block), "An entrypoint should not be in a loop");
+    ASSERT_WITH_MESSAGE(!graph.isRoot(block), "A CFG root should not be in a loop");
 
     // FIXME: If we run this utility on SSA IR, then we may end up with a bizarre arrangement of
     // Upsilons and Phis, like:

Modified: trunk/Source/_javascript_Core/dfg/DFGMaximalFlushInsertionPhase.cpp (221636 => 221637)


--- trunk/Source/_javascript_Core/dfg/DFGMaximalFlushInsertionPhase.cpp	2017-09-05 21:18:24 UTC (rev 221636)
+++ trunk/Source/_javascript_Core/dfg/DFGMaximalFlushInsertionPhase.cpp	2017-09-05 21:30:05 UTC (rev 221637)
@@ -53,7 +53,7 @@
             insertionSet.execute(block);
         }
 
-        for (BasicBlock* entrypoint : m_graph.m_entrypoints) {
+        for (BasicBlock* entrypoint : m_graph.m_roots) {
             treatRootBlock(entrypoint, insertionSet);
             insertionSet.execute(entrypoint);
         }
@@ -71,8 +71,8 @@
                 Node* node = block->at(i);
                 bool isPrimordialSetArgument = false;
                 if (node->op() == SetArgument && node->local().isArgument()) {
-                    auto iter = m_graph.m_entrypointToArguments.find(block);
-                    if (iter != m_graph.m_entrypointToArguments.end())
+                    auto iter = m_graph.m_rootToArguments.find(block);
+                    if (iter != m_graph.m_rootToArguments.end())
                         isPrimordialSetArgument = node == iter->value[node->local().toArgument()];
                 }
 

Modified: trunk/Source/_javascript_Core/dfg/DFGOSREntrypointCreationPhase.cpp (221636 => 221637)


--- trunk/Source/_javascript_Core/dfg/DFGOSREntrypointCreationPhase.cpp	2017-09-05 21:18:24 UTC (rev 221636)
+++ trunk/Source/_javascript_Core/dfg/DFGOSREntrypointCreationPhase.cpp	2017-09-05 21:30:05 UTC (rev 221637)
@@ -113,7 +113,7 @@
         // type checks to here.
         origin = target->at(0)->origin;
         
-        ArgumentsVector newArguments = m_graph.m_entrypointToArguments.find(m_graph.block(0))->value;
+        ArgumentsVector newArguments = m_graph.m_rootToArguments.find(m_graph.block(0))->value;
         for (int argument = 0; argument < baseline->numParameters(); ++argument) {
             Node* oldNode = target->variablesAtHead.argument(argument);
             if (!oldNode) {
@@ -142,10 +142,10 @@
         
         insertionSet.execute();
 
-        RELEASE_ASSERT(m_graph.m_entrypoints.size() == 1);
-        m_graph.m_entrypoints[0] = newRoot;
-        m_graph.m_entrypointToArguments.clear();
-        m_graph.m_entrypointToArguments.add(newRoot, newArguments);
+        RELEASE_ASSERT(m_graph.m_roots.size() == 1);
+        m_graph.m_roots[0] = newRoot;
+        m_graph.m_rootToArguments.clear();
+        m_graph.m_rootToArguments.add(newRoot, newArguments);
 
         m_graph.invalidateCFG();
         m_graph.resetReachability();

Modified: trunk/Source/_javascript_Core/dfg/DFGPredictionInjectionPhase.cpp (221636 => 221637)


--- trunk/Source/_javascript_Core/dfg/DFGPredictionInjectionPhase.cpp	2017-09-05 21:18:24 UTC (rev 221636)
+++ trunk/Source/_javascript_Core/dfg/DFGPredictionInjectionPhase.cpp	2017-09-05 21:30:05 UTC (rev 221637)
@@ -53,7 +53,7 @@
             
             // We only do this for the arguments at the first block. The arguments from
             // other entrypoints have already been populated with their predictions.
-            auto& arguments = m_graph.m_entrypointToArguments.find(m_graph.block(0))->value;
+            auto& arguments = m_graph.m_rootToArguments.find(m_graph.block(0))->value;
 
             for (size_t arg = 0; arg < static_cast<size_t>(codeBlock()->numParameters()); ++arg) {
                 ValueProfile& profile = ""

Modified: trunk/Source/_javascript_Core/dfg/DFGSSAConversionPhase.cpp (221636 => 221637)


--- trunk/Source/_javascript_Core/dfg/DFGSSAConversionPhase.cpp	2017-09-05 21:18:24 UTC (rev 221636)
+++ trunk/Source/_javascript_Core/dfg/DFGSSAConversionPhase.cpp	2017-09-05 21:30:05 UTC (rev 221637)
@@ -61,7 +61,7 @@
         HashMap<unsigned, BasicBlock*, WTF::IntHash<unsigned>, WTF::UnsignedWithZeroKeyHashTraits<unsigned>> entrypointIndexToArgumentsBlock;
 
         {
-            m_graph.m_numberOfEntrypoints = m_graph.m_entrypoints.size();
+            m_graph.m_numberOfEntrypoints = m_graph.m_roots.size();
 
             BlockInsertionSet blockInsertionSet(m_graph);
             BasicBlock* newRoot = blockInsertionSet.insert(0, 1.0f);
@@ -68,7 +68,7 @@
 
             EntrySwitchData* entrySwitchData = m_graph.m_entrySwitchData.add();
             for (unsigned entrypointIndex = 0; entrypointIndex < m_graph.m_numberOfEntrypoints; ++entrypointIndex) {
-                BasicBlock* oldRoot = m_graph.m_entrypoints[entrypointIndex];
+                BasicBlock* oldRoot = m_graph.m_roots[entrypointIndex];
                 entrypointIndexToArgumentsBlock.add(entrypointIndex, oldRoot);
                 entrySwitchData->cases.append(oldRoot);
 
@@ -97,8 +97,8 @@
             newRoot->appendNode(
                 m_graph, SpecNone, EntrySwitch, origin, OpInfo(entrySwitchData));
 
-            m_graph.m_entrypoints.clear();
-            m_graph.m_entrypoints.append(newRoot);
+            m_graph.m_roots.clear();
+            m_graph.m_roots.append(newRoot);
 
             blockInsertionSet.execute();
         }
@@ -436,7 +436,7 @@
         for (auto& pair : entrypointIndexToArgumentsBlock) {
             unsigned entrypointIndex = pair.key;
             BasicBlock* oldRoot = pair.value;
-            ArgumentsVector& arguments = m_graph.m_entrypointToArguments.find(oldRoot)->value;
+            ArgumentsVector& arguments = m_graph.m_rootToArguments.find(oldRoot)->value;
             Vector<FlushFormat> argumentFormats;
             argumentFormats.reserveInitialCapacity(arguments.size());
             for (unsigned i = 0; i < arguments.size(); ++i) {
@@ -447,7 +447,7 @@
             m_graph.m_argumentFormats[entrypointIndex] = WTFMove(argumentFormats);
         }
 
-        m_graph.m_entrypointToArguments.clear();
+        m_graph.m_rootToArguments.clear();
 
         RELEASE_ASSERT(m_graph.m_isInSSAConversion);
         m_graph.m_isInSSAConversion = false;

Modified: trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT.cpp (221636 => 221637)


--- trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT.cpp	2017-09-05 21:18:24 UTC (rev 221636)
+++ trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT.cpp	2017-09-05 21:30:05 UTC (rev 221637)
@@ -1808,7 +1808,7 @@
     ASSERT(!m_currentNode);
     m_origin = NodeOrigin(CodeOrigin(0), CodeOrigin(0), true);
 
-    auto& arguments = m_jit.graph().m_entrypointToArguments.find(m_jit.graph().block(0))->value;
+    auto& arguments = m_jit.graph().m_rootToArguments.find(m_jit.graph().block(0))->value;
     for (int i = 0; i < m_jit.codeBlock()->numParameters(); ++i) {
         Node* node = arguments[i];
         if (!node) {
@@ -1912,7 +1912,7 @@
         if (!block->isOSRTarget && !block->isCatchEntrypoint)
             continue;
         if (block->isCatchEntrypoint) {
-            auto& argumentsVector = m_jit.graph().m_entrypointToArguments.find(block)->value;
+            auto& argumentsVector = m_jit.graph().m_rootToArguments.find(block)->value;
             Vector<FlushFormat> argumentFormats;
             argumentFormats.reserveInitialCapacity(argumentsVector.size());
             for (Node* setArgument : argumentsVector) {

Modified: trunk/Source/_javascript_Core/dfg/DFGTypeCheckHoistingPhase.cpp (221636 => 221637)


--- trunk/Source/_javascript_Core/dfg/DFGTypeCheckHoistingPhase.cpp	2017-09-05 21:18:24 UTC (rev 221636)
+++ trunk/Source/_javascript_Core/dfg/DFGTypeCheckHoistingPhase.cpp	2017-09-05 21:30:05 UTC (rev 221637)
@@ -134,8 +134,8 @@
                     if (!iter->value.m_structure && !iter->value.m_arrayModeIsValid)
                         break;
 
-                    // Currently we should only be doing this hoisting for SetArguments at an entrypoint.
-                    ASSERT(m_graph.isEntrypoint(block));
+                    // Currently we should only be doing this hoisting for SetArguments at a CFG root.
+                    ASSERT(m_graph.isRoot(block));
 
                     NodeOrigin origin = node->origin;
                     RELEASE_ASSERT(origin.exitOK);

Modified: trunk/Source/_javascript_Core/dfg/DFGValidate.cpp (221636 => 221637)


--- trunk/Source/_javascript_Core/dfg/DFGValidate.cpp	2017-09-05 21:18:24 UTC (rev 221636)
+++ trunk/Source/_javascript_Core/dfg/DFGValidate.cpp	2017-09-05 21:30:05 UTC (rev 221637)
@@ -83,14 +83,14 @@
         // NB. This code is not written for performance, since it is not intended to run
         // in release builds.
 
-        VALIDATE((m_graph.block(0)), m_graph.isEntrypoint(m_graph.block(0)));
-        VALIDATE((m_graph.block(0)), m_graph.block(0) == m_graph.m_entrypoints[0]);
+        VALIDATE((m_graph.block(0)), m_graph.isRoot(m_graph.block(0)));
+        VALIDATE((m_graph.block(0)), m_graph.block(0) == m_graph.m_roots[0]);
 
-        for (BasicBlock* block : m_graph.m_entrypoints)
+        for (BasicBlock* block : m_graph.m_roots)
             VALIDATE((block), block->predecessors.isEmpty());
 
         // Validate that all local variables at the head of all entrypoints are dead.
-        for (BasicBlock* entrypoint : m_graph.m_entrypoints) {
+        for (BasicBlock* entrypoint : m_graph.m_roots) {
             for (unsigned i = 0; i < entrypoint->variablesAtHead.numberOfLocals(); ++i)
                 V_EQUAL((virtualRegisterForLocal(i), entrypoint), static_cast<Node*>(nullptr), entrypoint->variablesAtHead.local(i));
         }
@@ -400,6 +400,11 @@
     
     void validateCPS()
     {
+        VALIDATE((), !m_graph.m_rootToArguments.isEmpty()); // We should have at least one root.
+        VALIDATE((), m_graph.m_rootToArguments.size() == m_graph.m_roots.size());
+        for (BasicBlock* root : m_graph.m_rootToArguments.keys())
+            VALIDATE((), m_graph.m_roots.contains(root));
+
         for (BlockIndex blockIndex = 0; blockIndex < m_graph.numBlocks(); ++blockIndex) {
             BasicBlock* block = m_graph.block(blockIndex);
             if (!block)
@@ -650,9 +655,10 @@
         // FIXME: Add more things here.
         // https://bugs.webkit.org/show_bug.cgi?id=123471
         
-        VALIDATE((), m_graph.m_entrypoints.size() == 1);
-        VALIDATE((), m_graph.m_entrypoints[0] == m_graph.block(0));
+        VALIDATE((), m_graph.m_roots.size() == 1);
+        VALIDATE((), m_graph.m_roots[0] == m_graph.block(0));
         VALIDATE((), !m_graph.m_argumentFormats.isEmpty()); // We always have at least one entrypoint.
+        VALIDATE((), m_graph.m_rootToArguments.isEmpty()); // This is only used in CPS.
 
         for (unsigned entrypointIndex : m_graph.m_entrypointIndexToCatchBytecodeOffset.keys())
             VALIDATE((), entrypointIndex > 0); // By convention, 0 is the entrypoint index for the op_enter entrypoint, which can not be in a catch.
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to