Skip to content
  • kmccullough@apple.com's avatar
    JavaScriptCore: · c9005aea
    kmccullough@apple.com authored
    2008-06-20  Kevin McCullough  <kmccullough@apple.com>
    
            Reviewed by Tim.
    
            <rdar://problem/5958770> JSProfiler: Time incorrectly given to (idle)
            if profiling is started and finished within the same function. (19230)
            - Now we profile one more stack frame up from the last frame to allocate
            the time spent in it, if it exists.
    
            * JavaScriptCore.exp:
            * VM/Machine.cpp: We need to let the profiler know when the JS program 
            has finished since that is what will actually stop the profiler instead
            of just calling stopProfiling().
            (KJS::Machine::execute):
            * profiler/Profile.cpp:
            (KJS::Profile::create): Moved from Profile.h since it was getting pretty
            long.
            (KJS::Profile::Profile): We now have a client, which is a listener who
            we will return this profile to, once it has actually finished.
            (KJS::Profile::stopProfiling): Instead of fully stopping the profiler
            here, we set the flag and keep it profiling in the background.
            (KJS::Profile::didFinishAllExecution): This is where the profiler
            actually finishes and creates the (idle) node if one should be made.
            (KJS::Profile::removeProfileStart): Don't use m_currentNode since it is
            needed by the profiler as it runs silently in the background.
            (KJS::Profile::removeProfileEnd): Ditto.
            (KJS::Profile::willExecute): Don't profile new functions if we have
            stopped profiling.
            (KJS::Profile::didExecute): Only record one more return as all the
            remaining time will be attributed to that function.
            (KJS::Profile::setupCurrentNodeAsStopped): Sets the current node's time.
            * profiler/Profile.h: Added functions and variables for the above
            changes.
            (KJS::Profile::client):
            * profiler/ProfileNode.h:
            (KJS::CallIdentifier::toString): Debug method.
            * profiler/Profiler.cpp: Added support for the ProfilerClient.
            (KJS::Profiler::startProfiling):
            (KJS::Profiler::stopProfiling): No longer return sthe profile.
            (KJS::Profiler::didFinishAllExecution): Now returns the profile to the
            client instead of stopProfiling.
            * profiler/Profiler.h:
            (KJS::ProfilerClient::~ProfilerClient): Clients will implement this
            interface.
    
    WebCore:
    
    2008-06-20  Kevin McCullough  <kmccullough@apple.com>
    
            Reviewed by Tim.
    
            <rdar://problem/5958770> JSProfiler: Time incorrectly given to (idle)
            if profiling is started and finished within the same function. (19230)
            - Now we profile one more stack frame up from the last frame to allocate
            the time spent in it, if it exists.
    
            * page/Console.cpp:
            * manual-tests/inspector/profiler-test-start-and-stop-profiling-in-the-same-function.html: Added.
            (WebCore::Console::profile): When stating the profiler give a client for
            the callback of when the profile actually finishes.
            (WebCore::Console::profileEnd): No longer needs to handle the return of
            the profile object since it will be retruned in the client's callback.
            (WebCore::Console::finishedProfiling): Implemenet the ProfileClient
            callback method.
            * page/Console.h: Inherit from the ProfileClient.
            * page/InspectorController.cpp:
            (WebCore::InspectorController::startUserInitiatedProfiling): Use the
            client callback.
            (WebCore::InspectorController::stopUserInitiatedProfiling): Does not
            need to handle the profile being returned as it is now handled by the
            client callback.
            (WebCore::InspectorController::finishedProfiling): Implement the
            ProfileClient callback method.
            * page/InspectorController.h: Inherit from the ProfileClient.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@34696 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    c9005aea