| 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/dart_api_message.h" | 5 #include "vm/dart_api_message.h" |
| 6 #include "vm/object.h" | 6 #include "vm/object.h" |
| 7 #include "vm/snapshot_ids.h" | 7 #include "vm/snapshot_ids.h" |
| 8 #include "vm/symbols.h" | 8 #include "vm/symbols.h" |
| 9 | 9 |
| 10 namespace dart { | 10 namespace dart { |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 USE(tags); | 180 USE(tags); |
| 181 intptr_t class_id; | 181 intptr_t class_id; |
| 182 | 182 |
| 183 // Reading of regular dart instances is not supported. | 183 // Reading of regular dart instances is not supported. |
| 184 if (SerializedHeaderData::decode(class_header) == kInstanceObjectId) { | 184 if (SerializedHeaderData::decode(class_header) == kInstanceObjectId) { |
| 185 return AllocateDartCObjectUnsupported(); | 185 return AllocateDartCObjectUnsupported(); |
| 186 } | 186 } |
| 187 | 187 |
| 188 ASSERT((class_header & kSmiTagMask) != 0); | 188 ASSERT((class_header & kSmiTagMask) != 0); |
| 189 class_id = LookupInternalClass(class_header); | 189 class_id = LookupInternalClass(class_header); |
| 190 if (class_id == kArrayCid || class_id == kImmutableArrayCid) { | 190 if ((class_id == kArrayCid) || (class_id == kImmutableArrayCid)) { |
| 191 intptr_t len = ReadSmiValue(); | 191 intptr_t len = ReadSmiValue(); |
| 192 Dart_CObject* value = GetBackRef(object_id); | 192 Dart_CObject* value = GetBackRef(object_id); |
| 193 if (value == NULL) { | 193 if (value == NULL) { |
| 194 value = AllocateDartCObjectArray(len); | 194 value = AllocateDartCObjectArray(len); |
| 195 AddBackRef(object_id, value, kIsDeserialized); | 195 AddBackRef(object_id, value, kIsDeserialized); |
| 196 } | 196 } |
| 197 // Skip type arguments. | 197 // Skip type arguments. |
| 198 // TODO(sjesse): Remove this when message serialization format is | 198 // TODO(sjesse): Remove this when message serialization format is |
| 199 // updated (currently type_arguments is leaked). | 199 // updated (currently type_arguments is leaked). |
| 200 Dart_CObject* type_arguments = ReadObjectImpl(); | 200 Dart_CObject* type_arguments = ReadObjectImpl(); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 // Read the class header information and lookup the class. | 253 // Read the class header information and lookup the class. |
| 254 intptr_t class_header = ReadIntptrValue(); | 254 intptr_t class_header = ReadIntptrValue(); |
| 255 | 255 |
| 256 // Reading of regular dart instances is not supported. | 256 // Reading of regular dart instances is not supported. |
| 257 if (SerializedHeaderData::decode(class_header) == kInstanceObjectId) { | 257 if (SerializedHeaderData::decode(class_header) == kInstanceObjectId) { |
| 258 return AllocateDartCObjectUnsupported(); | 258 return AllocateDartCObjectUnsupported(); |
| 259 } | 259 } |
| 260 ASSERT((class_header & kSmiTagMask) != 0); | 260 ASSERT((class_header & kSmiTagMask) != 0); |
| 261 intptr_t object_id = SerializedHeaderData::decode(value); | 261 intptr_t object_id = SerializedHeaderData::decode(value); |
| 262 intptr_t class_id = LookupInternalClass(class_header); | 262 intptr_t class_id = LookupInternalClass(class_header); |
| 263 if (class_id == kArrayCid || class_id == kImmutableArrayCid) { | 263 if ((class_id == kArrayCid) || (class_id == kImmutableArrayCid)) { |
| 264 ASSERT(GetBackRef(object_id) == NULL); | 264 ASSERT(GetBackRef(object_id) == NULL); |
| 265 intptr_t len = ReadSmiValue(); | 265 intptr_t len = ReadSmiValue(); |
| 266 Dart_CObject* value = AllocateDartCObjectArray(len); | 266 Dart_CObject* value = AllocateDartCObjectArray(len); |
| 267 AddBackRef(object_id, value, kIsNotDeserialized); | 267 AddBackRef(object_id, value, kIsNotDeserialized); |
| 268 return value; | 268 return value; |
| 269 } | 269 } |
| 270 intptr_t tags = ReadIntptrValue(); | 270 intptr_t tags = ReadIntptrValue(); |
| 271 USE(tags); | 271 USE(tags); |
| 272 | 272 |
| 273 return ReadInternalVMObject(class_id, object_id); | 273 return ReadInternalVMObject(class_id, object_id); |
| (...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 779 // not been serialized yet. These would typically be fields of arrays. | 779 // not been serialized yet. These would typically be fields of arrays. |
| 780 // NOTE: The forward list might grow as we process the list. | 780 // NOTE: The forward list might grow as we process the list. |
| 781 for (intptr_t i = 0; i < forward_id_; i++) { | 781 for (intptr_t i = 0; i < forward_id_; i++) { |
| 782 WriteForwardedCObject(forward_list_[i]); | 782 WriteForwardedCObject(forward_list_[i]); |
| 783 } | 783 } |
| 784 UnmarkAllCObjects(object); | 784 UnmarkAllCObjects(object); |
| 785 FinalizeBuffer(); | 785 FinalizeBuffer(); |
| 786 } | 786 } |
| 787 | 787 |
| 788 } // namespace dart | 788 } // namespace dart |
| OLD | NEW |