| 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/object_store.h" | 7 #include "vm/object_store.h" |
| 8 | 8 |
| 9 namespace dart { | 9 namespace dart { |
| 10 | 10 |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 | 175 |
| 176 ASSERT((class_header & kSmiTagMask) != 0); | 176 ASSERT((class_header & kSmiTagMask) != 0); |
| 177 class_id = LookupInternalClass(class_header); | 177 class_id = LookupInternalClass(class_header); |
| 178 switch (class_id) { | 178 switch (class_id) { |
| 179 case Object::kClassClass: { | 179 case Object::kClassClass: { |
| 180 return NULL; | 180 return NULL; |
| 181 } | 181 } |
| 182 case Object::kTypeArgumentsClass: { | 182 case Object::kTypeArgumentsClass: { |
| 183 // TODO(sjesse): Remove this when message serialization format is | 183 // TODO(sjesse): Remove this when message serialization format is |
| 184 // updated (currently length is leaked). | 184 // updated (currently length is leaked). |
| 185 AddBackwardReference(object_id, NULL); | 185 Dart_CObject* value = &type_arguments_marker; |
| 186 AddBackwardReference(object_id, value); |
| 186 Dart_CObject* length = ReadObject(); | 187 Dart_CObject* length = ReadObject(); |
| 187 ASSERT(length->type == Dart_CObject::kInt32); | 188 ASSERT(length->type == Dart_CObject::kInt32); |
| 188 for (int i = 0; i < length->value.as_int32; i++) { | 189 for (int i = 0; i < length->value.as_int32; i++) { |
| 189 Dart_CObject* type = ReadObject(); | 190 Dart_CObject* type = ReadObject(); |
| 190 if (type != &dynamic_type_marker) return NULL; | 191 if (type != &dynamic_type_marker) { |
| 192 return NULL; |
| 193 } |
| 191 } | 194 } |
| 192 return &type_arguments_marker; | 195 return value; |
| 193 } | 196 } |
| 194 case ObjectStore::kArrayClass: { | 197 case ObjectStore::kArrayClass: { |
| 195 intptr_t len = ReadSmiValue(); | 198 intptr_t len = ReadSmiValue(); |
| 196 Dart_CObject* value = AllocateDartCObjectArray(len); | 199 Dart_CObject* value = AllocateDartCObjectArray(len); |
| 197 AddBackwardReference(object_id, value); | 200 AddBackwardReference(object_id, value); |
| 198 // Skip type arguments. | 201 // Skip type arguments. |
| 199 // TODO(sjesse): Remove this when message serialization format is | 202 // TODO(sjesse): Remove this when message serialization format is |
| 200 // updated (currently type_arguments is leaked). | 203 // updated (currently type_arguments is leaked). |
| 201 Dart_CObject* type_arguments = ReadObject(); | 204 Dart_CObject* type_arguments = ReadObject(); |
| 202 if (type_arguments != &type_arguments_marker && | 205 if (type_arguments != &type_arguments_marker && |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 534 } | 537 } |
| 535 | 538 |
| 536 | 539 |
| 537 void ApiMessageWriter::WriteCMessage(Dart_CObject* object) { | 540 void ApiMessageWriter::WriteCMessage(Dart_CObject* object) { |
| 538 WriteCObject(object); | 541 WriteCObject(object); |
| 539 UnmarkAllCObjects(object); | 542 UnmarkAllCObjects(object); |
| 540 FinalizeBuffer(); | 543 FinalizeBuffer(); |
| 541 } | 544 } |
| 542 | 545 |
| 543 } // namespace dart | 546 } // namespace dart |
| OLD | NEW |