Ignore:
Timestamp:
Dec 10, 2008, 12:05:53 PM (16 years ago)
Author:
[email protected]
Message:

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

Reviewed by Geoffrey Garen.

<rdar://problem/6428332> Remove the CTI return address table from CodeBlock

Step 2:

Convert the return address table from a HashMap to a sorted Vector. This
reduces the size of the data structure by ~4.5MB on Membuster head.

SunSpider reports a 0.5% progression.

  • bytecode/CodeBlock.cpp: (JSC::sizeInBytes): Generic method to get the cost of a Vector. (JSC::CodeBlock::dumpStatistics): Add dumping of member sizes.
  • bytecode/CodeBlock.h: (JSC::PC::PC): Struct representing NativePC -> VirtualPC mappings. (JSC::getNativePC): Helper for binary chop. (JSC::CodeBlock::getBytecodeIndex): Used to get the VirtualPC from a NativePC using a binary chop of the pcVector. (JSC::CodeBlock::pcVector): Accessor.
  • interpreter/Interpreter.cpp: (JSC::vPCForPC): Use getBytecodeIndex instead of jitReturnAddressVPCMap().get(). (JSC::Interpreter::cti_op_instanceof): Ditto. (JSC::Interpreter::cti_op_resolve): Ditto. (JSC::Interpreter::cti_op_resolve_func): Ditto. (JSC::Interpreter::cti_op_resolve_skip): Ditto. (JSC::Interpreter::cti_op_resolve_with_base): Ditto. (JSC::Interpreter::cti_op_throw): Ditto. (JSC::Interpreter::cti_op_in): Ditto. (JSC::Interpreter::cti_vm_throw): Ditto.
  • jit/JIT.cpp: (JSC::JIT::privateCompile): Reserve exact capacity and fill the pcVector.
File:
1 edited

Legend:

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

    r39157 r39182  
    972972    macro(expressionInfo) \
    973973    macro(lineInfo) \
     974    macro(pcVector)
    974975
    975976#define FOR_EACH_MEMBER_VECTOR_RARE_DATA(macro) \
     
    982983    macro(stringSwitchJumpTables)
    983984
     985template<typename T>
     986static size_t sizeInBytes(const Vector<T>& vector)
     987{
     988    return vector.capacity() * sizeof(T);
     989}
     990
    984991void CodeBlock::dumpStatistics()
    985992{
    986993#if DUMP_CODE_BLOCK_STATISTICS
    987 
    988     #define DEFINE_VARS(name) size_t name##IsNotEmpty = 0;
     994    #define DEFINE_VARS(name) size_t name##IsNotEmpty = 0; size_t name##TotalSize = 0;
    989995        FOR_EACH_MEMBER_VECTOR(DEFINE_VARS)
    990996        FOR_EACH_MEMBER_VECTOR_RARE_DATA(DEFINE_VARS)
     
    992998
    993999    // Non-vector data members
    994     size_t jitReturnAddressVPCMapIsNotEmpty = 0;
    9951000    size_t evalCodeCacheIsNotEmpty = 0;
     1001
    9961002    size_t symbolTableIsNotEmpty = 0;
     1003    size_t symbolTableTotalSize = 0;
    9971004
    9981005    size_t hasRareData = 0;
    999 
    1000     size_t symbolTableTotalSize = 0;
    10011006
    10021007    HashSet<CodeBlock*>::const_iterator end = liveCodeBlockSet.end();
     
    10041009        CodeBlock* codeBlock = *it;
    10051010
    1006         #define GET_STATS(name) if (!codeBlock->m_##name.isEmpty()) { name##IsNotEmpty++; }
     1011        #define GET_STATS(name) if (!codeBlock->m_##name.isEmpty()) { name##IsNotEmpty++; name##TotalSize += sizeInBytes(codeBlock->m_##name); }
    10071012            FOR_EACH_MEMBER_VECTOR(GET_STATS)
    10081013        #undef GET_STATS
    1009 
    1010         if (!codeBlock->m_jitReturnAddressVPCMap.isEmpty())
    1011             jitReturnAddressVPCMapIsNotEmpty++;
    10121014
    10131015        if (!codeBlock->m_symbolTable.isEmpty()) {
     
    10181020        if (codeBlock->m_rareData) {
    10191021            hasRareData++;
    1020             #define GET_STATS(name) if (!codeBlock->m_rareData->m_##name.isEmpty()) { name##IsNotEmpty++; }
     1022            #define GET_STATS(name) if (!codeBlock->m_rareData->m_##name.isEmpty()) { name##IsNotEmpty++; name##TotalSize += sizeInBytes(codeBlock->m_rareData->m_##name); }
    10211023                FOR_EACH_MEMBER_VECTOR_RARE_DATA(GET_STATS)
    10221024            #undef GET_STATS
     
    10321034    printf("Number of CodeBlocks with rare data: %zu\n", hasRareData);
    10331035
    1034     #define PRINT_STATS(name) printf("Number of CodeBlocks with " #name ": %zu\n", name##IsNotEmpty);
     1036    #define PRINT_STATS(name) printf("Number of CodeBlocks with " #name ": %zu\n", name##IsNotEmpty); printf("Size of all " #name ": %zu\n", name##TotalSize);
    10351037        FOR_EACH_MEMBER_VECTOR(PRINT_STATS)
    10361038        FOR_EACH_MEMBER_VECTOR_RARE_DATA(PRINT_STATS)
    10371039    #undef PRINT_STATS
    10381040
    1039     printf("Number of CodeBlocks with jitReturnAddressVPCMap: %zu\n", jitReturnAddressVPCMapIsNotEmpty);
    10401041    printf("Number of CodeBlocks with evalCodeCache: %zu\n", evalCodeCacheIsNotEmpty);
    10411042    printf("Number of CodeBlocks with symbolTable: %zu\n", symbolTableIsNotEmpty);
Note: See TracChangeset for help on using the changeset viewer.