Changeset 36113 in webkit for trunk/JavaScriptCore


Ignore:
Timestamp:
Sep 5, 2008, 10:52:39 AM (17 years ago)
Author:
[email protected]
Message:

2008-09-05 Kevin McCullough <[email protected]>

Reviewed by Sam and Alexey.

Make the profiler work with a null exec state. This will allow other
applications start the profiler to get DTrace probes going without
needing a WebView.

  • ChangeLog:
  • profiler/ProfileGenerator.cpp: (KJS::ProfileGenerator::ProfileGenerator): (KJS::ProfileGenerator::willExecute): (KJS::ProfileGenerator::didExecute):
  • profiler/Profiler.cpp: (KJS::Profiler::startProfiling): (KJS::Profiler::stopProfiling): (KJS::dispatchFunctionToProfiles):
Location:
trunk/JavaScriptCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r36106 r36113  
     12008-09-05  Kevin McCullough  <[email protected]>
     2
     3        Reviewed by Sam and Alexey.
     4
     5        Make the profiler work with a null exec state.  This will allow other
     6        applications start the profiler to get DTrace probes going without
     7        needing a WebView.
     8
     9        * ChangeLog:
     10        * profiler/ProfileGenerator.cpp:
     11        (KJS::ProfileGenerator::ProfileGenerator):
     12        (KJS::ProfileGenerator::willExecute):
     13        (KJS::ProfileGenerator::didExecute):
     14        * profiler/Profiler.cpp:
     15        (KJS::Profiler::startProfiling):
     16        (KJS::Profiler::stopProfiling):
     17        (KJS::dispatchFunctionToProfiles):
     18
    1192008-09-04  Gavin Barraclough  <[email protected]>
    220
  • trunk/JavaScriptCore/profiler/ProfileGenerator.cpp

    r36068 r36113  
    4646
    4747ProfileGenerator::ProfileGenerator(const UString& title, ExecState* originatingExec, unsigned uid)
    48     : m_originatingGlobalExec(originatingExec->lexicalGlobalObject()->globalExec())
    49     , m_profileGroup(originatingExec->lexicalGlobalObject()->profileGroup())
    50 
     48    : m_originatingGlobalExec(originatingExec ? originatingExec->lexicalGlobalObject()->globalExec() : 0)
     49    , m_profileGroup(originatingExec ? originatingExec->lexicalGlobalObject()->profileGroup() : 0)
    5150{
    5251    m_profile = Profile::create(title, uid);
    5352    m_currentNode = m_head = m_profile->head();
    54 
    55     addParentForConsoleStart(originatingExec);
     53    if (originatingExec)
     54        addParentForConsoleStart(originatingExec);
    5655}
    5756
     
    8180    }
    8281
     82    if (!m_originatingGlobalExec)
     83        return;
     84
    8385    ASSERT_ARG(m_currentNode, m_currentNode);
    8486    m_currentNode = m_currentNode->willExecute(callIdentifier);
     
    9294        JAVASCRIPTCORE_PROFILE_DID_EXECUTE(m_profileGroup, const_cast<char*>(name.c_str()), const_cast<char*>(url.c_str()), callIdentifier.m_lineNumber);
    9395    }
     96
     97    if (!m_originatingGlobalExec)
     98        return;
    9499
    95100    ASSERT_ARG(m_currentNode, m_currentNode);
  • trunk/JavaScriptCore/profiler/Profiler.cpp

    r36068 r36113  
    5959void Profiler::startProfiling(ExecState* exec, const UString& title)
    6060{
    61     ASSERT_ARG(exec, exec);
    62 
    6361    // Check if we currently have a Profile for this global ExecState and title.
    6462    // If so return early and don't create a new Profile.
    65     ExecState* globalExec = exec->lexicalGlobalObject()->globalExec();
     63    ExecState* globalExec = exec ? exec->lexicalGlobalObject()->globalExec() : 0;
     64
    6665    for (size_t i = 0; i < m_currentProfiles.size(); ++i) {
    6766        ProfileGenerator* profileGenerator = m_currentProfiles[i].get();
     
    7776PassRefPtr<Profile> Profiler::stopProfiling(ExecState* exec, const UString& title)
    7877{
    79     ExecState* globalExec = exec->lexicalGlobalObject()->globalExec();
     78    ExecState* globalExec = exec ? exec->lexicalGlobalObject()->globalExec() : 0;
    8079    for (ptrdiff_t i = m_currentProfiles.size() - 1; i >= 0; --i) {
    8180        ProfileGenerator* profileGenerator = m_currentProfiles[i].get();
     
    9897{
    9998    for (size_t i = 0; i < profiles.size(); ++i) {
    100         if (profiles[i]->profileGroup() == currentProfileTargetGroup)
     99        if (profiles[i]->profileGroup() == currentProfileTargetGroup || !profiles[i]->originatingGlobalExec())
    101100            (profiles[i].get()->*function)(callIdentifier);
    102101    }
Note: See TracChangeset for help on using the changeset viewer.