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

Side by Side Diff: src/profiler/heap-profiler.cc

Issue 1992913004: [heap] Do not invoke GC to make heap iterable. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 6 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
« no previous file with comments | « src/log.cc ('k') | src/profiler/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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/profiler/heap-profiler.h" 5 #include "src/profiler/heap-profiler.h"
6 6
7 #include "src/api.h" 7 #include "src/api.h"
8 #include "src/debug/debug.h" 8 #include "src/debug/debug.h"
9 #include "src/profiler/allocation-tracker.h" 9 #include "src/profiler/allocation-tracker.h"
10 #include "src/profiler/heap-snapshot-generator-inl.h" 10 #include "src/profiler/heap-snapshot-generator-inl.h"
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 191
192 void HeapProfiler::SetRetainedObjectInfo(UniqueId id, 192 void HeapProfiler::SetRetainedObjectInfo(UniqueId id,
193 RetainedObjectInfo* info) { 193 RetainedObjectInfo* info) {
194 // TODO(yurus, marja): Don't route this information through GlobalHandles. 194 // TODO(yurus, marja): Don't route this information through GlobalHandles.
195 heap()->isolate()->global_handles()->SetRetainedObjectInfo(id, info); 195 heap()->isolate()->global_handles()->SetRetainedObjectInfo(id, info);
196 } 196 }
197 197
198 198
199 Handle<HeapObject> HeapProfiler::FindHeapObjectById(SnapshotObjectId id) { 199 Handle<HeapObject> HeapProfiler::FindHeapObjectById(SnapshotObjectId id) {
200 HeapObject* object = NULL; 200 HeapObject* object = NULL;
201 HeapIterator iterator(heap(), HeapIterator::kFilterUnreachable); 201 HeapIterator iterator(heap(), HeapObjectsFiltering::kFilterUnreachable);
202 // Make sure that object with the given id is still reachable. 202 // Make sure that object with the given id is still reachable.
203 for (HeapObject* obj = iterator.next(); 203 for (HeapObject* obj = iterator.next();
204 obj != NULL; 204 obj != NULL;
205 obj = iterator.next()) { 205 obj = iterator.next()) {
206 if (ids_->FindEntry(obj->address()) == id) { 206 if (ids_->FindEntry(obj->address()) == id) {
207 DCHECK(object == NULL); 207 DCHECK(object == NULL);
208 object = obj; 208 object = obj;
209 // Can't break -- kFilterUnreachable requires full heap traversal. 209 // Can't break -- kFilterUnreachable requires full heap traversal.
210 } 210 }
211 } 211 }
212 return object != NULL ? Handle<HeapObject>(object) : Handle<HeapObject>(); 212 return object != NULL ? Handle<HeapObject>(object) : Handle<HeapObject>();
213 } 213 }
214 214
215 215
216 void HeapProfiler::ClearHeapObjectMap() { 216 void HeapProfiler::ClearHeapObjectMap() {
217 ids_.Reset(new HeapObjectsMap(heap())); 217 ids_.Reset(new HeapObjectsMap(heap()));
218 if (!is_tracking_allocations()) is_tracking_object_moves_ = false; 218 if (!is_tracking_allocations()) is_tracking_object_moves_ = false;
219 } 219 }
220 220
221 221
222 Heap* HeapProfiler::heap() const { return ids_->heap(); } 222 Heap* HeapProfiler::heap() const { return ids_->heap(); }
223 223
224 224
225 } // namespace internal 225 } // namespace internal
226 } // namespace v8 226 } // namespace v8
OLDNEW
« no previous file with comments | « src/log.cc ('k') | src/profiler/heap-snapshot-generator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698