| 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 intptr_t object_id, | 582 intptr_t object_id, |
| 583 bool classes_serialized) { | 583 bool classes_serialized) { |
| 584 ASSERT(reader != NULL); | 584 ASSERT(reader != NULL); |
| 585 | 585 |
| 586 // Allocate library object. | 586 // Allocate library object. |
| 587 Library& library = Library::ZoneHandle(Library::New()); | 587 Library& library = Library::ZoneHandle(Library::New()); |
| 588 reader->AddBackwardReference(object_id, &library); | 588 reader->AddBackwardReference(object_id, &library); |
| 589 | 589 |
| 590 // Set all non object fields. | 590 // Set all non object fields. |
| 591 library.raw_ptr()->num_imports_ = reader->Read<intptr_t>(); | 591 library.raw_ptr()->num_imports_ = reader->Read<intptr_t>(); |
| 592 library.raw_ptr()->num_imported_into_ = reader->Read<intptr_t>(); |
| 592 library.raw_ptr()->num_anonymous_ = reader->Read<intptr_t>(); | 593 library.raw_ptr()->num_anonymous_ = reader->Read<intptr_t>(); |
| 593 // The native resolver is not serialized. | 594 // The native resolver is not serialized. |
| 594 Dart_NativeEntryResolver resolver = reader->Read<Dart_NativeEntryResolver>(); | 595 Dart_NativeEntryResolver resolver = reader->Read<Dart_NativeEntryResolver>(); |
| 595 ASSERT(resolver == NULL); | 596 ASSERT(resolver == NULL); |
| 596 library.set_native_entry_resolver(resolver); | 597 library.set_native_entry_resolver(resolver); |
| 597 | 598 |
| 598 // Set all the object fields. | 599 // Set all the object fields. |
| 599 // 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 |
| 600 // allocations may happen. | 601 // allocations may happen. |
| 601 intptr_t num_flds = (library.raw()->to() - library.raw()->from()); | 602 intptr_t num_flds = (library.raw()->to() - library.raw()->from()); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 613 ASSERT(writer != NULL); | 614 ASSERT(writer != NULL); |
| 614 SnapshotWriterVisitor visitor(writer); | 615 SnapshotWriterVisitor visitor(writer); |
| 615 | 616 |
| 616 // Write out the serialization header value for this object. | 617 // Write out the serialization header value for this object. |
| 617 writer->WriteObjectHeader(kInlined, object_id); | 618 writer->WriteObjectHeader(kInlined, object_id); |
| 618 | 619 |
| 619 // Write out the class information. | 620 // Write out the class information. |
| 620 writer->WriteObjectHeader(kObjectId, Object::kLibraryClass); | 621 writer->WriteObjectHeader(kObjectId, Object::kLibraryClass); |
| 621 | 622 |
| 622 writer->Write<intptr_t>(ptr()->num_imports_); | 623 writer->Write<intptr_t>(ptr()->num_imports_); |
| 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_); |
| 624 // We do not serialize the native resolver over, this needs to be explicitly | 626 // We do not serialize the native resolver over, this needs to be explicitly |
| 625 // set after deserialization. | 627 // set after deserialization. |
| 626 writer->Write<Dart_NativeEntryResolver>(NULL); | 628 writer->Write<Dart_NativeEntryResolver>(NULL); |
| 627 | 629 |
| 628 // Write out all the object pointer fields. | 630 // Write out all the object pointer fields. |
| 629 visitor.VisitPointers(from(), to()); | 631 visitor.VisitPointers(from(), to()); |
| 630 } | 632 } |
| 631 | 633 |
| 632 | 634 |
| (...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1335 // Write out all the other fields. | 1337 // Write out all the other fields. |
| 1336 writer->Write<RawObject*>(ptr()->num_bracket_expressions_); | 1338 writer->Write<RawObject*>(ptr()->num_bracket_expressions_); |
| 1337 writer->WriteObject(ptr()->pattern_); | 1339 writer->WriteObject(ptr()->pattern_); |
| 1338 writer->Write<intptr_t>(ptr()->type_); | 1340 writer->Write<intptr_t>(ptr()->type_); |
| 1339 writer->Write<intptr_t>(ptr()->flags_); | 1341 writer->Write<intptr_t>(ptr()->flags_); |
| 1340 | 1342 |
| 1341 // Do not write out the data part which is native. | 1343 // Do not write out the data part which is native. |
| 1342 } | 1344 } |
| 1343 | 1345 |
| 1344 } // namespace dart | 1346 } // namespace dart |
| OLD | NEW |