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

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

Issue 216383004: Merge initial implementation of deferred handling in the VM: (Closed) Base URL: http://dart.googlecode.com/svn/trunk/dart/
Patch Set: Created 6 years, 9 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 | « runtime/vm/raw_object.h ('k') | runtime/vm/snapshot.cc » ('j') | 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/symbols.h" 9 #include "vm/symbols.h"
10 #include "vm/visitor.h" 10 #include "vm/visitor.h"
(...skipping 1076 matching lines...) Expand 10 before | Expand all | Expand 10 after
1087 // Allocate library prefix object. 1087 // Allocate library prefix object.
1088 LibraryPrefix& prefix = LibraryPrefix::ZoneHandle( 1088 LibraryPrefix& prefix = LibraryPrefix::ZoneHandle(
1089 reader->isolate(), NEW_OBJECT(LibraryPrefix)); 1089 reader->isolate(), NEW_OBJECT(LibraryPrefix));
1090 reader->AddBackRef(object_id, &prefix, kIsDeserialized); 1090 reader->AddBackRef(object_id, &prefix, kIsDeserialized);
1091 1091
1092 // Set the object tags. 1092 // Set the object tags.
1093 prefix.set_tags(tags); 1093 prefix.set_tags(tags);
1094 1094
1095 // Set all non object fields. 1095 // Set all non object fields.
1096 prefix.raw_ptr()->num_imports_ = reader->ReadIntptrValue(); 1096 prefix.raw_ptr()->num_imports_ = reader->ReadIntptrValue();
1097 prefix.raw_ptr()->is_deferred_load_ = reader->Read<bool>();
1098 prefix.raw_ptr()->is_loaded_ = reader->Read<bool>();
1097 1099
1098 // Set all the object fields. 1100 // Set all the object fields.
1099 // TODO(5411462): Need to assert No GC can happen here, even though 1101 // TODO(5411462): Need to assert No GC can happen here, even though
1100 // allocations may happen. 1102 // allocations may happen.
1101 intptr_t num_flds = (prefix.raw()->to() - prefix.raw()->from()); 1103 intptr_t num_flds = (prefix.raw()->to() - prefix.raw()->from());
1102 for (intptr_t i = 0; i <= num_flds; i++) { 1104 for (intptr_t i = 0; i <= num_flds; i++) {
1103 *(prefix.raw()->from() + i) = reader->ReadObjectRef(); 1105 *(prefix.raw()->from() + i) = reader->ReadObjectRef();
1104 } 1106 }
1105 1107
1106 return prefix.raw(); 1108 return prefix.raw();
1107 } 1109 }
1108 1110
1109 1111
1110 void RawLibraryPrefix::WriteTo(SnapshotWriter* writer, 1112 void RawLibraryPrefix::WriteTo(SnapshotWriter* writer,
1111 intptr_t object_id, 1113 intptr_t object_id,
1112 Snapshot::Kind kind) { 1114 Snapshot::Kind kind) {
1113 ASSERT(writer != NULL); 1115 ASSERT(writer != NULL);
1114 ASSERT(((kind == Snapshot::kScript) && 1116 ASSERT(((kind == Snapshot::kScript) &&
1115 !RawObject::IsCreatedFromSnapshot(writer->GetObjectTags(this))) || 1117 !RawObject::IsCreatedFromSnapshot(writer->GetObjectTags(this))) ||
1116 (kind == Snapshot::kFull)); 1118 (kind == Snapshot::kFull));
1117 1119
1118 // Write out the serialization header value for this object. 1120 // Write out the serialization header value for this object.
1119 writer->WriteInlinedObjectHeader(object_id); 1121 writer->WriteInlinedObjectHeader(object_id);
1120 1122
1121 // Write out the class and tags information. 1123 // Write out the class and tags information.
1122 writer->WriteVMIsolateObject(kLibraryPrefixCid); 1124 writer->WriteIndexedObject(kLibraryPrefixCid);
1123 writer->WriteIntptrValue(writer->GetObjectTags(this)); 1125 writer->WriteIntptrValue(writer->GetObjectTags(this));
1124 1126
1125 // Write out all non object fields. 1127 // Write out all non object fields.
1126 writer->WriteIntptrValue(ptr()->num_imports_); 1128 writer->WriteIntptrValue(ptr()->num_imports_);
1129 writer->Write<bool>(ptr()->is_deferred_load_);
1130 writer->Write<bool>(ptr()->is_loaded_);
1127 1131
1128 // Write out all the object pointer fields. 1132 // Write out all the object pointer fields.
1129 SnapshotWriterVisitor visitor(writer); 1133 SnapshotWriterVisitor visitor(writer);
1130 visitor.VisitPointers(from(), to()); 1134 visitor.VisitPointers(from(), to());
1131 } 1135 }
1132 1136
1133 1137
1134 RawNamespace* Namespace::ReadFrom(SnapshotReader* reader, 1138 RawNamespace* Namespace::ReadFrom(SnapshotReader* reader,
1135 intptr_t object_id, 1139 intptr_t object_id,
1136 intptr_t tags, 1140 intptr_t tags,
(...skipping 1538 matching lines...) Expand 10 before | Expand all | Expand 10 after
2675 // We do not allow objects with native fields in an isolate message. 2679 // We do not allow objects with native fields in an isolate message.
2676 writer->SetWriteException(Exceptions::kArgument, 2680 writer->SetWriteException(Exceptions::kArgument,
2677 "Illegal argument in isolate message" 2681 "Illegal argument in isolate message"
2678 " : (object is a MirrorReference)"); 2682 " : (object is a MirrorReference)");
2679 } else { 2683 } else {
2680 UNREACHABLE(); 2684 UNREACHABLE();
2681 } 2685 }
2682 } 2686 }
2683 2687
2684 } // namespace dart 2688 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/raw_object.h ('k') | runtime/vm/snapshot.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698