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 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
653 | 653 |
654 // The version string matches. Read the rest of the snapshot. | 654 // The version string matches. Read the rest of the snapshot. |
655 | 655 |
656 // TODO(asiva): Add a check here to ensure we have the right heap | 656 // TODO(asiva): Add a check here to ensure we have the right heap |
657 // size for the full snapshot being read. | 657 // size for the full snapshot being read. |
658 { | 658 { |
659 NoSafepointScope no_safepoint; | 659 NoSafepointScope no_safepoint; |
660 HeapLocker hl(isolate, old_space()); | 660 HeapLocker hl(isolate, old_space()); |
661 | 661 |
662 // Read in all the objects stored in the object store. | 662 // Read in all the objects stored in the object store. |
663 intptr_t num_flds = (object_store->to() - object_store->from()); | 663 RawObject** toobj = snapshot_code() ? object_store->to() |
| 664 : object_store->to_snapshot(); |
| 665 intptr_t num_flds = (toobj - object_store->from()); |
664 for (intptr_t i = 0; i <= num_flds; i++) { | 666 for (intptr_t i = 0; i <= num_flds; i++) { |
665 *(object_store->from() + i) = ReadObjectImpl(kAsInlinedObject); | 667 *(object_store->from() + i) = ReadObjectImpl(kAsInlinedObject); |
666 } | 668 } |
667 for (intptr_t i = 0; i < backward_references_->length(); i++) { | 669 for (intptr_t i = 0; i < backward_references_->length(); i++) { |
668 if (!(*backward_references_)[i].is_deserialized()) { | 670 if (!(*backward_references_)[i].is_deserialized()) { |
669 ReadObjectImpl(kAsInlinedObject); | 671 ReadObjectImpl(kAsInlinedObject); |
670 (*backward_references_)[i].set_state(kIsDeserialized); | 672 (*backward_references_)[i].set_state(kIsDeserialized); |
671 } | 673 } |
672 } | 674 } |
673 | 675 |
(...skipping 1313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1987 writer.ReserveHeader(); | 1989 writer.ReserveHeader(); |
1988 | 1990 |
1989 // Write out the version string. | 1991 // Write out the version string. |
1990 writer.WriteVersion(); | 1992 writer.WriteVersion(); |
1991 | 1993 |
1992 // Write out the full snapshot. | 1994 // Write out the full snapshot. |
1993 | 1995 |
1994 // Write out all the objects in the object store of the isolate which | 1996 // Write out all the objects in the object store of the isolate which |
1995 // is the root set for all dart allocated objects at this point. | 1997 // is the root set for all dart allocated objects at this point. |
1996 SnapshotWriterVisitor visitor(&writer, false); | 1998 SnapshotWriterVisitor visitor(&writer, false); |
1997 object_store->VisitObjectPointers(&visitor); | 1999 visitor.VisitPointers(object_store->from(), |
| 2000 snapshot_code_ ? object_store->to() |
| 2001 : object_store->to_snapshot()); |
1998 | 2002 |
1999 // Write out all forwarded objects. | 2003 // Write out all forwarded objects. |
2000 writer.WriteForwardedObjects(); | 2004 writer.WriteForwardedObjects(); |
2001 | 2005 |
2002 writer.FillHeader(writer.kind()); | 2006 writer.FillHeader(writer.kind()); |
2003 writer.UnmarkAll(); | 2007 writer.UnmarkAll(); |
2004 | 2008 |
2005 isolate_snapshot_size_ = writer.BytesWritten(); | 2009 isolate_snapshot_size_ = writer.BytesWritten(); |
2006 } else { | 2010 } else { |
2007 writer.ThrowException(writer.exception_type(), writer.exception_msg()); | 2011 writer.ThrowException(writer.exception_type(), writer.exception_msg()); |
(...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2784 NoSafepointScope no_safepoint; | 2788 NoSafepointScope no_safepoint; |
2785 WriteObject(obj.raw()); | 2789 WriteObject(obj.raw()); |
2786 UnmarkAll(); | 2790 UnmarkAll(); |
2787 } else { | 2791 } else { |
2788 ThrowException(exception_type(), exception_msg()); | 2792 ThrowException(exception_type(), exception_msg()); |
2789 } | 2793 } |
2790 } | 2794 } |
2791 | 2795 |
2792 | 2796 |
2793 } // namespace dart | 2797 } // namespace dart |
OLD | NEW |