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

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

Issue 10967052: Support for show/hide combinators (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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 | Annotate | Revision Log
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/symbols.h" 9 #include "vm/symbols.h"
10 #include "vm/visitor.h" 10 #include "vm/visitor.h"
(...skipping 889 matching lines...) Expand 10 before | Expand all | Expand 10 after
900 900
901 // Allocate library prefix object. 901 // Allocate library prefix object.
902 LibraryPrefix& prefix = LibraryPrefix::ZoneHandle( 902 LibraryPrefix& prefix = LibraryPrefix::ZoneHandle(
903 reader->isolate(), NEW_OBJECT(LibraryPrefix)); 903 reader->isolate(), NEW_OBJECT(LibraryPrefix));
904 reader->AddBackRef(object_id, &prefix, kIsDeserialized); 904 reader->AddBackRef(object_id, &prefix, kIsDeserialized);
905 905
906 // Set the object tags. 906 // Set the object tags.
907 prefix.set_tags(tags); 907 prefix.set_tags(tags);
908 908
909 // Set all non object fields. 909 // Set all non object fields.
910 prefix.raw_ptr()->num_libs_ = reader->ReadIntptrValue(); 910 prefix.raw_ptr()->num_imports_ = reader->ReadIntptrValue();
911 911
912 // Set all the object fields. 912 // Set all the object fields.
913 // TODO(5411462): Need to assert No GC can happen here, even though 913 // TODO(5411462): Need to assert No GC can happen here, even though
914 // allocations may happen. 914 // allocations may happen.
915 intptr_t num_flds = (prefix.raw()->to() - prefix.raw()->from()); 915 intptr_t num_flds = (prefix.raw()->to() - prefix.raw()->from());
916 for (intptr_t i = 0; i <= num_flds; i++) { 916 for (intptr_t i = 0; i <= num_flds; i++) {
917 *(prefix.raw()->from() + i) = reader->ReadObjectRef(); 917 *(prefix.raw()->from() + i) = reader->ReadObjectRef();
918 } 918 }
919 919
920 return prefix.raw(); 920 return prefix.raw();
921 } 921 }
922 922
923 923
924 void RawLibraryPrefix::WriteTo(SnapshotWriter* writer, 924 void RawLibraryPrefix::WriteTo(SnapshotWriter* writer,
925 intptr_t object_id, 925 intptr_t object_id,
926 Snapshot::Kind kind) { 926 Snapshot::Kind kind) {
927 ASSERT(writer != NULL); 927 ASSERT(writer != NULL);
928 ASSERT((kind != Snapshot::kMessage) && 928 ASSERT((kind != Snapshot::kMessage) &&
929 !RawObject::IsCreatedFromSnapshot(writer->GetObjectTags(this))); 929 !RawObject::IsCreatedFromSnapshot(writer->GetObjectTags(this)));
930 930
931 // Write out the serialization header value for this object. 931 // Write out the serialization header value for this object.
932 writer->WriteInlinedObjectHeader(object_id); 932 writer->WriteInlinedObjectHeader(object_id);
933 933
934 // Write out the class and tags information. 934 // Write out the class and tags information.
935 writer->WriteVMIsolateObject(kLibraryPrefixCid); 935 writer->WriteVMIsolateObject(kLibraryPrefixCid);
936 writer->WriteIntptrValue(writer->GetObjectTags(this)); 936 writer->WriteIntptrValue(writer->GetObjectTags(this));
937 937
938 // Write out all non object fields. 938 // Write out all non object fields.
939 writer->WriteIntptrValue(ptr()->num_libs_); 939 writer->WriteIntptrValue(ptr()->num_imports_);
940 940
941 // Write out all the object pointer fields. 941 // Write out all the object pointer fields.
942 SnapshotWriterVisitor visitor(writer); 942 SnapshotWriterVisitor visitor(writer);
943 visitor.VisitPointers(from(), to()); 943 visitor.VisitPointers(from(), to());
944 } 944 }
945 945
946 946
947 RawNamespace* Namespace::ReadFrom(SnapshotReader* reader,
948 intptr_t object_id,
949 intptr_t tags,
950 Snapshot::Kind kind) {
951 ASSERT(reader != NULL);
952 ASSERT((kind != Snapshot::kMessage) &&
953 !RawObject::IsCreatedFromSnapshot(tags));
954
955 // Allocate Namespace object.
956 Namespace& ns = Namespace::ZoneHandle(
957 reader->isolate(), NEW_OBJECT(Namespace));
958 reader->AddBackRef(object_id, &ns, kIsDeserialized);
959
960 // Set the object tags.
961 ns.set_tags(tags);
962
963 // Set all the object fields.
964 // TODO(5411462): Need to assert No GC can happen here, even though
965 // allocations may happen.
966 intptr_t num_flds = (ns.raw()->to() - ns.raw()->from());
967 for (intptr_t i = 0; i <= num_flds; i++) {
968 *(ns.raw()->from() + i) = reader->ReadObjectRef();
969 }
970
971 return ns.raw();
972 }
973
974
975 void RawNamespace::WriteTo(SnapshotWriter* writer,
976 intptr_t object_id,
977 Snapshot::Kind kind) {
978 ASSERT(writer != NULL);
979 ASSERT((kind != Snapshot::kMessage) &&
980 !RawObject::IsCreatedFromSnapshot(writer->GetObjectTags(this)));
981
982 // Write out the serialization header value for this object.
983 writer->WriteInlinedObjectHeader(object_id);
984
985 // Write out the class and tags information.
986 writer->WriteVMIsolateObject(kNamespaceCid);
987 writer->WriteIntptrValue(writer->GetObjectTags(this));
988
989 // Write out all the object pointer fields.
990 SnapshotWriterVisitor visitor(writer);
991 visitor.VisitPointers(from(), to());
992 }
993
994
947 RawCode* Code::ReadFrom(SnapshotReader* reader, 995 RawCode* Code::ReadFrom(SnapshotReader* reader,
948 intptr_t object_id, 996 intptr_t object_id,
949 intptr_t tags, 997 intptr_t tags,
950 Snapshot::Kind kind) { 998 Snapshot::Kind kind) {
951 UNREACHABLE(); 999 UNREACHABLE();
952 return Code::null(); 1000 return Code::null();
953 } 1001 }
954 1002
955 1003
956 void RawCode::WriteTo(SnapshotWriter* writer, 1004 void RawCode::WriteTo(SnapshotWriter* writer,
(...skipping 1271 matching lines...) Expand 10 before | Expand all | Expand 10 after
2228 // Write out the class and tags information. 2276 // Write out the class and tags information.
2229 writer->WriteIndexedObject(kWeakPropertyCid); 2277 writer->WriteIndexedObject(kWeakPropertyCid);
2230 writer->WriteIntptrValue(writer->GetObjectTags(this)); 2278 writer->WriteIntptrValue(writer->GetObjectTags(this));
2231 2279
2232 // Write out all the other fields. 2280 // Write out all the other fields.
2233 writer->Write<RawObject*>(ptr()->key_); 2281 writer->Write<RawObject*>(ptr()->key_);
2234 writer->Write<RawObject*>(ptr()->value_); 2282 writer->Write<RawObject*>(ptr()->value_);
2235 } 2283 }
2236 2284
2237 } // namespace dart 2285 } // namespace dart
OLDNEW
« runtime/vm/parser.cc ('K') | « runtime/vm/raw_object.cc ('k') | runtime/vm/snapshot.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698