Ignore:
Timestamp:
Jun 20, 2008, 9:39:23 PM (17 years ago)
Author:
[email protected]
Message:

Fixed an ASSERT(m_actualSelfTime <= m_actualTotalTime) when starting
and stopping a profile from the Develop menu. Also prevents
inserting an incorrect parent node as the new head after profiling
is stopped from the Develop menu.

Reviewed by Dan Bernstein.

  • profiler/Profile.cpp: (KJS::Profile::stopProfiling): If the current node is already the head then there is no more need to record future nodes in didExecute. (KJS::Profile::didExecute): Move the code of setupCurrentNodeAsStopped into here since this was the only caller. When setting the total time keep any current total time while adding the self time of the head. (KJS::Profile::setupCurrentNodeAsStopped): Removed.
  • profiler/Profile.h: Removed setupCurrentNodeAsStopped.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/profiler/Profile.cpp

    r34703 r34710  
    6666    removeProfileEnd();
    6767
     68    // Already at the head, set m_currentNode to prevent
     69    // didExecute from recording more nodes.
     70    if (m_currentNode == m_head)
     71        m_currentNode = 0;
     72
    6873    m_stoppedProfiling = true;
    6974}
     
    141146
    142147        if (m_stoppedProfiling) {
    143             setupCurrentNodeAsStopped();
     148            m_currentNode->setTotalTime(m_currentNode->totalTime() + m_head->selfTime());
     149            m_head->setSelfTime(0.0);
     150            m_currentNode->stopProfiling();
    144151            m_currentNode = 0;
    145152        } else
     
    155162
    156163    m_currentNode = m_currentNode->didExecute();
    157 }
    158 
    159 void Profile::setupCurrentNodeAsStopped() {
    160     m_currentNode->setTotalTime(m_head->selfTime());
    161     m_head->setSelfTime(0.0);
    162     m_currentNode->stopProfiling();
    163164}
    164165
Note: See TracChangeset for help on using the changeset viewer.