Title: [113906] trunk/Source/_javascript_Core
Revision
113906
Author
[email protected]
Date
2012-04-11 13:51:21 -0700 (Wed, 11 Apr 2012)

Log Message

Global variable predictions should not be coalesced unnecessarily
https://bugs.webkit.org/show_bug.cgi?id=83678

Reviewed by Geoff Garen.
        
Removed the PredictionTracker and everyone who used it. Converted GetGlobalVar
to have a heapPrediction like a civilized DFG opcode ought to.
        
No performance effect.

* GNUmakefile.list.am:
* _javascript_Core.xcodeproj/project.pbxproj:
* bytecode/CodeBlock.h:
* bytecode/PredictionTracker.h: Removed.
* dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::parseBlock):
* dfg/DFGGenerationInfo.h:
* dfg/DFGGraph.cpp:
(JSC::DFG::Graph::dump):
* dfg/DFGGraph.h:
(Graph):
* dfg/DFGNode.h:
(JSC::DFG::Node::hasHeapPrediction):
* dfg/DFGPredictionPropagationPhase.cpp:
(JSC::DFG::PredictionPropagationPhase::propagate):

Modified Paths

Removed Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (113905 => 113906)


--- trunk/Source/_javascript_Core/ChangeLog	2012-04-11 20:34:52 UTC (rev 113905)
+++ trunk/Source/_javascript_Core/ChangeLog	2012-04-11 20:51:21 UTC (rev 113906)
@@ -1,3 +1,31 @@
+2012-04-11  Filip Pizlo  <[email protected]>
+
+        Global variable predictions should not be coalesced unnecessarily
+        https://bugs.webkit.org/show_bug.cgi?id=83678
+
+        Reviewed by Geoff Garen.
+        
+        Removed the PredictionTracker and everyone who used it. Converted GetGlobalVar
+        to have a heapPrediction like a civilized DFG opcode ought to.
+        
+        No performance effect.
+
+        * GNUmakefile.list.am:
+        * _javascript_Core.xcodeproj/project.pbxproj:
+        * bytecode/CodeBlock.h:
+        * bytecode/PredictionTracker.h: Removed.
+        * dfg/DFGByteCodeParser.cpp:
+        (JSC::DFG::ByteCodeParser::parseBlock):
+        * dfg/DFGGenerationInfo.h:
+        * dfg/DFGGraph.cpp:
+        (JSC::DFG::Graph::dump):
+        * dfg/DFGGraph.h:
+        (Graph):
+        * dfg/DFGNode.h:
+        (JSC::DFG::Node::hasHeapPrediction):
+        * dfg/DFGPredictionPropagationPhase.cpp:
+        (JSC::DFG::PredictionPropagationPhase::propagate):
+
 2012-04-11  Benjamin Poulain  <[email protected]>
 
         Optimize String.split() for 1 character separator

Modified: trunk/Source/_javascript_Core/GNUmakefile.list.am (113905 => 113906)


--- trunk/Source/_javascript_Core/GNUmakefile.list.am	2012-04-11 20:34:52 UTC (rev 113905)
+++ trunk/Source/_javascript_Core/GNUmakefile.list.am	2012-04-11 20:51:21 UTC (rev 113906)
@@ -122,7 +122,6 @@
 	Source/_javascript_Core/bytecode/PolymorphicPutByIdList.h \
 	Source/_javascript_Core/bytecode/PredictedType.cpp \
 	Source/_javascript_Core/bytecode/PredictedType.h \
-	Source/_javascript_Core/bytecode/PredictionTracker.h \
 	Source/_javascript_Core/bytecode/PutByIdStatus.cpp \
 	Source/_javascript_Core/bytecode/PutByIdStatus.h \
 	Source/_javascript_Core/bytecode/PutKind.h \

Modified: trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj (113905 => 113906)


--- trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj	2012-04-11 20:34:52 UTC (rev 113905)
+++ trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj	2012-04-11 20:51:21 UTC (rev 113906)
@@ -170,7 +170,6 @@
 		0FD82E2114172CE300179C94 /* DFGCapabilities.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FD82E1E14172C2F00179C94 /* DFGCapabilities.cpp */; };
 		0FD82E39141AB14D00179C94 /* CompactJITCodeMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FD82E37141AB14200179C94 /* CompactJITCodeMap.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		0FD82E54141DAEEE00179C94 /* PredictedType.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FD82E4F141DAEA100179C94 /* PredictedType.h */; settings = {ATTRIBUTES = (Private, ); }; };
-		0FD82E55141DAEEE00179C94 /* PredictionTracker.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FD82E50141DAEA100179C94 /* PredictionTracker.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		0FD82E56141DAF0800179C94 /* DFGOSREntry.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FD82E52141DAEDE00179C94 /* DFGOSREntry.cpp */; };
 		0FD82E57141DAF1000179C94 /* DFGOSREntry.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FD82E53141DAEDE00179C94 /* DFGOSREntry.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		0FD82E86141F3FF100179C94 /* PredictedType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FD82E84141F3FDA00179C94 /* PredictedType.cpp */; };
@@ -843,7 +842,6 @@
 		0FD82E1F14172C2F00179C94 /* DFGCapabilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGCapabilities.h; path = dfg/DFGCapabilities.h; sourceTree = "<group>"; };
 		0FD82E37141AB14200179C94 /* CompactJITCodeMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CompactJITCodeMap.h; sourceTree = "<group>"; };
 		0FD82E4F141DAEA100179C94 /* PredictedType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PredictedType.h; sourceTree = "<group>"; };
-		0FD82E50141DAEA100179C94 /* PredictionTracker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PredictionTracker.h; sourceTree = "<group>"; };
 		0FD82E52141DAEDE00179C94 /* DFGOSREntry.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DFGOSREntry.cpp; path = dfg/DFGOSREntry.cpp; sourceTree = "<group>"; };
 		0FD82E53141DAEDE00179C94 /* DFGOSREntry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGOSREntry.h; path = dfg/DFGOSREntry.h; sourceTree = "<group>"; };
 		0FD82E84141F3FDA00179C94 /* PredictedType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PredictedType.cpp; sourceTree = "<group>"; };
@@ -2205,7 +2203,6 @@
 				969A07950ED1D3AE00F1F681 /* Opcode.h */,
 				0FD82E84141F3FDA00179C94 /* PredictedType.cpp */,
 				0FD82E4F141DAEA100179C94 /* PredictedType.h */,
-				0FD82E50141DAEA100179C94 /* PredictionTracker.h */,
 				1429D8830ED21C3D00B89619 /* SamplingTool.cpp */,
 				1429D8840ED21C3D00B89619 /* SamplingTool.h */,
 				BCCF0D0B0EF0B8A500413C8F /* StructureStubInfo.cpp */,
@@ -2436,7 +2433,6 @@
 				93052C350FB792190048FDC3 /* ParserArena.h in Headers */,
 				65303D641447B9E100D3F904 /* ParserTokens.h in Headers */,
 				0FD82E54141DAEEE00179C94 /* PredictedType.h in Headers */,
-				0FD82E55141DAEEE00179C94 /* PredictionTracker.h in Headers */,
 				BC18C4500E16F5CD00B34460 /* Profile.h in Headers */,
 				BC18C4510E16F5CD00B34460 /* ProfileNode.h in Headers */,
 				BC18C4520E16F5CD00B34460 /* Profiler.h in Headers */,

Modified: trunk/Source/_javascript_Core/bytecode/CodeBlock.h (113905 => 113906)


--- trunk/Source/_javascript_Core/bytecode/CodeBlock.h	2012-04-11 20:34:52 UTC (rev 113905)
+++ trunk/Source/_javascript_Core/bytecode/CodeBlock.h	2012-04-11 20:51:21 UTC (rev 113906)
@@ -56,7 +56,6 @@
 #include "LazyOperandValueProfile.h"
 #include "LineInfo.h"
 #include "Nodes.h"
