Changeset 33581 in webkit for trunk/JavaScriptCore/profiler/Profile.cpp
- Timestamp:
- May 19, 2008, 3:15:30 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/profiler/Profile.cpp
r33466 r33581 36 36 namespace KJS { 37 37 38 typedef Vector<UString>::const_iterator NameIterator;39 40 38 Profile::Profile(const UString& title) 41 39 : m_title(title) … … 46 44 } 47 45 46 // The callStackNames are in order of bottom of the stack to top of the stack so we iterate it backwards. 48 47 void Profile::willExecute(const Vector<UString>& callStackNames) 49 48 { 50 49 RefPtr<ProfileNode> callTreeInsertionPoint; 51 50 RefPtr<ProfileNode> foundNameInTree = m_callTree; 52 NameIterator callStackLocation = callStackNames.begin();53 51 54 while (callStackLocation != callStackNames.end() && foundNameInTree) { 52 int i = callStackNames.size(); 53 while (foundNameInTree && i) { 55 54 callTreeInsertionPoint = foundNameInTree; 56 foundNameInTree = callTreeInsertionPoint->findChild(*callStackLocation); 57 ++callStackLocation; 55 foundNameInTree = callTreeInsertionPoint->findChild(callStackNames[--i]); 58 56 } 59 57 60 58 if (!foundNameInTree) { // Insert remains of the stack into the call tree. 61 --callStackLocation; 62 for (RefPtr<ProfileNode> next; callStackLocation != callStackNames.end(); ++callStackLocation) { 63 next = ProfileNode::create(*callStackLocation); 59 for (RefPtr<ProfileNode> next; i >= 0; callTreeInsertionPoint = next) { 60 next = ProfileNode::create(callStackNames[i--]); 64 61 callTreeInsertionPoint->addChild(next); 65 callTreeInsertionPoint = next;66 62 } 67 63 } else // We are calling a function that is already in the call tree. … … 71 67 void Profile::didExecute(const Vector<UString>& stackNames) 72 68 { 73 m_callTree->didExecute(stackNames, 0); 69 ASSERT(stackNames.size()); 70 if (!stackNames.size()) 71 return; 72 73 m_callTree->didExecute(stackNames, stackNames.size() - 1); 74 74 } 75 75
Note:
See TracChangeset
for help on using the changeset viewer.