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/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 21 matching lines...) Expand all Loading... |
32 intptr_t object_id, | 32 intptr_t object_id, |
33 intptr_t tags, | 33 intptr_t tags, |
34 Snapshot::Kind kind) { | 34 Snapshot::Kind kind) { |
35 ASSERT(reader != NULL); | 35 ASSERT(reader != NULL); |
36 | 36 |
37 Class& cls = Class::ZoneHandle(reader->isolate(), Class::null()); | 37 Class& cls = Class::ZoneHandle(reader->isolate(), Class::null()); |
38 if ((kind == Snapshot::kFull) || | 38 if ((kind == Snapshot::kFull) || |
39 (kind == Snapshot::kScript && !RawObject::IsCreatedFromSnapshot(tags))) { | 39 (kind == Snapshot::kScript && !RawObject::IsCreatedFromSnapshot(tags))) { |
40 // Read in the base information. | 40 // Read in the base information. |
41 intptr_t class_id = reader->ReadIntptrValue(); | 41 intptr_t class_id = reader->ReadIntptrValue(); |
42 bool is_signature_class = reader->Read<bool>(); | |
43 | 42 |
44 // Allocate class object of specified kind. | 43 // Allocate class object of specified kind. |
45 if (kind == Snapshot::kFull) { | 44 if (kind == Snapshot::kFull) { |
46 cls = reader->NewClass(class_id, is_signature_class); | 45 cls = reader->NewClass(class_id); |
47 } else { | 46 } else { |
48 if (class_id < kNumPredefinedCids) { | 47 if (class_id < kNumPredefinedCids) { |
49 ASSERT((class_id >= kInstanceCid) && (class_id <= kDartFunctionCid)); | 48 ASSERT((class_id >= kInstanceCid) && (class_id <= kDartFunctionCid)); |
50 cls = reader->isolate()->class_table()->At(class_id); | 49 cls = reader->isolate()->class_table()->At(class_id); |
51 } else { | 50 } else { |
52 if (is_signature_class) { | 51 cls = New<Instance>(kIllegalCid); |
53 cls = New<Closure>(kIllegalCid); | |
54 } else { | |
55 cls = New<Instance>(kIllegalCid); | |
56 } | |
57 } | 52 } |
58 } | 53 } |
59 reader->AddBackRef(object_id, &cls, kIsDeserialized); | 54 reader->AddBackRef(object_id, &cls, kIsDeserialized); |
60 | 55 |
61 // Set the object tags. | 56 // Set the object tags. |
62 cls.set_tags(tags); | 57 cls.set_tags(tags); |
63 | 58 |
64 // Set all non object fields. | 59 // Set all non object fields. |
65 cls.set_instance_size(reader->ReadIntptrValue()); | 60 cls.set_instance_size(reader->ReadIntptrValue()); |
66 cls.set_type_arguments_instance_field_offset(reader->ReadIntptrValue()); | 61 cls.set_type_arguments_instance_field_offset(reader->ReadIntptrValue()); |
(...skipping 27 matching lines...) Expand all Loading... |
94 if ((kind == Snapshot::kFull) || | 89 if ((kind == Snapshot::kFull) || |
95 (kind == Snapshot::kScript && | 90 (kind == Snapshot::kScript && |
96 !RawObject::IsCreatedFromSnapshot(writer->GetObjectTags(this)))) { | 91 !RawObject::IsCreatedFromSnapshot(writer->GetObjectTags(this)))) { |
97 // Write out the class and tags information. | 92 // Write out the class and tags information. |
98 writer->WriteVMIsolateObject(kClassCid); | 93 writer->WriteVMIsolateObject(kClassCid); |
99 writer->WriteIntptrValue(writer->GetObjectTags(this)); | 94 writer->WriteIntptrValue(writer->GetObjectTags(this)); |
100 | 95 |
101 // Write out all the non object pointer fields. | 96 // Write out all the non object pointer fields. |
102 // NOTE: cpp_vtable_ is not written. | 97 // NOTE: cpp_vtable_ is not written. |
103 writer->WriteIntptrValue(ptr()->id_); | 98 writer->WriteIntptrValue(ptr()->id_); |
104 writer->Write<bool>(Class::IsSignatureClass(this) ? true : false); | |
105 writer->WriteIntptrValue(ptr()->instance_size_); | 99 writer->WriteIntptrValue(ptr()->instance_size_); |
106 writer->WriteIntptrValue(ptr()->type_arguments_instance_field_offset_); | 100 writer->WriteIntptrValue(ptr()->type_arguments_instance_field_offset_); |
107 writer->WriteIntptrValue(ptr()->next_field_offset_); | 101 writer->WriteIntptrValue(ptr()->next_field_offset_); |
108 writer->WriteIntptrValue(ptr()->num_native_fields_); | 102 writer->WriteIntptrValue(ptr()->num_native_fields_); |
109 writer->WriteIntptrValue(ptr()->token_pos_); | 103 writer->WriteIntptrValue(ptr()->token_pos_); |
110 writer->Write<uint8_t>(ptr()->state_bits_); | 104 writer->Write<uint8_t>(ptr()->state_bits_); |
111 | 105 |
112 // Write out all the object pointer fields. | 106 // Write out all the object pointer fields. |
113 SnapshotWriterVisitor visitor(writer); | 107 SnapshotWriterVisitor visitor(writer); |
114 visitor.VisitPointers(from(), to()); | 108 visitor.VisitPointers(from(), to()); |
(...skipping 2084 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2199 } | 2193 } |
2200 | 2194 |
2201 | 2195 |
2202 void RawDartFunction::WriteTo(SnapshotWriter* writer, | 2196 void RawDartFunction::WriteTo(SnapshotWriter* writer, |
2203 intptr_t object_id, | 2197 intptr_t object_id, |
2204 Snapshot::Kind kind) { | 2198 Snapshot::Kind kind) { |
2205 UNREACHABLE(); // DartFunction is an abstract class. | 2199 UNREACHABLE(); // DartFunction is an abstract class. |
2206 } | 2200 } |
2207 | 2201 |
2208 | 2202 |
2209 RawClosure* Closure::ReadFrom(SnapshotReader* reader, | |
2210 intptr_t object_id, | |
2211 intptr_t tags, | |
2212 Snapshot::Kind kind) { | |
2213 UNIMPLEMENTED(); | |
2214 return Closure::null(); | |
2215 } | |
2216 | |
2217 | |
2218 void RawClosure::WriteTo(SnapshotWriter* writer, | |
2219 intptr_t object_id, | |
2220 Snapshot::Kind kind) { | |
2221 UNIMPLEMENTED(); | |
2222 } | |
2223 | |
2224 | |
2225 RawStacktrace* Stacktrace::ReadFrom(SnapshotReader* reader, | 2203 RawStacktrace* Stacktrace::ReadFrom(SnapshotReader* reader, |
2226 intptr_t object_id, | 2204 intptr_t object_id, |
2227 intptr_t tags, | 2205 intptr_t tags, |
2228 Snapshot::Kind kind) { | 2206 Snapshot::Kind kind) { |
2229 UNIMPLEMENTED(); | 2207 UNIMPLEMENTED(); |
2230 return Stacktrace::null(); | 2208 return Stacktrace::null(); |
2231 } | 2209 } |
2232 | 2210 |
2233 | 2211 |
2234 void RawStacktrace::WriteTo(SnapshotWriter* writer, | 2212 void RawStacktrace::WriteTo(SnapshotWriter* writer, |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2328 // Write out the class and tags information. | 2306 // Write out the class and tags information. |
2329 writer->WriteIndexedObject(kWeakPropertyCid); | 2307 writer->WriteIndexedObject(kWeakPropertyCid); |
2330 writer->WriteIntptrValue(writer->GetObjectTags(this)); | 2308 writer->WriteIntptrValue(writer->GetObjectTags(this)); |
2331 | 2309 |
2332 // Write out all the other fields. | 2310 // Write out all the other fields. |
2333 writer->Write<RawObject*>(ptr()->key_); | 2311 writer->Write<RawObject*>(ptr()->key_); |
2334 writer->Write<RawObject*>(ptr()->value_); | 2312 writer->Write<RawObject*>(ptr()->value_); |
2335 } | 2313 } |
2336 | 2314 |
2337 } // namespace dart | 2315 } // namespace dart |
OLD | NEW |