Ignore:
Timestamp:
Jul 24, 2013, 9:05:36 PM (12 years ago)
Author:
[email protected]
Message:

fourthTier: DFG IR dumps should be easier to read
https://bugs.webkit.org/show_bug.cgi?id=119050

Source/JavaScriptCore:

Reviewed by Mark Hahnenberg.

Added a DumpContext that includes support for printing an endnote
that describes all structures in full, while the main flow of the
dump just uses made-up names for the structures. This is helpful
since Structure::dump() may print a lot. The stuff it prints is
useful, but if it's all inline with the surrounding thing you're
dumping (often, a node in the DFG), then you get a ridiculously
long print-out. All classes that dump structures (including
Structure itself) now have dumpInContext() methods that use
inContext() for dumping anything that might transitively print a
structure. If Structure::dumpInContext() is called with a NULL
context, it just uses dump() like before. Hence you don't have to
know anything about DumpContext unless you want to.

inContext(*structure, context) dumps something like %B4:Array,
and the endnote will have something like:

%B4:Array = 0x10e91a180:[Array, {Edge:100, Normal:101, Line:102, NumPx:103, LastPx:104}, ArrayWithContiguous, Proto:0x10e99ffe0]

where B4 is the inferred name that StringHashDumpContext came up
with.

Also shortened a bunch of other dumps, removing information that
isn't so important.

(JSC::dumpArrayModes):

  • bytecode/CodeBlockHash.cpp:

(JSC):
(JSC::CodeBlockHash::CodeBlockHash):
(JSC::CodeBlockHash::dump):

  • bytecode/CodeOrigin.cpp:

(JSC::CodeOrigin::dumpInContext):
(JSC):
(JSC::InlineCallFrame::dumpInContext):
(JSC::InlineCallFrame::dump):

  • bytecode/CodeOrigin.h:

(CodeOrigin):
(InlineCallFrame):

  • bytecode/Operands.h:

(JSC::OperandValueTraits::isEmptyForDump):
(Operands):
(JSC::Operands::dump):
(JSC):

  • bytecode/OperandsInlines.h: Added.

(JSC):
(JSC::::dumpInContext):

  • bytecode/StructureSet.h:

(JSC::StructureSet::dumpInContext):
(JSC::StructureSet::dump):
(StructureSet):

  • dfg/DFGAbstractValue.cpp:

(JSC::DFG::AbstractValue::dump):
(DFG):
(JSC::DFG::AbstractValue::dumpInContext):

  • dfg/DFGAbstractValue.h:

(JSC::DFG::AbstractValue::operator!):
(AbstractValue):

  • dfg/DFGCFAPhase.cpp:

(JSC::DFG::CFAPhase::performBlockCFA):

  • dfg/DFGCommon.cpp:
  • dfg/DFGCommon.h:

(JSC::DFG::NodePointerTraits::isEmptyForDump):

  • dfg/DFGDisassembler.cpp:

(JSC::DFG::Disassembler::createDumpList):

  • dfg/DFGDisassembler.h:

(Disassembler):

  • dfg/DFGFlushFormat.h:

(WTF::inContext):
(WTF):

  • dfg/DFGFlushLivenessAnalysisPhase.cpp:
  • dfg/DFGGraph.cpp:

(JSC::DFG::Graph::dumpCodeOrigin):
(JSC::DFG::Graph::dump):
(JSC::DFG::Graph::dumpBlockHeader):

  • dfg/DFGGraph.h:

(Graph):

  • dfg/DFGLazyJSValue.cpp:

(JSC::DFG::LazyJSValue::dumpInContext):
(JSC::DFG::LazyJSValue::dump):
(DFG):

  • dfg/DFGLazyJSValue.h:

(LazyJSValue):

  • dfg/DFGNode.h:

(JSC::DFG::nodeMapDump):
(WTF::inContext):
(WTF):

  • dfg/DFGOSRExitCompiler32_64.cpp:

(JSC::DFG::OSRExitCompiler::compileExit):

  • dfg/DFGOSRExitCompiler64.cpp:

