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

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

Issue 9159066: Allocate a Dart_CMessage structure when decoding a message into C structures (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed review comments from asiva@ Created 8 years, 10 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 | « runtime/vm/snapshot.h ('k') | runtime/vm/snapshot_test.cc » ('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/snapshot.h" 5 #include "vm/snapshot.h"
6 6
7 #include "platform/assert.h" 7 #include "platform/assert.h"
8 #include "vm/bootstrap.h" 8 #include "vm/bootstrap.h"
9 #include "vm/exceptions.h" 9 #include "vm/exceptions.h"
10 #include "vm/heap.h" 10 #include "vm/heap.h"
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 // updated. 448 // updated.
449 memset(&type_arguments_marker, 0, sizeof(type_arguments_marker)); 449 memset(&type_arguments_marker, 0, sizeof(type_arguments_marker));
450 memset(&dynamic_type_marker, 0, sizeof(dynamic_type_marker)); 450 memset(&dynamic_type_marker, 0, sizeof(dynamic_type_marker));
451 type_arguments_marker.type = 451 type_arguments_marker.type =
452 static_cast<Dart_CObject::Type>(Dart_CObject_Internal::kTypeArguments); 452 static_cast<Dart_CObject::Type>(Dart_CObject_Internal::kTypeArguments);
453 dynamic_type_marker.type = 453 dynamic_type_marker.type =
454 static_cast<Dart_CObject::Type>(Dart_CObject_Internal::kDynamicType); 454 static_cast<Dart_CObject::Type>(Dart_CObject_Internal::kDynamicType);
455 } 455 }
456 456
457 457
458 Dart_CMessage* CMessageReader::ReadMessage() {
459 // Read the object out of the message.
460 Dart_CObject* object = ReadObject();
461
462 Dart_CMessage* message =
463 reinterpret_cast<Dart_CMessage*>(alloc_(NULL, 0, sizeof(Dart_CMessage)));
464 if (message == NULL) return NULL;
465 message->root = object;
466 return message;
467 }
468
458 intptr_t CMessageReader::LookupInternalClass(intptr_t class_header) { 469 intptr_t CMessageReader::LookupInternalClass(intptr_t class_header) {
459 SerializedHeaderType header_type = SerializedHeaderTag::decode(class_header); 470 SerializedHeaderType header_type = SerializedHeaderTag::decode(class_header);
460 ASSERT(header_type == kObjectId); 471 ASSERT(header_type == kObjectId);
461 intptr_t header_value = SerializedHeaderData::decode(class_header); 472 intptr_t header_value = SerializedHeaderData::decode(class_header);
462 return header_value; 473 return header_value;
463 } 474 }
464 475
465 476
466 Dart_CObject* CMessageReader::AllocateDartCObject(Dart_CObject::Type type) { 477 Dart_CObject* CMessageReader::AllocateDartCObject(Dart_CObject::Type type) {
467 Dart_CObject* value = 478 Dart_CObject* value =
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
893 904
894 905
895 void SnapshotWriterVisitor::VisitPointers(RawObject** first, RawObject** last) { 906 void SnapshotWriterVisitor::VisitPointers(RawObject** first, RawObject** last) {
896 for (RawObject** current = first; current <= last; current++) { 907 for (RawObject** current = first; current <= last; current++) {
897 RawObject* raw_obj = *current; 908 RawObject* raw_obj = *current;
898 writer_->WriteObject(raw_obj); 909 writer_->WriteObject(raw_obj);
899 } 910 }
900 } 911 }
901 912
902 } // namespace dart 913 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/snapshot.h ('k') | runtime/vm/snapshot_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698