]> git.saurik.com Git - apple/javascriptcore.git/blobdiff - bytecode/DFGExitProfile.cpp
JavaScriptCore-1218.tar.gz
[apple/javascriptcore.git] / bytecode / DFGExitProfile.cpp
index 69fdc37371989d515eaa12e4889cb12af543e6b6..d36878fc9e5bbdab7d8421d0cfeb3407a13764c5 100644 (file)
@@ -55,6 +55,33 @@ bool ExitProfile::add(const FrequentExitSite& site)
     return true;
 }
 
+Vector<FrequentExitSite> ExitProfile::exitSitesFor(unsigned bytecodeIndex)
+{
+    Vector<FrequentExitSite> 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 FrequentExitSite& site) const
+{
+    if (!m_frequentExitSites)
+        return false;
+    
+    for (unsigned i = m_frequentExitSites->size(); i--;) {
+        if (m_frequentExitSites->at(i) == site)
+            return true;
+    }
+    return false;
+}
+
 QueryableExitProfile::QueryableExitProfile(const ExitProfile& profile)
 {
     if (!profile.m_frequentExitSites)