(JSC::DFG::OSRExitCompiler::compileExit):

  • dfg/DFGStructureAbstractValue.h:

(JSC::DFG::StructureAbstractValue::dumpInContext):
(JSC::DFG::StructureAbstractValue::dump):
(StructureAbstractValue):

  • ftl/FTLExitValue.cpp:

(JSC::FTL::ExitValue::dumpInContext):
(JSC::FTL::ExitValue::dump):
(FTL):

  • ftl/FTLExitValue.h:

(ExitValue):

  • ftl/FTLLowerDFGToLLVM.cpp:
  • ftl/FTLValueSource.cpp:

(JSC::FTL::ValueSource::dumpInContext):
(FTL):

  • ftl/FTLValueSource.h:

(ValueSource):

  • runtime/DumpContext.cpp: Added.

(JSC):
(JSC::DumpContext::DumpContext):
(JSC::DumpContext::~DumpContext):
(JSC::DumpContext::isEmpty):
(JSC::DumpContext::dump):

  • runtime/DumpContext.h: Added.

(JSC):
(DumpContext):

  • runtime/JSCJSValue.cpp:

(JSC::JSValue::dump):
(JSC):
(JSC::JSValue::dumpInContext):

  • runtime/JSCJSValue.h:

(JSC):
(JSValue):

  • runtime/Structure.cpp:

(JSC::Structure::dumpInContext):
(JSC):
(JSC::Structure::dumpBrief):
(JSC::Structure::dumpContextHeader):

  • runtime/Structure.h:

(JSC):
(Structure):

Source/WTF:

Reviewed by Mark Hahnenberg.

Added support for dumping values within a context. By default, if you say
print(inContext(value, context)) it calls value.dumpInContext(out, context)
instead of value.dump(out).

Hoisted the support for six-character hashes out of JSC::CodeBlockHash into
WTF, in the form of SixCharacterHash.h.

Added a helper for creating dump contexts where the inContext() dump will
just use a short string hash to "name" the object being dumped, and then
will print out the full dumps in an endnote to your dump.

Added support for using CString as a hashtable key.

  • WTF.xcodeproj/project.pbxproj:
  • wtf/PrintStream.h:

(WTF):
(ValueInContext):
(WTF::ValueInContext::ValueInContext):
(WTF::ValueInContext::dump):
(WTF::inContext):

  • wtf/SixCharacterHash.cpp: Added.

(WTF):
(WTF::sixCharacterHashStringToInteger):
(WTF::integerToSixCharacterHashString):

  • wtf/SixCharacterHash.h: Added.

(WTF):

  • wtf/StringHashDumpContext.h: Added.

(WTF):
(StringHashDumpContext):
(WTF::StringHashDumpContext::StringHashDumpContext):
(WTF::StringHashDumpContext::getID):
(WTF::StringHashDumpContext::dumpBrief):
(WTF::StringHashDumpContext::brief):
(WTF::StringHashDumpContext::isEmpty):
(WTF::StringHashDumpContext::dump):

  • wtf/text/CString.cpp:

(WTF::CString::hash):
(WTF):
(WTF::operator<):
(WTF::CStringHash::equal):

  • wtf/text/CString.h:

(WTF::CString::CString):
(CString):
(WTF::CString::isHashTableDeletedValue):
(WTF):
(WTF::CStringHash::hash):
(CStringHash):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/dfg/DFGLazyJSValue.cpp

    r153248 r153296  
    112112}
    113113
    114 void LazyJSValue::dump(PrintStream& out) const
     114void LazyJSValue::dumpInContext(PrintStream& out, DumpContext* context) const
    115115{
    116116    switch (m_kind) {
    117117    case KnownValue:
    118         value().dump(out);
     118        value().dumpInContext(out, context);
    119119        return;
    120120    case SingleCharacterString:
     
    130130}
    131131
     132void LazyJSValue::dump(PrintStream& out) const
     133{
     134    dumpInContext(out, 0);
     135}
     136
    132137} } // namespace JSC::DFG
    133138
Note: See TracChangeset for help on using the changeset viewer.