| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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/visitor.h" | 9 #include "vm/visitor.h" |
| 10 | 10 |
| (...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 582 ASSERT(reader != NULL); | 582 ASSERT(reader != NULL); |
| 583 | 583 |
| 584 // Allocate library object. | 584 // Allocate library object. |
| 585 Library& library = Library::ZoneHandle(Library::New()); | 585 Library& library = Library::ZoneHandle(Library::New()); |
| 586 reader->AddBackwardReference(object_id, &library); | 586 reader->AddBackwardReference(object_id, &library); |
| 587 | 587 |
| 588 // Set all non object fields. | 588 // Set all non object fields. |
| 589 library.raw_ptr()->num_imports_ = reader->Read<intptr_t>(); | 589 library.raw_ptr()->num_imports_ = reader->Read<intptr_t>(); |
| 590 library.raw_ptr()->num_imported_into_ = reader->Read<intptr_t>(); | 590 library.raw_ptr()->num_imported_into_ = reader->Read<intptr_t>(); |
| 591 library.raw_ptr()->num_anonymous_ = reader->Read<intptr_t>(); | 591 library.raw_ptr()->num_anonymous_ = reader->Read<intptr_t>(); |
| 592 library.raw_ptr()->corelib_imported_ = reader->Read<bool>(); |
| 593 library.raw_ptr()->load_state_ = reader->Read<int8_t>(); |
| 592 // The native resolver is not serialized. | 594 // The native resolver is not serialized. |
| 593 Dart_NativeEntryResolver resolver = reader->Read<Dart_NativeEntryResolver>(); | 595 Dart_NativeEntryResolver resolver = reader->Read<Dart_NativeEntryResolver>(); |
| 594 ASSERT(resolver == NULL); | 596 ASSERT(resolver == NULL); |
| 595 library.set_native_entry_resolver(resolver); | 597 library.set_native_entry_resolver(resolver); |
| 596 | 598 |
| 597 // Set all the object fields. | 599 // Set all the object fields. |
| 598 // TODO(5411462): Need to assert No GC can happen here, even though | 600 // TODO(5411462): Need to assert No GC can happen here, even though |
| 599 // allocations may happen. | 601 // allocations may happen. |
| 600 intptr_t num_flds = (library.raw()->to() - library.raw()->from()); | 602 intptr_t num_flds = (library.raw()->to() - library.raw()->from()); |
| 601 for (intptr_t i = 0; i <= num_flds; i++) { | 603 for (intptr_t i = 0; i <= num_flds; i++) { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 614 | 616 |
| 615 // Write out the serialization header value for this object. | 617 // Write out the serialization header value for this object. |
| 616 writer->WriteObjectHeader(kInlined, object_id); | 618 writer->WriteObjectHeader(kInlined, object_id); |
| 617 | 619 |
| 618 // Write out the class information. | 620 // Write out the class information. |
| 619 writer->WriteObjectHeader(kObjectId, Object::kLibraryClass); | 621 writer->WriteObjectHeader(kObjectId, Object::kLibraryClass); |
| 620 | 622 |
| 621 writer->Write<intptr_t>(ptr()->num_imports_); | 623 writer->Write<intptr_t>(ptr()->num_imports_); |
| 622 writer->Write<intptr_t>(ptr()->num_imported_into_); | 624 writer->Write<intptr_t>(ptr()->num_imported_into_); |
| 623 writer->Write<intptr_t>(ptr()->num_anonymous_); | 625 writer->Write<intptr_t>(ptr()->num_anonymous_); |
| 626 writer->Write<bool>(ptr()->corelib_imported_); |
| 627 writer->Write<int8_t>(ptr()->load_state_); |
| 624 // We do not serialize the native resolver over, this needs to be explicitly | 628 // We do not serialize the native resolver over, this needs to be explicitly |
| 625 // set after deserialization. | 629 // set after deserialization. |
| 626 writer->Write<Dart_NativeEntryResolver>(NULL); | 630 writer->Write<Dart_NativeEntryResolver>(NULL); |
| 627 | 631 |
| 628 // Write out all the object pointer fields. | 632 // Write out all the object pointer fields. |
| 629 visitor.VisitPointers(from(), to()); | 633 visitor.VisitPointers(from(), to()); |
| 630 } | 634 } |
| 631 | 635 |
| 632 | 636 |
| 633 RawLibraryPrefix* LibraryPrefix::ReadFrom(SnapshotReader* reader, | 637 RawLibraryPrefix* LibraryPrefix::ReadFrom(SnapshotReader* reader, |
| (...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1297 // Write out all the other fields. | 1301 // Write out all the other fields. |
| 1298 writer->Write<RawObject*>(ptr()->num_bracket_expressions_); | 1302 writer->Write<RawObject*>(ptr()->num_bracket_expressions_); |
| 1299 writer->WriteObject(ptr()->pattern_); | 1303 writer->WriteObject(ptr()->pattern_); |
| 1300 writer->Write<intptr_t>(ptr()->type_); | 1304 writer->Write<intptr_t>(ptr()->type_); |
| 1301 writer->Write<intptr_t>(ptr()->flags_); | 1305 writer->Write<intptr_t>(ptr()->flags_); |
| 1302 | 1306 |
| 1303 // Do not write out the data part which is native. | 1307 // Do not write out the data part which is native. |
| 1304 } | 1308 } |
| 1305 | 1309 |
| 1306 } // namespace dart | 1310 } // namespace dart |
| OLD | NEW |