Changeset 197303 in webkit


Ignore:
Timestamp:
Feb 28, 2016 2:21:54 PM (8 years ago)
Author:
akling@apple.com
Message:

Shrink UnlinkedCodeBlock a bit.
<https://webkit.org/b/154797>

Reviewed by Anders Carlsson.

Move profiler-related members of UnlinkedCodeBlock into its RareData
structure, saving 40 bytes, and then reorder the other members of
UnlinkedCodeBlock to save another 24 bytes, netting a nice total 64.

The VM member was removed entirely since UnlinkedCodeBlock is a cell
and can retrieve its VM through MarkedBlock header lookup.

  • bytecode/UnlinkedCodeBlock.cpp:

(JSC::UnlinkedCodeBlock::vm):
(JSC::UnlinkedCodeBlock::typeProfilerExpressionInfoForBytecodeOffset):
(JSC::UnlinkedCodeBlock::addTypeProfilerExpressionInfo):
(JSC::UnlinkedCodeBlock::UnlinkedCodeBlock): Deleted.

  • bytecode/UnlinkedCodeBlock.h:

(JSC::UnlinkedCodeBlock::addRegExp):
(JSC::UnlinkedCodeBlock::addConstant):
(JSC::UnlinkedCodeBlock::addFunctionDecl):
(JSC::UnlinkedCodeBlock::addFunctionExpr):
(JSC::UnlinkedCodeBlock::addOpProfileControlFlowBytecodeOffset):
(JSC::UnlinkedCodeBlock::opProfileControlFlowBytecodeOffsets):
(JSC::UnlinkedCodeBlock::vm): Deleted.

