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

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

Issue 291193005: Attempt no. 3 to fix Heap::IsHeapIterable and HeapIterator (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Remove EnsureHeapIterable and DisallocAllocation calls from LiveEdit::FindActiveGenerators Created 6 years, 7 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/heap.cc ('k') | src/heap-snapshot-generator.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 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 "v8.h" 5 #include "v8.h"
6 6
7 #include "heap-profiler.h" 7 #include "heap-profiler.h"
8 8
9 #include "allocation-tracker.h" 9 #include "allocation-tracker.h"
10 #include "heap-snapshot-generator-inl.h" 10 #include "heap-snapshot-generator-inl.h"
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 166
167 167
168 void HeapProfiler::SetRetainedObjectInfo(UniqueId id, 168 void HeapProfiler::SetRetainedObjectInfo(UniqueId id,
169 RetainedObjectInfo* info) { 169 RetainedObjectInfo* info) {
170 // TODO(yurus, marja): Don't route this information through GlobalHandles. 170 // TODO(yurus, marja): Don't route this information through GlobalHandles.
171 heap()->isolate()->global_handles()->SetRetainedObjectInfo(id, info); 171 heap()->isolate()->global_handles()->SetRetainedObjectInfo(id, info);
172 } 172 }
173 173
174 174
175 Handle<HeapObject> HeapProfiler::FindHeapObjectById(SnapshotObjectId id) { 175 Handle<HeapObject> HeapProfiler::FindHeapObjectById(SnapshotObjectId id) {
176 heap()->CollectAllGarbage(Heap::kMakeHeapIterableMask,
yurys 2014/05/22 11:24:50 Does this mean that we don't need to call GC anymo
177 "HeapProfiler::FindHeapObjectById");
178 DisallowHeapAllocation no_allocation;
179 HeapObject* object = NULL; 176 HeapObject* object = NULL;
180 HeapIterator iterator(heap(), HeapIterator::kFilterUnreachable); 177 HeapIterator iterator(heap(), HeapIterator::kFilterUnreachable);
181 // Make sure that object with the given id is still reachable. 178 // Make sure that object with the given id is still reachable.
182 for (HeapObject* obj = iterator.next(); 179 for (HeapObject* obj = iterator.next();
183 obj != NULL; 180 obj != NULL;
184 obj = iterator.next()) { 181 obj = iterator.next()) {
185 if (ids_->FindEntry(obj->address()) == id) { 182 if (ids_->FindEntry(obj->address()) == id) {
186 ASSERT(object == NULL); 183 ASSERT(object == NULL);
187 object = obj; 184 object = obj;
188 // Can't break -- kFilterUnreachable requires full heap traversal. 185 // Can't break -- kFilterUnreachable requires full heap traversal.
189 } 186 }
190 } 187 }
191 return object != NULL ? Handle<HeapObject>(object) : Handle<HeapObject>(); 188 return object != NULL ? Handle<HeapObject>(object) : Handle<HeapObject>();
192 } 189 }
193 190
194 191
195 void HeapProfiler::ClearHeapObjectMap() { 192 void HeapProfiler::ClearHeapObjectMap() {
196 ids_.Reset(new HeapObjectsMap(heap())); 193 ids_.Reset(new HeapObjectsMap(heap()));
197 if (!is_tracking_allocations()) is_tracking_object_moves_ = false; 194 if (!is_tracking_allocations()) is_tracking_object_moves_ = false;
198 } 195 }
199 196
200 197
201 } } // namespace v8::internal 198 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap.cc ('k') | src/heap-snapshot-generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698