Title: [179756] trunk/Source/_javascript_Core
Revision
179756
Author
[email protected]
Date
2015-02-06 13:39:04 -0800 (Fri, 06 Feb 2015)

Log Message

It should be possible to use the DFG SetArgument node to indicate that someone set the value of a local out-of-band
https://bugs.webkit.org/show_bug.cgi?id=141337

Reviewed by Mark Lam.

This mainly involved ensuring that SetArgument behaves just like SetLocal from a CPS standpoint, but with a special case for those SetArguments that
are associated with the prologue.

* dfg/DFGCPSRethreadingPhase.cpp:
(JSC::DFG::CPSRethreadingPhase::run):
(JSC::DFG::CPSRethreadingPhase::canonicalizeSet):
(JSC::DFG::CPSRethreadingPhase::canonicalizeLocalsInBlock):
(JSC::DFG::CPSRethreadingPhase::specialCaseArguments):
(JSC::DFG::CPSRethreadingPhase::canonicalizeSetLocal): Deleted.
(JSC::DFG::CPSRethreadingPhase::canonicalizeSetArgument): Deleted.

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (179755 => 179756)


--- trunk/Source/_javascript_Core/ChangeLog	2015-02-06 21:33:26 UTC (rev 179755)
+++ trunk/Source/_javascript_Core/ChangeLog	2015-02-06 21:39:04 UTC (rev 179756)
@@ -1,3 +1,21 @@
+2015-02-06  Filip Pizlo  <[email protected]>
+
+        It should be possible to use the DFG SetArgument node to indicate that someone set the value of a local out-of-band
+        https://bugs.webkit.org/show_bug.cgi?id=141337
+
+        Reviewed by Mark Lam.
+
+        This mainly involved ensuring that SetArgument behaves just like SetLocal from a CPS standpoint, but with a special case for those SetArguments that
+        are associated with the prologue.
+
+        * dfg/DFGCPSRethreadingPhase.cpp:
+        (JSC::DFG::CPSRethreadingPhase::run):
+        (JSC::DFG::CPSRethreadingPhase::canonicalizeSet):
+        (JSC::DFG::CPSRethreadingPhase::canonicalizeLocalsInBlock):
+        (JSC::DFG::CPSRethreadingPhase::specialCaseArguments):
+        (JSC::DFG::CPSRethreadingPhase::canonicalizeSetLocal): Deleted.
+        (JSC::DFG::CPSRethreadingPhase::canonicalizeSetArgument): Deleted.
+
 2015-02-06  Mark Lam  <[email protected]>
 
         MachineThreads should be ref counted.

Modified: trunk/Source/_javascript_Core/dfg/DFGCPSRethreadingPhase.cpp (179755 => 179756)


--- trunk/Source/_javascript_Core/dfg/DFGCPSRethreadingPhase.cpp	2015-02-06 21:33:26 UTC (rev 179755)
+++ trunk/Source/_javascript_Core/dfg/DFGCPSRethreadingPhase.cpp	2015-02-06 21:39:04 UTC (rev 179756)
@@ -54,6 +54,7 @@
         freeUnnecessaryNodes();
         m_graph.clearReplacements();
         canonicalizeLocalsInBlocks();
+        specialCaseArguments();
         propagatePhis<LocalOperand>();
         propagatePhis<ArgumentOperand>();
         computeIsFlushed();
@@ -233,11 +234,6 @@
             canonicalizeGetLocalFor<LocalOperand>(node, variable, variable->local().toLocal());
     }
     
-    void canonicalizeSetLocal(Node* node)
-    {
-        m_block->variablesAtTail.setOperand(node->local(), node);
-    }
-    
     template<NodeType nodeType, OperandKind operandKind>
     void canonicalizeFlushOrPhantomLocalFor(Node* node, VariableAccessData* variable, size_t idx)
     {
@@ -298,13 +294,9 @@
             canonicalizeFlushOrPhantomLocalFor<nodeType, LocalOperand>(node, variable, variable->local().toLocal());
     }
     
-    void canonicalizeSetArgument(Node* node)
+    void canonicalizeSet(Node* node)
     {
-        VirtualRegister local = node->local();
-        ASSERT(local.isArgument());
-        int argument = local.toArgument();
-        m_block->variablesAtHead.setArgumentFirstTime(argument, node);
-        m_block->variablesAtTail.setArgumentFirstTime(argument, node);
+        m_block->variablesAtTail.setOperand(node->local(), node);
     }
     
     void canonicalizeLocalsInBlock()
@@ -369,7 +361,7 @@
                 break;
                 
             case SetLocal:
-                canonicalizeSetLocal(node);
+                canonicalizeSet(node);
                 break;
                 
             case Flush:
@@ -381,7 +373,7 @@
                 break;
                 
             case SetArgument:
-                canonicalizeSetArgument(node);
+                canonicalizeSet(node);
                 break;
                 
             case MovHint:
@@ -404,6 +396,16 @@
         }
     }
     
+    void specialCaseArguments()
+    {
+        // Normally, a SetArgument denotes the start of a live range for a local's value on the stack.
+        // But those SetArguments used for the actual arguments to the machine CodeBlock get
+        // 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 (unsigned i = m_graph.m_arguments.size(); i--;)
+            m_graph.block(0)->variablesAtHead.setArgumentFirstTime(i, m_graph.m_arguments[i]);
+    }
+    
     template<OperandKind operandKind>
     void propagatePhis()
     {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to