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

Unified Diff: runtime/vm/snapshot.cc

Issue 1345053003: Write the contents of ICData and ObjectPools more eagerly and the contents of Code and Functions (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 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/snapshot.h ('k') | 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 515d5a560cf43df207f5c528d7733229d7ebf6e4..c7086a419da76d7e3e5ff32a68ab812d7dcd731f 100644
--- a/runtime/vm/snapshot.cc
+++ b/runtime/vm/snapshot.cc
@@ -2226,15 +2226,25 @@ void SnapshotWriter::WriteObjectImpl(RawObject* raw, bool as_reference) {
return;
}
- if (as_reference && !raw->IsCanonical()) {
- WriteObjectRef(raw);
- } else {
+ // Objects are usually writen as references to avoid deep recursion, but in
+ // some places we know we are dealing with leaf or shallow objects and write
+ // them inline.
+ // Code and Instructions are written inline so that Functions and Code
+ // can patch their entry points in their ReadFrom's. TODO(rmacnak): Remove the
+ // special case for Code and Instructions and patch entries after the whole
+ // graph has been loaded.
+ if (!as_reference ||
+ raw->IsCanonical() ||
+ raw->IsCode() ||
+ raw->IsInstructions()) {
// Object is being serialized, add it to the forward ref list and mark
// it so that future references to this object in the snapshot will use
// an object id, instead of trying to serialize it again.
forward_list_->MarkAndAddObject(raw, kIsSerialized);
WriteInlinedObject(raw);
+ } else {
+ WriteObjectRef(raw);
}
}
« no previous file with comments | « runtime/vm/snapshot.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698