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 copied

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/bytecode/OperandsInlines.h

    r153295 r153296  
    2424 */
    2525
    26 #include "config.h"
    27 #include "FTLValueSource.h"
     26#ifndef OperandsInlines_h
     27#define OperandsInlines_h
    2828
    29 #if ENABLE(FTL_JIT)
     29#include "Operands.h"
     30#include <wtf/CommaPrinter.h>
    3031
    31 namespace JSC { namespace FTL {
     32namespace JSC {
    3233
    33 void ValueSource::dump(PrintStream& out) const
     34template<typename T, typename Traits>
     35void Operands<T, Traits>::dumpInContext(PrintStream& out, DumpContext* context) const
    3436{
    35     switch (kind()) {
    36     case SourceNotSet:
    37         out.print("SourceNotSet");
    38         return;
    39     case ValueInJSStack:
    40         out.print("ValueInJSStack");
    41         return;
    42     case Int32InJSStack:
    43         out.print("Int32InJSStack");
    44         return;
    45     case DoubleInJSStack:
    46         out.print("DoubleInJSStack");
    47         return;
    48     case SourceIsDead:
    49         out.print("SourceIsDead");
    50         return;
    51     case HaveNode:
    52         out.print("Node(", node(), ")");
    53         return;
     37    CommaPrinter comma(" ");
     38    for (size_t argumentIndex = numberOfArguments(); argumentIndex--;) {
     39        if (Traits::isEmptyForDump(argument(argumentIndex)))
     40            continue;
     41        out.print(comma, "arg", argumentIndex, ":", inContext(argument(argumentIndex), context));
    5442    }
    55    
    56     RELEASE_ASSERT_NOT_REACHED();
     43    for (size_t localIndex = 0; localIndex < numberOfLocals(); ++localIndex) {
     44        if (Traits::isEmptyForDump(local(localIndex)))
     45            continue;
     46        out.print(comma, "r", localIndex, ":", inContext(local(localIndex), context));
     47    }
    5748}
    5849
    59 } } // namespace JSC::FTL
     50} // namespace JSC
    6051
    61 #endif // ENABLE(FTL_JIT)
     52#endif // OperandsInlines_h
    6253
Note: See TracChangeset for help on using the changeset viewer.