-#include "PredictionTracker.h"
 #include "RegExpObject.h"
 #include "StructureStubInfo.h"
 #include "UString.h"

Deleted: trunk/Source/_javascript_Core/bytecode/PredictionTracker.h (113905 => 113906)


--- trunk/Source/_javascript_Core/bytecode/PredictionTracker.h	2012-04-11 20:34:52 UTC (rev 113905)
+++ trunk/Source/_javascript_Core/bytecode/PredictionTracker.h	2012-04-11 20:51:21 UTC (rev 113906)
@@ -1,76 +0,0 @@
-/*
- * Copyright (C) 2011 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- */
-
-#ifndef PredictionTracker_h
-#define PredictionTracker_h
-
-#include "PredictedType.h"
-#include <wtf/HashMap.h>
-
-namespace JSC {
-
-struct PredictionSlot {
-public:
-    PredictionSlot()
-        : m_value(PredictNone)
-    {
-    }
-    PredictedType m_value;
-};
-
-class PredictionTracker {
-public:
-    PredictionTracker()
-    {
-    }
-    
-    bool predictGlobalVar(unsigned varNumber, PredictedType prediction)
-    {
-        HashMap<unsigned, PredictionSlot>::iterator iter = m_globalVars.find(varNumber + 1);
-        if (iter == m_globalVars.end()) {
-            PredictionSlot predictionSlot;
-            bool result = mergePrediction(predictionSlot.m_value, prediction);
-            m_globalVars.add(varNumber + 1, predictionSlot);
-            return result;
-        }
-        return mergePrediction(iter->second.m_value, prediction);
-    }
-    
-    PredictedType getGlobalVarPrediction(unsigned varNumber)
-    {
-        HashMap<unsigned, PredictionSlot>::iterator iter = m_globalVars.find(varNumber + 1);
-        if (iter == m_globalVars.end())
-            return PredictNone;
-        return iter->second.m_value;
-    }
-    
-private:
-    HashMap<unsigned, PredictionSlot> m_globalVars;
-};
-
-} // namespace JSC
-
-#endif // PredictionTracker_h
-

Modified: trunk/Source/_javascript_Core/dfg/DFGByteCodeParser.cpp (113905 => 113906)


--- trunk/Source/_javascript_Core/dfg/DFGByteCodeParser.cpp	2012-04-11 20:34:52 UTC (rev 113905)
+++ trunk/Source/_javascript_Core/dfg/DFGByteCodeParser.cpp	2012-04-11 20:51:21 UTC (rev 113906)
@@ -2022,9 +2022,8 @@
         case op_get_global_var: {
             PredictedType prediction = getPrediction();
             
-            NodeIndex getGlobalVar = addToGraph(GetGlobalVar, OpInfo(currentInstruction[2].u.operand));
+            NodeIndex getGlobalVar = addToGraph(GetGlobalVar, OpInfo(currentInstruction[2].u.operand), OpInfo(prediction));
             set(currentInstruction[1].u.operand, getGlobalVar);
-            m_graph.predictGlobalVar(currentInstruction[2].u.operand, prediction);
             NEXT_OPCODE(op_get_global_var);
         }
 

Modified: trunk/Source/_javascript_Core/dfg/DFGGenerationInfo.h (113905 => 113906)


