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 2628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2639 | 2639 |
2640 // Write out the class and tags information. | 2640 // Write out the class and tags information. |
2641 writer->WriteIndexedObject(kWeakPropertyCid); | 2641 writer->WriteIndexedObject(kWeakPropertyCid); |
2642 writer->WriteIntptrValue(writer->GetObjectTags(this)); | 2642 writer->WriteIntptrValue(writer->GetObjectTags(this)); |
2643 | 2643 |
2644 // Write out all the other fields. | 2644 // Write out all the other fields. |
2645 writer->Write<RawObject*>(ptr()->key_); | 2645 writer->Write<RawObject*>(ptr()->key_); |
2646 writer->Write<RawObject*>(ptr()->value_); | 2646 writer->Write<RawObject*>(ptr()->value_); |
2647 } | 2647 } |
2648 | 2648 |
2649 | |
2650 RawVMReference* VMReference::ReadFrom(SnapshotReader* reader, | |
2651 intptr_t object_id, | |
2652 intptr_t tags, | |
2653 Snapshot::Kind kind) { | |
2654 ASSERT(reader != NULL); | |
2655 | |
2656 // Allocate the weak property object. | |
2657 VMReference& vm_reference = VMReference::ZoneHandle( | |
2658 reader->isolate(), VMReference::New(HEAP_SPACE(kind))); | |
2659 reader->AddBackRef(object_id, &vm_reference, kIsDeserialized); | |
2660 | |
2661 // Set the object tags. | |
2662 vm_reference.set_tags(tags); | |
2663 | |
2664 // Set all the object fields. | |
2665 vm_reference.raw_ptr()->referent_ = reader->ReadObject(); | |
siva
2013/06/30 01:12:48
(*reader->ObjectHandle()) = reader->ReadObjectImpl
rmacnak
2013/07/01 18:35:49
Changed
| |
2666 | |
2667 return vm_reference.raw(); | |
2668 } | |
2669 | |
2670 | |
2671 void RawVMReference::WriteTo(SnapshotWriter* writer, | |
2672 intptr_t object_id, | |
2673 Snapshot::Kind kind) { | |
2674 ASSERT(writer != NULL); | |
2675 | |
2676 // Write out the serialization header value for this object. | |
2677 writer->WriteInlinedObjectHeader(object_id); | |
2678 | |
2679 // Write out the class and tags information. | |
2680 writer->WriteIndexedObject(kVMReferenceCid); | |
2681 writer->WriteIntptrValue(writer->GetObjectTags(this)); | |
2682 | |
2683 // Write out all the other fields. | |
2684 writer->WriteObject(ptr()->referent_); | |
siva
2013/06/30 01:12:48
writer->WriteObjectImpl(ptr()->referent_);
rmacnak
2013/07/01 18:35:49
Changed. Required adding RawVMReference as a frien
| |
2685 } | |
siva
2013/06/30 01:12:48
Need to add unit tests in snapshot_test.cc so that
| |
2686 | |
2649 } // namespace dart | 2687 } // namespace dart |
OLD | NEW |