Ignore:
Timestamp:
Apr 15, 2021, 12:03:38 AM (4 years ago)
Author:
[email protected]
Message:

[JSC] Change Vector<> to FixedVector<> in DFG::CommonData if possible
https://bugs.webkit.org/show_bug.cgi?id=224588

Reviewed by Mark Lam.

DFG::CommonData is kept alive so long as DFG code exists. It includes a lot of Vectors while they are not mutable after the DFG code compilation.
This patch changes Vector<> to FixedVector<> if possible to shrink sizeof(DFG::CommonData). And this also removes the need of calling shrinkToFit
explicitly for them.

  • bytecode/CodeBlock.cpp:

(JSC::CodeBlock::propagateTransitions):
(JSC::CodeBlock::determineLiveness):
(JSC::CodeBlock::stronglyVisitWeakReferences):
(JSC::CodeBlock::jettison):
(JSC::CodeBlock::numberOfDFGIdentifiers const):
(JSC::CodeBlock::identifier const):

  • bytecode/CodeBlock.h:
  • dfg/DFGCommonData.cpp:

(JSC::DFG::CommonData::shrinkToFit):
(JSC::DFG::CommonData::invalidate):
(JSC::DFG::CommonData::~CommonData):
(JSC::DFG::CommonData::installVMTrapBreakpoints):
(JSC::DFG::CommonData::isVMTrapBreakpoint):
(JSC::DFG::CommonData::finalizeCatchEntrypoints):
(JSC::DFG::CommonData::notifyCompilingStructureTransition): Deleted.

  • dfg/DFGCommonData.h:

(JSC::DFG::CommonData::catchOSREntryDataForBytecodeIndex):
(JSC::DFG::CommonData::appendCatchEntrypoint): Deleted.

  • dfg/DFGDesiredIdentifiers.cpp:

(JSC::DFG::DesiredIdentifiers::reallyAdd):

  • dfg/DFGDesiredTransitions.cpp:

(JSC::DFG::DesiredTransition::DesiredTransition):
(JSC::DFG::DesiredTransitions::DesiredTransitions):
(JSC::DFG::DesiredTransitions::addLazily):
(JSC::DFG::DesiredTransitions::reallyAdd):
(JSC::DFG::DesiredTransition::reallyAdd): Deleted.

  • dfg/DFGDesiredTransitions.h:
  • dfg/DFGDesiredWeakReferences.cpp:

(JSC::DFG::DesiredWeakReferences::reallyAdd):

  • dfg/DFGGraph.h:
  • dfg/DFGJITCompiler.cpp:

(JSC::DFG::JITCompiler::link):
(JSC::DFG::JITCompiler::noticeCatchEntrypoint):

  • dfg/DFGOSREntry.h:
  • dfg/DFGPlan.cpp:

(JSC::DFG::Plan::Plan):
(JSC::DFG::Plan::finalizeWithoutNotifyingCallback):

  • dfg/DFGSpeculativeJIT.cpp:

(JSC::DFG::SpeculativeJIT::linkOSREntries):

  • dfg/DFGSpeculativeJIT32_64.cpp:

(JSC::DFG::SpeculativeJIT::compile):

  • dfg/DFGSpeculativeJIT64.cpp:

(JSC::DFG::SpeculativeJIT::compile):

  • ftl/FTLCompile.cpp:

(JSC::FTL::compile):

  • ftl/FTLLowerDFGToB3.cpp:

(JSC::FTL::DFG::LowerDFGToB3::compilePutStructure):
(JSC::FTL::DFG::LowerDFGToB3::compileMultiPutByOffset):
(JSC::FTL::DFG::LowerDFGToB3::compileInvalidationPoint):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/dfg/DFGDesiredIdentifiers.cpp

    r261895 r276005  
    8888void DesiredIdentifiers::reallyAdd(VM& vm, CommonData* commonData)
    8989{
     90    unsigned index = 0;
     91    FixedVector<Identifier> identifiers(m_addedIdentifiers.size());
    9092    for (auto rep : m_addedIdentifiers) {
    9193        ASSERT(rep->hasAtLeastOneRef());
    92         Identifier uid = Identifier::fromUid(vm, rep);
    93         {
    94             ConcurrentJSLocker locker(m_codeBlock->m_lock);
    95             commonData->dfgIdentifiers.append(WTFMove(uid));
    96         }
     94        identifiers[index++] = Identifier::fromUid(vm, rep);
     95    }
     96    if (!identifiers.isEmpty()) {
     97        ConcurrentJSLocker locker(m_codeBlock->m_lock);
     98        ASSERT(commonData->m_dfgIdentifiers.isEmpty());
     99        commonData->m_dfgIdentifiers = WTFMove(identifiers);
    97100    }
    98101}
Note: See TracChangeset for help on using the changeset viewer.