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

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

Issue 17836002: CPUProfiler: Simplify CodeEntry constructor calls. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: win debug bot fix Created 7 years, 5 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
« no previous file with comments | « src/profile-generator.h ('k') | src/profile-generator-inl.h » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 176
177 size_t StringsStorage::GetUsedMemorySize() const { 177 size_t StringsStorage::GetUsedMemorySize() const {
178 size_t size = sizeof(*this); 178 size_t size = sizeof(*this);
179 size += sizeof(HashMap::Entry) * names_.capacity(); 179 size += sizeof(HashMap::Entry) * names_.capacity();
180 for (HashMap::Entry* p = names_.Start(); p != NULL; p = names_.Next(p)) { 180 for (HashMap::Entry* p = names_.Start(); p != NULL; p = names_.Next(p)) {
181 size += strlen(reinterpret_cast<const char*>(p->value)) + 1; 181 size += strlen(reinterpret_cast<const char*>(p->value)) + 1;
182 } 182 }
183 return size; 183 return size;
184 } 184 }
185 185
186
186 const char* const CodeEntry::kEmptyNamePrefix = ""; 187 const char* const CodeEntry::kEmptyNamePrefix = "";
188 const char* const CodeEntry::kEmptyResourceName = "";
187 189
188 190
189 CodeEntry::~CodeEntry() { 191 CodeEntry::~CodeEntry() {
190 delete no_frame_ranges_; 192 delete no_frame_ranges_;
191 } 193 }
192 194
193 195
194 void CodeEntry::CopyData(const CodeEntry& source) { 196 void CodeEntry::CopyData(const CodeEntry& source) {
195 tag_ = source.tag_; 197 tag_ = source.tag_;
196 name_prefix_ = source.name_prefix_; 198 name_prefix_ = source.name_prefix_;
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 291
290 void AfterAllChildrenTraversed(ProfileNode* node) { 292 void AfterAllChildrenTraversed(ProfileNode* node) {
291 delete node; 293 delete node;
292 } 294 }
293 295
294 void AfterChildTraversed(ProfileNode*, ProfileNode*) { } 296 void AfterChildTraversed(ProfileNode*, ProfileNode*) { }
295 }; 297 };
296 298
297 299
298 ProfileTree::ProfileTree() 300 ProfileTree::ProfileTree()
299 : root_entry_(Logger::FUNCTION_TAG, 301 : root_entry_(Logger::FUNCTION_TAG, "", "(root)"),
300 "",
301 "(root)",
302 "",
303 0,
304 TokenEnumerator::kNoSecurityToken),
305 next_node_id_(1), 302 next_node_id_(1),
306 root_(new ProfileNode(this, &root_entry_)) { 303 root_(new ProfileNode(this, &root_entry_)) {
307 } 304 }
308 305
309 306
310 ProfileTree::~ProfileTree() { 307 ProfileTree::~ProfileTree() {
311 DeleteNodesCallback cb; 308 DeleteNodesCallback cb;
312 TraverseDepthFirst(&cb); 309 TraverseDepthFirst(&cb);
313 } 310 }
314 311
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
790 } 787 }
791 788
792 789
793 CodeEntry* CpuProfilesCollection::NewCodeEntry(Logger::LogEventsAndTags tag, 790 CodeEntry* CpuProfilesCollection::NewCodeEntry(Logger::LogEventsAndTags tag,
794 Name* name, 791 Name* name,
795 String* resource_name, 792 String* resource_name,
796 int line_number) { 793 int line_number) {
797 CodeEntry* entry = new CodeEntry(tag, 794 CodeEntry* entry = new CodeEntry(tag,
798 CodeEntry::kEmptyNamePrefix, 795 CodeEntry::kEmptyNamePrefix,
799 GetFunctionName(name), 796 GetFunctionName(name),
797 TokenEnumerator::kNoSecurityToken,
800 GetName(resource_name), 798 GetName(resource_name),
801 line_number, 799 line_number);
802 TokenEnumerator::kNoSecurityToken);
803 code_entries_.Add(entry); 800 code_entries_.Add(entry);
804 return entry; 801 return entry;
805 } 802 }
806 803
807 804
808 CodeEntry* CpuProfilesCollection::NewCodeEntry(Logger::LogEventsAndTags tag, 805 CodeEntry* CpuProfilesCollection::NewCodeEntry(Logger::LogEventsAndTags tag,
809 const char* name) { 806 const char* name) {
810 CodeEntry* entry = new CodeEntry(tag, 807 CodeEntry* entry = new CodeEntry(tag,
811 CodeEntry::kEmptyNamePrefix, 808 CodeEntry::kEmptyNamePrefix,
812 GetFunctionName(name), 809 GetFunctionName(name));
813 "",
814 v8::CpuProfileNode::kNoLineNumberInfo,
815 TokenEnumerator::kNoSecurityToken);
816 code_entries_.Add(entry); 810 code_entries_.Add(entry);
817 return entry; 811 return entry;
818 } 812 }
819 813
820 814
821 CodeEntry* CpuProfilesCollection::NewCodeEntry(Logger::LogEventsAndTags tag, 815 CodeEntry* CpuProfilesCollection::NewCodeEntry(Logger::LogEventsAndTags tag,
822 const char* name_prefix, 816 const char* name_prefix,
823 Name* name) { 817 Name* name) {
824 CodeEntry* entry = new CodeEntry(tag, 818 CodeEntry* entry = new CodeEntry(tag,
825 name_prefix, 819 name_prefix,
826 GetName(name), 820 GetName(name),
827 "",
828 v8::CpuProfileNode::kNoLineNumberInfo,
829 TokenEnumerator::kInheritsSecurityToken); 821 TokenEnumerator::kInheritsSecurityToken);
830 code_entries_.Add(entry); 822 code_entries_.Add(entry);
831 return entry; 823 return entry;
832 } 824 }
833 825
834 826
835 CodeEntry* CpuProfilesCollection::NewCodeEntry(Logger::LogEventsAndTags tag, 827 CodeEntry* CpuProfilesCollection::NewCodeEntry(Logger::LogEventsAndTags tag,
836 int args_count) { 828 int args_count) {
837 CodeEntry* entry = new CodeEntry(tag, 829 CodeEntry* entry = new CodeEntry(tag,
838 "args_count: ", 830 "args_count: ",
839 GetName(args_count), 831 GetName(args_count),
840 "",
841 v8::CpuProfileNode::kNoLineNumberInfo,
842 TokenEnumerator::kInheritsSecurityToken); 832 TokenEnumerator::kInheritsSecurityToken);
843 code_entries_.Add(entry); 833 code_entries_.Add(entry);
844 return entry; 834 return entry;
845 } 835 }
846 836
847 837
848 void CpuProfilesCollection::AddPathToCurrentProfiles( 838 void CpuProfilesCollection::AddPathToCurrentProfiles(
849 const Vector<CodeEntry*>& path) { 839 const Vector<CodeEntry*>& path) {
850 // As starting / stopping profiles is rare relatively to this 840 // As starting / stopping profiles is rare relatively to this
851 // method, we don't bother minimizing the duration of lock holding, 841 // method, we don't bother minimizing the duration of lock holding,
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
956 if (no_symbolized_entries) { 946 if (no_symbolized_entries) {
957 *entry++ = EntryForVMState(sample.state); 947 *entry++ = EntryForVMState(sample.state);
958 } 948 }
959 } 949 }
960 950
961 profiles_->AddPathToCurrentProfiles(entries); 951 profiles_->AddPathToCurrentProfiles(entries);
962 } 952 }
963 953
964 954
965 } } // namespace v8::internal 955 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/profile-generator.h ('k') | src/profile-generator-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698