| 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/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 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 569 WriteObjectHeader(ObjectStore::kArrayClass, 0); | 569 WriteObjectHeader(ObjectStore::kArrayClass, 0); |
| 570 WriteSmi(object->value.as_array.length); | 570 WriteSmi(object->value.as_array.length); |
| 571 // Write out the type arguments. | 571 // Write out the type arguments. |
| 572 WriteIndexedObject(Object::kNullObject); | 572 WriteIndexedObject(Object::kNullObject); |
| 573 // Write out array elements. | 573 // Write out array elements. |
| 574 for (int i = 0; i < object->value.as_array.length; i++) { | 574 for (int i = 0; i < object->value.as_array.length; i++) { |
| 575 WriteCObject(object->value.as_array.values[i]); | 575 WriteCObject(object->value.as_array.values[i]); |
| 576 } | 576 } |
| 577 break; | 577 break; |
| 578 } | 578 } |
| 579 case Dart_CObject::kByteArray: { |
| 580 // Write out the serialization header value for this object. |
| 581 WriteInlinedHeader(object); |
| 582 // Write out the class and tags information. |
| 583 WriteObjectHeader(ObjectStore::kInternalByteArrayClass, 0); |
| 584 uint8_t* bytes = object->value.as_byte_array.values; |
| 585 intptr_t len = object->value.as_byte_array.length; |
| 586 WriteSmi(len); |
| 587 for (intptr_t i = 0; i < len; i++) { |
| 588 Write<uint8_t>(bytes[i]); |
| 589 } |
| 590 break; |
| 591 } |
| 579 default: | 592 default: |
| 580 UNREACHABLE(); | 593 UNREACHABLE(); |
| 581 } | 594 } |
| 582 } | 595 } |
| 583 | 596 |
| 584 | 597 |
| 585 void MessageWriter::WriteCMessage(Dart_CObject* object) { | 598 void MessageWriter::WriteCMessage(Dart_CObject* object) { |
| 586 WriteCObject(object); | 599 WriteCObject(object); |
| 587 UnmarkAllCObjects(object); | 600 UnmarkAllCObjects(object); |
| 588 FinalizeBuffer(); | 601 FinalizeBuffer(); |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 792 | 805 |
| 793 | 806 |
| 794 void SnapshotWriterVisitor::VisitPointers(RawObject** first, RawObject** last) { | 807 void SnapshotWriterVisitor::VisitPointers(RawObject** first, RawObject** last) { |
| 795 for (RawObject** current = first; current <= last; current++) { | 808 for (RawObject** current = first; current <= last; current++) { |
| 796 RawObject* raw_obj = *current; | 809 RawObject* raw_obj = *current; |
| 797 writer_->WriteObject(raw_obj); | 810 writer_->WriteObject(raw_obj); |
| 798 } | 811 } |
| 799 } | 812 } |
| 800 | 813 |
| 801 } // namespace dart | 814 } // namespace dart |
| OLD | NEW |