| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 // Set the object tags. | 59 // Set the object tags. |
| 60 cls.set_tags(tags); | 60 cls.set_tags(tags); |
| 61 | 61 |
| 62 // Set all non object fields. | 62 // Set all non object fields. |
| 63 if (!RawObject::IsInternalVMdefinedClassId(class_id)) { | 63 if (!RawObject::IsInternalVMdefinedClassId(class_id)) { |
| 64 // Instance size of a VM defined class is already set up. | 64 // Instance size of a VM defined class is already set up. |
| 65 cls.set_instance_size_in_words(reader->ReadIntptrValue()); | 65 cls.set_instance_size_in_words(reader->ReadIntptrValue()); |
| 66 cls.set_next_field_offset_in_words(reader->ReadIntptrValue()); | 66 cls.set_next_field_offset_in_words(reader->ReadIntptrValue()); |
| 67 } | 67 } |
| 68 cls.set_type_arguments_field_offset_in_words(reader->ReadIntptrValue()); | 68 cls.set_type_arguments_field_offset_in_words(reader->ReadIntptrValue()); |
| 69 cls.set_num_native_fields(reader->ReadIntptrValue()); | 69 cls.set_num_type_arguments(reader->Read<int16_t>()); |
| 70 cls.set_num_own_type_arguments(reader->Read<int16_t>()); |
| 71 cls.set_num_native_fields(reader->Read<uint16_t>()); |
| 70 cls.set_token_pos(reader->ReadIntptrValue()); | 72 cls.set_token_pos(reader->ReadIntptrValue()); |
| 71 cls.set_state_bits(reader->Read<uint16_t>()); | 73 cls.set_state_bits(reader->Read<uint16_t>()); |
| 72 | 74 |
| 73 // Set all the object fields. | 75 // Set all the object fields. |
| 74 // TODO(5411462): Need to assert No GC can happen here, even though | 76 // TODO(5411462): Need to assert No GC can happen here, even though |
| 75 // allocations may happen. | 77 // allocations may happen. |
| 76 intptr_t num_flds = (cls.raw()->to() - cls.raw()->from()); | 78 intptr_t num_flds = (cls.raw()->to() - cls.raw()->from()); |
| 77 for (intptr_t i = 0; i <= num_flds; i++) { | 79 for (intptr_t i = 0; i <= num_flds; i++) { |
| 78 *(cls.raw()->from() + i) = reader->ReadObjectRef(); | 80 *(cls.raw()->from() + i) = reader->ReadObjectRef(); |
| 79 } | 81 } |
| (...skipping 24 matching lines...) Expand all Loading... |
| 104 intptr_t class_id = ptr()->id_; | 106 intptr_t class_id = ptr()->id_; |
| 105 writer->WriteIntptrValue(class_id); | 107 writer->WriteIntptrValue(class_id); |
| 106 if (!RawObject::IsInternalVMdefinedClassId(class_id)) { | 108 if (!RawObject::IsInternalVMdefinedClassId(class_id)) { |
| 107 // We don't write the instance size of VM defined classes as they | 109 // We don't write the instance size of VM defined classes as they |
| 108 // are already setup during initialization as part of pre populating | 110 // are already setup during initialization as part of pre populating |
| 109 // the class table. | 111 // the class table. |
| 110 writer->WriteIntptrValue(ptr()->instance_size_in_words_); | 112 writer->WriteIntptrValue(ptr()->instance_size_in_words_); |
| 111 writer->WriteIntptrValue(ptr()->next_field_offset_in_words_); | 113 writer->WriteIntptrValue(ptr()->next_field_offset_in_words_); |
| 112 } | 114 } |
| 113 writer->WriteIntptrValue(ptr()->type_arguments_field_offset_in_words_); | 115 writer->WriteIntptrValue(ptr()->type_arguments_field_offset_in_words_); |
| 114 writer->WriteIntptrValue(ptr()->num_native_fields_); | 116 writer->Write<int16_t>(ptr()->num_type_arguments_); |
| 117 writer->Write<int16_t>(ptr()->num_own_type_arguments_); |
| 118 writer->Write<uint16_t>(ptr()->num_native_fields_); |
| 115 writer->WriteIntptrValue(ptr()->token_pos_); | 119 writer->WriteIntptrValue(ptr()->token_pos_); |
| 116 writer->Write<uint16_t>(ptr()->state_bits_); | 120 writer->Write<uint16_t>(ptr()->state_bits_); |
| 117 | 121 |
| 118 // Write out all the object pointer fields. | 122 // Write out all the object pointer fields. |
| 119 SnapshotWriterVisitor visitor(writer); | 123 SnapshotWriterVisitor visitor(writer); |
| 120 visitor.VisitPointers(from(), to()); | 124 visitor.VisitPointers(from(), to()); |
| 121 } else { | 125 } else { |
| 122 writer->WriteClassId(this); | 126 writer->WriteClassId(this); |
| 123 } | 127 } |
| 124 } | 128 } |
| (...skipping 2522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2647 } | 2651 } |
| 2648 | 2652 |
| 2649 | 2653 |
| 2650 void RawMirrorReference::WriteTo(SnapshotWriter* writer, | 2654 void RawMirrorReference::WriteTo(SnapshotWriter* writer, |
| 2651 intptr_t object_id, | 2655 intptr_t object_id, |
| 2652 Snapshot::Kind kind) { | 2656 Snapshot::Kind kind) { |
| 2653 UNREACHABLE(); | 2657 UNREACHABLE(); |
| 2654 } | 2658 } |
| 2655 | 2659 |
| 2656 } // namespace dart | 2660 } // namespace dart |
| OLD | NEW |