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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 } else { | 50 } else { |
51 cls = New<Instance>(kIllegalCid); | 51 cls = New<Instance>(kIllegalCid); |
52 } | 52 } |
53 } | 53 } |
54 reader->AddBackRef(object_id, &cls, kIsDeserialized); | 54 reader->AddBackRef(object_id, &cls, kIsDeserialized); |
55 | 55 |
56 // Set the object tags. | 56 // Set the object tags. |
57 cls.set_tags(tags); | 57 cls.set_tags(tags); |
58 | 58 |
59 // Set all non object fields. | 59 // Set all non object fields. |
60 cls.set_instance_size(reader->ReadIntptrValue()); | 60 cls.set_instance_size_in_words(reader->ReadIntptrValue()); |
61 cls.set_type_arguments_field_offset(reader->ReadIntptrValue()); | 61 cls.set_type_arguments_field_offset_in_words(reader->ReadIntptrValue()); |
62 cls.set_next_field_offset(reader->ReadIntptrValue()); | 62 cls.set_next_field_offset_in_words(reader->ReadIntptrValue()); |
63 cls.set_num_native_fields(reader->ReadIntptrValue()); | 63 cls.set_num_native_fields(reader->ReadIntptrValue()); |
64 cls.set_token_pos(reader->ReadIntptrValue()); | 64 cls.set_token_pos(reader->ReadIntptrValue()); |
65 cls.set_state_bits(reader->Read<uint8_t>()); | 65 cls.set_state_bits(reader->Read<uint8_t>()); |
66 | 66 |
67 // Set all the object fields. | 67 // Set all the object fields. |
68 // TODO(5411462): Need to assert No GC can happen here, even though | 68 // TODO(5411462): Need to assert No GC can happen here, even though |
69 // allocations may happen. | 69 // allocations may happen. |
70 intptr_t num_flds = (cls.raw()->to() - cls.raw()->from()); | 70 intptr_t num_flds = (cls.raw()->to() - cls.raw()->from()); |
71 for (intptr_t i = 0; i <= num_flds; i++) { | 71 for (intptr_t i = 0; i <= num_flds; i++) { |
72 *(cls.raw()->from() + i) = reader->ReadObjectRef(); | 72 *(cls.raw()->from() + i) = reader->ReadObjectRef(); |
(...skipping 16 matching lines...) Expand all Loading... |
89 if ((kind == Snapshot::kFull) || | 89 if ((kind == Snapshot::kFull) || |
90 (kind == Snapshot::kScript && | 90 (kind == Snapshot::kScript && |
91 !RawObject::IsCreatedFromSnapshot(writer->GetObjectTags(this)))) { | 91 !RawObject::IsCreatedFromSnapshot(writer->GetObjectTags(this)))) { |
92 // Write out the class and tags information. | 92 // Write out the class and tags information. |
93 writer->WriteVMIsolateObject(kClassCid); | 93 writer->WriteVMIsolateObject(kClassCid); |
94 writer->WriteIntptrValue(writer->GetObjectTags(this)); | 94 writer->WriteIntptrValue(writer->GetObjectTags(this)); |
95 | 95 |
96 // Write out all the non object pointer fields. | 96 // Write out all the non object pointer fields. |
97 // NOTE: cpp_vtable_ is not written. | 97 // NOTE: cpp_vtable_ is not written. |
98 writer->WriteIntptrValue(ptr()->id_); | 98 writer->WriteIntptrValue(ptr()->id_); |
99 writer->WriteIntptrValue(ptr()->instance_size_); | 99 writer->WriteIntptrValue(ptr()->instance_size_in_words_); |
100 writer->WriteIntptrValue(ptr()->type_arguments_field_offset_); | 100 writer->WriteIntptrValue(ptr()->type_arguments_field_offset_in_words_); |
101 writer->WriteIntptrValue(ptr()->next_field_offset_); | 101 writer->WriteIntptrValue(ptr()->next_field_offset_in_words_); |
102 writer->WriteIntptrValue(ptr()->num_native_fields_); | 102 writer->WriteIntptrValue(ptr()->num_native_fields_); |
103 writer->WriteIntptrValue(ptr()->token_pos_); | 103 writer->WriteIntptrValue(ptr()->token_pos_); |
104 writer->Write<uint8_t>(ptr()->state_bits_); | 104 writer->Write<uint8_t>(ptr()->state_bits_); |
105 | 105 |
106 // Write out all the object pointer fields. | 106 // Write out all the object pointer fields. |
107 SnapshotWriterVisitor visitor(writer); | 107 SnapshotWriterVisitor visitor(writer); |
108 visitor.VisitPointers(from(), to()); | 108 visitor.VisitPointers(from(), to()); |
109 } else { | 109 } else { |
110 writer->WriteClassId(this); | 110 writer->WriteClassId(this); |
111 } | 111 } |
(...skipping 2098 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2210 // Write out the class and tags information. | 2210 // Write out the class and tags information. |
2211 writer->WriteIndexedObject(kWeakPropertyCid); | 2211 writer->WriteIndexedObject(kWeakPropertyCid); |
2212 writer->WriteIntptrValue(writer->GetObjectTags(this)); | 2212 writer->WriteIntptrValue(writer->GetObjectTags(this)); |
2213 | 2213 |
2214 // Write out all the other fields. | 2214 // Write out all the other fields. |
2215 writer->Write<RawObject*>(ptr()->key_); | 2215 writer->Write<RawObject*>(ptr()->key_); |
2216 writer->Write<RawObject*>(ptr()->value_); | 2216 writer->Write<RawObject*>(ptr()->value_); |
2217 } | 2217 } |
2218 | 2218 |
2219 } // namespace dart | 2219 } // namespace dart |
OLD | NEW |