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

Unified Diff: runtime/vm/clustered_snapshot.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/class_table.cc ('k') | runtime/vm/compiler_stats.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/clustered_snapshot.cc
diff --git a/runtime/vm/clustered_snapshot.cc b/runtime/vm/clustered_snapshot.cc
index 6bc3bfe896f83e310fee6d1abebcede823b2c5dd..7948c6d39b3847e1177a6acc4a50c6333cdc902f 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(thread());
+ SnapshotTokenStreamVisitor token_streams_counter(thread());
+ iteration.IterateObjects(&token_streams_counter);
+ 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') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698