Ignore:
Timestamp:
Jan 31, 2020, 9:22:47 PM (6 years ago)
Author:
[email protected]
Message:

[JSC] ShrinkToFit some vectors kept by JIT data structures
https://bugs.webkit.org/show_bug.cgi?id=207085

Reviewed by Mark Lam.

  1. We are allocating RareCaseProfile by using SegmentedVector since JIT code is directly accessing to RareCaseProfile*. But when creating RareCaseProfile, we can know how many RareCaseProfiles should we create: RareCaseProfile is created per slow paths of Baseline JIT bytecode. Since we already scan bytecode for the main paths, we can count it and use this number when creating RareCaseProfile.
  2. Vectors held by PolymorphicAccess and PolymorphicCallStubRoutine should be kept small by calling shrinkToFit.
  • bytecode/CodeBlock.cpp:

(JSC::CodeBlock::setRareCaseProfiles):
(JSC::CodeBlock::shrinkToFit):
(JSC::CodeBlock::addRareCaseProfile): Deleted.

  • bytecode/CodeBlock.h:
  • bytecode/PolyProtoAccessChain.cpp:

(JSC::PolyProtoAccessChain::create):

  • bytecode/PolymorphicAccess.cpp:

(JSC::PolymorphicAccess::regenerate):

  • bytecode/ValueProfile.h:

(JSC::RareCaseProfile::RareCaseProfile):

  • jit/JIT.cpp:

(JSC::JIT::privateCompileMainPass):
(JSC::JIT::privateCompileSlowCases):

  • jit/JIT.h:
  • jit/PolymorphicCallStubRoutine.cpp:

(JSC::PolymorphicCallStubRoutine::PolymorphicCallStubRoutine):

File:
1 edited

Legend:

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

    r254934 r255541  
    15781578}
    15791579
    1580 RareCaseProfile* CodeBlock::addRareCaseProfile(BytecodeIndex bytecodeIndex)
     1580void CodeBlock::setRareCaseProfiles(RefCountedArray<RareCaseProfile>&& rareCaseProfiles)
    15811581{
    15821582    ConcurrentJSLocker locker(m_lock);
    1583     auto& jitData = ensureJITData(locker);
    1584     jitData.m_rareCaseProfiles.append(RareCaseProfile(bytecodeIndex));
    1585     return &jitData.m_rareCaseProfiles.last();
     1583    ensureJITData(locker).m_rareCaseProfiles = WTFMove(rareCaseProfiles);
    15861584}
    15871585
     
    19571955    ConcurrentJSLocker locker(m_lock);
    19581956
    1959 #if ENABLE(JIT)
    1960     if (auto* jitData = m_jitData.get())
    1961         jitData->m_rareCaseProfiles.shrinkToFit();
    1962 #endif
    1963    
    19641957    if (shrinkMode == EarlyShrink) {
    19651958        m_constantRegisters.shrinkToFit();
Note: See TracChangeset for help on using the changeset viewer.