Changeset 36058 in webkit for trunk/JavaScriptCore/VM/Machine.cpp


Ignore:
Timestamp:
Sep 3, 2008, 10:35:42 AM (17 years ago)
Author:
[email protected]
Message:

JavaScriptCore:

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

Reviewed by Darin and Tim.

Remove most of the "zombie" mode from the profiler. Next we will need
to remove the client callback mechanism in profiles.

  • This simplifies the code, leverages the recent changes I've made in getting line numbers from SquirrelFish, and is a slight speed improvement on SunSpider.
  • Also the "zombie" mode was a constant source of odd edge cases and obscure bugs so it's good to remove since all of its issues may not have been found.
  • API/JSProfilerPrivate.cpp: No need to call didFinishAllExecution() any more. (JSEndProfiling):
  • JavaScriptCore.exp: Export the new signature of retrieveLastCaller()
  • VM/Machine.cpp: (KJS::Machine::execute): No need to call didFinishAllExecution() any more. (KJS::Machine::retrieveCaller): Now operates on InternalFunctions now since the RegisterFile is no longer guaranteeded to store only JSFunctions (KJS::Machine::retrieveLastCaller): Now also retrieve the function's name (KJS::Machine::callFrame): A result of changing retrieveCaller()
  • VM/Machine.h:
  • VM/Register.h:
  • kjs/JSGlobalObject.cpp: (KJS::JSGlobalObject::~JSGlobalObject):
  • kjs/nodes.h:
  • profiler/ProfileGenerator.cpp: (KJS::ProfileGenerator::create): Now pass the original exec and get the global exec and client when necessary. We need the original exec so we can have the stack frame where profiling started. (KJS::ProfileGenerator::ProfileGenerator): ditto. (KJS::ProfileGenerator::addParentForConsoleStart): This is where the parent to star of the profile is added, if there is one. (KJS::ProfileGenerator::willExecute): Remove uglyness! (KJS::ProfileGenerator::didExecute): Ditto! (KJS::ProfileGenerator::stopProfiling): (KJS::ProfileGenerator::removeProfileStart): Use a better way to find and remove the function we are looking for. (KJS::ProfileGenerator::removeProfileEnd): Ditto.
  • profiler/ProfileGenerator.h: (KJS::ProfileGenerator::client):
  • profiler/ProfileNode.cpp: (KJS::ProfileNode::removeChild): Add a better way to remove a child from a ProfileNode. (KJS::ProfileNode::stopProfiling): (KJS::ProfileNode::debugPrintData): Modified a debug-only diagnostic function to be sane.
  • profiler/ProfileNode.h:
  • profiler/Profiler.cpp: Change to pass the original exec state. (KJS::Profiler::startProfiling): (KJS::Profiler::stopProfiling): (KJS::Profiler::willExecute): (KJS::Profiler::didExecute): (KJS::Profiler::createCallIdentifier):
  • profiler/Profiler.h:

WebCore:

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

Reviewed by Darin and Tim.

Remove most of the "zombie" mode from the profiler. Next we will need
to remove the client callback mechanism in profiles.

  • These changes are a result of changes to JSCore.
  • manual-tests/inspector/profiler-test-nested-start-and-stop-profiler.html:
  • page/Console.cpp: (WebCore::retrieveLastCaller): (WebCore::Console::profileEnd):
  • page/InspectorController.cpp: (WebCore::InspectorController::stopUserInitiatedProfiling):
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/VM/Machine.cpp

    r36055 r36058  
    798798    MACHINE_SAMPLING_privateExecuteReturned();
    799799
    800     if (*profiler) {
     800    if (*profiler)
    801801        (*profiler)->didExecute(exec, programNode->sourceURL(), programNode->lineNo());
    802         if (!m_reentryDepth)
    803             (*profiler)->didFinishAllExecution(exec);
    804     }
    805802
    806803    if (m_reentryDepth && lastGlobalObject && globalObject != lastGlobalObject)
     
    860857
    861858    MACHINE_SAMPLING_privateExecuteReturned();
    862 
    863     if (*profiler && !m_reentryDepth)
    864         (*profiler)->didFinishAllExecution(exec);
    865859
    866860    m_registerFile.shrink(oldSize);
     
    942936    MACHINE_SAMPLING_privateExecuteReturned();
    943937
    944     if (*profiler) {
     938    if (*profiler)
    945939        (*profiler)->didExecute(exec, evalNode->sourceURL(), evalNode->lineNo());
    946         if (!m_reentryDepth)
    947             (*profiler)->didFinishAllExecution(exec);
    948     }
    949940
    950941    m_registerFile.shrink(oldSize);
     
    34123403}
    34133404
    3414 JSValue* Machine::retrieveCaller(ExecState* exec, JSFunction* function) const
     3405JSValue* Machine::retrieveCaller(ExecState* exec, InternalFunction* function) const
    34153406{
    34163407    Register* callFrame = this->callFrame(exec, function);
     
    34293420}
    34303421
    3431 void Machine::retrieveLastCaller(ExecState* exec, int& lineNumber, int& sourceId, UString& sourceURL) const
    3432 {
     3422void Machine::retrieveLastCaller(ExecState* exec, int& lineNumber, int& sourceId, UString& sourceURL, JSValue*& function) const
     3423{
     3424    function = 0;
    34333425    lineNumber = -1;
    34343426    sourceURL = UString();
     
    34463438    sourceId = callerCodeBlock->ownerNode->sourceId();
    34473439    sourceURL = callerCodeBlock->ownerNode->sourceURL();
    3448 }
    3449 
    3450 Register* Machine::callFrame(ExecState* exec, JSFunction* function) const
     3440
     3441    JSValue* callee = callFrame[RegisterFile::Callee].getJSValue();
     3442    if (callee->toThisObject(exec)->inherits(&InternalFunction::info))
     3443        function = retrieveCaller(exec, static_cast<InternalFunction*>(callee));
     3444}
     3445
     3446Register* Machine::callFrame(ExecState* exec, InternalFunction* function) const
    34513447{
    34523448    Register* callFrame = exec->m_callFrame;
Note: See TracChangeset for help on using the changeset viewer.