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

Side by Side Diff: runtime/vm/snapshot.cc

Issue 1377543003: Clean up serialization of RawFunction, RawCode (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: as-reference Created 5 years, 2 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 unified diff | Download patch
« runtime/vm/raw_object_snapshot.cc ('K') | « runtime/vm/snapshot.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/snapshot.h" 5 #include "vm/snapshot.h"
6 6
7 #include "platform/assert.h" 7 #include "platform/assert.h"
8 #include "vm/bootstrap.h" 8 #include "vm/bootstrap.h"
9 #include "vm/class_finalizer.h" 9 #include "vm/class_finalizer.h"
10 #include "vm/dart.h" 10 #include "vm/dart.h"
(...skipping 2211 matching lines...) Expand 10 before | Expand all | Expand 10 after
2222 2222
2223 void SnapshotWriter::WriteObjectImpl(RawObject* raw, bool as_reference) { 2223 void SnapshotWriter::WriteObjectImpl(RawObject* raw, bool as_reference) {
2224 // First check if object can be written as a simple predefined type. 2224 // First check if object can be written as a simple predefined type.
2225 if (CheckAndWritePredefinedObject(raw)) { 2225 if (CheckAndWritePredefinedObject(raw)) {
2226 return; 2226 return;
2227 } 2227 }
2228 2228
2229 // Objects are usually writen as references to avoid deep recursion, but in 2229 // Objects are usually writen as references to avoid deep recursion, but in
2230 // some places we know we are dealing with leaf or shallow objects and write 2230 // some places we know we are dealing with leaf or shallow objects and write
2231 // them inline. 2231 // them inline.
2232 // Code and Instructions are written inline so that Functions and Code 2232 if (!as_reference || raw->IsCanonical()) {
2233 // can patch their entry points in their ReadFrom's. TODO(rmacnak): Remove the
2234 // special case for Code and Instructions and patch entries after the whole
2235 // graph has been loaded.
2236 if (!as_reference ||
2237 raw->IsCanonical() ||
2238 raw->IsCode() ||
2239 raw->IsInstructions()) {
2240 // Object is being serialized, add it to the forward ref list and mark 2233 // Object is being serialized, add it to the forward ref list and mark
2241 // it so that future references to this object in the snapshot will use 2234 // it so that future references to this object in the snapshot will use
2242 // an object id, instead of trying to serialize it again. 2235 // an object id, instead of trying to serialize it again.
2243 forward_list_->MarkAndAddObject(raw, kIsSerialized); 2236 forward_list_->MarkAndAddObject(raw, kIsSerialized);
2244 2237
2245 WriteInlinedObject(raw); 2238 WriteInlinedObject(raw);
2246 } else { 2239 } else {
2247 WriteObjectRef(raw); 2240 WriteObjectRef(raw);
2248 } 2241 }
2249 } 2242 }
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after
2811 NoSafepointScope no_safepoint; 2804 NoSafepointScope no_safepoint;
2812 WriteObject(obj.raw()); 2805 WriteObject(obj.raw());
2813 UnmarkAll(); 2806 UnmarkAll();
2814 } else { 2807 } else {
2815 ThrowException(exception_type(), exception_msg()); 2808 ThrowException(exception_type(), exception_msg());
2816 } 2809 }
2817 } 2810 }
2818 2811
2819 2812
2820 } // namespace dart 2813 } // namespace dart
OLDNEW
« runtime/vm/raw_object_snapshot.cc ('K') | « runtime/vm/snapshot.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698