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

Side by Side Diff: src/heap-profiler.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-profiler.h ('k') | src/heap-snapshot-generator.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 2009-2010 the V8 project authors. All rights reserved. 1 // Copyright 2009-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 18 matching lines...) Expand all
29 29
30 #include "heap-profiler.h" 30 #include "heap-profiler.h"
31 #include "heap-snapshot-generator-inl.h" 31 #include "heap-snapshot-generator-inl.h"
32 32
33 namespace v8 { 33 namespace v8 {
34 namespace internal { 34 namespace internal {
35 35
36 HeapProfiler::HeapProfiler(Heap* heap) 36 HeapProfiler::HeapProfiler(Heap* heap)
37 : snapshots_(new HeapSnapshotsCollection(heap)), 37 : snapshots_(new HeapSnapshotsCollection(heap)),
38 next_snapshot_uid_(1), 38 next_snapshot_uid_(1),
39 is_tracking_allocations_(false) { 39 is_tracking_allocations_(false),
40 is_tracking_object_moves_(false) {
40 } 41 }
41 42
42 43
43 HeapProfiler::~HeapProfiler() { 44 HeapProfiler::~HeapProfiler() {
44 delete snapshots_; 45 delete snapshots_;
45 } 46 }
46 47
47 48
48 void HeapProfiler::DeleteAllSnapshots() { 49 void HeapProfiler::DeleteAllSnapshots() {
49 Heap* the_heap = heap(); 50 Heap* the_heap = heap();
(...skipping 27 matching lines...) Expand all
77 v8::HeapProfiler::ObjectNameResolver* resolver) { 78 v8::HeapProfiler::ObjectNameResolver* resolver) {
78 HeapSnapshot* result = snapshots_->NewSnapshot(name, next_snapshot_uid_++); 79 HeapSnapshot* result = snapshots_->NewSnapshot(name, next_snapshot_uid_++);
79 { 80 {
80 HeapSnapshotGenerator generator(result, control, resolver, heap()); 81 HeapSnapshotGenerator generator(result, control, resolver, heap());
81 if (!generator.GenerateSnapshot()) { 82 if (!generator.GenerateSnapshot()) {
82 delete result; 83 delete result;
83 result = NULL; 84 result = NULL;
84 } 85 }
85 } 86 }
86 snapshots_->SnapshotGenerationFinished(result); 87 snapshots_->SnapshotGenerationFinished(result);
88 is_tracking_object_moves_ = true;
87 return result; 89 return result;
88 } 90 }
89 91
90 92
91 HeapSnapshot* HeapProfiler::TakeSnapshot( 93 HeapSnapshot* HeapProfiler::TakeSnapshot(
92 String* name, 94 String* name,
93 v8::ActivityControl* control, 95 v8::ActivityControl* control,
94 v8::HeapProfiler::ObjectNameResolver* resolver) { 96 v8::HeapProfiler::ObjectNameResolver* resolver) {
95 return TakeSnapshot(snapshots_->names()->GetName(name), control, resolver); 97 return TakeSnapshot(snapshots_->names()->GetName(name), control, resolver);
96 } 98 }
97 99
98 100
99 void HeapProfiler::StartHeapObjectsTracking() { 101 void HeapProfiler::StartHeapObjectsTracking() {
100 snapshots_->StartHeapObjectsTracking(); 102 snapshots_->StartHeapObjectsTracking();
103 is_tracking_object_moves_ = true;
101 } 104 }
102 105
103 106
104 SnapshotObjectId HeapProfiler::PushHeapObjectsStats(OutputStream* stream) { 107 SnapshotObjectId HeapProfiler::PushHeapObjectsStats(OutputStream* stream) {
105 return snapshots_->PushHeapObjectsStats(stream); 108 return snapshots_->PushHeapObjectsStats(stream);
106 } 109 }
107 110
108 111
109 void HeapProfiler::StopHeapObjectsTracking() { 112 void HeapProfiler::StopHeapObjectsTracking() {
110 snapshots_->StopHeapObjectsTracking(); 113 snapshots_->StopHeapObjectsTracking();
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 RetainedObjectInfo* info) { 155 RetainedObjectInfo* info) {
153 // TODO(yurus, marja): Don't route this information through GlobalHandles. 156 // TODO(yurus, marja): Don't route this information through GlobalHandles.
154 heap()->isolate()->global_handles()->SetRetainedObjectInfo(id, info); 157 heap()->isolate()->global_handles()->SetRetainedObjectInfo(id, info);
155 } 158 }
156 159
157 160
158 void HeapProfiler::StartHeapAllocationsRecording() { 161 void HeapProfiler::StartHeapAllocationsRecording() {
159 StartHeapObjectsTracking(); 162 StartHeapObjectsTracking();
160 heap()->DisableInlineAllocation(); 163 heap()->DisableInlineAllocation();
161 is_tracking_allocations_ = true; 164 is_tracking_allocations_ = true;
162 snapshots_->UpdateHeapObjectsMap();
163 } 165 }
164 166
165 167
166 void HeapProfiler::StopHeapAllocationsRecording() { 168 void HeapProfiler::StopHeapAllocationsRecording() {
167 StopHeapObjectsTracking(); 169 StopHeapObjectsTracking();
168 heap()->EnableInlineAllocation(); 170 heap()->EnableInlineAllocation();
169 is_tracking_allocations_ = false; 171 is_tracking_allocations_ = false;
170 } 172 }
171 173
172 174
173 } } // namespace v8::internal 175 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap-profiler.h ('k') | src/heap-snapshot-generator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698