Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(135)

Side by Side Diff: runtime/vm/snapshot.h

Issue 1174173007: Expand the class id to 32 bits and size field to 16 bits on 64-bit platforms. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 template <typename T> 188 template <typename T>
189 T Read() { 189 T Read() {
190 return ReadStream::Raw<sizeof(T), T>::Read(&stream_); 190 return ReadStream::Raw<sizeof(T), T>::Read(&stream_);
191 } 191 }
192 192
193 intptr_t ReadRawPointerValue() { 193 intptr_t ReadRawPointerValue() {
194 int64_t value = Read<int64_t>(); 194 int64_t value = Read<int64_t>();
195 return static_cast<intptr_t>(value); 195 return static_cast<intptr_t>(value);
196 } 196 }
197 197
198 classid_t ReadClassIDValue() {
199 uint32_t value = Read<uint32_t>();
200 return static_cast<classid_t>(value);
201 }
202 COMPILE_ASSERT(sizeof(uint32_t) >= sizeof(classid_t));
203
198 void ReadBytes(uint8_t* addr, intptr_t len) { 204 void ReadBytes(uint8_t* addr, intptr_t len) {
199 stream_.ReadBytes(addr, len); 205 stream_.ReadBytes(addr, len);
200 } 206 }
201 207
202 double ReadDouble() { 208 double ReadDouble() {
203 double result; 209 double result;
204 stream_.ReadBytes(reinterpret_cast<uint8_t*>(&result), sizeof(result)); 210 stream_.ReadBytes(reinterpret_cast<uint8_t*>(&result), sizeof(result));
205 return result; 211 return result;
206 } 212 }
207 213
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 // sizeof(T) must be in {1,2,4,8}. 510 // sizeof(T) must be in {1,2,4,8}.
505 template <typename T> 511 template <typename T>
506 void Write(T value) { 512 void Write(T value) {
507 WriteStream::Raw<sizeof(T), T>::Write(&stream_, value); 513 WriteStream::Raw<sizeof(T), T>::Write(&stream_, value);
508 } 514 }
509 515
510 void WriteRawPointerValue(intptr_t value) { 516 void WriteRawPointerValue(intptr_t value) {
511 Write<int64_t>(value); 517 Write<int64_t>(value);
512 } 518 }
513 519
520 void WriteClassIDValue(classid_t value) {
521 Write<uint32_t>(value);
522 }
523 COMPILE_ASSERT(sizeof(uint32_t) >= sizeof(classid_t));
524
514 // Write an object that is serialized as an Id (singleton in object store, 525 // Write an object that is serialized as an Id (singleton in object store,
515 // or an object that was already serialized before). 526 // or an object that was already serialized before).
516 void WriteIndexedObject(intptr_t object_id) { 527 void WriteIndexedObject(intptr_t object_id) {
517 ASSERT(object_id <= kMaxObjectId); 528 ASSERT(object_id <= kMaxObjectId);
518 intptr_t value = 0; 529 intptr_t value = 0;
519 value = SerializedHeaderTag::update(kObjectId, value); 530 value = SerializedHeaderTag::update(kObjectId, value);
520 value = SerializedHeaderData::update(object_id, value); 531 value = SerializedHeaderData::update(object_id, value);
521 Write<int32_t>(value); 532 Write<int32_t>(value);
522 } 533 }
523 534
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
848 private: 859 private:
849 SnapshotWriter* writer_; 860 SnapshotWriter* writer_;
850 bool as_references_; 861 bool as_references_;
851 862
852 DISALLOW_COPY_AND_ASSIGN(SnapshotWriterVisitor); 863 DISALLOW_COPY_AND_ASSIGN(SnapshotWriterVisitor);
853 }; 864 };
854 865
855 } // namespace dart 866 } // namespace dart
856 867
857 #endif // VM_SNAPSHOT_H_ 868 #endif // VM_SNAPSHOT_H_
OLDNEW
« runtime/vm/intermediate_language_x64.cc ('K') | « runtime/vm/raw_object_snapshot.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698