Title: [184646] trunk/Source/_javascript_Core
Revision
184646
Author
[email protected]
Date
2015-05-20 11:40:42 -0700 (Wed, 20 May 2015)

Log Message

Add some assertions about the CFG in the loop pre-header creation phase
https://bugs.webkit.org/show_bug.cgi?id=145205

Reviewed by Geoffrey Garen.
        
* dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::currentNodeOrigin): Add a FIXME.
* dfg/DFGLICMPhase.cpp:
(JSC::DFG::LICMPhase::run): Add a FIXME.
* dfg/DFGLoopPreHeaderCreationPhase.cpp:
(JSC::DFG::LoopPreHeaderCreationPhase::run): Add the assertions.

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (184645 => 184646)


--- trunk/Source/_javascript_Core/ChangeLog	2015-05-20 17:58:37 UTC (rev 184645)
+++ trunk/Source/_javascript_Core/ChangeLog	2015-05-20 18:40:42 UTC (rev 184646)
@@ -1,3 +1,17 @@
+2015-05-19  Filip Pizlo  <[email protected]>
+
+        Add some assertions about the CFG in the loop pre-header creation phase
+        https://bugs.webkit.org/show_bug.cgi?id=145205
+
+        Reviewed by Geoffrey Garen.
+        
+        * dfg/DFGByteCodeParser.cpp:
+        (JSC::DFG::ByteCodeParser::currentNodeOrigin): Add a FIXME.
+        * dfg/DFGLICMPhase.cpp:
+        (JSC::DFG::LICMPhase::run): Add a FIXME.
+        * dfg/DFGLoopPreHeaderCreationPhase.cpp:
+        (JSC::DFG::LoopPreHeaderCreationPhase::run): Add the assertions.
+
 2015-05-20  Joseph Pecoraro  <[email protected]>
 
         ES6: Implement Object.setPrototypeOf

Modified: trunk/Source/_javascript_Core/dfg/DFGByteCodeParser.cpp (184645 => 184646)


--- trunk/Source/_javascript_Core/dfg/DFGByteCodeParser.cpp	2015-05-20 17:58:37 UTC (rev 184645)
+++ trunk/Source/_javascript_Core/dfg/DFGByteCodeParser.cpp	2015-05-20 18:40:42 UTC (rev 184646)
@@ -607,6 +607,8 @@
 
     NodeOrigin currentNodeOrigin()
     {
+        // FIXME: We should set the forExit origin only on those nodes that can exit.
+        // https://bugs.webkit.org/show_bug.cgi?id=145204
         if (m_currentSemanticOrigin.isSet())
             return NodeOrigin(m_currentSemanticOrigin, currentCodeOrigin());
         return NodeOrigin(currentCodeOrigin());

Modified: trunk/Source/_javascript_Core/dfg/DFGLICMPhase.cpp (184645 => 184646)


--- trunk/Source/_javascript_Core/dfg/DFGLICMPhase.cpp	2015-05-20 17:58:37 UTC (rev 184645)
+++ trunk/Source/_javascript_Core/dfg/DFGLICMPhase.cpp	2015-05-20 18:40:42 UTC (rev 184646)
@@ -130,6 +130,12 @@
             
             DFG_ASSERT(m_graph, preHeader->terminal(), preHeader->terminal()->op() == Jump);
             
+            // We should validate the pre-header. If we placed forExit origins on nodes only if
+            // at the top of that node it is legal to exit, then we would simply check if Jump
+            // had a forExit. We should disable hoisting to pre-headers that don't validate.
+            // Or, we could only allow hoisting of things that definitely don't exit.
+            // FIXME: https://bugs.webkit.org/show_bug.cgi?id=145204
+            
             data.preHeader = preHeader;
         }
         

Modified: trunk/Source/_javascript_Core/dfg/DFGLoopPreHeaderCreationPhase.cpp (184645 => 184646)


--- trunk/Source/_javascript_Core/dfg/DFGLoopPreHeaderCreationPhase.cpp	2015-05-20 17:58:37 UTC (rev 184645)
+++ trunk/Source/_javascript_Core/dfg/DFGLoopPreHeaderCreationPhase.cpp	2015-05-20 18:40:42 UTC (rev 184646)
@@ -88,11 +88,23 @@
                     existingPreHeader = predecessor;
                     continue;
                 }
-                if (existingPreHeader == predecessor)
-                    continue;
+                // We won't have duplicate entries in the predecessors list.
+                DFG_ASSERT(m_graph, nullptr, existingPreHeader != predecessor);
                 needsNewPreHeader = true;
                 break;
             }
+            
+            // This phase should only be run on a DFG where unreachable blocks have been pruned.
+            // We also don't allow loops back to root. This means that every loop header has got
+            // to have a pre-header.
+            DFG_ASSERT(m_graph, nullptr, existingPreHeader);
+            
+            // We are looking at the predecessors of a loop header. A loop header has to have
+            // some predecessor other than the pre-header. We must have broken critical edges
+            // because that is the DFG SSA convention. Therefore, each predecessor of the loop
+            // header must have only one successor.
+            DFG_ASSERT(m_graph, nullptr, existingPreHeader->terminal()->op() == Jump);
+            
             if (!needsNewPreHeader)
                 continue;
             
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to