OLD | NEW |
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 2208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2219 return false; | 2219 return false; |
2220 } | 2220 } |
2221 | 2221 |
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 if (as_reference && !raw->IsCanonical()) { | 2229 if (as_reference && |
| 2230 !raw->IsCanonical() && |
| 2231 !raw->IsCode() && |
| 2232 !raw->IsInstructions()) { |
2230 WriteObjectRef(raw); | 2233 WriteObjectRef(raw); |
2231 } else { | 2234 } else { |
2232 // Object is being serialized, add it to the forward ref list and mark | 2235 // Object is being serialized, add it to the forward ref list and mark |
2233 // it so that future references to this object in the snapshot will use | 2236 // it so that future references to this object in the snapshot will use |
2234 // an object id, instead of trying to serialize it again. | 2237 // an object id, instead of trying to serialize it again. |
2235 forward_list_->MarkAndAddObject(raw, kIsSerialized); | 2238 forward_list_->MarkAndAddObject(raw, kIsSerialized); |
2236 | 2239 |
2237 WriteInlinedObject(raw); | 2240 WriteInlinedObject(raw); |
2238 } | 2241 } |
2239 } | 2242 } |
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2801 NoSafepointScope no_safepoint; | 2804 NoSafepointScope no_safepoint; |
2802 WriteObject(obj.raw()); | 2805 WriteObject(obj.raw()); |
2803 UnmarkAll(); | 2806 UnmarkAll(); |
2804 } else { | 2807 } else { |
2805 ThrowException(exception_type(), exception_msg()); | 2808 ThrowException(exception_type(), exception_msg()); |
2806 } | 2809 } |
2807 } | 2810 } |
2808 | 2811 |
2809 | 2812 |
2810 } // namespace dart | 2813 } // namespace dart |
OLD | NEW |