| 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 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 } | 290 } |
| 291 | 291 |
| 292 double ReadDouble() { | 292 double ReadDouble() { |
| 293 double result; | 293 double result; |
| 294 stream_.ReadBytes(reinterpret_cast<uint8_t*>(&result), sizeof(result)); | 294 stream_.ReadBytes(reinterpret_cast<uint8_t*>(&result), sizeof(result)); |
| 295 return result; | 295 return result; |
| 296 } | 296 } |
| 297 | 297 |
| 298 intptr_t ReadTags() { | 298 intptr_t ReadTags() { |
| 299 const intptr_t tags = static_cast<intptr_t>(Read<int8_t>()) & 0xff; | 299 const intptr_t tags = static_cast<intptr_t>(Read<int8_t>()) & 0xff; |
| 300 ASSERT(SerializedHeaderTag::decode(tags) != kObjectId); | |
| 301 return tags; | 300 return tags; |
| 302 } | 301 } |
| 303 | 302 |
| 304 const uint8_t* CurrentBufferAddress() const { | 303 const uint8_t* CurrentBufferAddress() const { |
| 305 return stream_.AddressOfCurrentPosition(); | 304 return stream_.AddressOfCurrentPosition(); |
| 306 } | 305 } |
| 307 | 306 |
| 308 void Advance(intptr_t value) { | 307 void Advance(intptr_t value) { |
| 309 stream_.Advance(value); | 308 stream_.Advance(value); |
| 310 } | 309 } |
| (...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 750 // Write serialization header information for an object. | 749 // Write serialization header information for an object. |
| 751 void WriteInlinedObjectHeader(intptr_t id) { | 750 void WriteInlinedObjectHeader(intptr_t id) { |
| 752 ASSERT(id <= kMaxObjectId); | 751 ASSERT(id <= kMaxObjectId); |
| 753 intptr_t value = 0; | 752 intptr_t value = 0; |
| 754 value = SerializedHeaderTag::update(kInlined, value); | 753 value = SerializedHeaderTag::update(kInlined, value); |
| 755 value = SerializedHeaderData::update(id, value); | 754 value = SerializedHeaderData::update(id, value); |
| 756 Write<int32_t>(value); | 755 Write<int32_t>(value); |
| 757 } | 756 } |
| 758 | 757 |
| 759 void WriteTags(intptr_t tags) { | 758 void WriteTags(intptr_t tags) { |
| 760 ASSERT(SerializedHeaderTag::decode(tags) != kObjectId); | |
| 761 const intptr_t flags = tags & 0xff; | 759 const intptr_t flags = tags & 0xff; |
| 762 Write<int8_t>(static_cast<int8_t>(flags)); | 760 Write<int8_t>(static_cast<int8_t>(flags)); |
| 763 } | 761 } |
| 764 | 762 |
| 765 // Write out a buffer of bytes. | 763 // Write out a buffer of bytes. |
| 766 void WriteBytes(const uint8_t* addr, intptr_t len) { | 764 void WriteBytes(const uint8_t* addr, intptr_t len) { |
| 767 stream_.WriteBytes(addr, len); | 765 stream_.WriteBytes(addr, len); |
| 768 } | 766 } |
| 769 | 767 |
| 770 void WriteDouble(double value) { | 768 void WriteDouble(double value) { |
| (...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1213 private: | 1211 private: |
| 1214 SnapshotWriter* writer_; | 1212 SnapshotWriter* writer_; |
| 1215 bool as_references_; | 1213 bool as_references_; |
| 1216 | 1214 |
| 1217 DISALLOW_COPY_AND_ASSIGN(SnapshotWriterVisitor); | 1215 DISALLOW_COPY_AND_ASSIGN(SnapshotWriterVisitor); |
| 1218 }; | 1216 }; |
| 1219 | 1217 |
| 1220 } // namespace dart | 1218 } // namespace dart |
| 1221 | 1219 |
| 1222 #endif // VM_SNAPSHOT_H_ | 1220 #endif // VM_SNAPSHOT_H_ |
| OLD | NEW |