Ignore:
Timestamp:
Feb 28, 2016, 2:21:54 PM (9 years ago)
Author:
[email protected]
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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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
Note: See TracChangeset for help on using the changeset viewer.