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

Unified Diff: runtime/vm/raw_object_snapshot.cc

Issue 1311403009: More precompiled snapshotting. (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/precompiler.cc ('k') | runtime/vm/snapshot.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/raw_object_snapshot.cc
diff --git a/runtime/vm/raw_object_snapshot.cc b/runtime/vm/raw_object_snapshot.cc
index 06dce1270cfcef8cc55dd362cd12161f0f4d19eb..78c96416dcc6a55adc329ffb42e94a20f38f3368 100644
--- a/runtime/vm/raw_object_snapshot.cc
+++ b/runtime/vm/raw_object_snapshot.cc
@@ -756,15 +756,25 @@ void RawField::WriteTo(SnapshotWriter* writer,
writer->WriteObjectImpl(ptr()->type_, kAsReference);
// Write out the initial static value or field offset.
if (Field::StaticBit::decode(ptr()->kind_bits_)) {
- // For static field we write out the initial static value.
- writer->WriteObjectImpl(ptr()->initializer_.saved_value_, kAsReference);
+ if (writer->snapshot_code()) {
+ // For precompiled static fields, the value was already reset and
+ // initializer_ now contains a Function.
+ writer->WriteObjectImpl(ptr()->value_.static_value_, kAsReference);
+ } else {
+ // Otherwise, for static fields we write out the initial static value.
+ writer->WriteObjectImpl(ptr()->initializer_.saved_value_, kAsReference);
+ }
} else {
writer->WriteObjectImpl(ptr()->value_.offset_, kAsReference);
}
// Write out the dependent code.
writer->WriteObjectImpl(ptr()->dependent_code_, kAsReference);
- // Write out the initializer value.
- writer->WriteObjectImpl(ptr()->initializer_.saved_value_, kAsReference);
+ // Write out the initializer function or saved initial value.
+ if (writer->snapshot_code()) {
+ writer->WriteObjectImpl(ptr()->initializer_.precompiled_, kAsReference);
+ } else {
+ writer->WriteObjectImpl(ptr()->initializer_.saved_value_, kAsReference);
+ }
// Write out the guarded list length.
writer->WriteObjectImpl(ptr()->guarded_list_length_, kAsReference);
}
« no previous file with comments | « runtime/vm/precompiler.cc ('k') | runtime/vm/snapshot.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698