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

Side by Side Diff: vm/raw_object_snapshot.cc

Issue 9363048: Implement capability to use the same library prefix for multiple library imports (currently this ... (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « vm/raw_object.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/bigint_operations.h" 5 #include "vm/bigint_operations.h"
6 #include "vm/object.h" 6 #include "vm/object.h"
7 #include "vm/object_store.h" 7 #include "vm/object_store.h"
8 #include "vm/snapshot.h" 8 #include "vm/snapshot.h"
9 #include "vm/visitor.h" 9 #include "vm/visitor.h"
10 10
(...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after
764 ASSERT(kind != Snapshot::kMessage && !RawObject::IsCreatedFromSnapshot(tags)); 764 ASSERT(kind != Snapshot::kMessage && !RawObject::IsCreatedFromSnapshot(tags));
765 765
766 // Allocate library prefix object. 766 // Allocate library prefix object.
767 LibraryPrefix& prefix = LibraryPrefix::ZoneHandle( 767 LibraryPrefix& prefix = LibraryPrefix::ZoneHandle(
768 reader->isolate(), NEW_OBJECT(LibraryPrefix)); 768 reader->isolate(), NEW_OBJECT(LibraryPrefix));
769 reader->AddBackwardReference(object_id, &prefix); 769 reader->AddBackwardReference(object_id, &prefix);
770 770
771 // Set the object tags. 771 // Set the object tags.
772 prefix.set_tags(tags); 772 prefix.set_tags(tags);
773 773
774 // Set all non object fields.
775 prefix.raw_ptr()->num_libs_ = reader->ReadIntptrValue();
776
774 // Set all the object fields. 777 // Set all the object fields.
775 // TODO(5411462): Need to assert No GC can happen here, even though 778 // TODO(5411462): Need to assert No GC can happen here, even though
776 // allocations may happen. 779 // allocations may happen.
777 intptr_t num_flds = (prefix.raw()->to() - prefix.raw()->from()); 780 intptr_t num_flds = (prefix.raw()->to() - prefix.raw()->from());
778 for (intptr_t i = 0; i <= num_flds; i++) { 781 for (intptr_t i = 0; i <= num_flds; i++) {
779 *(prefix.raw()->from() + i) = reader->ReadObject(); 782 *(prefix.raw()->from() + i) = reader->ReadObject();
780 } 783 }
781 784
782 return prefix.raw(); 785 return prefix.raw();
783 } 786 }
784 787
785 788
786 void RawLibraryPrefix::WriteTo(SnapshotWriter* writer, 789 void RawLibraryPrefix::WriteTo(SnapshotWriter* writer,
787 intptr_t object_id, 790 intptr_t object_id,
788 Snapshot::Kind kind) { 791 Snapshot::Kind kind) {
789 ASSERT(writer != NULL); 792 ASSERT(writer != NULL);
790 ASSERT(kind != Snapshot::kMessage && !IsCreatedFromSnapshot()); 793 ASSERT(kind != Snapshot::kMessage && !IsCreatedFromSnapshot());
791 794
792 // Write out the serialization header value for this object. 795 // Write out the serialization header value for this object.
793 writer->WriteSerializationMarker(kInlined, object_id); 796 writer->WriteSerializationMarker(kInlined, object_id);
794 797
795 // Write out the class and tags information. 798 // Write out the class and tags information.
796 writer->WriteObjectHeader(Object::kLibraryPrefixClass, ptr()->tags_); 799 writer->WriteObjectHeader(Object::kLibraryPrefixClass, ptr()->tags_);
797 800
801 // Write out all non object fields.
802 writer->WriteIntptrValue(ptr()->num_libs_);
803
798 // Write out all the object pointer fields. 804 // Write out all the object pointer fields.
799 SnapshotWriterVisitor visitor(writer); 805 SnapshotWriterVisitor visitor(writer);
800 visitor.VisitPointers(from(), to()); 806 visitor.VisitPointers(from(), to());
801 } 807 }
802 808
803 809
804 RawCode* Code::ReadFrom(SnapshotReader* reader, 810 RawCode* Code::ReadFrom(SnapshotReader* reader,
805 intptr_t object_id, 811 intptr_t object_id,
806 intptr_t tags, 812 intptr_t tags,
807 Snapshot::Kind kind) { 813 Snapshot::Kind kind) {
(...skipping 1027 matching lines...) Expand 10 before | Expand all | Expand 10 after
1835 // Write out all the other fields. 1841 // Write out all the other fields.
1836 writer->Write<RawObject*>(ptr()->num_bracket_expressions_); 1842 writer->Write<RawObject*>(ptr()->num_bracket_expressions_);
1837 writer->WriteObject(ptr()->pattern_); 1843 writer->WriteObject(ptr()->pattern_);
1838 writer->WriteIntptrValue(ptr()->type_); 1844 writer->WriteIntptrValue(ptr()->type_);
1839 writer->WriteIntptrValue(ptr()->flags_); 1845 writer->WriteIntptrValue(ptr()->flags_);
1840 1846
1841 // Do not write out the data part which is native. 1847 // Do not write out the data part which is native.
1842 } 1848 }
1843 1849
1844 } // namespace dart 1850 } // namespace dart
OLDNEW
« no previous file with comments | « vm/raw_object.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698