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

Unified Diff: runtime/vm/pages.cc

Issue 2995543004: [vm, gc] Require a safepoint for heap iteration. (Closed)
Patch Set: . Created 3 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: runtime/vm/pages.cc
diff --git a/runtime/vm/pages.cc b/runtime/vm/pages.cc
index 895d2b2439878d29e023f9e705cc918890b98eed..92b8f0696400d5995b073f373e272a9b32c38f7c 100644
--- a/runtime/vm/pages.cc
+++ b/runtime/vm/pages.cc
@@ -113,6 +113,7 @@ void HeapPage::Deallocate() {
}
void HeapPage::VisitObjects(ObjectVisitor* visitor) const {
+ ASSERT(Thread::Current()->IsAtSafepoint());
NoSafepointScope no_safepoint;
uword obj_addr = object_start();
uword end_addr = object_end();
@@ -125,6 +126,7 @@ void HeapPage::VisitObjects(ObjectVisitor* visitor) const {
}
void HeapPage::VisitObjectPointers(ObjectPointerVisitor* visitor) const {
+ ASSERT(Thread::Current()->IsAtSafepoint());
NoSafepointScope no_safepoint;
uword obj_addr = object_start();
uword end_addr = object_end();
@@ -752,9 +754,9 @@ void PageSpace::PrintHeapMapToJSONStream(Isolate* isolate,
// "pages" is an array [page0, page1, ..., pageN], each page of the form
// {"object_start": "0x...", "objects": [size, class id, size, ...]}
// TODO(19445): Use ExclusivePageIterator once HeapMap supports large pages.
+ HeapIterationScope iteration;
MutexLocker ml(pages_lock_);
MakeIterable();
- NoSafepointScope no_safepoint;
JSONArray all_pages(&heap_map, "pages");
for (HeapPage* page = pages_; page != NULL; page = page->next()) {
JSONObject page_container(&all_pages);

Powered by Google App Engine
This is Rietveld 408576698