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

Side by Side Diff: src/heap-snapshot-generator.cc

Issue 94993004: Move heap profiler state flags to HeapProfiler (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years 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/heap-snapshot-generator.h ('k') | src/mark-compact.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 729 matching lines...) Expand 10 before | Expand all | Expand 10 after
740 size_t HeapObjectsMap::GetUsedMemorySize() const { 740 size_t HeapObjectsMap::GetUsedMemorySize() const {
741 return 741 return
742 sizeof(*this) + 742 sizeof(*this) +
743 sizeof(HashMap::Entry) * entries_map_.capacity() + 743 sizeof(HashMap::Entry) * entries_map_.capacity() +
744 GetMemoryUsedByList(entries_) + 744 GetMemoryUsedByList(entries_) +
745 GetMemoryUsedByList(time_intervals_); 745 GetMemoryUsedByList(time_intervals_);
746 } 746 }
747 747
748 748
749 HeapSnapshotsCollection::HeapSnapshotsCollection(Heap* heap) 749 HeapSnapshotsCollection::HeapSnapshotsCollection(Heap* heap)
750 : is_tracking_objects_(false), 750 : names_(heap),
751 names_(heap),
752 ids_(heap), 751 ids_(heap),
753 allocation_tracker_(NULL) { 752 allocation_tracker_(NULL) {
754 } 753 }
755 754
756 755
757 static void DeleteHeapSnapshot(HeapSnapshot** snapshot_ptr) { 756 static void DeleteHeapSnapshot(HeapSnapshot** snapshot_ptr) {
758 delete *snapshot_ptr; 757 delete *snapshot_ptr;
759 } 758 }
760 759
761 760
762 HeapSnapshotsCollection::~HeapSnapshotsCollection() { 761 HeapSnapshotsCollection::~HeapSnapshotsCollection() {
763 delete allocation_tracker_; 762 delete allocation_tracker_;
764 snapshots_.Iterate(DeleteHeapSnapshot); 763 snapshots_.Iterate(DeleteHeapSnapshot);
765 } 764 }
766 765
767 766
768 void HeapSnapshotsCollection::StartHeapObjectsTracking() { 767 void HeapSnapshotsCollection::StartHeapObjectsTracking() {
769 ids_.UpdateHeapObjectsMap(); 768 ids_.UpdateHeapObjectsMap();
770 if (allocation_tracker_ == NULL) { 769 if (allocation_tracker_ == NULL) {
771 allocation_tracker_ = new AllocationTracker(&ids_, names()); 770 allocation_tracker_ = new AllocationTracker(&ids_, names());
772 } 771 }
773 is_tracking_objects_ = true;
774 } 772 }
775 773
776 774
777 void HeapSnapshotsCollection::StopHeapObjectsTracking() { 775 void HeapSnapshotsCollection::StopHeapObjectsTracking() {
778 ids_.StopHeapObjectsTracking(); 776 ids_.StopHeapObjectsTracking();
779 if (allocation_tracker_ != NULL) { 777 if (allocation_tracker_ != NULL) {
780 delete allocation_tracker_; 778 delete allocation_tracker_;
781 allocation_tracker_ = NULL; 779 allocation_tracker_ = NULL;
782 } 780 }
783 } 781 }
784 782
785 783
786 HeapSnapshot* HeapSnapshotsCollection::NewSnapshot(const char* name, 784 HeapSnapshot* HeapSnapshotsCollection::NewSnapshot(const char* name,
787 unsigned uid) { 785 unsigned uid) {
788 is_tracking_objects_ = true; // Start watching for heap objects moves.
789 return new HeapSnapshot(this, name, uid); 786 return new HeapSnapshot(this, name, uid);
790 } 787 }
791 788
792 789
793 void HeapSnapshotsCollection::SnapshotGenerationFinished( 790 void HeapSnapshotsCollection::SnapshotGenerationFinished(
794 HeapSnapshot* snapshot) { 791 HeapSnapshot* snapshot) {
795 ids_.SnapshotGenerationFinished(); 792 ids_.SnapshotGenerationFinished();
796 if (snapshot != NULL) { 793 if (snapshot != NULL) {
797 snapshots_.Add(snapshot); 794 snapshots_.Add(snapshot);
798 } 795 }
(...skipping 2279 matching lines...) Expand 10 before | Expand all | Expand 10 after
3078 writer_->AddString("\"<dummy>\""); 3075 writer_->AddString("\"<dummy>\"");
3079 for (int i = 1; i < sorted_strings.length(); ++i) { 3076 for (int i = 1; i < sorted_strings.length(); ++i) {
3080 writer_->AddCharacter(','); 3077 writer_->AddCharacter(',');
3081 SerializeString(sorted_strings[i]); 3078 SerializeString(sorted_strings[i]);
3082 if (writer_->aborted()) return; 3079 if (writer_->aborted()) return;
3083 } 3080 }
3084 } 3081 }
3085 3082
3086 3083
3087 } } // namespace v8::internal 3084 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap-snapshot-generator.h ('k') | src/mark-compact.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698