⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 283387 in webkit


Ignore:
Timestamp:
Oct 1, 2021, 11:51:43 AM (5 years ago)
Author:
ysuzuki@apple.com
Message:

[JSC] Remove CodeBlock::m_numberOfNonArgumentValueProfiles since we can get the same value from UnlinkedCodeBlock
https://bugs.webkit.org/show_bug.cgi?id=231066

Reviewed by Robin Morisset.

Since UnlinkedCodeBlock has UnlinkedValueProfile FixedVector, we can get CodeBlock::m_numberOfNonArgumentValueProfiles
from UnlinkedCodeBlock. So CodeBlock does not need to keep it in its member.
We also reorder some fields to shrink sizeof(CodeBlock) after this change.

  • bytecode/CodeBlock.cpp:

(JSC::CodeBlock::CodeBlock):
(JSC::CodeBlock::finishCreation):

  • bytecode/CodeBlock.h:

(JSC::CodeBlock::numberOfNonArgumentValueProfiles):
(JSC::CodeBlock::totalNumberOfValueProfiles):

  • bytecode/UnlinkedCodeBlock.h:

(JSC::UnlinkedCodeBlock::numberOfValueProfiles const):
(JSC::UnlinkedCodeBlock::numberOfArrayProfiles const):

Location:
trunk/Source/JavaScriptCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r283366 r283387  
     12021-10-01  Yusuke Suzuki  <ysuzuki@apple.com>
     2
     3        [JSC] Remove CodeBlock::m_numberOfNonArgumentValueProfiles since we can get the same value from UnlinkedCodeBlock
     4        https://bugs.webkit.org/show_bug.cgi?id=231066
     5
     6        Reviewed by Robin Morisset.
     7
     8        Since UnlinkedCodeBlock has UnlinkedValueProfile FixedVector, we can get CodeBlock::m_numberOfNonArgumentValueProfiles
     9        from UnlinkedCodeBlock. So CodeBlock does not need to keep it in its member.
     10        We also reorder some fields to shrink sizeof(CodeBlock) after this change.
     11
     12        * bytecode/CodeBlock.cpp:
     13        (JSC::CodeBlock::CodeBlock):
     14        (JSC::CodeBlock::finishCreation):
     15        * bytecode/CodeBlock.h:
     16        (JSC::CodeBlock::numberOfNonArgumentValueProfiles):
     17        (JSC::CodeBlock::totalNumberOfValueProfiles):
     18        * bytecode/UnlinkedCodeBlock.h:
     19        (JSC::UnlinkedCodeBlock::numberOfValueProfiles const):
     20        (JSC::UnlinkedCodeBlock::numberOfArrayProfiles const):
     21
    1222021-10-01  Olivier Blin  <olivier.blin@softathome.com>
    223
  • trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp

    r283236 r283387  
    296296    , m_functionDecls(other.m_functionDecls)
    297297    , m_functionExprs(other.m_functionExprs)
    298     , m_osrExitCounter(0)
    299     , m_optimizationDelayCounter(0)
    300     , m_reoptimizationRetryCounter(0)
    301298    , m_metadata(other.m_metadata)
    302299    , m_creationTime(MonotonicTime::now())
     
    344341    , m_vm(&vm)
    345342    , m_instructionsRawPointer(unlinkedCodeBlock->instructions().rawPointer())
    346     , m_osrExitCounter(0)
    347     , m_optimizationDelayCounter(0)
    348     , m_reoptimizationRetryCounter(0)
    349343    , m_metadata(unlinkedCodeBlock->metadata().link())
    350344    , m_creationTime(MonotonicTime::now())
     
    438432    auto link_profile = [&](const auto& /*instruction*/, auto /*bytecode*/, auto& metadata) {
    439433        static_assert(std::is_same_v<ValueProfile, decltype(metadata.m_profile)>);
    440         m_numberOfNonArgumentValueProfiles++;
    441434    };
    442435
     
    537530        case op_iterator_open: {
    538531            INITIALIZE_METADATA(OpIteratorOpen)
    539 
    540             m_numberOfNonArgumentValueProfiles += 3;
    541532            break;
    542533        }
     
    544535        case op_iterator_next: {
    545536            INITIALIZE_METADATA(OpIteratorNext)
    546 
    547             m_numberOfNonArgumentValueProfiles += 3;
    548537            break;
    549538        }
  • trunk/Source/JavaScriptCore/bytecode/CodeBlock.h

    r283236 r283387  
    918918    template<typename Visitor> void visitOSRExitTargets(const ConcurrentJSLocker&, Visitor&);
    919919
    920     unsigned numberOfNonArgumentValueProfiles() { return m_numberOfNonArgumentValueProfiles; }
    921     unsigned totalNumberOfValueProfiles() { return numberOfArgumentValueProfiles() + numberOfNonArgumentValueProfiles(); }
     920    unsigned numberOfNonArgumentValueProfiles() { return totalNumberOfValueProfiles() - numberOfArgumentValueProfiles(); }
     921    unsigned totalNumberOfValueProfiles() { return m_unlinkedCode->numberOfValueProfiles(); }
    922922    ValueProfile* tryGetValueProfileForBytecodeIndex(BytecodeIndex);
    923923
     
    943943    unsigned m_numParameters;
    944944    unsigned m_numberOfArgumentsToSkip { 0 };
    945     unsigned m_numberOfNonArgumentValueProfiles { 0 };
     945    uint32_t m_osrExitCounter { 0 };
    946946    union {
    947947        unsigned m_debuggerRequests;
     
    990990
    991991    BaselineExecutionCounter m_jitExecuteCounter;
    992     uint32_t m_osrExitCounter;
    993 
    994     uint16_t m_optimizationDelayCounter;
    995     uint16_t m_reoptimizationRetryCounter;
     992
     993    uint16_t m_optimizationDelayCounter { 0 };
     994    uint16_t m_reoptimizationRetryCounter { 0 };
    996995
    997996    RefPtr<MetadataTable> m_metadata;
  • trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.h

    r283168 r283387  
    356356    UnlinkedValueProfile& unlinkedValueProfile(unsigned index) { return m_valueProfiles[index]; }
    357357    UnlinkedArrayProfile& unlinkedArrayProfile(unsigned index) { return m_arrayProfiles[index]; }
     358    unsigned numberOfValueProfiles() const { return m_valueProfiles.size(); }
     359    unsigned numberOfArrayProfiles() const { return m_arrayProfiles.size(); }
    358360
    359361#if ASSERT_ENABLED
Note: See TracChangeset for help on using the changeset viewer.