Commit 02e3563e authored by fpizlo@apple.com's avatar fpizlo@apple.com

SpeculatedType dumping should not use the static char buffer[thingy] idiom

https://bugs.webkit.org/show_bug.cgi?id=103584

Reviewed by Michael Saboff.

Source/JavaScriptCore: 

Changed SpeculatedType to be "dumpable" by saying things like:
        
dataLog("thingy = ", SpeculationDump(thingy))
        
Removed the old stringification functions, and changed all code that referred to them
to use the new dataLog()/print() style.

* CMakeLists.txt:
* GNUmakefile.list.am:
* JavaScriptCore.xcodeproj/project.pbxproj:
* Target.pri:
* bytecode/SpeculatedType.cpp:
(JSC::dumpSpeculation):
(JSC::speculationToAbbreviatedString):
(JSC::dumpSpeculationAbbreviated):
* bytecode/SpeculatedType.h:
* bytecode/ValueProfile.h:
(JSC::ValueProfileBase::dump):
* bytecode/VirtualRegister.h:
(WTF::printInternal):
* dfg/DFGAbstractValue.h:
(JSC::DFG::AbstractValue::dump):
* dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::injectLazyOperandSpeculation):
(JSC::DFG::ByteCodeParser::getPredictionWithoutOSRExit):
* dfg/DFGGraph.cpp:
(JSC::DFG::Graph::dump):
(JSC::DFG::Graph::predictArgumentTypes):
* dfg/DFGGraph.h:
(Graph):
* dfg/DFGStructureAbstractValue.h:
* dfg/DFGVariableAccessDataDump.cpp: Added.
(JSC::DFG::VariableAccessDataDump::VariableAccessDataDump):
(JSC::DFG::VariableAccessDataDump::dump):
* dfg/DFGVariableAccessDataDump.h: Added.
(VariableAccessDataDump):

Source/WTF: 

Added a StringPrintStream, and made it easy to create dumpers for typedefs to primitives.

