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

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

Issue 18053004: CpuProfiler: eliminate 2 layers of 4 for CodeCreateEvent calls. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: all tests were fixed 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
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 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 291
292 void AfterAllChildrenTraversed(ProfileNode* node) { 292 void AfterAllChildrenTraversed(ProfileNode* node) {
293 delete node; 293 delete node;
294 } 294 }
295 295
296 void AfterChildTraversed(ProfileNode*, ProfileNode*) { } 296 void AfterChildTraversed(ProfileNode*, ProfileNode*) { }
297 }; 297 };
298 298
299 299
300 ProfileTree::ProfileTree() 300 ProfileTree::ProfileTree()
301 : root_entry_(Logger::FUNCTION_TAG, "", "(root)"), 301 : root_entry_(Logger::FUNCTION_TAG, "(root)"),
302 next_node_id_(1), 302 next_node_id_(1),
303 root_(new ProfileNode(this, &root_entry_)) { 303 root_(new ProfileNode(this, &root_entry_)) {
304 } 304 }
305 305
306 306
307 ProfileTree::~ProfileTree() { 307 ProfileTree::~ProfileTree() {
308 DeleteNodesCallback cb; 308 DeleteNodesCallback cb;
309 TraverseDepthFirst(&cb); 309 TraverseDepthFirst(&cb);
310 } 310 }
311 311
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
780 const int current_count = unabridged_list->length(); 780 const int current_count = unabridged_list->length();
781 for (int i = 0; i < current_count; ++i) { 781 for (int i = 0; i < current_count; ++i) {
782 if (list->at(i) == NULL) { 782 if (list->at(i) == NULL) {
783 (*list)[i] = unabridged_list->at(i)->FilteredClone(security_token_id); 783 (*list)[i] = unabridged_list->at(i)->FilteredClone(security_token_id);
784 } 784 }
785 } 785 }
786 return list; 786 return list;
787 } 787 }
788 788
789 789
790 CodeEntry* CpuProfilesCollection::NewCodeEntry(Logger::LogEventsAndTags tag,
791 Name* name,
792 String* resource_name,
793 int line_number) {
794 CodeEntry* entry = new CodeEntry(tag,
795 CodeEntry::kEmptyNamePrefix,
796 GetFunctionName(name),
797 TokenEnumerator::kNoSecurityToken,
798 GetName(resource_name),
799 line_number);
800 code_entries_.Add(entry);
801 return entry;
802 }
803
804
805 CodeEntry* CpuProfilesCollection::NewCodeEntry(Logger::LogEventsAndTags tag,
806 const char* name) {
807 CodeEntry* entry = new CodeEntry(tag,
808 CodeEntry::kEmptyNamePrefix,
809 GetFunctionName(name));
810 code_entries_.Add(entry);
811 return entry;
812 }
813
814
815 CodeEntry* CpuProfilesCollection::NewCodeEntry(Logger::LogEventsAndTags tag,
816 const char* name_prefix,
817 Name* name) {
818 CodeEntry* entry = new CodeEntry(tag,
819 name_prefix,
820 GetName(name),
821 TokenEnumerator::kInheritsSecurityToken);
822 code_entries_.Add(entry);
823 return entry;
824 }
825
826
827 CodeEntry* CpuProfilesCollection::NewCodeEntry(Logger::LogEventsAndTags tag,
828 int args_count) {
829 CodeEntry* entry = new CodeEntry(tag,
830 "args_count: ",
831 GetName(args_count),
832 TokenEnumerator::kInheritsSecurityToken);
833 code_entries_.Add(entry);
834 return entry;
835 }
836
837
838 void CpuProfilesCollection::AddPathToCurrentProfiles( 790 void CpuProfilesCollection::AddPathToCurrentProfiles(
839 const Vector<CodeEntry*>& path) { 791 const Vector<CodeEntry*>& path) {
840 // As starting / stopping profiles is rare relatively to this 792 // As starting / stopping profiles is rare relatively to this
841 // method, we don't bother minimizing the duration of lock holding, 793 // method, we don't bother minimizing the duration of lock holding,
842 // e.g. copying contents of the list to a local vector. 794 // e.g. copying contents of the list to a local vector.
843 current_profiles_semaphore_->Wait(); 795 current_profiles_semaphore_->Wait();
844 for (int i = 0; i < current_profiles_.length(); ++i) { 796 for (int i = 0; i < current_profiles_.length(); ++i) {
845 current_profiles_[i]->AddPath(path); 797 current_profiles_[i]->AddPath(path);
846 } 798 }
847 current_profiles_semaphore_->Signal(); 799 current_profiles_semaphore_->Signal();
(...skipping 27 matching lines...) Expand all
875 "(anonymous function)"; 827 "(anonymous function)";
876 const char* const ProfileGenerator::kProgramEntryName = 828 const char* const ProfileGenerator::kProgramEntryName =
877 "(program)"; 829 "(program)";
878 const char* const ProfileGenerator::kGarbageCollectorEntryName = 830 const char* const ProfileGenerator::kGarbageCollectorEntryName =
879 "(garbage collector)"; 831 "(garbage collector)";
880 832
881 833
882 ProfileGenerator::ProfileGenerator(CpuProfilesCollection* profiles) 834 ProfileGenerator::ProfileGenerator(CpuProfilesCollection* profiles)
883 : profiles_(profiles), 835 : profiles_(profiles),
884 program_entry_( 836 program_entry_(
885 profiles->NewCodeEntry(Logger::FUNCTION_TAG, kProgramEntryName)), 837 profiles->NewCodeEntry(Logger::FUNCTION_TAG,
yurys 2013/06/28 11:33:43 Revert?
loislo 2013/06/28 12:33:12 Done.
838 kProgramEntryName)),
886 gc_entry_( 839 gc_entry_(
887 profiles->NewCodeEntry(Logger::BUILTIN_TAG, 840 profiles->NewCodeEntry(Logger::BUILTIN_TAG,
888 kGarbageCollectorEntryName)) { 841 kGarbageCollectorEntryName)) {
889 } 842 }
890 843
891 844
892 void ProfileGenerator::RecordTickSample(const TickSample& sample) { 845 void ProfileGenerator::RecordTickSample(const TickSample& sample) {
893 // Allocate space for stack frames + pc + function + vm-state. 846 // Allocate space for stack frames + pc + function + vm-state.
894 ScopedVector<CodeEntry*> entries(sample.frames_count + 3); 847 ScopedVector<CodeEntry*> entries(sample.frames_count + 3);
895 // As actual number of decoded code entries may vary, initialize 848 // As actual number of decoded code entries may vary, initialize
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
946 if (no_symbolized_entries) { 899 if (no_symbolized_entries) {
947 *entry++ = EntryForVMState(sample.state); 900 *entry++ = EntryForVMState(sample.state);
948 } 901 }
949 } 902 }
950 903
951 profiles_->AddPathToCurrentProfiles(entries); 904 profiles_->AddPathToCurrentProfiles(entries);
952 } 905 }
953 906
954 907
955 } } // namespace v8::internal 908 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698