Ignore:
Timestamp:
May 22, 2008, 3:09:43 PM (17 years ago)
Author:
[email protected]
Message:

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

Reviewed by Sam.

<rdar://problem/5951561> Turn on JavaScript Profiler
Get basic JS profiling working.
Even with this patch the profiler will not be compiled in because we do
not know the extend, if any, of the performance regression it would cause
when it is not in use. However with these changes, if the profiler were
on, it would not crash and show good profiling data.

  • VM/Machine.cpp: Instrument the calls sites that are needed for profiling. (KJS::callEval): (KJS::Machine::unwindCallFrame): (KJS::Machine::execute): (KJS::Machine::privateExecute):
  • kjs/function.cpp: Ditto. (KJS::globalFuncEval):
  • kjs/interpreter.cpp: Ditto. (KJS::Interpreter::evaluate):
  • profiler/Profile.cpp: (KJS::Profile::willExecute): (KJS::Profile::didExecute): Because we do not get a good context when startProfiling is called it is possible that m_currentNode will be at the top of the known stack when a didExecute() is called. What we then do is create a new node that represents the function being exited and insert it between the head and the currently known children, since they should be children of this new node.
  • profiler/ProfileNode.cpp: (KJS::ProfileNode::ProfileNode): (KJS::ProfileNode::willExecute): Rename the add function for consistency. (KJS::ProfileNode::addChild): Appends the child to this node but also sets the parent pointer of the children to this node. (KJS::ProfileNode::insertNode): Insert a node between this node and its children. Also set the time for the new node since it is now exiting and we don't really know when it started. (KJS::ProfileNode::stopProfiling): (KJS::ProfileNode::startTimer):
  • profiler/ProfileNode.h: (KJS::CallIdentifier::toString): Added for debugging. (KJS::ProfileNode::setParent): (KJS::ProfileNode::setSelfTime): Fixed an old bug where we set the visibleTotalTime not the visibleSelfTime. (KJS::ProfileNode::children): (KJS::ProfileNode::toString): Added for debugging.
  • profiler/Profiler.cpp: remove unecessary calls. (KJS::Profiler::startProfiling):
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/interpreter.cpp

    r33979 r34036  
    7070    UString errMsg;
    7171
    72 #if JAVASCRIPT_PROFILING
    73     Profiler::profiler()->willExecute(exec, sourceURL, startingLineNumber);
    74 #endif
    75 
    7672    RefPtr<ProgramNode> programNode = parser().parse<ProgramNode>(exec, sourceURL, startingLineNumber, source, &sourceId, &errLine, &errMsg);
    7773
     
    8480    JSValue* exception = 0;
    8581    JSValue* result = machine().execute(programNode.get(), exec, scopeChain.node(), thisObj, &exec->dynamicGlobalObject()->registerFileStack(), &exception);
    86 
    87 #if JAVASCRIPT_PROFILING
    88     Profiler::profiler()->didExecute(exec, sourceURL, startingLineNumber);
    89 #endif
    9082
    9183    return exception ? Completion(Throw, exception) : Completion(Normal, result);
Note: See TracChangeset for help on using the changeset viewer.