Chromium Code Reviews| 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/stub_code.h" | 9 #include "vm/stub_code.h" |
| 10 #include "vm/symbols.h" | 10 #include "vm/symbols.h" |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 32 RawClass* Class::ReadFrom(SnapshotReader* reader, | 32 RawClass* Class::ReadFrom(SnapshotReader* reader, |
| 33 intptr_t object_id, | 33 intptr_t object_id, |
| 34 intptr_t tags, | 34 intptr_t tags, |
| 35 Snapshot::Kind kind) { | 35 Snapshot::Kind kind) { |
| 36 ASSERT(reader != NULL); | 36 ASSERT(reader != NULL); |
| 37 | 37 |
| 38 Class& cls = Class::ZoneHandle(reader->isolate(), Class::null()); | 38 Class& cls = Class::ZoneHandle(reader->isolate(), Class::null()); |
| 39 if ((kind == Snapshot::kFull) || | 39 if ((kind == Snapshot::kFull) || |
| 40 (kind == Snapshot::kScript && !RawObject::IsCreatedFromSnapshot(tags))) { | 40 (kind == Snapshot::kScript && !RawObject::IsCreatedFromSnapshot(tags))) { |
| 41 // Read in the base information. | 41 // Read in the base information. |
| 42 intptr_t class_id = reader->ReadIntptrValue(); | 42 intptr_t class_id = reader->ReadIntptrValue(); |
|
siva
2014/06/12 16:39:25
This was written out as an int32_t field below so
zra
2014/06/12 17:34:02
Done.
| |
| 43 | 43 |
| 44 // Allocate class object of specified kind. | 44 // Allocate class object of specified kind. |
| 45 if (kind == Snapshot::kFull) { | 45 if (kind == Snapshot::kFull) { |
| 46 cls = reader->NewClass(class_id); | 46 cls = reader->NewClass(class_id); |
| 47 } else { | 47 } else { |
| 48 if (class_id < kNumPredefinedCids) { | 48 if (class_id < kNumPredefinedCids) { |
| 49 ASSERT((class_id >= kInstanceCid) && (class_id <= kMirrorReferenceCid)); | 49 ASSERT((class_id >= kInstanceCid) && (class_id <= kMirrorReferenceCid)); |
| 50 cls = reader->isolate()->class_table()->At(class_id); | 50 cls = reader->isolate()->class_table()->At(class_id); |
| 51 } else { | 51 } else { |
| 52 cls = New<Instance>(kIllegalCid); | 52 cls = New<Instance>(kIllegalCid); |
| 53 } | 53 } |
| 54 } | 54 } |
| 55 reader->AddBackRef(object_id, &cls, kIsDeserialized); | 55 reader->AddBackRef(object_id, &cls, kIsDeserialized); |
| 56 | 56 |
| 57 // Set the object tags. | 57 // Set the object tags. |
| 58 cls.set_tags(tags); | 58 cls.set_tags(tags); |
| 59 | 59 |
| 60 // Set all non object fields. | 60 // Set all non object fields. |
| 61 if (!RawObject::IsInternalVMdefinedClassId(class_id)) { | 61 if (!RawObject::IsInternalVMdefinedClassId(class_id)) { |
| 62 // Instance size of a VM defined class is already set up. | 62 // Instance size of a VM defined class is already set up. |
| 63 cls.set_instance_size_in_words(reader->ReadIntptrValue()); | 63 cls.set_instance_size_in_words(reader->Read<int32_t>()); |
| 64 cls.set_next_field_offset_in_words(reader->ReadIntptrValue()); | 64 cls.set_next_field_offset_in_words(reader->Read<int32_t>()); |
| 65 } | 65 } |
| 66 cls.set_type_arguments_field_offset_in_words(reader->ReadIntptrValue()); | 66 cls.set_type_arguments_field_offset_in_words(reader->Read<int32_t>()); |
| 67 cls.set_num_type_arguments(reader->Read<int16_t>()); | 67 cls.set_num_type_arguments(reader->Read<int16_t>()); |
| 68 cls.set_num_own_type_arguments(reader->Read<int16_t>()); | 68 cls.set_num_own_type_arguments(reader->Read<int16_t>()); |
| 69 cls.set_num_native_fields(reader->Read<uint16_t>()); | 69 cls.set_num_native_fields(reader->Read<uint16_t>()); |
| 70 cls.set_token_pos(reader->ReadIntptrValue()); | 70 cls.set_token_pos(reader->Read<int32_t>()); |
| 71 cls.set_state_bits(reader->Read<uint16_t>()); | 71 cls.set_state_bits(reader->Read<uint16_t>()); |
| 72 | 72 |
| 73 // Set all the object fields. | 73 // Set all the object fields. |
| 74 // TODO(5411462): Need to assert No GC can happen here, even though | 74 // TODO(5411462): Need to assert No GC can happen here, even though |
| 75 // allocations may happen. | 75 // allocations may happen. |
| 76 intptr_t num_flds = (cls.raw()->to() - cls.raw()->from()); | 76 intptr_t num_flds = (cls.raw()->to() - cls.raw()->from()); |
| 77 for (intptr_t i = 0; i <= num_flds; i++) { | 77 for (intptr_t i = 0; i <= num_flds; i++) { |
| 78 *(cls.raw()->from() + i) = reader->ReadObjectRef(); | 78 *(cls.raw()->from() + i) = reader->ReadObjectRef(); |
| 79 } | 79 } |
| 80 } else { | 80 } else { |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 94 | 94 |
| 95 if ((kind == Snapshot::kFull) || | 95 if ((kind == Snapshot::kFull) || |
| 96 (kind == Snapshot::kScript && | 96 (kind == Snapshot::kScript && |
| 97 !RawObject::IsCreatedFromSnapshot(writer->GetObjectTags(this)))) { | 97 !RawObject::IsCreatedFromSnapshot(writer->GetObjectTags(this)))) { |
| 98 // Write out the class and tags information. | 98 // Write out the class and tags information. |
| 99 writer->WriteVMIsolateObject(kClassCid); | 99 writer->WriteVMIsolateObject(kClassCid); |
| 100 writer->WriteIntptrValue(writer->GetObjectTags(this)); | 100 writer->WriteIntptrValue(writer->GetObjectTags(this)); |
| 101 | 101 |
| 102 // Write out all the non object pointer fields. | 102 // Write out all the non object pointer fields. |
| 103 // NOTE: cpp_vtable_ is not written. | 103 // NOTE: cpp_vtable_ is not written. |
| 104 intptr_t class_id = ptr()->id_; | 104 int32_t class_id = ptr()->id_; |
| 105 writer->WriteIntptrValue(class_id); | 105 writer->Write<int32_t>(class_id); |
| 106 if (!RawObject::IsInternalVMdefinedClassId(class_id)) { | 106 if (!RawObject::IsInternalVMdefinedClassId(class_id)) { |
| 107 // We don't write the instance size of VM defined classes as they | 107 // We don't write the instance size of VM defined classes as they |
| 108 // are already setup during initialization as part of pre populating | 108 // are already setup during initialization as part of pre populating |
| 109 // the class table. | 109 // the class table. |
| 110 writer->WriteIntptrValue(ptr()->instance_size_in_words_); | 110 writer->Write<int32_t>(ptr()->instance_size_in_words_); |
| 111 writer->WriteIntptrValue(ptr()->next_field_offset_in_words_); | 111 writer->Write<int32_t>(ptr()->next_field_offset_in_words_); |
| 112 } | 112 } |
| 113 writer->WriteIntptrValue(ptr()->type_arguments_field_offset_in_words_); | 113 writer->Write<int32_t>(ptr()->type_arguments_field_offset_in_words_); |
| 114 writer->Write<int16_t>(ptr()->num_type_arguments_); | 114 writer->Write<int16_t>(ptr()->num_type_arguments_); |
| 115 writer->Write<int16_t>(ptr()->num_own_type_arguments_); | 115 writer->Write<int16_t>(ptr()->num_own_type_arguments_); |
| 116 writer->Write<uint16_t>(ptr()->num_native_fields_); | 116 writer->Write<uint16_t>(ptr()->num_native_fields_); |
| 117 writer->WriteIntptrValue(ptr()->token_pos_); | 117 writer->Write<int32_t>(ptr()->token_pos_); |
| 118 writer->Write<uint16_t>(ptr()->state_bits_); | 118 writer->Write<uint16_t>(ptr()->state_bits_); |
| 119 | 119 |
| 120 // Write out all the object pointer fields. | 120 // Write out all the object pointer fields. |
| 121 SnapshotWriterVisitor visitor(writer); | 121 SnapshotWriterVisitor visitor(writer); |
| 122 visitor.VisitPointers(from(), to()); | 122 visitor.VisitPointers(from(), to()); |
| 123 } else { | 123 } else { |
| 124 writer->WriteClassId(this); | 124 writer->WriteClassId(this); |
| 125 } | 125 } |
| 126 } | 126 } |
| 127 | 127 |
| 128 | 128 |
| 129 RawUnresolvedClass* UnresolvedClass::ReadFrom(SnapshotReader* reader, | 129 RawUnresolvedClass* UnresolvedClass::ReadFrom(SnapshotReader* reader, |
| 130 intptr_t object_id, | 130 intptr_t object_id, |
| 131 intptr_t tags, | 131 intptr_t tags, |
| 132 Snapshot::Kind kind) { | 132 Snapshot::Kind kind) { |
| 133 ASSERT(reader != NULL); | 133 ASSERT(reader != NULL); |
| 134 | 134 |
| 135 // Allocate unresolved class object. | 135 // Allocate unresolved class object. |
| 136 UnresolvedClass& unresolved_class = UnresolvedClass::ZoneHandle( | 136 UnresolvedClass& unresolved_class = UnresolvedClass::ZoneHandle( |
| 137 reader->isolate(), NEW_OBJECT(UnresolvedClass)); | 137 reader->isolate(), NEW_OBJECT(UnresolvedClass)); |
| 138 reader->AddBackRef(object_id, &unresolved_class, kIsDeserialized); | 138 reader->AddBackRef(object_id, &unresolved_class, kIsDeserialized); |
| 139 | 139 |
| 140 // Set the object tags. | 140 // Set the object tags. |
| 141 unresolved_class.set_tags(tags); | 141 unresolved_class.set_tags(tags); |
| 142 | 142 |
| 143 // Set all non object fields. | 143 // Set all non object fields. |
| 144 unresolved_class.set_token_pos(reader->ReadIntptrValue()); | 144 unresolved_class.set_token_pos(reader->Read<int32_t>()); |
| 145 | 145 |
| 146 // Set all the object fields. | 146 // Set all the object fields. |
| 147 // TODO(5411462): Need to assert No GC can happen here, even though | 147 // TODO(5411462): Need to assert No GC can happen here, even though |
| 148 // allocations may happen. | 148 // allocations may happen. |
| 149 intptr_t num_flds = (unresolved_class.raw()->to() - | 149 intptr_t num_flds = (unresolved_class.raw()->to() - |
| 150 unresolved_class.raw()->from()); | 150 unresolved_class.raw()->from()); |
| 151 for (intptr_t i = 0; i <= num_flds; i++) { | 151 for (intptr_t i = 0; i <= num_flds; i++) { |
| 152 (*reader->ObjectHandle()) = reader->ReadObjectRef(); | 152 (*reader->ObjectHandle()) = reader->ReadObjectRef(); |
| 153 unresolved_class.StorePointer((unresolved_class.raw()->from() + i), | 153 unresolved_class.StorePointer((unresolved_class.raw()->from() + i), |
| 154 reader->ObjectHandle()->raw()); | 154 reader->ObjectHandle()->raw()); |
| 155 } | 155 } |
| 156 return unresolved_class.raw(); | 156 return unresolved_class.raw(); |
| 157 } | 157 } |
| 158 | 158 |
| 159 | 159 |
| 160 void RawUnresolvedClass::WriteTo(SnapshotWriter* writer, | 160 void RawUnresolvedClass::WriteTo(SnapshotWriter* writer, |
| 161 intptr_t object_id, | 161 intptr_t object_id, |
| 162 Snapshot::Kind kind) { | 162 Snapshot::Kind kind) { |
| 163 ASSERT(writer != NULL); | 163 ASSERT(writer != NULL); |
| 164 | 164 |
| 165 // Write out the serialization header value for this object. | 165 // Write out the serialization header value for this object. |
| 166 writer->WriteInlinedObjectHeader(object_id); | 166 writer->WriteInlinedObjectHeader(object_id); |
| 167 | 167 |
| 168 // Write out the class and tags information. | 168 // Write out the class and tags information. |
| 169 writer->WriteVMIsolateObject(kUnresolvedClassCid); | 169 writer->WriteVMIsolateObject(kUnresolvedClassCid); |
| 170 writer->WriteIntptrValue(writer->GetObjectTags(this)); | 170 writer->WriteIntptrValue(writer->GetObjectTags(this)); |
| 171 | 171 |
| 172 // Write out all the non object pointer fields. | 172 // Write out all the non object pointer fields. |
| 173 writer->WriteIntptrValue(ptr()->token_pos_); | 173 writer->Write<int32_t>(ptr()->token_pos_); |
| 174 | 174 |
| 175 // Write out all the object pointer fields. | 175 // Write out all the object pointer fields. |
| 176 SnapshotWriterVisitor visitor(writer); | 176 SnapshotWriterVisitor visitor(writer); |
| 177 visitor.VisitPointers(from(), to()); | 177 visitor.VisitPointers(from(), to()); |
| 178 } | 178 } |
| 179 | 179 |
| 180 | 180 |
| 181 RawAbstractType* AbstractType::ReadFrom(SnapshotReader* reader, | 181 RawAbstractType* AbstractType::ReadFrom(SnapshotReader* reader, |
| 182 intptr_t object_id, | 182 intptr_t object_id, |
| 183 intptr_t tags, | 183 intptr_t tags, |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 198 intptr_t object_id, | 198 intptr_t object_id, |
| 199 intptr_t tags, | 199 intptr_t tags, |
| 200 Snapshot::Kind kind) { | 200 Snapshot::Kind kind) { |
| 201 ASSERT(reader != NULL); | 201 ASSERT(reader != NULL); |
| 202 | 202 |
| 203 // Allocate type object. | 203 // Allocate type object. |
| 204 Type& type = Type::ZoneHandle(reader->isolate(), NEW_OBJECT(Type)); | 204 Type& type = Type::ZoneHandle(reader->isolate(), NEW_OBJECT(Type)); |
| 205 reader->AddBackRef(object_id, &type, kIsDeserialized); | 205 reader->AddBackRef(object_id, &type, kIsDeserialized); |
| 206 | 206 |
| 207 // Set all non object fields. | 207 // Set all non object fields. |
| 208 type.set_token_pos(reader->ReadIntptrValue()); | 208 type.set_token_pos(reader->Read<int32_t>()); |
| 209 type.set_type_state(reader->Read<int8_t>()); | 209 type.set_type_state(reader->Read<int8_t>()); |
| 210 | 210 |
| 211 // Set all the object fields. | 211 // Set all the object fields. |
| 212 // TODO(5411462): Need to assert No GC can happen here, even though | 212 // TODO(5411462): Need to assert No GC can happen here, even though |
| 213 // allocations may happen. | 213 // allocations may happen. |
| 214 intptr_t num_flds = (type.raw()->to() - type.raw()->from()); | 214 intptr_t num_flds = (type.raw()->to() - type.raw()->from()); |
| 215 for (intptr_t i = 0; i <= num_flds; i++) { | 215 for (intptr_t i = 0; i <= num_flds; i++) { |
| 216 (*reader->ObjectHandle()) = reader->ReadObjectImpl(); | 216 (*reader->ObjectHandle()) = reader->ReadObjectImpl(); |
| 217 type.StorePointer((type.raw()->from() + i), reader->ObjectHandle()->raw()); | 217 type.StorePointer((type.raw()->from() + i), reader->ObjectHandle()->raw()); |
| 218 } | 218 } |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 249 (ptr()->type_state_ == RawType::kFinalizedUninstantiated)); | 249 (ptr()->type_state_ == RawType::kFinalizedUninstantiated)); |
| 250 | 250 |
| 251 // Write out the serialization header value for this object. | 251 // Write out the serialization header value for this object. |
| 252 writer->WriteInlinedObjectHeader(object_id); | 252 writer->WriteInlinedObjectHeader(object_id); |
| 253 | 253 |
| 254 // Write out the class and tags information. | 254 // Write out the class and tags information. |
| 255 writer->WriteIndexedObject(kTypeCid); | 255 writer->WriteIndexedObject(kTypeCid); |
| 256 writer->WriteIntptrValue(writer->GetObjectTags(this)); | 256 writer->WriteIntptrValue(writer->GetObjectTags(this)); |
| 257 | 257 |
| 258 // Write out all the non object pointer fields. | 258 // Write out all the non object pointer fields. |
| 259 writer->WriteIntptrValue(ptr()->token_pos_); | 259 writer->Write<int32_t>(ptr()->token_pos_); |
| 260 writer->Write<int8_t>(ptr()->type_state_); | 260 writer->Write<int8_t>(ptr()->type_state_); |
| 261 | 261 |
| 262 // Write out all the object pointer fields. Since we will be canonicalizing | 262 // Write out all the object pointer fields. Since we will be canonicalizing |
| 263 // the type object when reading it back we should write out all the fields | 263 // the type object when reading it back we should write out all the fields |
| 264 // inline and not as references. | 264 // inline and not as references. |
| 265 SnapshotWriterVisitor visitor(writer, false); | 265 SnapshotWriterVisitor visitor(writer, false); |
| 266 visitor.VisitPointers(from(), to()); | 266 visitor.VisitPointers(from(), to()); |
| 267 } | 267 } |
| 268 | 268 |
| 269 | 269 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 321 | 321 |
| 322 // Allocate type parameter object. | 322 // Allocate type parameter object. |
| 323 TypeParameter& type_parameter = TypeParameter::ZoneHandle( | 323 TypeParameter& type_parameter = TypeParameter::ZoneHandle( |
| 324 reader->isolate(), NEW_OBJECT(TypeParameter)); | 324 reader->isolate(), NEW_OBJECT(TypeParameter)); |
| 325 reader->AddBackRef(object_id, &type_parameter, kIsDeserialized); | 325 reader->AddBackRef(object_id, &type_parameter, kIsDeserialized); |
| 326 | 326 |
| 327 // Set the object tags. | 327 // Set the object tags. |
| 328 type_parameter.set_tags(tags); | 328 type_parameter.set_tags(tags); |
| 329 | 329 |
| 330 // Set all non object fields. | 330 // Set all non object fields. |
| 331 type_parameter.set_index(reader->ReadIntptrValue()); | 331 type_parameter.set_index(reader->Read<int32_t>()); |
| 332 type_parameter.set_token_pos(reader->ReadIntptrValue()); | 332 type_parameter.set_token_pos(reader->Read<int32_t>()); |
| 333 type_parameter.set_type_state(reader->Read<int8_t>()); | 333 type_parameter.set_type_state(reader->Read<int8_t>()); |
| 334 | 334 |
| 335 // Set all the object fields. | 335 // Set all the object fields. |
| 336 // TODO(5411462): Need to assert No GC can happen here, even though | 336 // TODO(5411462): Need to assert No GC can happen here, even though |
| 337 // allocations may happen. | 337 // allocations may happen. |
| 338 intptr_t num_flds = (type_parameter.raw()->to() - | 338 intptr_t num_flds = (type_parameter.raw()->to() - |
| 339 type_parameter.raw()->from()); | 339 type_parameter.raw()->from()); |
| 340 for (intptr_t i = 0; i <= num_flds; i++) { | 340 for (intptr_t i = 0; i <= num_flds; i++) { |
| 341 (*reader->ObjectHandle()) = reader->ReadObjectRef(); | 341 (*reader->ObjectHandle()) = reader->ReadObjectRef(); |
| 342 type_parameter.StorePointer((type_parameter.raw()->from() + i), | 342 type_parameter.StorePointer((type_parameter.raw()->from() + i), |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 356 ASSERT(ptr()->type_state_ == RawTypeParameter::kFinalizedUninstantiated); | 356 ASSERT(ptr()->type_state_ == RawTypeParameter::kFinalizedUninstantiated); |
| 357 | 357 |
| 358 // Write out the serialization header value for this object. | 358 // Write out the serialization header value for this object. |
| 359 writer->WriteInlinedObjectHeader(object_id); | 359 writer->WriteInlinedObjectHeader(object_id); |
| 360 | 360 |
| 361 // Write out the class and tags information. | 361 // Write out the class and tags information. |
| 362 writer->WriteIndexedObject(kTypeParameterCid); | 362 writer->WriteIndexedObject(kTypeParameterCid); |
| 363 writer->WriteIntptrValue(writer->GetObjectTags(this)); | 363 writer->WriteIntptrValue(writer->GetObjectTags(this)); |
| 364 | 364 |
| 365 // Write out all the non object pointer fields. | 365 // Write out all the non object pointer fields. |
| 366 writer->WriteIntptrValue(ptr()->index_); | 366 writer->Write<int32_t>(ptr()->index_); |
| 367 writer->WriteIntptrValue(ptr()->token_pos_); | 367 writer->Write<int32_t>(ptr()->token_pos_); |
| 368 writer->Write<int8_t>(ptr()->type_state_); | 368 writer->Write<int8_t>(ptr()->type_state_); |
| 369 | 369 |
| 370 // Write out all the object pointer fields. | 370 // Write out all the object pointer fields. |
| 371 SnapshotWriterVisitor visitor(writer); | 371 SnapshotWriterVisitor visitor(writer); |
| 372 visitor.VisitPointers(from(), to()); | 372 visitor.VisitPointers(from(), to()); |
| 373 } | 373 } |
| 374 | 374 |
| 375 | 375 |
| 376 RawBoundedType* BoundedType::ReadFrom(SnapshotReader* reader, | 376 RawBoundedType* BoundedType::ReadFrom(SnapshotReader* reader, |
| 377 intptr_t object_id, | 377 intptr_t object_id, |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 685 | 685 |
| 686 // Allocate function object. | 686 // Allocate function object. |
| 687 Function& func = Function::ZoneHandle( | 687 Function& func = Function::ZoneHandle( |
| 688 reader->isolate(), NEW_OBJECT(Function)); | 688 reader->isolate(), NEW_OBJECT(Function)); |
| 689 reader->AddBackRef(object_id, &func, kIsDeserialized); | 689 reader->AddBackRef(object_id, &func, kIsDeserialized); |
| 690 | 690 |
| 691 // Set the object tags. | 691 // Set the object tags. |
| 692 func.set_tags(tags); | 692 func.set_tags(tags); |
| 693 | 693 |
| 694 // Set all the non object fields. | 694 // Set all the non object fields. |
| 695 func.set_token_pos(reader->ReadIntptrValue()); | 695 func.set_token_pos(reader->Read<int32_t>()); |
| 696 func.set_end_token_pos(reader->ReadIntptrValue()); | 696 func.set_end_token_pos(reader->Read<int32_t>()); |
| 697 func.set_usage_counter(reader->ReadIntptrValue()); | 697 func.set_usage_counter(reader->Read<int32_t>()); |
| 698 func.set_num_fixed_parameters(reader->ReadIntptrValue()); | 698 func.set_num_fixed_parameters(reader->Read<int16_t>()); |
| 699 func.set_num_optional_parameters(reader->ReadIntptrValue()); | 699 func.set_num_optional_parameters(reader->Read<int16_t>()); |
| 700 func.set_deoptimization_counter(reader->ReadIntptrValue()); | 700 func.set_deoptimization_counter(reader->Read<int16_t>()); |
| 701 func.set_kind_tag(reader->Read<uint16_t>()); | 701 func.set_kind_tag(reader->Read<uint16_t>()); |
| 702 func.set_optimized_instruction_count(reader->Read<uint16_t>()); | 702 func.set_optimized_instruction_count(reader->Read<uint16_t>()); |
| 703 func.set_optimized_call_site_count(reader->Read<uint16_t>()); | 703 func.set_optimized_call_site_count(reader->Read<uint16_t>()); |
| 704 | 704 |
| 705 // Set all the object fields. | 705 // Set all the object fields. |
| 706 // TODO(5411462): Need to assert No GC can happen here, even though | 706 // TODO(5411462): Need to assert No GC can happen here, even though |
| 707 // allocations may happen. | 707 // allocations may happen. |
| 708 intptr_t num_flds = (func.raw()->to() - func.raw()->from()); | 708 intptr_t num_flds = (func.raw()->to() - func.raw()->from()); |
| 709 for (intptr_t i = 0; i <= num_flds; i++) { | 709 for (intptr_t i = 0; i <= num_flds; i++) { |
| 710 *(func.raw()->from() + i) = reader->ReadObjectRef(); | 710 *(func.raw()->from() + i) = reader->ReadObjectRef(); |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 726 (kind == Snapshot::kFull)); | 726 (kind == Snapshot::kFull)); |
| 727 | 727 |
| 728 // Write out the serialization header value for this object. | 728 // Write out the serialization header value for this object. |
| 729 writer->WriteInlinedObjectHeader(object_id); | 729 writer->WriteInlinedObjectHeader(object_id); |
| 730 | 730 |
| 731 // Write out the class and tags information. | 731 // Write out the class and tags information. |
| 732 writer->WriteVMIsolateObject(kFunctionCid); | 732 writer->WriteVMIsolateObject(kFunctionCid); |
| 733 writer->WriteIntptrValue(writer->GetObjectTags(this)); | 733 writer->WriteIntptrValue(writer->GetObjectTags(this)); |
| 734 | 734 |
| 735 // Write out all the non object fields. | 735 // Write out all the non object fields. |
| 736 writer->WriteIntptrValue(ptr()->token_pos_); | 736 writer->Write<int32_t>(ptr()->token_pos_); |
| 737 writer->WriteIntptrValue(ptr()->end_token_pos_); | 737 writer->Write<int32_t>(ptr()->end_token_pos_); |
| 738 writer->WriteIntptrValue(ptr()->usage_counter_); | 738 writer->Write<int32_t>(ptr()->usage_counter_); |
| 739 writer->WriteIntptrValue(ptr()->num_fixed_parameters_); | 739 writer->Write<int16_t>(ptr()->num_fixed_parameters_); |
| 740 writer->WriteIntptrValue(ptr()->num_optional_parameters_); | 740 writer->Write<int16_t>(ptr()->num_optional_parameters_); |
| 741 writer->WriteIntptrValue(ptr()->deoptimization_counter_); | 741 writer->Write<int16_t>(ptr()->deoptimization_counter_); |
| 742 writer->Write<uint16_t>(ptr()->kind_tag_); | 742 writer->Write<uint16_t>(ptr()->kind_tag_); |
| 743 writer->Write<uint16_t>(ptr()->optimized_instruction_count_); | 743 writer->Write<uint16_t>(ptr()->optimized_instruction_count_); |
| 744 writer->Write<uint16_t>(ptr()->optimized_call_site_count_); | 744 writer->Write<uint16_t>(ptr()->optimized_call_site_count_); |
| 745 | 745 |
| 746 // Write out all the object pointer fields. | 746 // Write out all the object pointer fields. |
| 747 SnapshotWriterVisitor visitor(writer); | 747 SnapshotWriterVisitor visitor(writer); |
| 748 visitor.VisitPointers(from(), to_no_code()); | 748 visitor.VisitPointers(from(), to_no_code()); |
| 749 | 749 |
| 750 // Write null for the instructions and unoptimized code. | 750 // Write null for the instructions and unoptimized code. |
| 751 writer->WriteVMIsolateObject(kNullObject); | 751 writer->WriteVMIsolateObject(kNullObject); |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 763 (kind == Snapshot::kFull)); | 763 (kind == Snapshot::kFull)); |
| 764 | 764 |
| 765 // Allocate field object. | 765 // Allocate field object. |
| 766 Field& field = Field::ZoneHandle(reader->isolate(), NEW_OBJECT(Field)); | 766 Field& field = Field::ZoneHandle(reader->isolate(), NEW_OBJECT(Field)); |
| 767 reader->AddBackRef(object_id, &field, kIsDeserialized); | 767 reader->AddBackRef(object_id, &field, kIsDeserialized); |
| 768 | 768 |
| 769 // Set the object tags. | 769 // Set the object tags. |
| 770 field.set_tags(tags); | 770 field.set_tags(tags); |
| 771 | 771 |
| 772 // Set all non object fields. | 772 // Set all non object fields. |
| 773 field.set_token_pos(reader->ReadIntptrValue()); | 773 field.set_token_pos(reader->Read<int32_t>()); |
| 774 field.set_guarded_cid(reader->ReadIntptrValue()); | 774 field.set_guarded_cid(reader->Read<int32_t>()); |
| 775 field.set_is_nullable(reader->ReadIntptrValue()); | 775 field.set_is_nullable(reader->Read<int32_t>()); |
| 776 field.set_kind_bits(reader->Read<uint8_t>()); | 776 field.set_kind_bits(reader->Read<uint8_t>()); |
| 777 | 777 |
| 778 // Set all the object fields. | 778 // Set all the object fields. |
| 779 // TODO(5411462): Need to assert No GC can happen here, even though | 779 // TODO(5411462): Need to assert No GC can happen here, even though |
| 780 // allocations may happen. | 780 // allocations may happen. |
| 781 intptr_t num_flds = (field.raw()->to() - field.raw()->from()); | 781 intptr_t num_flds = (field.raw()->to() - field.raw()->from()); |
| 782 for (intptr_t i = 0; i <= num_flds; i++) { | 782 for (intptr_t i = 0; i <= num_flds; i++) { |
| 783 *(field.raw()->from() + i) = reader->ReadObjectRef(); | 783 *(field.raw()->from() + i) = reader->ReadObjectRef(); |
| 784 } | 784 } |
| 785 | 785 |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 798 (kind == Snapshot::kFull)); | 798 (kind == Snapshot::kFull)); |
| 799 | 799 |
| 800 // Write out the serialization header value for this object. | 800 // Write out the serialization header value for this object. |
| 801 writer->WriteInlinedObjectHeader(object_id); | 801 writer->WriteInlinedObjectHeader(object_id); |
| 802 | 802 |
| 803 // Write out the class and tags information. | 803 // Write out the class and tags information. |
| 804 writer->WriteVMIsolateObject(kFieldCid); | 804 writer->WriteVMIsolateObject(kFieldCid); |
| 805 writer->WriteIntptrValue(writer->GetObjectTags(this)); | 805 writer->WriteIntptrValue(writer->GetObjectTags(this)); |
| 806 | 806 |
| 807 // Write out all the non object fields. | 807 // Write out all the non object fields. |
| 808 writer->WriteIntptrValue(ptr()->token_pos_); | 808 writer->Write<int32_t>(ptr()->token_pos_); |
| 809 writer->WriteIntptrValue(ptr()->guarded_cid_); | 809 writer->Write<int32_t>(ptr()->guarded_cid_); |
| 810 writer->WriteIntptrValue(ptr()->is_nullable_); | 810 writer->Write<int32_t>(ptr()->is_nullable_); |
| 811 writer->Write<uint8_t>(ptr()->kind_bits_); | 811 writer->Write<uint8_t>(ptr()->kind_bits_); |
| 812 | 812 |
| 813 // Write out all the object pointer fields. | 813 // Write out all the object pointer fields. |
| 814 SnapshotWriterVisitor visitor(writer); | 814 SnapshotWriterVisitor visitor(writer); |
| 815 visitor.VisitPointers(from(), to()); | 815 visitor.VisitPointers(from(), to()); |
| 816 } | 816 } |
| 817 | 817 |
| 818 | 818 |
| 819 RawLiteralToken* LiteralToken::ReadFrom(SnapshotReader* reader, | 819 RawLiteralToken* LiteralToken::ReadFrom(SnapshotReader* reader, |
| 820 intptr_t object_id, | 820 intptr_t object_id, |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1009 *reader->StringHandle() ^= reader->ReadObjectImpl(); | 1009 *reader->StringHandle() ^= reader->ReadObjectImpl(); |
| 1010 library = Library::LookupLibrary(*reader->StringHandle()); | 1010 library = Library::LookupLibrary(*reader->StringHandle()); |
| 1011 } else { | 1011 } else { |
| 1012 // Allocate library object. | 1012 // Allocate library object. |
| 1013 library = NEW_OBJECT(Library); | 1013 library = NEW_OBJECT(Library); |
| 1014 | 1014 |
| 1015 // Set the object tags. | 1015 // Set the object tags. |
| 1016 library.set_tags(tags); | 1016 library.set_tags(tags); |
| 1017 | 1017 |
| 1018 // Set all non object fields. | 1018 // Set all non object fields. |
| 1019 library.raw_ptr()->index_ = reader->ReadIntptrValue(); | 1019 library.raw_ptr()->index_ = reader->Read<int32_t>(); |
| 1020 library.raw_ptr()->num_imports_ = reader->ReadIntptrValue(); | 1020 library.raw_ptr()->num_imports_ = reader->Read<int32_t>(); |
| 1021 library.raw_ptr()->num_anonymous_ = reader->ReadIntptrValue(); | 1021 library.raw_ptr()->num_anonymous_ = reader->Read<int32_t>(); |
| 1022 library.raw_ptr()->corelib_imported_ = reader->Read<bool>(); | 1022 library.raw_ptr()->corelib_imported_ = reader->Read<bool>(); |
| 1023 library.raw_ptr()->is_dart_scheme_ = reader->Read<bool>(); | 1023 library.raw_ptr()->is_dart_scheme_ = reader->Read<bool>(); |
| 1024 library.raw_ptr()->debuggable_ = reader->Read<bool>(); | 1024 library.raw_ptr()->debuggable_ = reader->Read<bool>(); |
| 1025 library.raw_ptr()->load_state_ = reader->Read<int8_t>(); | 1025 library.raw_ptr()->load_state_ = reader->Read<int8_t>(); |
| 1026 // The native resolver is not serialized. | 1026 // The native resolver is not serialized. |
| 1027 Dart_NativeEntryResolver resolver = | 1027 Dart_NativeEntryResolver resolver = |
| 1028 reader->Read<Dart_NativeEntryResolver>(); | 1028 reader->Read<Dart_NativeEntryResolver>(); |
| 1029 ASSERT(resolver == NULL); | 1029 ASSERT(resolver == NULL); |
| 1030 library.set_native_entry_resolver(resolver); | 1030 library.set_native_entry_resolver(resolver); |
| 1031 // The symbol resolver is not serialized. | 1031 // The symbol resolver is not serialized. |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1064 writer->WriteVMIsolateObject(kLibraryCid); | 1064 writer->WriteVMIsolateObject(kLibraryCid); |
| 1065 writer->WriteIntptrValue(writer->GetObjectTags(this)); | 1065 writer->WriteIntptrValue(writer->GetObjectTags(this)); |
| 1066 | 1066 |
| 1067 if ((kind == Snapshot::kScript) && | 1067 if ((kind == Snapshot::kScript) && |
| 1068 RawObject::IsCreatedFromSnapshot(writer->GetObjectTags(this))) { | 1068 RawObject::IsCreatedFromSnapshot(writer->GetObjectTags(this))) { |
| 1069 ASSERT(kind != Snapshot::kFull); | 1069 ASSERT(kind != Snapshot::kFull); |
| 1070 // Write out library URL so that it can be looked up when reading. | 1070 // Write out library URL so that it can be looked up when reading. |
| 1071 writer->WriteObjectImpl(ptr()->url_); | 1071 writer->WriteObjectImpl(ptr()->url_); |
| 1072 } else { | 1072 } else { |
| 1073 // Write out all non object fields. | 1073 // Write out all non object fields. |
| 1074 writer->WriteIntptrValue(ptr()->index_); | 1074 writer->Write<int32_t>(ptr()->index_); |
| 1075 writer->WriteIntptrValue(ptr()->num_imports_); | 1075 writer->Write<int32_t>(ptr()->num_imports_); |
| 1076 writer->WriteIntptrValue(ptr()->num_anonymous_); | 1076 writer->Write<int32_t>(ptr()->num_anonymous_); |
| 1077 writer->Write<bool>(ptr()->corelib_imported_); | 1077 writer->Write<bool>(ptr()->corelib_imported_); |
| 1078 writer->Write<bool>(ptr()->is_dart_scheme_); | 1078 writer->Write<bool>(ptr()->is_dart_scheme_); |
| 1079 writer->Write<bool>(ptr()->debuggable_); | 1079 writer->Write<bool>(ptr()->debuggable_); |
| 1080 writer->Write<int8_t>(ptr()->load_state_); | 1080 writer->Write<int8_t>(ptr()->load_state_); |
| 1081 // We do not serialize the native resolver over, this needs to be explicitly | 1081 // We do not serialize the native resolver over, this needs to be explicitly |
| 1082 // set after deserialization. | 1082 // set after deserialization. |
| 1083 writer->Write<Dart_NativeEntryResolver>(NULL); | 1083 writer->Write<Dart_NativeEntryResolver>(NULL); |
| 1084 // We do not serialize the native entry symbol, this needs to be explicitly | 1084 // We do not serialize the native entry symbol, this needs to be explicitly |
| 1085 // set after deserialization. | 1085 // set after deserialization. |
| 1086 writer->Write<Dart_NativeEntrySymbol>(NULL); | 1086 writer->Write<Dart_NativeEntrySymbol>(NULL); |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 1106 | 1106 |
| 1107 // Allocate library prefix object. | 1107 // Allocate library prefix object. |
| 1108 LibraryPrefix& prefix = LibraryPrefix::ZoneHandle( | 1108 LibraryPrefix& prefix = LibraryPrefix::ZoneHandle( |
| 1109 reader->isolate(), NEW_OBJECT(LibraryPrefix)); | 1109 reader->isolate(), NEW_OBJECT(LibraryPrefix)); |
| 1110 reader->AddBackRef(object_id, &prefix, kIsDeserialized); | 1110 reader->AddBackRef(object_id, &prefix, kIsDeserialized); |
| 1111 | 1111 |
| 1112 // Set the object tags. | 1112 // Set the object tags. |
| 1113 prefix.set_tags(tags); | 1113 prefix.set_tags(tags); |
| 1114 | 1114 |
| 1115 // Set all non object fields. | 1115 // Set all non object fields. |
| 1116 prefix.raw_ptr()->num_imports_ = reader->ReadIntptrValue(); | 1116 prefix.raw_ptr()->num_imports_ = reader->Read<int32_t>(); |
| 1117 prefix.raw_ptr()->is_deferred_load_ = reader->Read<bool>(); | 1117 prefix.raw_ptr()->is_deferred_load_ = reader->Read<bool>(); |
| 1118 prefix.raw_ptr()->is_loaded_ = reader->Read<bool>(); | 1118 prefix.raw_ptr()->is_loaded_ = reader->Read<bool>(); |
| 1119 | 1119 |
| 1120 // Set all the object fields. | 1120 // Set all the object fields. |
| 1121 // TODO(5411462): Need to assert No GC can happen here, even though | 1121 // TODO(5411462): Need to assert No GC can happen here, even though |
| 1122 // allocations may happen. | 1122 // allocations may happen. |
| 1123 intptr_t num_flds = (prefix.raw()->to() - prefix.raw()->from()); | 1123 intptr_t num_flds = (prefix.raw()->to() - prefix.raw()->from()); |
| 1124 for (intptr_t i = 0; i <= num_flds; i++) { | 1124 for (intptr_t i = 0; i <= num_flds; i++) { |
| 1125 *(prefix.raw()->from() + i) = reader->ReadObjectRef(); | 1125 *(prefix.raw()->from() + i) = reader->ReadObjectRef(); |
| 1126 } | 1126 } |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 1138 (kind == Snapshot::kFull)); | 1138 (kind == Snapshot::kFull)); |
| 1139 | 1139 |
| 1140 // Write out the serialization header value for this object. | 1140 // Write out the serialization header value for this object. |
| 1141 writer->WriteInlinedObjectHeader(object_id); | 1141 writer->WriteInlinedObjectHeader(object_id); |
| 1142 | 1142 |
| 1143 // Write out the class and tags information. | 1143 // Write out the class and tags information. |
| 1144 writer->WriteIndexedObject(kLibraryPrefixCid); | 1144 writer->WriteIndexedObject(kLibraryPrefixCid); |
| 1145 writer->WriteIntptrValue(writer->GetObjectTags(this)); | 1145 writer->WriteIntptrValue(writer->GetObjectTags(this)); |
| 1146 | 1146 |
| 1147 // Write out all non object fields. | 1147 // Write out all non object fields. |
| 1148 writer->WriteIntptrValue(ptr()->num_imports_); | 1148 writer->Write<int32_t>(ptr()->num_imports_); |
| 1149 writer->Write<bool>(ptr()->is_deferred_load_); | 1149 writer->Write<bool>(ptr()->is_deferred_load_); |
| 1150 writer->Write<bool>(ptr()->is_loaded_); | 1150 writer->Write<bool>(ptr()->is_loaded_); |
| 1151 | 1151 |
| 1152 // Write out all the object pointer fields. | 1152 // Write out all the object pointer fields. |
| 1153 SnapshotWriterVisitor visitor(writer); | 1153 SnapshotWriterVisitor visitor(writer); |
| 1154 visitor.VisitPointers(from(), to()); | 1154 visitor.VisitPointers(from(), to()); |
| 1155 } | 1155 } |
| 1156 | 1156 |
| 1157 | 1157 |
| 1158 RawNamespace* Namespace::ReadFrom(SnapshotReader* reader, | 1158 RawNamespace* Namespace::ReadFrom(SnapshotReader* reader, |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1512 | 1512 |
| 1513 // Allocate LanguageError object. | 1513 // Allocate LanguageError object. |
| 1514 LanguageError& language_error = | 1514 LanguageError& language_error = |
| 1515 LanguageError::ZoneHandle(reader->isolate(), NEW_OBJECT(LanguageError)); | 1515 LanguageError::ZoneHandle(reader->isolate(), NEW_OBJECT(LanguageError)); |
| 1516 reader->AddBackRef(object_id, &language_error, kIsDeserialized); | 1516 reader->AddBackRef(object_id, &language_error, kIsDeserialized); |
| 1517 | 1517 |
| 1518 // Set the object tags. | 1518 // Set the object tags. |
| 1519 language_error.set_tags(tags); | 1519 language_error.set_tags(tags); |
| 1520 | 1520 |
| 1521 // Set all non object fields. | 1521 // Set all non object fields. |
| 1522 language_error.set_token_pos(reader->ReadIntptrValue()); | 1522 language_error.set_token_pos(reader->Read<int32_t>()); |
| 1523 language_error.set_kind(reader->Read<uint8_t>()); | 1523 language_error.set_kind(reader->Read<uint8_t>()); |
| 1524 | 1524 |
| 1525 // Set all the object fields. | 1525 // Set all the object fields. |
| 1526 // TODO(5411462): Need to assert No GC can happen here, even though | 1526 // TODO(5411462): Need to assert No GC can happen here, even though |
| 1527 // allocations may happen. | 1527 // allocations may happen. |
| 1528 intptr_t num_flds = | 1528 intptr_t num_flds = |
| 1529 (language_error.raw()->to() - language_error.raw()->from()); | 1529 (language_error.raw()->to() - language_error.raw()->from()); |
| 1530 for (intptr_t i = 0; i <= num_flds; i++) { | 1530 for (intptr_t i = 0; i <= num_flds; i++) { |
| 1531 (*reader->ObjectHandle()) = reader->ReadObjectRef(); | 1531 (*reader->ObjectHandle()) = reader->ReadObjectRef(); |
| 1532 language_error.StorePointer((language_error.raw()->from() + i), | 1532 language_error.StorePointer((language_error.raw()->from() + i), |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 1543 ASSERT(writer != NULL); | 1543 ASSERT(writer != NULL); |
| 1544 | 1544 |
| 1545 // Write out the serialization header value for this object. | 1545 // Write out the serialization header value for this object. |
| 1546 writer->WriteInlinedObjectHeader(object_id); | 1546 writer->WriteInlinedObjectHeader(object_id); |
| 1547 | 1547 |
| 1548 // Write out the class and tags information. | 1548 // Write out the class and tags information. |
| 1549 writer->WriteVMIsolateObject(kLanguageErrorCid); | 1549 writer->WriteVMIsolateObject(kLanguageErrorCid); |
| 1550 writer->WriteIntptrValue(writer->GetObjectTags(this)); | 1550 writer->WriteIntptrValue(writer->GetObjectTags(this)); |
| 1551 | 1551 |
| 1552 // Write out all the non object fields. | 1552 // Write out all the non object fields. |
| 1553 writer->WriteIntptrValue(ptr()->token_pos_); | 1553 writer->Write<int32_t>(ptr()->token_pos_); |
| 1554 writer->Write<uint8_t>(ptr()->kind_); | 1554 writer->Write<uint8_t>(ptr()->kind_); |
| 1555 | 1555 |
| 1556 // Write out all the object pointer fields. | 1556 // Write out all the object pointer fields. |
| 1557 SnapshotWriterVisitor visitor(writer); | 1557 SnapshotWriterVisitor visitor(writer); |
| 1558 visitor.VisitPointers(from(), to()); | 1558 visitor.VisitPointers(from(), to()); |
| 1559 } | 1559 } |
| 1560 | 1560 |
| 1561 | 1561 |
| 1562 RawUnhandledException* UnhandledException::ReadFrom(SnapshotReader* reader, | 1562 RawUnhandledException* UnhandledException::ReadFrom(SnapshotReader* reader, |
| 1563 intptr_t object_id, | 1563 intptr_t object_id, |
| (...skipping 1219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2783 // We do not allow objects with native fields in an isolate message. | 2783 // We do not allow objects with native fields in an isolate message. |
| 2784 writer->SetWriteException(Exceptions::kArgument, | 2784 writer->SetWriteException(Exceptions::kArgument, |
| 2785 "Illegal argument in isolate message" | 2785 "Illegal argument in isolate message" |
| 2786 " : (object is a UserTag)"); | 2786 " : (object is a UserTag)"); |
| 2787 } else { | 2787 } else { |
| 2788 UNREACHABLE(); | 2788 UNREACHABLE(); |
| 2789 } | 2789 } |
| 2790 } | 2790 } |
| 2791 | 2791 |
| 2792 } // namespace dart | 2792 } // namespace dart |
| OLD | NEW |