Changeset 173262 in webkit for trunk/Source/JavaScriptCore/profiler/ProfileNode.h
- Timestamp:
- Sep 4, 2014, 10:00:22 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/profiler/ProfileNode.h
r173199 r173262 64 64 65 65 double startTime() const { return m_startTime; } 66 void setStartTime(double time) { m_startTime = time; } 66 void setStartTime(double time) 67 { 68 ASSERT_ARG(time, time >= 0.0); 69 m_startTime = time; 70 } 67 71 68 72 double totalTime() const { return m_totalTime; } 69 void setTotalTime(double time) { m_totalTime = time; } 73 void setTotalTime(double time) 74 { 75 ASSERT_ARG(time, time >= 0.0); 76 m_totalTime = time; 77 } 70 78 71 79 private: … … 76 84 bool operator==(ProfileNode* node) { return m_callIdentifier == node->callIdentifier(); } 77 85 78 ProfileNode* willExecute(ExecState* callerCallFrame, const CallIdentifier&);79 ProfileNode* didExecute();80 81 void stopProfiling();82 83 // CallIdentifier members84 86 ExecState* callerCallFrame() const { return m_callerCallFrame; } 85 87 const CallIdentifier& callIdentifier() const { return m_callIdentifier; } … … 90 92 unsigned columnNumber() const { return m_callIdentifier.columnNumber(); } 91 93 92 // Relationships93 94 ProfileNode* parent() const { return m_parent; } 94 95 void setParent(ProfileNode* parent) { m_parent = parent; } 95 96 96 ProfileNode* nextSibling() const { return m_nextSibling; }97 void setNextSibling(ProfileNode* nextSibling) { m_nextSibling = nextSibling; }98 99 97 const Vector<Call>& calls() const { return m_calls; } 100 98 Call& lastCall() { ASSERT(!m_calls.isEmpty()); return m_calls.last(); } 101 size_t numberOfCalls() const { return m_calls.size(); }99 void appendCall(Call call) { m_calls.append(call); } 102 100 103 // Children members104 101 const Vector<RefPtr<ProfileNode>>& children() const { return m_children; } 105 ProfileNode* firstChild() const { return m_children.size() ? m_children.first().get() : 0; } 106 ProfileNode* lastChild() const { return m_children.size() ? m_children.last().get() : 0; } 102 ProfileNode* firstChild() const { return m_children.size() ? m_children.first().get() : nullptr; } 103 ProfileNode* lastChild() const { return m_children.size() ? m_children.last().get() : nullptr; } 104 107 105 void removeChild(ProfileNode*); 108 void addChild(PassRefPtr<ProfileNode> prpChild); 109 void insertNode(PassRefPtr<ProfileNode> prpNode); 110 111 template <typename Functor> void forEachNodePostorder(Functor&); 106 void addChild(PassRefPtr<ProfileNode>); 107 // Reparent our child nodes to the passed node, and make it a child node of |this|. 108 void spliceNode(PassRefPtr<ProfileNode>); 112 109 113 110 #ifndef NDEBUG … … 117 114 }; 118 115 119 const char* c_str() const { return m_callIdentifier; }120 116 // Use these functions to dump the subtree rooted at this node. 121 117 void debugPrint(); … … 123 119 124 120 // These are used to recursively print entire subtrees using precomputed self and total times. 121 template <typename Functor> void forEachNodePostorder(Functor&); 122 125 123 void debugPrintRecursively(int indentLevel, const ProfileSubtreeData&); 126 124 double debugPrintSampleStyleRecursively(int indentLevel, FunctionCallHashCount&, const ProfileSubtreeData&); … … 133 131 ProfileNode(ExecState* callerCallFrame, ProfileNode* nodeToCopy); 134 132 135 void startTimer(); 136 void resetChildrensSiblings(); 137 void endAndRecordCall(); 133 #ifndef NDEBUG 134 ProfileNode* nextSibling() const { return m_nextSibling; } 135 void setNextSibling(ProfileNode* nextSibling) { m_nextSibling = nextSibling; } 136 138 137 ProfileNode* traverseNextNodePostOrder() const; 138 #endif 139 139 140 140 ExecState* m_callerCallFrame; 141 141 CallIdentifier m_callIdentifier; 142 142 ProfileNode* m_parent; 143 ProfileNode* m_nextSibling;144 145 143 Vector<Call> m_calls; 146 144 Vector<RefPtr<ProfileNode>> m_children; 145 146 #ifndef NDEBUG 147 ProfileNode* m_nextSibling; 148 #endif 147 149 }; 148 150 151 #ifndef NDEBUG 149 152 template <typename Functor> inline void ProfileNode::forEachNodePostorder(Functor& functor) 150 153 { … … 163 166 } 164 167 165 #ifndef NDEBUG166 168 struct CalculateProfileSubtreeDataFunctor { 167 169 void operator()(ProfileNode* node)
Note:
See TracChangeset
for help on using the changeset viewer.