X-Git-Url: https://git.saurik.com/apple/javascriptcore.git/blobdiff_plain/6fe7ccc865dc7d7541b93c5bcaf6368d2c98a174..ed1e77d3adeb83d26fd1dfb16dd84cabdcefd250:/bytecode/DFGExitProfile.cpp?ds=inline diff --git a/bytecode/DFGExitProfile.cpp b/bytecode/DFGExitProfile.cpp index 69fdc37..40a25ce 100644 --- a/bytecode/DFGExitProfile.cpp +++ b/bytecode/DFGExitProfile.cpp @@ -26,19 +26,21 @@ #include "config.h" #include "DFGExitProfile.h" -#include +#if ENABLE(DFG_JIT) namespace JSC { namespace DFG { ExitProfile::ExitProfile() { } ExitProfile::~ExitProfile() { } -bool ExitProfile::add(const FrequentExitSite& site) +bool ExitProfile::add(const ConcurrentJITLocker&, const FrequentExitSite& site) { + ASSERT(site.jitType() != ExitFromAnything); + // If we've never seen any frequent exits then create the list and put this site // into it. if (!m_frequentExitSites) { - m_frequentExitSites = adoptPtr(new Vector()); + m_frequentExitSites = std::make_unique>(); m_frequentExitSites->append(site); return true; } @@ -55,7 +57,37 @@ bool ExitProfile::add(const FrequentExitSite& site) return true; } -QueryableExitProfile::QueryableExitProfile(const ExitProfile& profile) +Vector ExitProfile::exitSitesFor(unsigned bytecodeIndex) +{ + Vector result; + + if (!m_frequentExitSites) + return result; + + for (unsigned i = 0; i < m_frequentExitSites->size(); ++i) { + if (m_frequentExitSites->at(i).bytecodeOffset() == bytecodeIndex) + result.append(m_frequentExitSites->at(i)); + } + + return result; +} + +bool ExitProfile::hasExitSite(const ConcurrentJITLocker&, const FrequentExitSite& site) const +{ + if (!m_frequentExitSites) + return false; + + for (unsigned i = m_frequentExitSites->size(); i--;) { + if (site.subsumes(m_frequentExitSites->at(i))) + return true; + } + return false; +} + +QueryableExitProfile::QueryableExitProfile() { } +QueryableExitProfile::~QueryableExitProfile() { } + +void QueryableExitProfile::initialize(const ConcurrentJITLocker&, const ExitProfile& profile) { if (!profile.m_frequentExitSites) return; @@ -64,6 +96,6 @@ QueryableExitProfile::QueryableExitProfile(const ExitProfile& profile) m_frequentExitSites.add(profile.m_frequentExitSites->at(i)); } -QueryableExitProfile::~QueryableExitProfile() { } - } } // namespace JSC::DFG + +#endif