| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 | 47 |
| 48 // Set the object tags. | 48 // Set the object tags. |
| 49 cls.set_tags(tags); | 49 cls.set_tags(tags); |
| 50 | 50 |
| 51 // Set all non object fields. | 51 // Set all non object fields. |
| 52 cls.set_instance_size(reader->ReadIntptrValue()); | 52 cls.set_instance_size(reader->ReadIntptrValue()); |
| 53 cls.set_type_arguments_instance_field_offset(reader->ReadIntptrValue()); | 53 cls.set_type_arguments_instance_field_offset(reader->ReadIntptrValue()); |
| 54 cls.set_next_field_offset(reader->ReadIntptrValue()); | 54 cls.set_next_field_offset(reader->ReadIntptrValue()); |
| 55 cls.set_num_native_fields(reader->ReadIntptrValue()); | 55 cls.set_num_native_fields(reader->ReadIntptrValue()); |
| 56 cls.set_token_pos(reader->ReadIntptrValue()); | 56 cls.set_token_pos(reader->ReadIntptrValue()); |
| 57 cls.set_class_state(reader->Read<int8_t>()); | 57 cls.set_state_bits(reader->Read<uint8_t>()); |
| 58 if (reader->Read<bool>()) { | |
| 59 cls.set_is_const(); | |
| 60 } | |
| 61 if (reader->Read<bool>()) { | |
| 62 cls.set_is_interface(); | |
| 63 } | |
| 64 | 58 |
| 65 // Set all the object fields. | 59 // Set all the object fields. |
| 66 // TODO(5411462): Need to assert No GC can happen here, even though | 60 // TODO(5411462): Need to assert No GC can happen here, even though |
| 67 // allocations may happen. | 61 // allocations may happen. |
| 68 intptr_t num_flds = (cls.raw()->to() - cls.raw()->from()); | 62 intptr_t num_flds = (cls.raw()->to() - cls.raw()->from()); |
| 69 for (intptr_t i = 0; i <= num_flds; i++) { | 63 for (intptr_t i = 0; i <= num_flds; i++) { |
| 70 *(cls.raw()->from() + i) = reader->ReadObjectRef(); | 64 *(cls.raw()->from() + i) = reader->ReadObjectRef(); |
| 71 } | 65 } |
| 72 } else { | 66 } else { |
| 73 cls ^= reader->ReadClassId(object_id); | 67 cls ^= reader->ReadClassId(object_id); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 93 | 87 |
| 94 // Write out all the non object pointer fields. | 88 // Write out all the non object pointer fields. |
| 95 // NOTE: cpp_vtable_ is not written. | 89 // NOTE: cpp_vtable_ is not written. |
| 96 writer->WriteIntptrValue(ptr()->id_); | 90 writer->WriteIntptrValue(ptr()->id_); |
| 97 writer->Write<bool>(Class::IsSignatureClass(this) ? true : false); | 91 writer->Write<bool>(Class::IsSignatureClass(this) ? true : false); |
| 98 writer->WriteIntptrValue(ptr()->instance_size_); | 92 writer->WriteIntptrValue(ptr()->instance_size_); |
| 99 writer->WriteIntptrValue(ptr()->type_arguments_instance_field_offset_); | 93 writer->WriteIntptrValue(ptr()->type_arguments_instance_field_offset_); |
| 100 writer->WriteIntptrValue(ptr()->next_field_offset_); | 94 writer->WriteIntptrValue(ptr()->next_field_offset_); |
| 101 writer->WriteIntptrValue(ptr()->num_native_fields_); | 95 writer->WriteIntptrValue(ptr()->num_native_fields_); |
| 102 writer->WriteIntptrValue(ptr()->token_pos_); | 96 writer->WriteIntptrValue(ptr()->token_pos_); |
| 103 writer->Write<int8_t>(ptr()->class_state_); | 97 writer->Write<uint8_t>(ptr()->state_bits_); |
| 104 writer->Write<bool>(ptr()->is_const_); | |
| 105 writer->Write<bool>(ptr()->is_interface_); | |
| 106 | 98 |
| 107 // Write out all the object pointer fields. | 99 // Write out all the object pointer fields. |
| 108 SnapshotWriterVisitor visitor(writer); | 100 SnapshotWriterVisitor visitor(writer); |
| 109 visitor.VisitPointers(from(), to()); | 101 visitor.VisitPointers(from(), to()); |
| 110 } else { | 102 } else { |
| 111 writer->WriteClassId(this); | 103 writer->WriteClassId(this); |
| 112 } | 104 } |
| 113 } | 105 } |
| 114 | 106 |
| 115 | 107 |
| (...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 531 | 523 |
| 532 // Allocate field object. | 524 // Allocate field object. |
| 533 Field& field = Field::ZoneHandle(reader->isolate(), NEW_OBJECT(Field)); | 525 Field& field = Field::ZoneHandle(reader->isolate(), NEW_OBJECT(Field)); |
| 534 reader->AddBackRef(object_id, &field, kIsDeserialized); | 526 reader->AddBackRef(object_id, &field, kIsDeserialized); |
| 535 | 527 |
| 536 // Set the object tags. | 528 // Set the object tags. |
| 537 field.set_tags(tags); | 529 field.set_tags(tags); |
| 538 | 530 |
| 539 // Set all non object fields. | 531 // Set all non object fields. |
| 540 field.set_token_pos(reader->ReadIntptrValue()); | 532 field.set_token_pos(reader->ReadIntptrValue()); |
| 541 field.set_is_static(reader->Read<bool>()); | 533 field.set_kind_bits(reader->Read<uint8_t>()); |
| 542 field.set_is_final(reader->Read<bool>()); | |
| 543 field.set_is_const(reader->Read<bool>()); | |
| 544 field.set_has_initializer(reader->Read<bool>()); | |
| 545 | 534 |
| 546 // Set all the object fields. | 535 // Set all the object fields. |
| 547 // TODO(5411462): Need to assert No GC can happen here, even though | 536 // TODO(5411462): Need to assert No GC can happen here, even though |
| 548 // allocations may happen. | 537 // allocations may happen. |
| 549 intptr_t num_flds = (field.raw()->to() - field.raw()->from()); | 538 intptr_t num_flds = (field.raw()->to() - field.raw()->from()); |
| 550 for (intptr_t i = 0; i <= num_flds; i++) { | 539 for (intptr_t i = 0; i <= num_flds; i++) { |
| 551 *(field.raw()->from() + i) = reader->ReadObjectRef(); | 540 *(field.raw()->from() + i) = reader->ReadObjectRef(); |
| 552 } | 541 } |
| 553 | 542 |
| 554 return field.raw(); | 543 return field.raw(); |
| 555 } | 544 } |
| 556 | 545 |
| 557 | 546 |
| 558 void RawField::WriteTo(SnapshotWriter* writer, | 547 void RawField::WriteTo(SnapshotWriter* writer, |
| 559 intptr_t object_id, | 548 intptr_t object_id, |
| 560 Snapshot::Kind kind) { | 549 Snapshot::Kind kind) { |
| 561 ASSERT(writer != NULL); | 550 ASSERT(writer != NULL); |
| 562 ASSERT(kind != Snapshot::kMessage && | 551 ASSERT(kind != Snapshot::kMessage && |
| 563 !RawObject::IsCreatedFromSnapshot(writer->GetObjectTags(this))); | 552 !RawObject::IsCreatedFromSnapshot(writer->GetObjectTags(this))); |
| 564 | 553 |
| 565 // Write out the serialization header value for this object. | 554 // Write out the serialization header value for this object. |
| 566 writer->WriteInlinedObjectHeader(object_id); | 555 writer->WriteInlinedObjectHeader(object_id); |
| 567 | 556 |
| 568 // Write out the class and tags information. | 557 // Write out the class and tags information. |
| 569 writer->WriteVMIsolateObject(kFieldCid); | 558 writer->WriteVMIsolateObject(kFieldCid); |
| 570 writer->WriteIntptrValue(writer->GetObjectTags(this)); | 559 writer->WriteIntptrValue(writer->GetObjectTags(this)); |
| 571 | 560 |
| 572 // Write out all the non object fields. | 561 // Write out all the non object fields. |
| 573 writer->WriteIntptrValue(ptr()->token_pos_); | 562 writer->WriteIntptrValue(ptr()->token_pos_); |
| 574 writer->Write<bool>(ptr()->is_static_); | 563 writer->WriteIntptrValue(ptr()->kind_bits_); |
| 575 writer->Write<bool>(ptr()->is_final_); | |
| 576 writer->Write<bool>(ptr()->is_const_); | |
| 577 writer->Write<bool>(ptr()->has_initializer_); | |
| 578 | 564 |
| 579 // Write out all the object pointer fields. | 565 // Write out all the object pointer fields. |
| 580 SnapshotWriterVisitor visitor(writer); | 566 SnapshotWriterVisitor visitor(writer); |
| 581 visitor.VisitPointers(from(), to()); | 567 visitor.VisitPointers(from(), to()); |
| 582 } | 568 } |
| 583 | 569 |
| 584 | 570 |
| 585 RawLiteralToken* LiteralToken::ReadFrom(SnapshotReader* reader, | 571 RawLiteralToken* LiteralToken::ReadFrom(SnapshotReader* reader, |
| 586 intptr_t object_id, | 572 intptr_t object_id, |
| 587 intptr_t tags, | 573 intptr_t tags, |
| (...skipping 1471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2059 writer->Write<RawObject*>(ptr()->num_bracket_expressions_); | 2045 writer->Write<RawObject*>(ptr()->num_bracket_expressions_); |
| 2060 writer->WriteObjectImpl(ptr()->pattern_); | 2046 writer->WriteObjectImpl(ptr()->pattern_); |
| 2061 writer->WriteIntptrValue(ptr()->type_); | 2047 writer->WriteIntptrValue(ptr()->type_); |
| 2062 writer->WriteIntptrValue(ptr()->flags_); | 2048 writer->WriteIntptrValue(ptr()->flags_); |
| 2063 | 2049 |
| 2064 // Do not write out the data part which is native. | 2050 // Do not write out the data part which is native. |
| 2065 } | 2051 } |
| 2066 | 2052 |
| 2067 | 2053 |
| 2068 } // namespace dart | 2054 } // namespace dart |
| OLD | NEW |