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

Unified Diff: runtime/vm/pages.cc

Issue 2995543004: [vm, gc] Require a safepoint for heap iteration. (Closed)
Patch Set: explicit-thread 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
« no previous file with comments | « runtime/vm/object_test.cc ('k') | runtime/vm/profiler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/pages.cc
diff --git a/runtime/vm/pages.cc b/runtime/vm/pages.cc
index 895d2b2439878d29e023f9e705cc918890b98eed..4f62c59d6f0ea02bef7f2ec2e98a7d60f510489e 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(Thread::Current());
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);
« no previous file with comments | « runtime/vm/object_test.cc ('k') | runtime/vm/profiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698