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

Unified Diff: runtime/vm/snapshot.cc

Issue 1867653003: Fix full snapshot writer code (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/snapshot.cc
diff --git a/runtime/vm/snapshot.cc b/runtime/vm/snapshot.cc
index f7a880d59b5aa3a1ae213ea4ea01f4c7edc4f7d0..c455d302f77a326acf8774258d02db40eab8c49c 100644
--- a/runtime/vm/snapshot.cc
+++ b/runtime/vm/snapshot.cc
@@ -1917,11 +1917,13 @@ FullSnapshotWriter::FullSnapshotWriter(uint8_t** vm_isolate_snapshot_buffer,
ScriptVisitor script_visitor(thread(), &scripts_);
heap()->IterateOldObjects(&script_visitor);
- // Stash the symbol table away for writing and reading into the vm isolate,
- // and reset the symbol table for the regular isolate so that we do not
- // write these symbols into the snapshot of a regular dart isolate.
- symbol_table_ = object_store->symbol_table();
- Symbols::SetupSymbolTable(isolate());
+ if (vm_isolate_snapshot_buffer != NULL) {
+ // Stash the symbol table away for writing and reading into the vm isolate,
+ // and reset the symbol table for the regular isolate so that we do not
+ // write these symbols into the snapshot of a regular dart isolate.
+ symbol_table_ = object_store->symbol_table();
+ Symbols::SetupSymbolTable(isolate());
+ }
forward_list_ = new ForwardList(thread(), SnapshotWriter::FirstObjectId());
ASSERT(forward_list_ != NULL);
@@ -1936,9 +1938,11 @@ FullSnapshotWriter::FullSnapshotWriter(uint8_t** vm_isolate_snapshot_buffer,
FullSnapshotWriter::~FullSnapshotWriter() {
delete forward_list_;
- // We may run Dart code afterwards, restore the symbol table.
- isolate()->object_store()->set_symbol_table(symbol_table_);
- symbol_table_ = Array::null();
+ // We may run Dart code afterwards, restore the symbol table if needed.
+ if (!symbol_table_.IsNull()) {
+ isolate()->object_store()->set_symbol_table(symbol_table_);
+ symbol_table_ = Array::null();
+ }
scripts_ = Array::null();
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698