Ignore:
Timestamp:
Jan 12, 2018, 4:36:37 PM (7 years ago)
Author:
[email protected]
Message:

Move ExitProfile to UnlinkedCodeBlock so it can be shared amongst CodeBlocks backed by the same UnlinkedCodeBlock
https://bugs.webkit.org/show_bug.cgi?id=181545

Reviewed by Michael Saboff.

This patch follows the theme of putting optimization profiling information on
UnlinkedCodeBlock. This allows the unlinked code cache to remember OSR exit data.
This often leads to the first compile of a CodeBlock, backed by an UnlinkedCodeBlock
pulled from the code cache, making better compilation decisions, usually
resulting in fewer exits, and fewer recompilations.

This is a 1% Speedometer progression in my testing.

  • bytecode/BytecodeDumper.cpp:

(JSC::BytecodeDumper<CodeBlock>::dumpProfilesForBytecodeOffset):

  • bytecode/CallLinkStatus.cpp:

(JSC::CallLinkStatus::computeFromLLInt):
(JSC::CallLinkStatus::computeFor):
(JSC::CallLinkStatus::computeExitSiteData):
(JSC::CallLinkStatus::computeDFGStatuses):

  • bytecode/CallLinkStatus.h:
  • bytecode/CodeBlock.h:

(JSC::CodeBlock::addFrequentExitSite): Deleted.
(JSC::CodeBlock::hasExitSite const): Deleted.
(JSC::CodeBlock::exitProfile): Deleted.

  • bytecode/DFGExitProfile.cpp:

(JSC::DFG::ExitProfile::add):
(JSC::DFG::QueryableExitProfile::initialize):

  • bytecode/DFGExitProfile.h:

(JSC::DFG::ExitProfile::hasExitSite const):

  • bytecode/GetByIdStatus.cpp:

(JSC::GetByIdStatus::hasExitSite):
(JSC::GetByIdStatus::computeFor):
(JSC::GetByIdStatus::computeForStubInfo):

  • bytecode/GetByIdStatus.h:
  • bytecode/PutByIdStatus.cpp:

(JSC::PutByIdStatus::hasExitSite):
(JSC::PutByIdStatus::computeFor):
(JSC::PutByIdStatus::computeForStubInfo):

  • bytecode/PutByIdStatus.h:
  • bytecode/UnlinkedCodeBlock.cpp:

(JSC::UnlinkedCodeBlock::livenessAnalysisSlow):

  • bytecode/UnlinkedCodeBlock.h:

(JSC::UnlinkedCodeBlock::hasExitSite const):
(JSC::UnlinkedCodeBlock::hasExitSite):
(JSC::UnlinkedCodeBlock::exitProfile):

  • dfg/DFGByteCodeParser.cpp:

(JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry):

  • dfg/DFGGraph.h:

(JSC::DFG::Graph::hasGlobalExitSite):
(JSC::DFG::Graph::hasExitSite):

  • dfg/DFGLICMPhase.cpp:

(JSC::DFG::LICMPhase::attemptHoist):

  • dfg/DFGOSRExitBase.cpp:

(JSC::DFG::OSRExitBase::considerAddingAsFrequentExitSiteSlow):

File:
1 edited

Legend:

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

    r222827 r226928  
    11/*
    2  * Copyright (C) 2012-2015 Apple Inc. All rights reserved.
     2 * Copyright (C) 2012-2018 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    6666
    6767#if ENABLE(DFG_JIT)
    68 bool GetByIdStatus::hasExitSite(const ConcurrentJSLocker& locker, CodeBlock* profiledBlock, unsigned bytecodeIndex)
    69 {
    70     return profiledBlock->hasExitSite(locker, DFG::FrequentExitSite(bytecodeIndex, BadCache))
    71         || profiledBlock->hasExitSite(locker, DFG::FrequentExitSite(bytecodeIndex, BadConstantCache));
     68bool GetByIdStatus::hasExitSite(CodeBlock* profiledBlock, unsigned bytecodeIndex)
     69{
     70    UnlinkedCodeBlock* unlinkedCodeBlock = profiledBlock->unlinkedCodeBlock();
     71    ConcurrentJSLocker locker(unlinkedCodeBlock->m_lock);
     72    return unlinkedCodeBlock->hasExitSite(locker, DFG::FrequentExitSite(bytecodeIndex, BadCache))
     73        || unlinkedCodeBlock->hasExitSite(locker, DFG::FrequentExitSite(bytecodeIndex, BadConstantCache));
    7274}
    7375#endif
     
    120122    result = computeForStubInfoWithoutExitSiteFeedback(
    121123        locker, profiledBlock, map.get(CodeOrigin(bytecodeIndex)), uid,
    122         CallLinkStatus::computeExitSiteData(locker, profiledBlock, bytecodeIndex));
     124        CallLinkStatus::computeExitSiteData(profiledBlock, bytecodeIndex));
    123125   
    124126    if (!result.takesSlowPath()
    125         && hasExitSite(locker, profiledBlock, bytecodeIndex))
     127        && hasExitSite(profiledBlock, bytecodeIndex))
    126128        return GetByIdStatus(result.makesCalls() ? MakesCalls : TakesSlowPath, true);
    127129#else
     
    140142    GetByIdStatus result = GetByIdStatus::computeForStubInfoWithoutExitSiteFeedback(
    141143        locker, profiledBlock, stubInfo, uid,
    142         CallLinkStatus::computeExitSiteData(locker, profiledBlock, codeOrigin.bytecodeIndex));
    143 
    144     if (!result.takesSlowPath() && GetByIdStatus::hasExitSite(locker, profiledBlock, codeOrigin.bytecodeIndex))
     144        CallLinkStatus::computeExitSiteData(profiledBlock, codeOrigin.bytecodeIndex));
     145
     146    if (!result.takesSlowPath() && GetByIdStatus::hasExitSite(profiledBlock, codeOrigin.bytecodeIndex))
    145147        return GetByIdStatus(result.makesCalls() ? GetByIdStatus::MakesCalls : GetByIdStatus::TakesSlowPath, true);
    146148    return result;
     
    329331            ConcurrentJSLocker locker(profiledBlock->m_lock);
    330332            exitSiteData = CallLinkStatus::computeExitSiteData(
    331                 locker, profiledBlock, codeOrigin.bytecodeIndex);
     333                profiledBlock, codeOrigin.bytecodeIndex);
    332334        }
    333335       
     
    342344            return result;
    343345   
    344         {
    345             ConcurrentJSLocker locker(profiledBlock->m_lock);
    346             if (hasExitSite(locker, profiledBlock, codeOrigin.bytecodeIndex))
    347                 return GetByIdStatus(TakesSlowPath, true);
    348         }
     346        if (hasExitSite(profiledBlock, codeOrigin.bytecodeIndex))
     347            return GetByIdStatus(TakesSlowPath, true);
    349348       
    350349        if (result.isSet())
Note: See TracChangeset for help on using the changeset viewer.