Title: [161776] branches/jsCStack/Source/_javascript_Core
Revision
161776
Author
[email protected]
Date
2014-01-11 12:31:54 -0800 (Sat, 11 Jan 2014)

Log Message

FTL tier-up should behave the same with CountExecution's as it does without
https://bugs.webkit.org/show_bug.cgi?id=126822

Not yet reviewed.
        
CountExecution nodes are inserted by the profiler. Prior to this change, their
presence would change how we inserted CheckTierUp nodes, since a CountExecution
might be inserted before a LoopHint thereby making it so the LoopHint was no
longer at the top of a loop header. This makes the code resilient against such
things. The result is that when you enable the profiler, you get the same OSR
behavior as with the profiler disabled.

* dfg/DFGNode.h:
(JSC::DFG::Node::isSemanticallySkippable):
* dfg/DFGOSREntrypointCreationPhase.cpp:
(JSC::DFG::OSREntrypointCreationPhase::run):
* dfg/DFGTierUpCheckInjectionPhase.cpp:
(JSC::DFG::TierUpCheckInjectionPhase::run):

Modified Paths

Diff

Modified: branches/jsCStack/Source/_javascript_Core/ChangeLog (161775 => 161776)


--- branches/jsCStack/Source/_javascript_Core/ChangeLog	2014-01-11 20:05:17 UTC (rev 161775)
+++ branches/jsCStack/Source/_javascript_Core/ChangeLog	2014-01-11 20:31:54 UTC (rev 161776)
@@ -1,3 +1,24 @@
+2014-01-11  Filip Pizlo  <[email protected]>
+
+        FTL tier-up should behave the same with CountExecution's as it does without
+        https://bugs.webkit.org/show_bug.cgi?id=126822
+
+        Not yet reviewed.
+        
+        CountExecution nodes are inserted by the profiler. Prior to this change, their
+        presence would change how we inserted CheckTierUp nodes, since a CountExecution
+        might be inserted before a LoopHint thereby making it so the LoopHint was no
+        longer at the top of a loop header. This makes the code resilient against such
+        things. The result is that when you enable the profiler, you get the same OSR
+        behavior as with the profiler disabled.
+
+        * dfg/DFGNode.h:
+        (JSC::DFG::Node::isSemanticallySkippable):
+        * dfg/DFGOSREntrypointCreationPhase.cpp:
+        (JSC::DFG::OSREntrypointCreationPhase::run):
+        * dfg/DFGTierUpCheckInjectionPhase.cpp:
+        (JSC::DFG::TierUpCheckInjectionPhase::run):
+
 2014-01-10  Filip Pizlo  <[email protected]>
 
         FTL should work with the bytecode profiler

Modified: branches/jsCStack/Source/_javascript_Core/dfg/DFGNode.h (161775 => 161776)


--- branches/jsCStack/Source/_javascript_Core/dfg/DFGNode.h	2014-01-11 20:05:17 UTC (rev 161775)
+++ branches/jsCStack/Source/_javascript_Core/dfg/DFGNode.h	2014-01-11 20:31:54 UTC (rev 161776)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2011, 2012, 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2011, 2012, 2013, 2014 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -1186,6 +1186,11 @@
             return shouldGenerate();
         }
     }
+    
+    bool isSemanticallySkippable()
+    {
+        return op() == CountExecution;
+    }
 
     unsigned refCount()
     {

Modified: branches/jsCStack/Source/_javascript_Core/dfg/DFGOSREntrypointCreationPhase.cpp (161775 => 161776)


--- branches/jsCStack/Source/_javascript_Core/dfg/DFGOSREntrypointCreationPhase.cpp	2014-01-11 20:05:17 UTC (rev 161775)
+++ branches/jsCStack/Source/_javascript_Core/dfg/DFGOSREntrypointCreationPhase.cpp	2014-01-11 20:31:54 UTC (rev 161776)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -63,7 +63,10 @@
             BasicBlock* block = m_graph.block(blockIndex);
             if (!block)
                 continue;
+            unsigned nodeIndex = 0;
             Node* firstNode = block->at(0);
+            while (firstNode->isSemanticallySkippable())
+                firstNode = block->at(++nodeIndex);
             if (firstNode->op() == LoopHint
                 && firstNode->codeOrigin == CodeOrigin(bytecodeIndex)) {
                 target = block;

Modified: branches/jsCStack/Source/_javascript_Core/dfg/DFGTierUpCheckInjectionPhase.cpp (161775 => 161776)


--- branches/jsCStack/Source/_javascript_Core/dfg/DFGTierUpCheckInjectionPhase.cpp	2014-01-11 20:05:17 UTC (rev 161775)
+++ branches/jsCStack/Source/_javascript_Core/dfg/DFGTierUpCheckInjectionPhase.cpp	2014-01-11 20:31:54 UTC (rev 161776)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -61,15 +61,41 @@
             if (!block)
                 continue;
             
-            if (block->at(0)->op() == LoopHint) {
-                CodeOrigin codeOrigin = block->at(0)->codeOrigin;
-                NodeType nodeType;
-                if (level == FTL::CanCompileAndOSREnter && !codeOrigin.inlineCallFrame) {
-                    nodeType = CheckTierUpAndOSREnter;
-                    RELEASE_ASSERT(block->bytecodeBegin == codeOrigin.bytecodeIndex);
-                } else
-                    nodeType = CheckTierUpInLoop;
-                insertionSet.insertNode(1, SpecNone, nodeType, codeOrigin);
+            for (unsigned nodeIndex = 0; nodeIndex < block->size(); ++nodeIndex) {
+                Node* node = block->at(nodeIndex);
+                if (node->op() != LoopHint)
+                    continue;
+                
+                // We only put OSR checks for the first LoopHint in the block. Note that
+                // more than one LoopHint could happen in cases where we did a lot of CFG
+                // simplification in the bytecode parser, but it should be very rare.
+                
+                CodeOrigin codeOrigin = node->codeOrigin;
+                
+                if (level != FTL::CanCompileAndOSREnter || codeOrigin.inlineCallFrame) {
+                    insertionSet.insertNode(
+                        nodeIndex + 1, SpecNone, CheckTierUpInLoop, codeOrigin);
+                    break;
+                }
+                
+                bool isAtTop = true;
+                for (unsigned subNodeIndex = nodeIndex; subNodeIndex--;) {
+                    if (!block->at(subNodeIndex)->isSemanticallySkippable()) {
+                        isAtTop = false;
+                        break;
+                    }
+                }
+                
+                if (!isAtTop) {
+                    insertionSet.insertNode(
+                        nodeIndex + 1, SpecNone, CheckTierUpInLoop, codeOrigin);
+                    break;
+                }
+                
+                RELEASE_ASSERT(block->bytecodeBegin == codeOrigin.bytecodeIndex);
+                insertionSet.insertNode(
+                    nodeIndex + 1, SpecNone, CheckTierUpAndOSREnter, codeOrigin);
+                break;
             }
             
             if (block->last()->op() == Return) {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to