Ignore:
Timestamp:
May 13, 2008, 12:35:31 PM (17 years ago)
Author:
[email protected]
Message:

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

Reviewed by Sam.

<rdar://problem/5770054> JavaScript profiler (10928)

  • Made some functions static (as per Adam) and changed from using raw pointers to RefPtr for making these JavaScript Objects.
  • profiler/FunctionCallProfile.cpp: (KJS::FunctionCallProfile::addChild): (KJS::FunctionCallProfile::findChild):
  • profiler/FunctionCallProfile.h: (KJS::FunctionCallProfile::create):
  • profiler/Profile.cpp: (KJS::Profile::Profile): (KJS::Profile::willExecute): (KJS::Profile::didExecute): (KJS::functionNameCountPairComparator):
  • profiler/Profile.h: (KJS::Profile::create): (KJS::Profile::title): (KJS::Profile::callTree):
  • profiler/Profiler.cpp: (KJS::Profiler::startProfiling):
  • profiler/Profiler.h: (KJS::Profiler::allProfiles): (KJS::Profiler::clearProfiles):
File:
1 edited

Legend:

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

    r33007 r33382  
    4343    // FIXME: When multi-threading is supported this will be a vector and calls
    4444    // into the profiler will need to know which thread it is executing on.
    45     m_callTree.set(new FunctionCallProfile("Thread_1"));
     45    m_callTree = FunctionCallProfile::create("Thread_1");
    4646}
    4747
    4848void Profile::willExecute(const Vector<UString>& callStackNames)
    4949{
    50     FunctionCallProfile* callTreeInsertionPoint = 0;
    51     FunctionCallProfile* foundNameInTree = m_callTree.get();
     50    RefPtr<FunctionCallProfile> callTreeInsertionPoint;
     51    RefPtr<FunctionCallProfile> foundNameInTree = m_callTree;
    5252    NameIterator callStackLocation = callStackNames.begin();
    5353
     
    6060    if (!foundNameInTree) {   // Insert remains of the stack into the call tree.
    6161        --callStackLocation;
    62         for (FunctionCallProfile* next; callStackLocation != callStackNames.end(); ++callStackLocation) {
    63             next = new FunctionCallProfile(*callStackLocation);
     62        for (RefPtr<FunctionCallProfile> next; callStackLocation != callStackNames.end(); ++callStackLocation) {
     63            next = FunctionCallProfile::create(*callStackLocation);
    6464            callTreeInsertionPoint->addChild(next);
    6565            callTreeInsertionPoint = next;
     
    6969}
    7070
    71 void Profile::didExecute(Vector<UString> stackNames)
     71void Profile::didExecute(const Vector<UString>& stackNames)
    7272{
    7373    m_callTree->didExecute(stackNames, 0);   
     
    8282typedef pair<UString::Rep*, unsigned> NameCountPair;
    8383
    84 static inline bool functionNameCountPairComparator(const NameCountPair a, const NameCountPair b)
     84static inline bool functionNameCountPairComparator(const NameCountPair& a, const NameCountPair& b)
    8585{
    8686    return a.second > b.second;
Note: See TracChangeset for help on using the changeset viewer.