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

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

Issue 6551011: Fix CPU profiling for Crankshaft. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 10 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 | Annotate | Revision Log
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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 HashMap names_; 81 HashMap names_;
82 // Mapping from ints to char* strings. 82 // Mapping from ints to char* strings.
83 List<char*> index_names_; 83 List<char*> index_names_;
84 84
85 DISALLOW_COPY_AND_ASSIGN(StringsStorage); 85 DISALLOW_COPY_AND_ASSIGN(StringsStorage);
86 }; 86 };
87 87
88 88
89 class CodeEntry { 89 class CodeEntry {
90 public: 90 public:
91 explicit INLINE(CodeEntry(int security_token_id));
92 // CodeEntry doesn't own name strings, just references them. 91 // CodeEntry doesn't own name strings, just references them.
93 INLINE(CodeEntry(Logger::LogEventsAndTags tag, 92 INLINE(CodeEntry(Logger::LogEventsAndTags tag,
94 const char* name_prefix, 93 const char* name_prefix,
95 const char* name, 94 const char* name,
96 const char* resource_name, 95 const char* resource_name,
97 int line_number, 96 int line_number,
98 int security_token_id)); 97 int security_token_id));
99 98
100 INLINE(bool is_js_function() const) { return is_js_function_tag(tag_); } 99 INLINE(bool is_js_function() const) { return is_js_function_tag(tag_); }
101 INLINE(const char* name_prefix() const) { return name_prefix_; } 100 INLINE(const char* name_prefix() const) { return name_prefix_; }
102 INLINE(bool has_name_prefix() const) { return name_prefix_[0] != '\0'; } 101 INLINE(bool has_name_prefix() const) { return name_prefix_[0] != '\0'; }
103 INLINE(const char* name() const) { return name_; } 102 INLINE(const char* name() const) { return name_; }
104 INLINE(const char* resource_name() const) { return resource_name_; } 103 INLINE(const char* resource_name() const) { return resource_name_; }
105 INLINE(int line_number() const) { return line_number_; } 104 INLINE(int line_number() const) { return line_number_; }
105 INLINE(int shared_id() const) { return shared_id_; }
106 INLINE(void set_shared_id(int shared_id)) { shared_id_ = shared_id; }
106 INLINE(int security_token_id() const) { return security_token_id_; } 107 INLINE(int security_token_id() const) { return security_token_id_; }
107 108
108 INLINE(static bool is_js_function_tag(Logger::LogEventsAndTags tag)); 109 INLINE(static bool is_js_function_tag(Logger::LogEventsAndTags tag));
109 110
110 void CopyData(const CodeEntry& source); 111 void CopyData(const CodeEntry& source);
111 uint32_t GetCallUid() const; 112 uint32_t GetCallUid() const;
112 bool IsSameAs(CodeEntry* entry) const; 113 bool IsSameAs(CodeEntry* entry) const;
113 114
114 static const char* kEmptyNamePrefix; 115 static const char* kEmptyNamePrefix;
115 116
116 private: 117 private:
117 Logger::LogEventsAndTags tag_; 118 Logger::LogEventsAndTags tag_;
118 const char* name_prefix_; 119 const char* name_prefix_;
119 const char* name_; 120 const char* name_;
120 const char* resource_name_; 121 const char* resource_name_;
121 int line_number_; 122 int line_number_;
123 int shared_id_;
122 int security_token_id_; 124 int security_token_id_;
123 125
124 DISALLOW_COPY_AND_ASSIGN(CodeEntry); 126 DISALLOW_COPY_AND_ASSIGN(CodeEntry);
125 }; 127 };
126 128
127 129
128 class ProfileTree; 130 class ProfileTree;
129 131
130 class ProfileNode { 132 class ProfileNode {
131 public: 133 public:
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 unsigned uid_; 229 unsigned uid_;
228 ProfileTree top_down_; 230 ProfileTree top_down_;
229 ProfileTree bottom_up_; 231 ProfileTree bottom_up_;
230 232
231 DISALLOW_COPY_AND_ASSIGN(CpuProfile); 233 DISALLOW_COPY_AND_ASSIGN(CpuProfile);
232 }; 234 };
233 235
234 236
235 class CodeMap { 237 class CodeMap {
236 public: 238 public:
237 CodeMap() { } 239 CodeMap() : next_sfi_tag_(1) { }
238 INLINE(void AddCode(Address addr, CodeEntry* entry, unsigned size)); 240 INLINE(void AddCode(Address addr, CodeEntry* entry, unsigned size));
239 INLINE(void MoveCode(Address from, Address to)); 241 INLINE(void MoveCode(Address from, Address to));
240 INLINE(void DeleteCode(Address addr)); 242 INLINE(void DeleteCode(Address addr));
241 void AddAlias(Address start, CodeEntry* entry, Address code_start);
242 CodeEntry* FindEntry(Address addr); 243 CodeEntry* FindEntry(Address addr);
244 int GetSFITag(Address addr);
243 245
244 void Print(); 246 void Print();
245 247
246 private: 248 private:
247 struct CodeEntryInfo { 249 struct CodeEntryInfo {
248 CodeEntryInfo(CodeEntry* an_entry, unsigned a_size) 250 CodeEntryInfo(CodeEntry* an_entry, unsigned a_size)
249 : entry(an_entry), size(a_size) { } 251 : entry(an_entry), size(a_size) { }
250 CodeEntry* entry; 252 CodeEntry* entry;
251 unsigned size; 253 unsigned size;
252 }; 254 };
253 255
254 struct CodeTreeConfig { 256 struct CodeTreeConfig {
255 typedef Address Key; 257 typedef Address Key;
256 typedef CodeEntryInfo Value; 258 typedef CodeEntryInfo Value;
257 static const Key kNoKey; 259 static const Key kNoKey;
258 static const Value kNoValue; 260 static const Value kNoValue;
259 static int Compare(const Key& a, const Key& b) { 261 static int Compare(const Key& a, const Key& b) {
260 return a < b ? -1 : (a > b ? 1 : 0); 262 return a < b ? -1 : (a > b ? 1 : 0);
261 } 263 }
262 }; 264 };
263 typedef SplayTree<CodeTreeConfig> CodeTree; 265 typedef SplayTree<CodeTreeConfig> CodeTree;
264 266
265 class CodeTreePrinter { 267 class CodeTreePrinter {
266 public: 268 public:
267 void Call(const Address& key, const CodeEntryInfo& value); 269 void Call(const Address& key, const CodeEntryInfo& value);
268 }; 270 };
269 271
272 // Fake CodeEntry pointer to distinguish SFI entries.
273 static const CodeEntry* kSfiCodeEntry;
Vitaly Repeshko 2011/02/22 15:11:19 Add one more "const" to make it really constant.
mnaganov (inactive) 2011/02/22 16:18:22 Ah, yes, stupid syntax. I've changed it to "static
274
270 CodeTree tree_; 275 CodeTree tree_;
276 int next_sfi_tag_;
271 277
272 DISALLOW_COPY_AND_ASSIGN(CodeMap); 278 DISALLOW_COPY_AND_ASSIGN(CodeMap);
273 }; 279 };
274 280
275 281
276 class CpuProfilesCollection { 282 class CpuProfilesCollection {
277 public: 283 public:
278 CpuProfilesCollection(); 284 CpuProfilesCollection();
279 ~CpuProfilesCollection(); 285 ~CpuProfilesCollection();
280 286
(...skipping 795 matching lines...) Expand 10 before | Expand all | Expand 10 after
1076 }; 1082 };
1077 1083
1078 1084
1079 String* GetConstructorNameForHeapProfile(JSObject* object); 1085 String* GetConstructorNameForHeapProfile(JSObject* object);
1080 1086
1081 } } // namespace v8::internal 1087 } } // namespace v8::internal
1082 1088
1083 #endif // ENABLE_LOGGING_AND_PROFILING 1089 #endif // ENABLE_LOGGING_AND_PROFILING
1084 1090
1085 #endif // V8_PROFILE_GENERATOR_H_ 1091 #endif // V8_PROFILE_GENERATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698