| 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 #ifndef VM_SNAPSHOT_H_ | 5 #ifndef VM_SNAPSHOT_H_ |
| 6 #define VM_SNAPSHOT_H_ | 6 #define VM_SNAPSHOT_H_ |
| 7 | 7 |
| 8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
| 9 #include "vm/allocation.h" | 9 #include "vm/allocation.h" |
| 10 #include "vm/bitfield.h" | 10 #include "vm/bitfield.h" |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 | 315 |
| 316 // Write serialization header information for an object. | 316 // Write serialization header information for an object. |
| 317 void WriteSerializationMarker(SerializedHeaderType type, intptr_t id) { | 317 void WriteSerializationMarker(SerializedHeaderType type, intptr_t id) { |
| 318 ASSERT(id <= kMaxObjectId); | 318 ASSERT(id <= kMaxObjectId); |
| 319 intptr_t value = 0; | 319 intptr_t value = 0; |
| 320 value = SerializedHeaderTag::update(type, value); | 320 value = SerializedHeaderTag::update(type, value); |
| 321 value = SerializedHeaderData::update(id, value); | 321 value = SerializedHeaderData::update(id, value); |
| 322 WriteIntptrValue(value); | 322 WriteIntptrValue(value); |
| 323 } | 323 } |
| 324 | 324 |
| 325 // Write out a buffer of bytes. |
| 326 void WriteBytes(const uint8_t* addr, intptr_t len) { |
| 327 stream_.WriteBytes(addr, len); |
| 328 } |
| 329 |
| 325 // Finalize the serialized buffer by filling in the header information | 330 // Finalize the serialized buffer by filling in the header information |
| 326 // which comprises of a flag(snaphot kind) and the length of | 331 // which comprises of a flag(snaphot kind) and the length of |
| 327 // serialzed bytes. | 332 // serialzed bytes. |
| 328 void FinalizeBuffer(Snapshot::Kind kind) { | 333 void FinalizeBuffer(Snapshot::Kind kind) { |
| 329 int32_t* data = reinterpret_cast<int32_t*>(stream_.buffer()); | 334 int32_t* data = reinterpret_cast<int32_t*>(stream_.buffer()); |
| 330 data[Snapshot::kLengthIndex] = stream_.bytes_written(); | 335 data[Snapshot::kLengthIndex] = stream_.bytes_written(); |
| 331 data[Snapshot::kSnapshotFlagIndex] = kind; | 336 data[Snapshot::kSnapshotFlagIndex] = kind; |
| 332 } | 337 } |
| 333 | 338 |
| 334 protected: | 339 protected: |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 470 private: | 475 private: |
| 471 SnapshotWriter* writer_; | 476 SnapshotWriter* writer_; |
| 472 bool as_references_; | 477 bool as_references_; |
| 473 | 478 |
| 474 DISALLOW_COPY_AND_ASSIGN(SnapshotWriterVisitor); | 479 DISALLOW_COPY_AND_ASSIGN(SnapshotWriterVisitor); |
| 475 }; | 480 }; |
| 476 | 481 |
| 477 } // namespace dart | 482 } // namespace dart |
| 478 | 483 |
| 479 #endif // VM_SNAPSHOT_H_ | 484 #endif // VM_SNAPSHOT_H_ |
| OLD | NEW |