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/object.h" | 5 #include "vm/object.h" |
6 #include "vm/object_store.h" | 6 #include "vm/object_store.h" |
7 #include "vm/snapshot.h" | 7 #include "vm/snapshot.h" |
8 #include "vm/stub_code.h" | 8 #include "vm/stub_code.h" |
9 #include "vm/symbols.h" | 9 #include "vm/symbols.h" |
10 #include "vm/visitor.h" | 10 #include "vm/visitor.h" |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 writer->Write<int16_t>(ptr()->num_type_arguments_); | 109 writer->Write<int16_t>(ptr()->num_type_arguments_); |
110 writer->Write<int16_t>(ptr()->num_own_type_arguments_); | 110 writer->Write<int16_t>(ptr()->num_own_type_arguments_); |
111 writer->Write<uint16_t>(ptr()->num_native_fields_); | 111 writer->Write<uint16_t>(ptr()->num_native_fields_); |
112 writer->Write<int32_t>(ptr()->token_pos_); | 112 writer->Write<int32_t>(ptr()->token_pos_); |
113 writer->Write<uint16_t>(ptr()->state_bits_); | 113 writer->Write<uint16_t>(ptr()->state_bits_); |
114 | 114 |
115 // Write out all the object pointer fields. | 115 // Write out all the object pointer fields. |
116 SnapshotWriterVisitor visitor(writer); | 116 SnapshotWriterVisitor visitor(writer); |
117 visitor.VisitPointers(from(), to()); | 117 visitor.VisitPointers(from(), to()); |
118 } else { | 118 } else { |
119 writer->WriteClassId(this); | 119 // Until we have maps implemented as internal VM objects we will use |
| 120 // the collections library qualifier to allow maps to be sent across. |
| 121 if (writer->can_send_any_object() || |
| 122 writer->AllowObjectsInDartLibrary(ptr()->library_)) { |
| 123 writer->WriteClassId(this); |
| 124 } else { |
| 125 // We do not allow regular dart instances in isolate messages. |
| 126 writer->SetWriteException(Exceptions::kArgument, |
| 127 "Illegal argument in isolate message" |
| 128 " : (object is a regular Dart Instance)"); |
| 129 } |
120 } | 130 } |
121 } | 131 } |
122 | 132 |
123 | 133 |
124 RawUnresolvedClass* UnresolvedClass::ReadFrom(SnapshotReader* reader, | 134 RawUnresolvedClass* UnresolvedClass::ReadFrom(SnapshotReader* reader, |
125 intptr_t object_id, | 135 intptr_t object_id, |
126 intptr_t tags, | 136 intptr_t tags, |
127 Snapshot::Kind kind) { | 137 Snapshot::Kind kind) { |
128 ASSERT(reader != NULL); | 138 ASSERT(reader != NULL); |
129 | 139 |
(...skipping 2529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2659 UNREACHABLE(); | 2669 UNREACHABLE(); |
2660 } | 2670 } |
2661 } | 2671 } |
2662 | 2672 |
2663 | 2673 |
2664 RawSendPort* SendPort::ReadFrom(SnapshotReader* reader, | 2674 RawSendPort* SendPort::ReadFrom(SnapshotReader* reader, |
2665 intptr_t object_id, | 2675 intptr_t object_id, |
2666 intptr_t tags, | 2676 intptr_t tags, |
2667 Snapshot::Kind kind) { | 2677 Snapshot::Kind kind) { |
2668 uint64_t id = reader->Read<uint64_t>(); | 2678 uint64_t id = reader->Read<uint64_t>(); |
| 2679 uint64_t origin_id = reader->Read<uint64_t>(); |
2669 | 2680 |
2670 SendPort& result = SendPort::ZoneHandle(reader->isolate(), | 2681 SendPort& result = SendPort::ZoneHandle(reader->isolate(), |
2671 SendPort::New(id)); | 2682 SendPort::New(id, origin_id)); |
2672 reader->AddBackRef(object_id, &result, kIsDeserialized); | 2683 reader->AddBackRef(object_id, &result, kIsDeserialized); |
2673 return result.raw(); | 2684 return result.raw(); |
2674 } | 2685 } |
2675 | 2686 |
2676 | 2687 |
2677 void RawSendPort::WriteTo(SnapshotWriter* writer, | 2688 void RawSendPort::WriteTo(SnapshotWriter* writer, |
2678 intptr_t object_id, | 2689 intptr_t object_id, |
2679 Snapshot::Kind kind) { | 2690 Snapshot::Kind kind) { |
2680 // Write out the serialization header value for this object. | 2691 // Write out the serialization header value for this object. |
2681 writer->WriteInlinedObjectHeader(object_id); | 2692 writer->WriteInlinedObjectHeader(object_id); |
2682 | 2693 |
2683 // Write out the class and tags information. | 2694 // Write out the class and tags information. |
2684 writer->WriteIndexedObject(kSendPortCid); | 2695 writer->WriteIndexedObject(kSendPortCid); |
2685 writer->WriteTags(writer->GetObjectTags(this)); | 2696 writer->WriteTags(writer->GetObjectTags(this)); |
2686 | 2697 |
2687 writer->Write<uint64_t>(ptr()->id_); | 2698 writer->Write<uint64_t>(ptr()->id_); |
| 2699 writer->Write<uint64_t>(ptr()->origin_id_); |
2688 } | 2700 } |
2689 | 2701 |
2690 | 2702 |
2691 RawStacktrace* Stacktrace::ReadFrom(SnapshotReader* reader, | 2703 RawStacktrace* Stacktrace::ReadFrom(SnapshotReader* reader, |
2692 intptr_t object_id, | 2704 intptr_t object_id, |
2693 intptr_t tags, | 2705 intptr_t tags, |
2694 Snapshot::Kind kind) { | 2706 Snapshot::Kind kind) { |
2695 if (kind == Snapshot::kFull) { | 2707 if (kind == Snapshot::kFull) { |
2696 Stacktrace& result = Stacktrace::ZoneHandle(reader->isolate(), | 2708 Stacktrace& result = Stacktrace::ZoneHandle(reader->isolate(), |
2697 reader->NewStacktrace()); | 2709 reader->NewStacktrace()); |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2889 // We do not allow objects with native fields in an isolate message. | 2901 // We do not allow objects with native fields in an isolate message. |
2890 writer->SetWriteException(Exceptions::kArgument, | 2902 writer->SetWriteException(Exceptions::kArgument, |
2891 "Illegal argument in isolate message" | 2903 "Illegal argument in isolate message" |
2892 " : (object is a UserTag)"); | 2904 " : (object is a UserTag)"); |
2893 } else { | 2905 } else { |
2894 UNREACHABLE(); | 2906 UNREACHABLE(); |
2895 } | 2907 } |
2896 } | 2908 } |
2897 | 2909 |
2898 } // namespace dart | 2910 } // namespace dart |
OLD | NEW |