Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(50)

Side by Side Diff: src/profile-generator.h

Issue 3426008: Show RegExp calls in the profile. (Closed)
Patch Set: Created 10 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/cpu-profiler-inl.h ('k') | src/profile-generator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 const char* resource_name, 93 const char* resource_name,
94 int line_number, 94 int line_number,
95 int security_token_id)); 95 int security_token_id));
96 96
97 INLINE(bool is_js_function() const) { return is_js_function_tag(tag_); } 97 INLINE(bool is_js_function() const) { return is_js_function_tag(tag_); }
98 INLINE(const char* name_prefix() const) { return name_prefix_; } 98 INLINE(const char* name_prefix() const) { return name_prefix_; }
99 INLINE(bool has_name_prefix() const) { return name_prefix_[0] != '\0'; } 99 INLINE(bool has_name_prefix() const) { return name_prefix_[0] != '\0'; }
100 INLINE(const char* name() const) { return name_; } 100 INLINE(const char* name() const) { return name_; }
101 INLINE(const char* resource_name() const) { return resource_name_; } 101 INLINE(const char* resource_name() const) { return resource_name_; }
102 INLINE(int line_number() const) { return line_number_; } 102 INLINE(int line_number() const) { return line_number_; }
103 INLINE(unsigned call_uid() const) { return call_uid_; }
104 INLINE(int security_token_id() const) { return security_token_id_; } 103 INLINE(int security_token_id() const) { return security_token_id_; }
105 104
106 INLINE(static bool is_js_function_tag(Logger::LogEventsAndTags tag)); 105 INLINE(static bool is_js_function_tag(Logger::LogEventsAndTags tag));
107 106
108 void CopyData(const CodeEntry& source); 107 void CopyData(const CodeEntry& source);
108 uint32_t GetCallUid() const;
109 bool IsSameAs(CodeEntry* entry) const;
109 110
110 static const char* kEmptyNamePrefix; 111 static const char* kEmptyNamePrefix;
111 112
112 private: 113 private:
113 unsigned call_uid_;
114 Logger::LogEventsAndTags tag_; 114 Logger::LogEventsAndTags tag_;
115 const char* name_prefix_; 115 const char* name_prefix_;
116 const char* name_; 116 const char* name_;
117 const char* resource_name_; 117 const char* resource_name_;
118 int line_number_; 118 int line_number_;
119 int security_token_id_; 119 int security_token_id_;
120 120
121 static unsigned next_call_uid_;
122
123 DISALLOW_COPY_AND_ASSIGN(CodeEntry); 121 DISALLOW_COPY_AND_ASSIGN(CodeEntry);
124 }; 122 };
125 123
126 124
127 class ProfileTree; 125 class ProfileTree;
128 126
129 class ProfileNode { 127 class ProfileNode {
130 public: 128 public:
131 INLINE(ProfileNode(ProfileTree* tree, CodeEntry* entry)); 129 INLINE(ProfileNode(ProfileTree* tree, CodeEntry* entry));
132 130
133 ProfileNode* FindChild(CodeEntry* entry); 131 ProfileNode* FindChild(CodeEntry* entry);
134 ProfileNode* FindOrAddChild(CodeEntry* entry); 132 ProfileNode* FindOrAddChild(CodeEntry* entry);
135 INLINE(void IncrementSelfTicks()) { ++self_ticks_; } 133 INLINE(void IncrementSelfTicks()) { ++self_ticks_; }
136 INLINE(void IncreaseSelfTicks(unsigned amount)) { self_ticks_ += amount; } 134 INLINE(void IncreaseSelfTicks(unsigned amount)) { self_ticks_ += amount; }
137 INLINE(void IncreaseTotalTicks(unsigned amount)) { total_ticks_ += amount; } 135 INLINE(void IncreaseTotalTicks(unsigned amount)) { total_ticks_ += amount; }
138 136
139 INLINE(CodeEntry* entry() const) { return entry_; } 137 INLINE(CodeEntry* entry() const) { return entry_; }
140 INLINE(unsigned self_ticks() const) { return self_ticks_; } 138 INLINE(unsigned self_ticks() const) { return self_ticks_; }
141 INLINE(unsigned total_ticks() const) { return total_ticks_; } 139 INLINE(unsigned total_ticks() const) { return total_ticks_; }
142 INLINE(const List<ProfileNode*>* children() const) { return &children_list_; } 140 INLINE(const List<ProfileNode*>* children() const) { return &children_list_; }
143 double GetSelfMillis() const; 141 double GetSelfMillis() const;
144 double GetTotalMillis() const; 142 double GetTotalMillis() const;
145 143
146 void Print(int indent); 144 void Print(int indent);
147 145
148 private: 146 private:
149 INLINE(static bool CodeEntriesMatch(void* entry1, void* entry2)) { 147 INLINE(static bool CodeEntriesMatch(void* entry1, void* entry2)) {
150 return entry1 == entry2; 148 return reinterpret_cast<CodeEntry*>(entry1)->IsSameAs(
149 reinterpret_cast<CodeEntry*>(entry2));
151 } 150 }
152 151
153 INLINE(static uint32_t CodeEntryHash(CodeEntry* entry)) { 152 INLINE(static uint32_t CodeEntryHash(CodeEntry* entry)) {
154 return static_cast<int32_t>(reinterpret_cast<intptr_t>(entry)); 153 return entry->GetCallUid();
155 } 154 }
156 155
157 ProfileTree* tree_; 156 ProfileTree* tree_;
158 CodeEntry* entry_; 157 CodeEntry* entry_;
159 unsigned total_ticks_; 158 unsigned total_ticks_;
160 unsigned self_ticks_; 159 unsigned self_ticks_;
161 // Mapping from CodeEntry* to ProfileNode* 160 // Mapping from CodeEntry* to ProfileNode*
162 HashMap children_; 161 HashMap children_;
163 List<ProfileNode*> children_list_; 162 List<ProfileNode*> children_list_;
164 163
(...skipping 857 matching lines...) Expand 10 before | Expand all | Expand 10 after
1022 friend class HeapSnapshotJSONSerializerIterator; 1021 friend class HeapSnapshotJSONSerializerIterator;
1023 1022
1024 DISALLOW_COPY_AND_ASSIGN(HeapSnapshotJSONSerializer); 1023 DISALLOW_COPY_AND_ASSIGN(HeapSnapshotJSONSerializer);
1025 }; 1024 };
1026 1025
1027 } } // namespace v8::internal 1026 } } // namespace v8::internal
1028 1027
1029 #endif // ENABLE_LOGGING_AND_PROFILING 1028 #endif // ENABLE_LOGGING_AND_PROFILING
1030 1029
1031 #endif // V8_PROFILE_GENERATOR_H_ 1030 #endif // V8_PROFILE_GENERATOR_H_
OLDNEW
« no previous file with comments | « src/cpu-profiler-inl.h ('k') | src/profile-generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698