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

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: Removed dummy changes from dart_api_impl.cc 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
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 427 matching lines...) Expand 10 before | Expand all | Expand 10 after
895 906
896 907
897 void SnapshotWriterVisitor::VisitPointers(RawObject** first, RawObject** last) { 908 void SnapshotWriterVisitor::VisitPointers(RawObject** first, RawObject** last) {
898 for (RawObject** current = first; current <= last; current++) { 909 for (RawObject** current = first; current <= last; current++) {
899 RawObject* raw_obj = *current; 910 RawObject* raw_obj = *current;
900 writer_->WriteObject(raw_obj); 911 writer_->WriteObject(raw_obj);
901 } 912 }
902 } 913 }
903 914
904 } // namespace dart 915 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/snapshot.h ('k') | runtime/vm/snapshot_test.cc » ('j') | runtime/vm/snapshot_test.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698