+2012-04-11 Filip Pizlo <fpizlo@apple.com>
+
+ 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:
+ * JavaScriptCore.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 <bpoulain@apple.com>
Optimize String.split() for 1 character separator
Source/JavaScriptCore/bytecode/PolymorphicPutByIdList.h \
Source/JavaScriptCore/bytecode/PredictedType.cpp \
Source/JavaScriptCore/bytecode/PredictedType.h \
- Source/JavaScriptCore/bytecode/PredictionTracker.h \
Source/JavaScriptCore/bytecode/PutByIdStatus.cpp \
Source/JavaScriptCore/bytecode/PutByIdStatus.h \
Source/JavaScriptCore/bytecode/PutKind.h \
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 */; };
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>"; };
969A07950ED1D3AE00F1F681 /* Opcode.h */,
0FD82E84141F3FDA00179C94 /* PredictedType.cpp */,
0FD82E4F141DAEA100179C94 /* PredictedType.h */,
- 0FD82E50141DAEA100179C94 /* PredictionTracker.h */,
1429D8830ED21C3D00B89619 /* SamplingTool.cpp */,
1429D8840ED21C3D00B89619 /* SamplingTool.h */,
BCCF0D0B0EF0B8A500413C8F /* StructureStubInfo.cpp */,
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 */,
#include "LazyOperandValueProfile.h"
#include "LineInfo.h"
#include "Nodes.h"
-#include "PredictionTracker.h"
#include "RegExpObject.h"
#include "StructureStubInfo.h"
#include "UString.h"
+++ /dev/null
-/*
- * 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
-
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);
}
+
/*
* Copyright (C) 2011 Apple Inc. All rights reserved.
*
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");
#include "DFGBasicBlock.h"
#include "DFGNode.h"
#include "MethodOfGettingAValueProfile.h"
-#include "PredictionTracker.h"
#include "RegisterFile.h"
#include <wtf/BitVector.h>
#include <wtf/HashMap.h>
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));
// 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 {
case ArrayPush:
case RegExpExec:
case RegExpTest:
+ case GetGlobalVar:
return true;
default:
return false;
}
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;
}