Changeset 209929 in webkit


Ignore:
Timestamp:
Dec 16, 2016 11:28:58 AM (7 years ago)
Author:
mark.lam@apple.com
Message:

Add predecessor info to dumps from JSC_dumpBytecodeLivenessResults=true.
https://bugs.webkit.org/show_bug.cgi?id=165958

Reviewed by Saam Barati.

Also:

  1. refactored the code to use a common lambda function to dump FastBitVectors.
  2. list successors by their block index instead of pointers.
  • bytecode/BytecodeLivenessAnalysis.cpp:

(JSC::BytecodeLivenessAnalysis::dumpResults):

Location:
trunk/Source/JavaScriptCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r209928 r209929  
     12016-12-16  Mark Lam  <mark.lam@apple.com>
     2
     3        Add predecessor info to dumps from JSC_dumpBytecodeLivenessResults=true.
     4        https://bugs.webkit.org/show_bug.cgi?id=165958
     5
     6        Reviewed by Saam Barati.
     7
     8        Also:
     9        1. refactored the code to use a common lambda function to dump FastBitVectors.
     10        2. list successors by their block index instead of pointers.
     11
     12        * bytecode/BytecodeLivenessAnalysis.cpp:
     13        (JSC::BytecodeLivenessAnalysis::dumpResults):
     14
    1152016-12-16  Saam Barati  <sbarati@apple.com>
    216
  • trunk/Source/JavaScriptCore/bytecode/BytecodeLivenessAnalysis.cpp

    r209358 r209929  
    143143    Instruction* instructionsBegin = codeBlock->instructions().begin();
    144144    unsigned i = 0;
     145
     146    unsigned numberOfBlocks = m_graph.size();
     147    Vector<FastBitVector> predecessors(numberOfBlocks);
     148    for (BytecodeBasicBlock* block : m_graph)
     149        predecessors[block->index()].resize(numberOfBlocks);
     150    for (BytecodeBasicBlock* block : m_graph) {
     151        for (unsigned j = 0; j < block->successors().size(); j++) {
     152            unsigned blockIndex = block->index();
     153            unsigned successorIndex = block->successors()[j]->index();
     154            predecessors[successorIndex][blockIndex] = true;
     155        }
     156    }
     157
     158    auto dumpBitVector = [] (FastBitVector& bits) {
     159        for (unsigned j = 0; j < bits.numBits(); j++) {
     160            if (bits[j])
     161                dataLogF(" %u", j);
     162        }
     163    };
     164
    145165    for (BytecodeBasicBlock* block : m_graph) {
    146166        dataLogF("\nBytecode basic block %u: %p (offset: %u, length: %u)\n", i++, block, block->leaderOffset(), block->totalLength());
    147         dataLogF("Successors: ");
     167
     168        dataLogF("Predecessors:");
     169        dumpBitVector(predecessors[block->index()]);
     170        dataLogF("\n");
     171
     172        dataLogF("Successors:");
     173        FastBitVector successors;
     174        successors.resize(numberOfBlocks);
    148175        for (unsigned j = 0; j < block->successors().size(); j++) {
    149176            BytecodeBasicBlock* successor = block->successors()[j];
    150             dataLogF("%p ", successor);
    151         }
     177            successors[successor->index()] = true;
     178        }
     179        dumpBitVector(successors); // Dump in sorted order.
    152180        dataLogF("\n");
     181
    153182        if (block->isEntryBlock()) {
    154183            dataLogF("Entry block %p\n", block);
     
    162191            const Instruction* currentInstruction = &instructionsBegin[bytecodeOffset];
    163192
    164             dataLogF("Live variables: ");
     193            dataLogF("Live variables:");
    165194            FastBitVector liveBefore = getLivenessInfoAtBytecodeOffset(bytecodeOffset);
    166             for (unsigned j = 0; j < liveBefore.numBits(); j++) {
    167                 if (liveBefore[j])
    168                     dataLogF("%u ", j);
    169             }
     195            dumpBitVector(liveBefore);
    170196            dataLogF("\n");
    171197            codeBlock->dumpBytecode(WTF::dataFile(), codeBlock->globalObject()->globalExec(), instructionsBegin, currentInstruction);
     
    176202        }
    177203
    178         dataLogF("Live variables: ");
     204        dataLogF("Live variables:");
    179205        FastBitVector liveAfter = block->out();
    180         for (unsigned j = 0; j < liveAfter.numBits(); j++) {
    181             if (liveAfter[j])
    182                 dataLogF("%u ", j);
    183         }
     206        dumpBitVector(liveAfter);
    184207        dataLogF("\n");
    185208    }
Note: See TracChangeset for help on using the changeset viewer.