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

Unified Diff: runtime/vm/clustered_snapshot.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/clustered_snapshot.cc
diff --git a/runtime/vm/clustered_snapshot.cc b/runtime/vm/clustered_snapshot.cc
index 6bc3bfe896f83e310fee6d1abebcede823b2c5dd..720e95ae059169e99a44143e0a76d7d8c5b19970 100644
--- a/runtime/vm/clustered_snapshot.cc
+++ b/runtime/vm/clustered_snapshot.cc
@@ -5349,15 +5349,18 @@ FullSnapshotWriter::FullSnapshotWriter(Snapshot::Kind kind,
// it out as part of the VM isolate snapshot. We first count the number of
// token streams, allocate an array and then fill it up with the token
// streams.
- SnapshotTokenStreamVisitor token_streams_counter(thread());
- heap()->IterateOldObjects(&token_streams_counter);
- Dart::vm_isolate()->heap()->IterateOldObjects(&token_streams_counter);
- intptr_t count = token_streams_counter.count();
- token_streams_ = Array::New(count, Heap::kOld);
- SnapshotTokenStreamVisitor script_visitor(thread(), &token_streams_);
- heap()->IterateOldObjects(&script_visitor);
- Dart::vm_isolate()->heap()->IterateOldObjects(&script_visitor);
- ASSERT(script_visitor.count() == count);
+ {
+ HeapIterationScope iteration;
+ SnapshotTokenStreamVisitor token_streams_counter(thread());
+ iteration.IterateObjects(&token_streams_counter);
danunez 2017/08/05 17:24:11 It looks like this version will collect token stre
rmacnak 2017/08/07 22:37:50 Token streams are allocated into old space, which
+ iteration.IterateVMIsolateObjects(&token_streams_counter);
+ intptr_t count = token_streams_counter.count();
+ token_streams_ = Array::New(count, Heap::kOld);
+ SnapshotTokenStreamVisitor script_visitor(thread(), &token_streams_);
+ iteration.IterateObjects(&script_visitor);
+ iteration.IterateVMIsolateObjects(&script_visitor);
+ ASSERT(script_visitor.count() == count);
+ }
// Tuck away the current symbol table.
saved_symbol_table_ = object_store->symbol_table();
« no previous file with comments | « runtime/vm/class_table.cc ('k') | runtime/vm/compiler_stats.cc » ('j') | runtime/vm/heap.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698