| 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 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 | 392 |
| 393 // Writes raw data to the stream (basic type). | 393 // Writes raw data to the stream (basic type). |
| 394 // sizeof(T) must be in {1,2,4,8}. | 394 // sizeof(T) must be in {1,2,4,8}. |
| 395 template <typename T> | 395 template <typename T> |
| 396 void Write(T value) { | 396 void Write(T value) { |
| 397 WriteStream::Raw<sizeof(T), T>::Write(&stream_, value); | 397 WriteStream::Raw<sizeof(T), T>::Write(&stream_, value); |
| 398 } | 398 } |
| 399 | 399 |
| 400 // Writes an intptr_t type value out. | 400 // Writes an intptr_t type value out. |
| 401 void WriteIntptrValue(intptr_t value) { | 401 void WriteIntptrValue(intptr_t value) { |
| 402 ASSERT((value >= kMinInt32) && (value <= kMaxInt32)); |
| 403 Write<int64_t>(value); |
| 404 } |
| 405 |
| 406 void WriteRawPointerValue(intptr_t value) { |
| 402 Write<int64_t>(value); | 407 Write<int64_t>(value); |
| 403 } | 408 } |
| 404 | 409 |
| 405 // Write an object that is serialized as an Id (singleton in object store, | 410 // Write an object that is serialized as an Id (singleton in object store, |
| 406 // or an object that was already serialized before). | 411 // or an object that was already serialized before). |
| 407 void WriteIndexedObject(intptr_t object_id) { | 412 void WriteIndexedObject(intptr_t object_id) { |
| 408 ASSERT(object_id <= kMaxObjectId); | 413 ASSERT(object_id <= kMaxObjectId); |
| 409 intptr_t value = 0; | 414 intptr_t value = 0; |
| 410 value = SerializedHeaderTag::update(kObjectId, value); | 415 value = SerializedHeaderTag::update(kObjectId, value); |
| 411 value = SerializedHeaderData::update(object_id, value); | 416 value = SerializedHeaderData::update(object_id, value); |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 639 private: | 644 private: |
| 640 SnapshotWriter* writer_; | 645 SnapshotWriter* writer_; |
| 641 bool as_references_; | 646 bool as_references_; |
| 642 | 647 |
| 643 DISALLOW_COPY_AND_ASSIGN(SnapshotWriterVisitor); | 648 DISALLOW_COPY_AND_ASSIGN(SnapshotWriterVisitor); |
| 644 }; | 649 }; |
| 645 | 650 |
| 646 } // namespace dart | 651 } // namespace dart |
| 647 | 652 |
| 648 #endif // VM_SNAPSHOT_H_ | 653 #endif // VM_SNAPSHOT_H_ |
| OLD | NEW |