--- trunk/Source/_javascript_Core/dfg/DFGGenerationInfo.h	2012-04-11 20:34:52 UTC (rev 113905)
+++ trunk/Source/_javascript_Core/dfg/DFGGenerationInfo.h	2012-04-11 20:51:21 UTC (rev 113906)
@@ -1,3 +1,4 @@
+
 /*
  * Copyright (C) 2011 Apple Inc. All rights reserved.
  *

Modified: trunk/Source/_javascript_Core/dfg/DFGGraph.cpp (113905 => 113906)


--- trunk/Source/_javascript_Core/dfg/DFGGraph.cpp	2012-04-11 20:34:52 UTC (rev 113905)
+++ trunk/Source/_javascript_Core/dfg/DFGGraph.cpp	2012-04-11 20:51:21 UTC (rev 113906)
@@ -268,8 +268,6 @@
             dataLog("  predicting %s, double ratio %lf%s", predictionToString(node.variableAccessData()->prediction()), node.variableAccessData()->doubleVoteRatio(), node.variableAccessData()->shouldUseDoubleFormat() ? ", forcing double" : "");
         else if (node.hasHeapPrediction())
             dataLog("  predicting %s", predictionToString(node.getHeapPrediction()));
-        else if (node.hasVarNumber())
-            dataLog("  predicting %s", predictionToString(getGlobalVarPrediction(node.varNumber())));
     }
     
     dataLog("\n");

Modified: trunk/Source/_javascript_Core/dfg/DFGGraph.h (113905 => 113906)


--- trunk/Source/_javascript_Core/dfg/DFGGraph.h	2012-04-11 20:34:52 UTC (rev 113905)
+++ trunk/Source/_javascript_Core/dfg/DFGGraph.h	2012-04-11 20:51:21 UTC (rev 113906)
@@ -34,7 +34,6 @@
 #include "DFGBasicBlock.h"
 #include "DFGNode.h"
 #include "MethodOfGettingAValueProfile.h"
-#include "PredictionTracker.h"
 #include "RegisterFile.h"
 #include <wtf/BitVector.h>
 #include <wtf/HashMap.h>
@@ -148,16 +147,6 @@
 
     BlockIndex blockIndexForBytecodeOffset(Vector<BlockIndex>& blocks, unsigned bytecodeBegin);
 
-    bool predictGlobalVar(unsigned varNumber, PredictedType prediction)
-    {
-        return m_predictions.predictGlobalVar(varNumber, prediction);
-    }
-    
-    PredictedType getGlobalVarPrediction(unsigned varNumber)
-    {
-        return m_predictions.getGlobalVarPrediction(varNumber);
-    }
-    
     PredictedType getJSConstantPrediction(Node& node)
     {
         return predictionFromValue(node.valueOfJSConstant(m_codeBlock));
@@ -390,8 +379,6 @@
     // When a node's refCount goes from 0 to 1, it must (logically) recursively ref all of its children, and vice versa.
     void refChildren(NodeIndex);
     void derefChildren(NodeIndex);
-
-    PredictionTracker m_predictions;
 };
 
 class GetBytecodeBeginForBlock {

Modified: trunk/Source/_javascript_Core/dfg/DFGNode.h (113905 => 113906)


--- trunk/Source/_javascript_Core/dfg/DFGNode.h	2012-04-11 20:34:52 UTC (rev 113905)
+++ trunk/Source/_javascript_Core/dfg/DFGNode.h	2012-04-11 20:51:21 UTC (rev 113906)
@@ -476,6 +476,7 @@
         case ArrayPush:
         case RegExpExec:
         case RegExpTest:
+        case GetGlobalVar:
             return true;
         default:
             return false;

Modified: trunk/Source/_javascript_Core/dfg/DFGPredictionPropagationPhase.cpp (113905 => 113906)


--- trunk/Source/_javascript_Core/dfg/DFGPredictionPropagationPhase.cpp	2012-04-11 20:34:52 UTC (rev 113905)
+++ trunk/Source/_javascript_Core/dfg/DFGPredictionPropagationPhase.cpp	2012-04-11 20:51:21 UTC (rev 113906)
@@ -447,14 +447,11 @@
         }
             
         case GetGlobalVar: {
-            PredictedType prediction = m_graph.getGlobalVarPrediction(node.varNumber());
-            changed |= mergePrediction(prediction);
+            changed |= mergePrediction(node.getHeapPrediction());
             break;
         }
             
         case PutGlobalVar: {
-            changed |= m_graph.predictGlobalVar(
-                node.varNumber(), m_graph[node.child1()].prediction());
             changed |= m_graph[node.child1()].mergeFlags(NodeUsedAsValue);
             break;
         }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to