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(); |