Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(21)

Side by Side Diff: runtime/vm/dart_api_message.cc

Issue 12893013: dart:io | Fix error in deserializing of native port messages. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | tests/standalone/standalone.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "vm/unicode.h" 9 #include "vm/unicode.h"
10 10
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 } 260 }
261 if (SerializedHeaderTag::decode(value) == kObjectId) { 261 if (SerializedHeaderTag::decode(value) == kObjectId) {
262 return ReadIndexedObject(SerializedHeaderData::decode(value)); 262 return ReadIndexedObject(SerializedHeaderData::decode(value));
263 } 263 }
264 ASSERT(SerializedHeaderTag::decode(value) == kInlined); 264 ASSERT(SerializedHeaderTag::decode(value) == kInlined);
265 // Read the class header information and lookup the class. 265 // Read the class header information and lookup the class.
266 intptr_t class_header = ReadIntptrValue(); 266 intptr_t class_header = ReadIntptrValue();
267 267
268 // Reading of regular dart instances is not supported. 268 // Reading of regular dart instances is not supported.
269 if (SerializedHeaderData::decode(class_header) == kInstanceObjectId) { 269 if (SerializedHeaderData::decode(class_header) == kInstanceObjectId) {
270 return AllocateDartCObjectUnsupported(); 270 intptr_t object_id = SerializedHeaderData::decode(value);
271 Dart_CObject* object = AllocateDartCObjectUnsupported();
272 AddBackRef(object_id, object, kIsNotDeserialized);
273 return object;
271 } 274 }
272 ASSERT((class_header & kSmiTagMask) != 0); 275 ASSERT((class_header & kSmiTagMask) != 0);
273 intptr_t object_id = SerializedHeaderData::decode(value); 276 intptr_t object_id = SerializedHeaderData::decode(value);
274 intptr_t class_id = LookupInternalClass(class_header); 277 intptr_t class_id = LookupInternalClass(class_header);
275 if ((class_id == kArrayCid) || (class_id == kImmutableArrayCid)) { 278 if ((class_id == kArrayCid) || (class_id == kImmutableArrayCid)) {
276 ASSERT(GetBackRef(object_id) == NULL); 279 ASSERT(GetBackRef(object_id) == NULL);
277 intptr_t len = ReadSmiValue(); 280 intptr_t len = ReadSmiValue();
278 Dart_CObject* value = AllocateDartCObjectArray(len); 281 Dart_CObject* value = AllocateDartCObjectArray(len);
279 AddBackRef(object_id, value, kIsNotDeserialized); 282 AddBackRef(object_id, value, kIsNotDeserialized);
280 return value; 283 return value;
(...skipping 22 matching lines...) Expand all
303 } 306 }
304 // No other VM isolate objects are supported. 307 // No other VM isolate objects are supported.
305 return AllocateDartCObjectNull(); 308 return AllocateDartCObjectNull();
306 } 309 }
307 310
308 311
309 Dart_CObject* ApiMessageReader::ReadInternalVMObject(intptr_t class_id, 312 Dart_CObject* ApiMessageReader::ReadInternalVMObject(intptr_t class_id,
310 intptr_t object_id) { 313 intptr_t object_id) {
311 switch (class_id) { 314 switch (class_id) {
312 case kClassCid: { 315 case kClassCid: {
313 return AllocateDartCObjectUnsupported(); 316 Dart_CObject* object = AllocateDartCObjectUnsupported();
317 AddBackRef(object_id, object, kIsDeserialized);
318 return object;
314 } 319 }
315 case kTypeArgumentsCid: { 320 case kTypeArgumentsCid: {
316 // TODO(sjesse): Remove this when message serialization format is 321 // TODO(sjesse): Remove this when message serialization format is
317 // updated (currently length is leaked). 322 // updated (currently length is leaked).
318 Dart_CObject* value = &type_arguments_marker; 323 Dart_CObject* value = &type_arguments_marker;
319 AddBackRef(object_id, value, kIsDeserialized); 324 AddBackRef(object_id, value, kIsDeserialized);
320 Dart_CObject* length = ReadObjectImpl(); 325 Dart_CObject* length = ReadObjectImpl();
321 ASSERT(length->type == Dart_CObject::kInt32); 326 ASSERT(length->type == Dart_CObject::kInt32);
322 for (int i = 0; i < length->value.as_int32; i++) { 327 for (int i = 0; i < length->value.as_int32; i++) {
323 Dart_CObject* type = ReadObjectImpl(); 328 Dart_CObject* type = ReadObjectImpl();
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 // Read the content of the GrowableObjectArray. 465 // Read the content of the GrowableObjectArray.
461 Dart_CObject* content = ReadObjectImpl(); 466 Dart_CObject* content = ReadObjectImpl();
462 ASSERT(content->type == Dart_CObject::kArray); 467 ASSERT(content->type == Dart_CObject::kArray);
463 // Make the empty array allocated point to the backing store content. 468 // Make the empty array allocated point to the backing store content.
464 value->value.as_array.length = len; 469 value->value.as_array.length = len;
465 value->value.as_array.values = content->value.as_array.values; 470 value->value.as_array.values = content->value.as_array.values;
466 return value; 471 return value;
467 } 472 }
468 default: 473 default:
469 // Everything else not supported. 474 // Everything else not supported.
470 return AllocateDartCObjectUnsupported(); 475 Dart_CObject* value = AllocateDartCObjectUnsupported();
476 AddBackRef(object_id, value, kIsDeserialized);
477 return value;
471 } 478 }
472 } 479 }
473 480
474 481
475 Dart_CObject* ApiMessageReader::ReadIndexedObject(intptr_t object_id) { 482 Dart_CObject* ApiMessageReader::ReadIndexedObject(intptr_t object_id) {
476 if (object_id == kDynamicType || 483 if (object_id == kDynamicType ||
477 object_id == kDoubleType || 484 object_id == kDoubleType ||
478 object_id == kIntType || 485 object_id == kIntType ||
479 object_id == kBoolType || 486 object_id == kBoolType ||
480 object_id == kStringType) { 487 object_id == kStringType) {
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
903 if (!success) { 910 if (!success) {
904 UnmarkAllCObjects(object); 911 UnmarkAllCObjects(object);
905 return false; 912 return false;
906 } 913 }
907 } 914 }
908 UnmarkAllCObjects(object); 915 UnmarkAllCObjects(object);
909 return true; 916 return true;
910 } 917 }
911 918
912 } // namespace dart 919 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | tests/standalone/standalone.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698