* GNUmakefile.list.am:
* WTF.gypi:
* WTF.pro:
* WTF.vcproj/WTF.vcproj:
* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/PrintStream.cpp:
(WTF::dumpCharacter):
* wtf/PrintStream.h:
(WTF::printInternal):
* wtf/StringPrintStream.cpp: Added.
(WTF::StringPrintStream::StringPrintStream):
(WTF::StringPrintStream::~StringPrintStream):
(WTF::StringPrintStream::vprintf):
(WTF::StringPrintStream::toCString):
(WTF::StringPrintStream::increaseSize):
* wtf/StringPrintStream.h: Added.
(StringPrintStream):
(WTF::toCString):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@136096 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent fe64b4c2
......@@ -100,6 +100,7 @@ SET(JavaScriptCore_SOURCES
dfg/DFGStructureCheckHoistingPhase.cpp
dfg/DFGThunks.cpp
dfg/DFGValueSource.cpp
dfg/DFGVariableAccessDataDump.cpp
dfg/DFGVariableEvent.cpp
dfg/DFGVariableEventStream.cpp
dfg/DFGValidate.cpp
......
2012-11-28 Filip Pizlo <fpizlo@apple.com>
SpeculatedType dumping should not use the static char buffer[thingy] idiom
https://bugs.webkit.org/show_bug.cgi?id=103584
Reviewed by Michael Saboff.
Changed SpeculatedType to be "dumpable" by saying things like:
dataLog("thingy = ", SpeculationDump(thingy))
Removed the old stringification functions, and changed all code that referred to them
to use the new dataLog()/print() style.
* CMakeLists.txt:
* GNUmakefile.list.am:
* JavaScriptCore.xcodeproj/project.pbxproj:
* Target.pri:
* bytecode/SpeculatedType.cpp:
(JSC::dumpSpeculation):
(JSC::speculationToAbbreviatedString):
(JSC::dumpSpeculationAbbreviated):
* bytecode/SpeculatedType.h:
* bytecode/ValueProfile.h:
(JSC::ValueProfileBase::dump):
* bytecode/VirtualRegister.h:
(WTF::printInternal):
* dfg/DFGAbstractValue.h:
(JSC::DFG::AbstractValue::dump):
* dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::injectLazyOperandSpeculation):
(JSC::DFG::ByteCodeParser::getPredictionWithoutOSRExit):
* dfg/DFGGraph.cpp:
(JSC::DFG::Graph::dump):
(JSC::DFG::Graph::predictArgumentTypes):
* dfg/DFGGraph.h:
(Graph):
* dfg/DFGStructureAbstractValue.h:
* dfg/DFGVariableAccessDataDump.cpp: Added.
(JSC::DFG::VariableAccessDataDump::VariableAccessDataDump):
(JSC::DFG::VariableAccessDataDump::dump):
* dfg/DFGVariableAccessDataDump.h: Added.
(VariableAccessDataDump):
2012-11-28 Michael Saboff <msaboff@apple.com>
Change Bytecompiler s_dumpsGeneratedCode to an Options value
......
......@@ -250,6 +250,8 @@ javascriptcore_sources += \
Source/JavaScriptCore/dfg/DFGValidate.cpp \
Source/JavaScriptCore/dfg/DFGValidate.h \
Source/JavaScriptCore/dfg/DFGVariableAccessData.h \
Source/JavaScriptCore/dfg/DFGVariableAccessDataDump.cpp \
Source/JavaScriptCore/dfg/DFGVariableAccessDataDump.h \
Source/JavaScriptCore/dfg/DFGVirtualRegisterAllocationPhase.cpp \
Source/JavaScriptCore/dfg/DFGVirtualRegisterAllocationPhase.h \
Source/JavaScriptCore/disassembler/Disassembler.cpp \
......
......@@ -237,6 +237,8 @@
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 /* SpeculatedType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FD82E84141F3FDA00179C94 /* SpeculatedType.cpp */; };
0FDDBFB51666EED800C55FEF /* DFGVariableAccessDataDump.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FDDBFB21666EED500C55FEF /* DFGVariableAccessDataDump.cpp */; };
0FDDBFB61666EEDA00C55FEF /* DFGVariableAccessDataDump.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FDDBFB31666EED500C55FEF /* DFGVariableAccessDataDump.h */; settings = {ATTRIBUTES = (Private, ); }; };
0FE228ED1436AB2700196C48 /* Options.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FE228EB1436AB2300196C48 /* Options.h */; settings = {ATTRIBUTES = (Private, ); }; };
0FE228EE1436AB2C00196C48 /* Options.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FE228EA1436AB2300196C48 /* Options.cpp */; };
0FEB3ECD16237F4D00AB67AD /* TypedArrayDescriptor.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FEB3ECB16237F4700AB67AD /* TypedArrayDescriptor.h */; settings = {ATTRIBUTES = (Private, ); }; };
......@@ -1036,6 +1038,8 @@
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 /* SpeculatedType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SpeculatedType.cpp; sourceTree = "<group>"; };
0FDDBFB21666EED500C55FEF /* DFGVariableAccessDataDump.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DFGVariableAccessDataDump.cpp; path = dfg/DFGVariableAccessDataDump.cpp; sourceTree = "<group>"; };
0FDDBFB31666EED500C55FEF /* DFGVariableAccessDataDump.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGVariableAccessDataDump.h; path = dfg/DFGVariableAccessDataDump.h; sourceTree = "<group>"; };
0FE228EA1436AB2300196C48 /* Options.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Options.cpp; sourceTree = "<group>"; };
0FE228EB1436AB2300196C48 /* Options.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Options.h; sourceTree = "<group>"; };
0FEB3ECB16237F4700AB67AD /* TypedArrayDescriptor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TypedArrayDescriptor.h; sourceTree = "<group>"; };
......@@ -2470,6 +2474,8 @@
0F2BDC4E15228BE700CD8910 /* DFGValueSource.cpp */,
0F2BDC401522801700CD8910 /* DFGValueSource.h */,
0F620172143FCD2F0068B77C /* DFGVariableAccessData.h */,
0FDDBFB21666EED500C55FEF /* DFGVariableAccessDataDump.cpp */,
0FDDBFB31666EED500C55FEF /* DFGVariableAccessDataDump.h */,
0F2BDC5015228FFA00CD8910 /* DFGVariableEvent.cpp */,
0F2BDC411522801700CD8910 /* DFGVariableEvent.h */,
0F2BDC421522801700CD8910 /* DFGVariableEventStream.cpp */,
......@@ -3047,6 +3053,7 @@
A77F1825164192C700640A47 /* ParserModes.h in Headers */,
0FAF7EFE165BA91F000C8455 /* JITDisassembler.h in Headers */,
0F73D7AF165A143000ACAB71 /* ClosureCallStubRoutine.h in Headers */,
0FDDBFB61666EEDA00C55FEF /* DFGVariableAccessDataDump.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -3629,6 +3636,7 @@
0FAF7EFD165BA91B000C8455 /* JITDisassembler.cpp in Sources */,
0F73D7AE165A142D00ACAB71 /* ClosureCallStubRoutine.cpp in Sources */,
0F9D3370165DBB90005AD387 /* Disassembler.cpp in Sources */,
0FDDBFB51666EED800C55FEF /* DFGVariableAccessDataDump.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......
......@@ -136,6 +136,7 @@ SOURCES += \
dfg/DFGStructureCheckHoistingPhase.cpp \
dfg/DFGThunks.cpp \
dfg/DFGValueSource.cpp \
dfg/DFGVariableAccessDataDump.cpp \
dfg/DFGVariableEvent.cpp \
dfg/DFGVariableEventStream.cpp \
dfg/DFGValidate.cpp \
......
......@@ -34,144 +34,143 @@
#include "JSFunction.h"
#include "ValueProfile.h"
#include <wtf/BoundsCheckedPointer.h>
#include <wtf/StringPrintStream.h>
namespace JSC {
const char* speculationToString(SpeculatedType value)
void dumpSpeculation(PrintStream& out, SpeculatedType value)
{
if (value == SpecNone)
return "None";
if (value == SpecNone) {
out.print("None");
return;
}
static const int size = 256;
static char description[size];
BoundsCheckedPointer<char> ptr(description, size);
StringPrintStream myOut;
bool isTop = true;
if (value & SpecCellOther)
ptr.strcat("Othercell");
myOut.print("Othercell");
else
isTop = false;
if (value & SpecObjectOther)
ptr.strcat("Otherobj");
myOut.print("Otherobj");
else
isTop = false;
if (value & SpecFinalObject)
ptr.strcat("Final");
myOut.print("Final");
else
isTop = false;
if (value & SpecArray)
ptr.strcat("Array");
myOut.print("Array");
else
isTop = false;
if (value & SpecInt8Array)
ptr.strcat("Int8array");
myOut.print("Int8array");
else
isTop = false;
if (value & SpecInt16Array)
ptr.strcat("Int16array");
myOut.print("Int16array");
else
isTop = false;
if (value & SpecInt32Array)
ptr.strcat("Int32array");
myOut.print("Int32array");
else
isTop = false;
if (value & SpecUint8Array)
ptr.strcat("Uint8array");
myOut.print("Uint8array");
else
isTop = false;
if (value & SpecUint8ClampedArray)
ptr.strcat("Uint8clampedarray");
myOut.print("Uint8clampedarray");
else
isTop = false;
if (value & SpecUint16Array)
ptr.strcat("Uint16array");
myOut.print("Uint16array");
else
isTop = false;
if (value & SpecUint32Array)
ptr.strcat("Uint32array");
myOut.print("Uint32array");
else
isTop = false;
if (value & SpecFloat32Array)
ptr.strcat("Float32array");
myOut.print("Float32array");
else
isTop = false;
if (value & SpecFloat64Array)
ptr.strcat("Float64array");
myOut.print("Float64array");
else
isTop = false;
if (value & SpecFunction)
ptr.strcat("Function");
myOut.print("Function");
else
isTop = false;
if (value & SpecMyArguments)
ptr.strcat("Myarguments");
myOut.print("Myarguments");
else
isTop = false;
if (value & SpecForeignArguments)
ptr.strcat("Foreignarguments");
myOut.print("Foreignarguments");
else
isTop = false;
if (value & SpecString)
ptr.strcat("String");
myOut.print("String");
else
isTop = false;
if (value & SpecInt32)
ptr.strcat("Int");
myOut.print("Int");
else
isTop = false;
if (value & SpecDoubleReal)
ptr.strcat("Doublereal");
myOut.print("Doublereal");
else
isTop = false;
if (value & SpecDoubleNaN)
ptr.strcat("Doublenan");
myOut.print("Doublenan");
else
isTop = false;
if (value & SpecBoolean)
ptr.strcat("Bool");
myOut.print("Bool");
else
isTop = false;
if (value & SpecOther)
ptr.strcat("Other");
myOut.print("Other");
else
isTop = false;
if (isTop) {
ptr = description;
ptr.strcat("Top");
}
if (isTop)
out.print("Top");
else
out.print(myOut.toCString());
if (value & SpecEmpty)
ptr.strcat("Empty");
*ptr++ = 0;
return description;
out.print("Empty");
}
const char* speculationToAbbreviatedString(SpeculatedType prediction)
// We don't expose this because we don't want anyone relying on the fact that this method currently
// just returns string constants.
static const char* speculationToAbbreviatedString(SpeculatedType prediction)
{
if (isFinalObjectSpeculation(prediction))
return "<Final>";
......@@ -218,6 +217,11 @@ const char* speculationToAbbreviatedString(SpeculatedType prediction)
return "";
}
void dumpSpeculationAbbreviated(PrintStream& out, SpeculatedType value)
{
out.print(speculationToAbbreviatedString(value));
}
SpeculatedType speculationFromClassInfo(const ClassInfo* classInfo)
{
if (classInfo == &JSFinalObject::s_info)
......
......@@ -289,8 +289,11 @@ inline bool isEmptySpeculation(SpeculatedType value)
return value == SpecEmpty;
}
const char* speculationToString(SpeculatedType value);
const char* speculationToAbbreviatedString(SpeculatedType value);
void dumpSpeculation(PrintStream&, SpeculatedType);
void dumpSpeculationAbbreviated(PrintStream&, SpeculatedType);
MAKE_PRINT_ADAPTOR(SpeculationDump, SpeculatedType, dumpSpeculation);
MAKE_PRINT_ADAPTOR(AbbreviatedSpeculationDump, SpeculatedType, dumpSpeculationAbbreviated);
// Merge two predictions. Note that currently this just does left | right. It may
// seem tempting to do so directly, but you would be doing so at your own peril,
......
......@@ -112,10 +112,7 @@ struct ValueProfileBase {
void dump(PrintStream& out)
{
out.printf(
"samples = %u, prediction = %s",
totalNumberOfSamples(),
speculationToString(m_prediction));
out.print("samples = ", totalNumberOfSamples(), " prediction = ", SpeculationDump(m_prediction));
out.printf(", value = ");
if (m_singletonValueIsTop)
out.printf("TOP");
......
......@@ -27,6 +27,7 @@
#define VirtualRegister_h
#include <wtf/Platform.h>
#include <wtf/PrintStream.h>
namespace JSC {
......@@ -37,4 +38,13 @@ COMPILE_ASSERT(sizeof(VirtualRegister) == sizeof(int), VirtualRegister_is_32bit)
} // namespace JSC
namespace WTF {
inline void printInternal(PrintStream& out, JSC::VirtualRegister value)
{
out.print(static_cast<int>(value));
}
} // namespace WTF
#endif // VirtualRegister_h
......@@ -374,7 +374,7 @@ struct AbstractValue {
void dump(PrintStream& out) const
{
out.print(
"(", speculationToString(m_type), ", ", arrayModesToString(m_arrayModes), ", ",
"(", SpeculationDump(m_type), ", ", arrayModesToString(m_arrayModes), ", ",
m_currentKnownStructure, ", ", m_futurePossibleStructure);
if (!!m_value)
out.print(", ", m_value.description());
......@@ -532,15 +532,6 @@ private:
} } // namespace JSC::DFG
namespace WTF {
inline void printInternal(PrintStream& out, const JSC::DFG::AbstractValue& value)
{
value.dump(out);
}
} // namespace WTF
#endif // ENABLE(DFG_JIT)
#endif // DFGAbstractValue_h
......
......@@ -267,8 +267,7 @@ private:
m_inlineStackTop->m_lazyOperands.prediction(
LazyOperandValueProfileKey(m_currentIndex, node.local()));
#if DFG_ENABLE(DEBUG_VERBOSE)
dataLogF("Lazy operand [@%u, bc#%u, r%d] prediction: %s\n",
nodeIndex, m_currentIndex, node.local(), speculationToString(prediction));
dataLog("Lazy operand [@", nodeIndex, ", bc#", m_currentIndex, ", r", node.local(), "] prediction: ", SpeculationDump(prediction), "\n");
#endif
node.variableAccessData()->predict(prediction);
return nodeIndex;
......@@ -887,7 +886,7 @@ private:
SpeculatedType prediction = m_inlineStackTop->m_profiledBlock->valueProfilePredictionForBytecodeOffset(bytecodeIndex);
#if DFG_ENABLE(DEBUG_VERBOSE)
dataLogF("Dynamic [@%u, bc#%u] prediction: %s\n", nodeIndex, bytecodeIndex, speculationToString(prediction));
dataLog("Dynamic [@", nodeIndex, ", bc#", bytecodeIndex, "] prediction: ", SpeculationDump(prediction), "\n");
#endif
return prediction;
......
......@@ -27,7 +27,7 @@
#include "DFGGraph.h"
#include "CodeBlock.h"
#include <wtf/BoundsCheckedPointer.h>
#include "DFGVariableAccessDataDump.h"
#if ENABLE(DFG_JIT)
......@@ -57,44 +57,6 @@ const char *Graph::opName(NodeType op)
return dfgOpNames[op];
}
const char* Graph::nameOfVariableAccessData(VariableAccessData* variableAccessData)
{
// Variables are already numbered. For readability of IR dumps, this returns
// an alphabetic name for the variable access data, so that you don't have to
// reason about two numbers (variable number and live range number), but instead
// a number and a letter.
unsigned index = std::numeric_limits<unsigned>::max();
for (unsigned i = 0; i < m_variableAccessData.size(); ++i) {
if (&m_variableAccessData[i] == variableAccessData) {
index = i;
break;
}
}
ASSERT(index != std::numeric_limits<unsigned>::max());
if (!index)
return "A";
static char buf[100];
BoundsCheckedPointer<char> ptr(buf, sizeof(buf));
while (index) {
*ptr++ = 'A' + (index % 26);
index /= 26;
}
if (variableAccessData->isCaptured())
*ptr++ = '*';
ptr.strcat(speculationToAbbreviatedString(variableAccessData->prediction()));
*ptr++ = 0;
return buf;
}
static void printWhiteSpace(PrintStream& out, unsigned amount)
{
while (amount-- > 0)
......@@ -152,8 +114,7 @@ void Graph::dump(PrintStream& out, Edge edge)
out.print(
useKindToString(edge.useKind()),
"@", edge.index(),
speculationToAbbreviatedString(
at(edge).prediction()));
AbbreviatedSpeculationDump(at(edge).prediction()));
}
void Graph::dump(PrintStream& out, const char* prefix, NodeIndex nodeIndex)
......@@ -264,7 +225,7 @@ void Graph::dump(PrintStream& out, const char* prefix, NodeIndex nodeIndex)
if (node.hasStorageAccessData()) {
StorageAccessData& storageAccessData = m_storageAccessData[node.storageAccessDataIndex()];
out.print(hasPrinted ? ", " : "", "id", storageAccessData.identifierNumber, "{", m_codeBlock->identifier(storageAccessData.identifierNumber).string(), "}");
out.print(", ", storageAccessData.offset);
out.print(", ", static_cast<ptrdiff_t>(storageAccessData.offset));
hasPrinted = true;
}
ASSERT(node.hasVariableAccessData() == node.hasLocal());
......@@ -272,9 +233,9 @@ void Graph::dump(PrintStream& out, const char* prefix, NodeIndex nodeIndex)
VariableAccessData* variableAccessData = node.variableAccessData();
int operand = variableAccessData->operand();
if (operandIsArgument(operand))
out.print(hasPrinted ? ", " : "", "arg", operandToArgument(operand), "(", nameOfVariableAccessData(variableAccessData), ")");
out.print(hasPrinted ? ", " : "", "arg", operandToArgument(operand), "(", VariableAccessDataDump(*this, variableAccessData), ")");
else
out.print(hasPrinted ? ", " : "", "r", operand, "(", nameOfVariableAccessData(variableAccessData), ")");
out.print(hasPrinted ? ", " : "", "r", operand, "(", VariableAccessDataDump(*this, variableAccessData), ")");
hasPrinted = true;
}
if (node.hasConstantBuffer()) {
......@@ -321,9 +282,9 @@ void Graph::dump(PrintStream& out, const char* prefix, NodeIndex nodeIndex)
if (!skipped) {
if (node.hasVariableAccessData())
out.print(" predicting ", speculationToString(node.variableAccessData()->prediction()), node.variableAccessData()->shouldUseDoubleFormat() ? ", forcing double" : "");
out.print(" predicting ", SpeculationDump(node.variableAccessData()->prediction()), node.variableAccessData()->shouldUseDoubleFormat() ? ", forcing double" : "");
else if (node.hasHeapPrediction())
out.print(" predicting ", speculationToString(node.getHeapPrediction()));
out.print(" predicting ", SpeculationDump(node.getHeapPrediction()));
}
out.print("\n");
......@@ -459,7 +420,9 @@ void Graph::predictArgumentTypes()
at(m_arguments[arg]).variableAccessData()->predict(profile->computeUpdatedPrediction());
#if DFG_ENABLE(DEBUG_VERBOSE)
dataLogF("Argument [%zu] prediction: %s\n", arg, speculationToString(at(m_arguments[arg]).variableAccessData()->prediction()));
dataLog(
"Argument [", arg, "] prediction: ",
SpeculationDump(at(m_arguments[arg]).variableAccessData()->prediction()), "\n");
#endif
}
}
......
......@@ -327,9 +327,6 @@ public:
static const char *opName(NodeType);
// This is O(n), and should only be used for verbose dumps.
const char* nameOfVariableAccessData(VariableAccessData*);
void predictArgumentTypes();
StructureSet* addStructureSet(const StructureSet& structureSet)
......
......@@ -320,15 +320,6 @@ private:
} } // namespace JSC::DFG
namespace WTF {
inline void printInternal(PrintStream& out, const JSC::DFG::StructureAbstractValue& value)
{
value.dump(out);
}
} // namespace WTF
#endif // ENABLE(DFG_JIT)
#endif // DFGStructureAbstractValue_h
......
/*
* Copyright (C) 2012 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.
*/
#include "config.h"
#include "DFGVariableAccessDataDump.h"
#if ENABLE(DFG_JIT)
#include "DFGGraph.h"
#include "DFGVariableAccessData.h"
namespace JSC { namespace DFG {
VariableAccessDataDump::VariableAccessDataDump(Graph& graph, VariableAccessData* data)
: m_graph(graph)
, m_data(data)
{
}
void VariableAccessDataDump::dump(PrintStream& out) const
{
unsigned index = std::numeric_limits<unsigned>::max();
for (unsigned i = 0; i < m_graph.m_variableAccessData.size(); ++i) {
if (&m_graph.m_variableAccessData[i] == m_data) {
index = i;
break;
}
}
ASSERT(index != std::numeric_limits<unsigned>::max());
if (!index) {
out.print("a");
return;
}
while (index) {
out.print(CharacterDump('A' + (index % 26)));
index /= 26;
}
if (m_data->isCaptured())
out.print("*");
out.print(AbbreviatedSpeculationDump(m_data->prediction()));
}
} } // namespace JSC::DFG
#endif // ENABLE(DFG_JIT)
/*
* Copyright (C) 2012 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 DFGVariableAccessDataDump_h
#define DFGVariableAccessDataDump_h
#include <wtf/Platform.h>
#if ENABLE(DFG_JIT)
#include <wtf/PrintStream.h>
namespace JSC { namespace DFG {