CallEdgeProfile::visitWeak() shouldn't attempt to despecify empty profiles
authorfpizlo@apple.com <fpizlo@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 4 Sep 2014 00:28:50 +0000 (00:28 +0000)
committerfpizlo@apple.com <fpizlo@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 4 Sep 2014 00:28:50 +0000 (00:28 +0000)
https://bugs.webkit.org/show_bug.cgi?id=136511

Reviewed by Geoffrey Garen.

* bytecode/CallEdgeProfile.cpp:
(JSC::CallEdgeProfile::worthDespecifying):
(JSC::CallEdgeProfile::visitWeak):
(JSC::CallEdgeProfile::mergeBack):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@173244 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/bytecode/CallEdgeProfile.cpp

index c98a781..b86ad2f 100644 (file)
@@ -1,3 +1,15 @@
+2014-09-03  Filip Pizlo  <fpizlo@apple.com>
+
+        CallEdgeProfile::visitWeak() shouldn't attempt to despecify empty profiles
+        https://bugs.webkit.org/show_bug.cgi?id=136511
+
+        Reviewed by Geoffrey Garen.
+
+        * bytecode/CallEdgeProfile.cpp:
+        (JSC::CallEdgeProfile::worthDespecifying):
+        (JSC::CallEdgeProfile::visitWeak):
+        (JSC::CallEdgeProfile::mergeBack):
+
 2014-09-03  David Kilzer  <ddkilzer@apple.com>
 
         REGRESSION (r167325): (null) entry added to Xcode project file when JSBoundFunction.h was removed
index 2d402aa..c20b5c4 100644 (file)
@@ -95,17 +95,23 @@ bool CallEdgeProfile::worthDespecifying()
     if (m_closuresAreDespecified)
         return false;
     
-    if (!!m_primaryCallee && !JSC::worthDespecifying(m_primaryCallee))
-        return false;
+    bool didSeeEntry = false;
+    
+    if (!!m_primaryCallee) {
+        didSeeEntry = true;
+        if (!JSC::worthDespecifying(m_primaryCallee))
+            return false;
+    }
     
     if (m_otherCallees) {
         for (unsigned i = m_otherCallees->m_processed.size(); i--;) {
+            didSeeEntry = true;
             if (!JSC::worthDespecifying(m_otherCallees->m_processed[i].callee()))
                 return false;
         }
     }
     
-    return true;
+    return didSeeEntry;
 }
 
 void CallEdgeProfile::visitWeak()
@@ -131,7 +137,7 @@ void CallEdgeProfile::visitWeak()
         }
         
         Vector<CallSpectrum::KeyAndCount> list = newSpectrum.buildList();
-        ASSERT(list.size());
+        RELEASE_ASSERT(list.size());
         m_primaryCallee = list.last().key;
         m_numCallsToPrimary = list.last().count;
         
@@ -207,8 +213,8 @@ void CallEdgeProfile::mergeBack()
 {
     ConcurrentJITLocker locker(m_lock);
     
-    ASSERT(m_otherCallees);
-    ASSERT(m_otherCallees->m_temporarySpectrum);
+    RELEASE_ASSERT(m_otherCallees);
+    RELEASE_ASSERT(m_otherCallees->m_temporarySpectrum);
     
     if (!!m_primaryCallee)
         m_otherCallees->m_temporarySpectrum->add(m_primaryCallee, m_numCallsToPrimary);