Ignore:
Timestamp:
Dec 8, 2008, 4:14:58 PM (16 years ago)
Author:
[email protected]
Message:

2008-12-08 Sam Weinig <[email protected]>

Reviewed by Mark Rowe.

Add dumping of CodeBlock member structure usage.

  • bytecode/CodeBlock.cpp: (JSC::CodeBlock::dumpStatistics):
  • bytecode/EvalCodeCache.h: (JSC::EvalCodeCache::isEmpty):
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/bytecode/CodeBlock.cpp

    r39102 r39113  
    961961#endif
    962962
     963#define FOR_EACH_MEMBER_VECTOR(macro) \
     964    macro(instructions) \
     965    macro(globalResolveInstructions) \
     966    macro(propertyAccessInstructions) \
     967    macro(callLinkInfos) \
     968    macro(linkedCallerList) \
     969    macro(identifiers) \
     970    macro(functionExpressions) \
     971    macro(constantRegisters) \
     972    macro(expressionInfo) \
     973    macro(lineInfo) \
     974    macro(regexps) \
     975    macro(functions) \
     976    macro(unexpectedConstants) \
     977    macro(exceptionHandlers) \
     978    macro(immediateSwitchJumpTables) \
     979    macro(characterSwitchJumpTables) \
     980    macro(stringSwitchJumpTables)
     981
    963982void CodeBlock::dumpStatistics()
    964983{
    965984#if DUMP_CODE_BLOCK_STATISTICS
     985
     986    #define DEFINE_VARS(name) size_t name##IsNotEmpty = 0;
     987        FOR_EACH_MEMBER_VECTOR(DEFINE_VARS)
     988    #undef DEFINE_VARS
     989
     990    // Non-vector data members
     991    size_t jitReturnAddressVPCMapIsNotEmpty = 0;
     992    size_t evalCodeCacheIsNotEmpty = 0;
     993
     994    HashSet<CodeBlock*>::const_iterator end = liveCodeBlockSet.end();
     995    for (HashSet<CodeBlock*>::const_iterator it = liveCodeBlockSet.begin(); it != end; ++it) {
     996        CodeBlock* codeBlock = *it;
     997
     998        #define GET_STATS(name) if (!codeBlock->m_##name.isEmpty()) { name##IsNotEmpty++; }
     999            FOR_EACH_MEMBER_VECTOR(GET_STATS)
     1000        #undef GET_STATS
     1001
     1002        if (!codeBlock->m_jitReturnAddressVPCMap.isEmpty())
     1003            jitReturnAddressVPCMapIsNotEmpty++;
     1004        if (!codeBlock->m_evalCodeCache.isEmpty())
     1005            evalCodeCacheIsNotEmpty++;
     1006    }
     1007
    9661008    printf("Number of live CodeBlocks: %d\n", liveCodeBlockSet.size());
    9671009    printf("Size of a single CodeBlock [sizeof(CodeBlock)]: %zu\n", sizeof(CodeBlock));
     1010
     1011    #define PRINT_STATS(name) printf("Number of CodeBlocks with " #name ": %zu\n", name##IsNotEmpty);
     1012        FOR_EACH_MEMBER_VECTOR(PRINT_STATS)
     1013    #undef PRINT_STATS
     1014    printf("Number of CodeBlocks with jitReturnAddressVPCMap: %zu\n", jitReturnAddressVPCMapIsNotEmpty);
     1015    printf("Number of CodeBlocks with evalCodeCache: %zu\n", evalCodeCacheIsNotEmpty);
    9681016#else
    9691017    printf("Dumping CodeBlock statistics is not enabled.\n");
Note: See TracChangeset for help on using the changeset viewer.