Allow object allocation sinking through GetScope, GetExecutable and SkipScope nodes
authorbasile_clement@apple.com <basile_clement@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 30 Jun 2015 22:19:05 +0000 (22:19 +0000)
committerbasile_clement@apple.com <basile_clement@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 30 Jun 2015 22:19:05 +0000 (22:19 +0000)
https://bugs.webkit.org/show_bug.cgi?id=146431

Reviewed by Filip Pizlo.

* dfg/DFGNode.h:
(JSC::DFG::Node::isFunctionAllocation):
(JSC::DFG::Node::isPhantomFunctionAllocation):
* dfg/DFGObjectAllocationSinkingPhase.cpp:
(JSC::DFG::ObjectAllocationSinkingPhase::handleNode):
* dfg/DFGPromoteHeapAccess.h:
(JSC::DFG::promoteHeapAccess):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@186136 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/dfg/DFGNode.h
Source/JavaScriptCore/dfg/DFGObjectAllocationSinkingPhase.cpp
Source/JavaScriptCore/dfg/DFGPromoteHeapAccess.h

index b91a99c..167c65c 100644 (file)
@@ -1,3 +1,18 @@
+2015-06-30  Basile Clement  <basile_clement@apple.com>
+
+        Allow object allocation sinking through GetScope, GetExecutable and SkipScope nodes
+        https://bugs.webkit.org/show_bug.cgi?id=146431
+
+        Reviewed by Filip Pizlo.
+
+        * dfg/DFGNode.h:
+        (JSC::DFG::Node::isFunctionAllocation):
+        (JSC::DFG::Node::isPhantomFunctionAllocation):
+        * dfg/DFGObjectAllocationSinkingPhase.cpp:
+        (JSC::DFG::ObjectAllocationSinkingPhase::handleNode):
+        * dfg/DFGPromoteHeapAccess.h:
+        (JSC::DFG::promoteHeapAccess):
+
 2015-06-30  Matt Baker  <mattbaker@apple.com>
 
         Web Inspector: Reduce rendering frames "Other" time by instrumenting compositing
index 5befd83..9ca2cdc 100644 (file)
@@ -1489,6 +1489,26 @@ struct Node {
         }
     }
 
+    bool isFunctionAllocation()
+    {
+        switch (op()) {
+        case NewFunction:
+            return true;
+        default:
+            return false;
+        }
+    }
+
+    bool isPhantomFunctionAllocation()
+    {
+        switch (op()) {
+        case PhantomNewFunction:
+            return true;
+        default:
+            return false;
+        }
+    }
+
     bool isPhantomAllocation()
     {
         switch (op()) {
index 040d578..422382f 100644 (file)
@@ -914,6 +914,27 @@ private:
             escape(node->child2().node());
             break;
         }
+
+        case GetScope: {
+            Node* target = node->child1().node();
+            if (!target->isFunctionAllocation())
+                escape(target);
+            break;
+        }
+
+        case GetExecutable: {
+            Node* target = node->child1().node();
+            if (!target->isFunctionAllocation())
+                escape(target);
+            break;
+        }
+
+        case SkipScope: {
+            Node* target = node->child1().node();
+            if (!target->isActivationAllocation())
+                escape(target);
+            break;
+        }
             
         case MultiPutByOffset:
             // FIXME: In the future we should be able to handle this. It's just a matter of
index 018c3b1..2bf2875 100644 (file)
@@ -64,7 +64,22 @@ void promoteHeapAccess(Node* node, const WriteFunctor& write, const ReadFunctor&
         if (node->child1()->isPhantomActivationAllocation())
             read(PromotedHeapLocation(ClosureVarPLoc, node->child1(), node->scopeOffset().offset()));
         break;
-        
+
+    case SkipScope:
+        if (node->child1()->isPhantomActivationAllocation())
+            read(PromotedHeapLocation(ActivationScopePLoc, node->child1()));
+        break;
+
+    case GetScope:
+        if (node->child1()->isPhantomFunctionAllocation())
+            read(PromotedHeapLocation(FunctionActivationPLoc, node->child1()));
+        break;
+
+    case GetExecutable:
+        if (node->child1()->isPhantomFunctionAllocation())
+            read(PromotedHeapLocation(FunctionExecutablePLoc, node->child1()));
+        break;
+
     case PutHint: {
         ASSERT(node->child1()->isPhantomAllocation());
         write(