Location:
trunk/Source/JavaScriptCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r197299 r197303  
     12016-02-28  Andreas Kling  <akling@apple.com>
     2
     3        Shrink UnlinkedCodeBlock a bit.
     4        <https://webkit.org/b/154797>
     5
     6        Reviewed by Anders Carlsson.
     7
     8        Move profiler-related members of UnlinkedCodeBlock into its RareData
     9        structure, saving 40 bytes, and then reorder the other members of
     10        UnlinkedCodeBlock to save another 24 bytes, netting a nice total 64.
     11
     12        The VM member was removed entirely since UnlinkedCodeBlock is a cell
     13        and can retrieve its VM through MarkedBlock header lookup.
     14
     15        * bytecode/UnlinkedCodeBlock.cpp:
     16        (JSC::UnlinkedCodeBlock::vm):
     17        (JSC::UnlinkedCodeBlock::typeProfilerExpressionInfoForBytecodeOffset):
     18        (JSC::UnlinkedCodeBlock::addTypeProfilerExpressionInfo):
     19        (JSC::UnlinkedCodeBlock::UnlinkedCodeBlock): Deleted.
     20        * bytecode/UnlinkedCodeBlock.h:
     21        (JSC::UnlinkedCodeBlock::addRegExp):
     22        (JSC::UnlinkedCodeBlock::addConstant):
     23        (JSC::UnlinkedCodeBlock::addFunctionDecl):
     24        (JSC::UnlinkedCodeBlock::addFunctionExpr):
     25        (JSC::UnlinkedCodeBlock::addOpProfileControlFlowBytecodeOffset):
     26        (JSC::UnlinkedCodeBlock::opProfileControlFlowBytecodeOffsets):
     27        (JSC::UnlinkedCodeBlock::vm): Deleted.
     28
    1292016-02-27  Filip Pizlo  <fpizlo@apple.com>
    230
  • trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.cpp

    r197043 r197303  
    5757    , m_numCalleeLocals(0)
    5858    , m_numParameters(0)
    59     , m_vm(vm)
    6059    , m_globalObjectRegister(VirtualRegister())
    6160    , m_usesEval(info.usesEval())
     
    8685}
    8786
     87VM* UnlinkedCodeBlock::vm() const
     88{
     89    return MarkedBlock::blockFor(this)->vm();
     90}
     91
    8892void UnlinkedCodeBlock::visitChildren(JSCell* cell, SlotVisitor& visitor)
    8993{
     
    262266bool UnlinkedCodeBlock::typeProfilerExpressionInfoForBytecodeOffset(unsigned bytecodeOffset, unsigned& startDivot, unsigned& endDivot)
    263267{
     268    ASSERT(m_rareData);
    264269    static const bool verbose = false;
    265     auto iter = m_typeProfilerInfoMap.find(bytecodeOffset);
    266     if (iter == m_typeProfilerInfoMap.end()) {
     270    auto iter = m_rareData->m_typeProfilerInfoMap.find(bytecodeOffset);
     271    if (iter == m_rareData->m_typeProfilerInfoMap.end()) {
    267272        if (verbose)
    268273            dataLogF("Don't have assignment info for offset:%u\n", bytecodeOffset);
     
    272277    }
    273278   
    274     TypeProfilerExpressionRange& range = iter->value;
     279    RareData::TypeProfilerExpressionRange& range = iter->value;
    275280    startDivot = range.m_startDivot;
    276281    endDivot = range.m_endDivot;
     
    280285void UnlinkedCodeBlock::addTypeProfilerExpressionInfo(unsigned instructionOffset, unsigned startDivot, unsigned endDivot)
    281286{
    282     TypeProfilerExpressionRange range;
     287    createRareDataIfNecessary();
     288    RareData::TypeProfilerExpressionRange range;
    283289    range.m_startDivot = startDivot;
    284290    range.m_endDivot = endDivot;
    285     m_typeProfilerInfoMap.set(instructionOffset, range); 
     291    m_rareData->m_typeProfilerInfoMap.set(instructionOffset, range);
    286292}
    287293
  • trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.h

    r197043 r197303  
    149149        createRareDataIfNecessary();
    150150        unsigned size = m_rareData->m_regexps.size();
    151         m_rareData->m_regexps.append(WriteBarrier<RegExp>(*m_vm, this, r));
     151        m_rareData->m_regexps.append(WriteBarrier<RegExp>(*vm(), this, r));
    152152        return size;
    153153    }
     
    171171        unsigned result = m_constantRegisters.size();
    172172        m_constantRegisters.append(WriteBarrier<Unknown>());
    173         m_constantRegisters.last().set(*m_vm, this, v);
     173        m_constantRegisters.last().set(*vm(), this, v);
    174174        m_constantsSourceCodeRepresentation.append(sourceCodeRepresentation);
    175175        return result;
     
    250250        unsigned size = m_functionDecls.size();
    251251        m_functionDecls.append(WriteBarrier<UnlinkedFunctionExecutable>());
    252         m_functionDecls.last().set(*m_vm, this, n);
     252        m_functionDecls.last().set(*vm(), this, n);
    253253        return size;
    254254    }
     
    259259        unsigned size = m_functionExprs.size();
    260260        m_functionExprs.append(WriteBarrier<UnlinkedFunctionExecutable>());
    261         m_functionExprs.last().set(*m_vm, this, n);
     261        m_functionExprs.last().set(*vm(), this, n);
    262262        return size;
    263263    }
     
    270270    UnlinkedHandlerInfo& exceptionHandler(int index) { ASSERT(m_rareData); return m_rareData->m_exceptionHandlers[index]; }
    271271
    272     VM* vm() const { return m_vm; }
     272    VM* vm() const;
    273273
    274274    UnlinkedArrayProfile addArrayProfile() { return m_arrayProfileCount++; }
     
    346346    unsigned endColumn() const { return m_endColumn; }
    347347
    348     void addOpProfileControlFlowBytecodeOffset(size_t offset) { m_opProfileControlFlowBytecodeOffsets.append(offset); }
    349     const Vector<size_t>& opProfileControlFlowBytecodeOffsets() const { return m_opProfileControlFlowBytecodeOffsets; }
     348    void addOpProfileControlFlowBytecodeOffset(size_t offset)
     349    {
     350        createRareDataIfNecessary();
     351        m_rareData->m_opProfileControlFlowBytecodeOffsets.append(offset);
     352    }
     353    const Vector<size_t>& opProfileControlFlowBytecodeOffsets() const
     354    {
     355        ASSERT(m_rareData);
     356        return m_rareData->m_opProfileControlFlowBytecodeOffsets;
     357    }
    350358
    351359    void dumpExpressionRangeInfo(); // For debugging purpose only.
     
    370378    void getLineAndColumn(ExpressionRangeInfo&, unsigned& line, unsigned& column);
    371379
     380    int m_numParameters;
     381
    372382    std::unique_ptr<UnlinkedInstructionStream> m_unlinkedInstructions;
    373 
    374     int m_numParameters;
    375     VM* m_vm;
    376383
    377384    VirtualRegister m_thisRegister;
     
    399406    Vector<unsigned> m_jumpTargets;
    400407
     408    Vector<unsigned> m_propertyAccessInstructions;
     409
    401410    // Constant Pools
    402411    Vector<Identifier> m_identifiers;
    403412    Vector<WriteBarrier<Unknown>> m_constantRegisters;
    404413    Vector<SourceCodeRepresentation> m_constantsSourceCodeRepresentation;
    405     std::array<unsigned, LinkTimeConstantCount> m_linkTimeConstants;
    406414    typedef Vector<WriteBarrier<UnlinkedFunctionExecutable>> FunctionExpressionVector;
    407415    FunctionExpressionVector m_functionDecls;
    408416    FunctionExpressionVector m_functionExprs;
    409 
    410     Vector<unsigned> m_propertyAccessInstructions;
     417    std::array<unsigned, LinkTimeConstantCount> m_linkTimeConstants;
    411418
    412419    unsigned m_arrayProfileCount;
     
    433440
    434441        Vector<ExpressionRangeInfo::FatPosition> m_expressionInfoFatPositions;
     442
     443        struct TypeProfilerExpressionRange {
     444            unsigned m_startDivot;
     445            unsigned m_endDivot;
     446        };
     447        HashMap<unsigned, TypeProfilerExpressionRange> m_typeProfilerInfoMap;
     448        Vector<size_t> m_opProfileControlFlowBytecodeOffsets;
    435449    };
    436450
     
    438452    std::unique_ptr<RareData> m_rareData;
    439453    Vector<ExpressionRangeInfo> m_expressionInfo;
    440     struct TypeProfilerExpressionRange {
    441         unsigned m_startDivot;
    442         unsigned m_endDivot;
    443     };
    444     HashMap<unsigned, TypeProfilerExpressionRange> m_typeProfilerInfoMap;
    445     Vector<size_t> m_opProfileControlFlowBytecodeOffsets;
    446454
    447455protected:
Note: See TracChangeset for help on using the changeset viewer.