Ignore:
Timestamp:
May 20, 2008, 1:59:16 PM (17 years ago)
Author:
[email protected]
Message:

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

Reviewed by Tim.

<rdar://problem/5770054> JavaScript profiler (10928)
Split function name into 3 parts so that the Web Inspector can link it to
the resource location from whence it came.

  • kjs/ustring.cpp: Implemented operator> for UStrings (KJS::operator>):
  • kjs/ustring.h:
  • profiler/Profile.cpp: (KJS::Profile::Profile): Initialize all 3 values. (KJS::Profile::willExecute): Use CallIdentifier struct. (KJS::Profile::didExecute): Ditto.
  • profiler/Profile.h: Ditto and remove unused function.
  • profiler/ProfileNode.cpp: (KJS::ProfileNode::ProfileNode): Use CallIdentifier struct. (KJS::ProfileNode::willExecute): Ditto and fix an issue where we restarted the m_startTime even though it was already started. (KJS::ProfileNode::didExecute): Ditto. (KJS::ProfileNode::findChild): Ditto. (KJS::functionNameDescendingComparator): Ditto and use new comparator. (KJS::functionNameAscendingComparator): Ditto. (KJS::ProfileNode::printDataInspectorStyle): Use CallIdentifier struct. (KJS::ProfileNode::printDataSampleStyle): Ditto.
  • profiler/ProfileNode.h: (KJS::CallIdentifier::CallIdentifier): Describe the CallIdentifier struct (KJS::CallIdentifier::operator== ): (KJS::ProfileNode::create): Use the CallIdentifier struct. (KJS::ProfileNode::callIdentifier): (KJS::ProfileNode::functionName): Now only return the function name, not the url and line number too. (KJS::ProfileNode::url): (KJS::ProfileNode::lineNumber):
  • profiler/Profiler.cpp: Use the CallIdentifier struct. (KJS::Profiler::startProfiling): (KJS::Profiler::willExecute): (KJS::Profiler::didExecute): (KJS::getCallIdentifiers): (KJS::getCallIdentifierFromFunctionImp):
File:
1 edited

Legend:

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

    r33581 r33941  
    4141    // FIXME: When multi-threading is supported this will be a vector and calls
    4242    // into the profiler will need to know which thread it is executing on.
    43     m_callTree = ProfileNode::create("Thread_1");
     43    m_callTree = ProfileNode::create(CallIdentifier("Thread_1", 0, 0));
    4444}
    4545
    46 // The callStackNames are in order of bottom of the stack to top of the stack so we iterate it backwards.
    47 void Profile::willExecute(const Vector<UString>& callStackNames)
     46// The callIdentifiers are in order of bottom of the stack to top of the stack so we iterate it backwards.
     47void Profile::willExecute(const Vector<CallIdentifier>& callIdentifiers)
    4848{
    4949    RefPtr<ProfileNode> callTreeInsertionPoint;
    5050    RefPtr<ProfileNode> foundNameInTree = m_callTree;
    5151
    52     int i = callStackNames.size();
     52    int i = callIdentifiers.size();
    5353    while (foundNameInTree && i) {
    5454        callTreeInsertionPoint = foundNameInTree;
    55         foundNameInTree = callTreeInsertionPoint->findChild(callStackNames[--i]);
     55        foundNameInTree = callTreeInsertionPoint->findChild(callIdentifiers[--i]);
    5656    }
    5757
    5858    if (!foundNameInTree) {   // Insert remains of the stack into the call tree.
    5959        for (RefPtr<ProfileNode> next; i >= 0; callTreeInsertionPoint = next) {
    60             next = ProfileNode::create(callStackNames[i--]);
     60            next = ProfileNode::create(callIdentifiers[i--]);
    6161            callTreeInsertionPoint->addChild(next);
    6262        }
     
    6565}
    6666
    67 void Profile::didExecute(const Vector<UString>& stackNames)
     67void Profile::didExecute(const Vector<CallIdentifier>& callIdentifiers)
    6868{
    69     ASSERT(stackNames.size());
    70     if (!stackNames.size())
     69    if (!callIdentifiers.size())
    7170        return;
    7271
    73     m_callTree->didExecute(stackNames, stackNames.size() - 1);
     72    m_callTree->didExecute(callIdentifiers, callIdentifiers.size() - 1);
    7473}
    7574
Note: See TracChangeset for help on using the changeset viewer.