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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 // sizeof(T) must be in {1,2,4,8}. | 158 // sizeof(T) must be in {1,2,4,8}. |
159 template <typename T> | 159 template <typename T> |
160 T Read() { | 160 T Read() { |
161 return ReadStream::Raw<sizeof(T), T>::Read(&stream_); | 161 return ReadStream::Raw<sizeof(T), T>::Read(&stream_); |
162 } | 162 } |
163 | 163 |
164 // Reads an intptr_t type value. | 164 // Reads an intptr_t type value. |
165 intptr_t ReadIntptrValue() { | 165 intptr_t ReadIntptrValue() { |
166 int64_t value = Read<int64_t>(); | 166 int64_t value = Read<int64_t>(); |
167 ASSERT((value <= kIntptrMax) && (value >= kIntptrMin)); | 167 ASSERT((value <= kIntptrMax) && (value >= kIntptrMin)); |
168 return value; | 168 return static_cast<intptr_t>(value); |
169 } | 169 } |
170 | 170 |
171 void ReadBytes(uint8_t* addr, intptr_t len) { | 171 void ReadBytes(uint8_t* addr, intptr_t len) { |
172 stream_.ReadBytes(addr, len); | 172 stream_.ReadBytes(addr, len); |
173 } | 173 } |
174 | 174 |
175 const uint8_t* CurrentBufferAddress() const { | 175 const uint8_t* CurrentBufferAddress() const { |
176 return stream_.AddressOfCurrentPosition(); | 176 return stream_.AddressOfCurrentPosition(); |
177 } | 177 } |
178 | 178 |
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
570 private: | 570 private: |
571 SnapshotWriter* writer_; | 571 SnapshotWriter* writer_; |
572 bool as_references_; | 572 bool as_references_; |
573 | 573 |
574 DISALLOW_COPY_AND_ASSIGN(SnapshotWriterVisitor); | 574 DISALLOW_COPY_AND_ASSIGN(SnapshotWriterVisitor); |
575 }; | 575 }; |
576 | 576 |
577 } // namespace dart | 577 } // namespace dart |
578 | 578 |
579 #endif // VM_SNAPSHOT_H_ | 579 #endif // VM_SNAPSHOT_H_ |
OLD | NEW |