| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 #include "vm/snapshot.h" | 5 #include "vm/snapshot.h" |
| 6 | 6 |
| 7 #include "vm/assert.h" | 7 #include "vm/assert.h" |
| 8 #include "vm/bootstrap.h" | 8 #include "vm/bootstrap.h" |
| 9 #include "vm/heap.h" | 9 #include "vm/heap.h" |
| 10 #include "vm/object.h" | 10 #include "vm/object.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 | 32 |
| 33 static bool IsObjectStoreTypeId(intptr_t index) { | 33 static bool IsObjectStoreTypeId(intptr_t index) { |
| 34 // Check if this is a type which is stored in the object store. | 34 // Check if this is a type which is stored in the object store. |
| 35 return (index >= ObjectStore::kObjectType && | 35 return (index >= ObjectStore::kObjectType && |
| 36 index <= ObjectStore::kBoolInterface); | 36 index <= ObjectStore::kBoolInterface); |
| 37 } | 37 } |
| 38 | 38 |
| 39 | 39 |
| 40 // TODO(5411462): Temporary setup of snapshot for testing purposes, | 40 // TODO(5411462): Temporary setup of snapshot for testing purposes, |
| 41 // the actual creation of a snapshot maybe done differently. | 41 // the actual creation of a snapshot maybe done differently. |
| 42 Snapshot* Snapshot::SetupFromBuffer(void* raw_memory) { | 42 const Snapshot* Snapshot::SetupFromBuffer(const void* raw_memory) { |
| 43 ASSERT(raw_memory != NULL); | 43 ASSERT(raw_memory != NULL); |
| 44 ASSERT(kHeaderSize == sizeof(Snapshot)); | 44 ASSERT(kHeaderSize == sizeof(Snapshot)); |
| 45 ASSERT(kLengthIndex == length_offset()); | 45 ASSERT(kLengthIndex == length_offset()); |
| 46 ASSERT((kSnapshotFlagIndex * sizeof(int32_t)) == full_snapshot_offset()); | 46 ASSERT((kSnapshotFlagIndex * sizeof(int32_t)) == full_snapshot_offset()); |
| 47 ASSERT((kHeapObjectTag & kInlined)); | 47 ASSERT((kHeapObjectTag & kInlined)); |
| 48 ASSERT((kHeapObjectTag & kObjectId)); | 48 ASSERT((kHeapObjectTag & kObjectId)); |
| 49 ASSERT((kObjectAlignmentMask & kObjectId) == kObjectId); | 49 ASSERT((kObjectAlignmentMask & kObjectId) == kObjectId); |
| 50 Snapshot* snapshot = reinterpret_cast<Snapshot*>(raw_memory); | 50 const Snapshot* snapshot = reinterpret_cast<const Snapshot*>(raw_memory); |
| 51 return snapshot; | 51 return snapshot; |
| 52 } | 52 } |
| 53 | 53 |
| 54 | 54 |
| 55 RawObject* SnapshotReader::ReadObject() { | 55 RawObject* SnapshotReader::ReadObject() { |
| 56 intptr_t header = Read<intptr_t>(); | 56 intptr_t header = Read<intptr_t>(); |
| 57 if ((header & kSmiTagMask) == 0) { | 57 if ((header & kSmiTagMask) == 0) { |
| 58 return reinterpret_cast<RawObject*>(header); | 58 return reinterpret_cast<RawObject*>(header); |
| 59 } | 59 } |
| 60 return ReadObjectImpl(header); | 60 return ReadObjectImpl(header); |
| (...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 | 427 |
| 428 | 428 |
| 429 void SnapshotWriterVisitor::VisitPointers(RawObject** first, RawObject** last) { | 429 void SnapshotWriterVisitor::VisitPointers(RawObject** first, RawObject** last) { |
| 430 for (RawObject** current = first; current <= last; current++) { | 430 for (RawObject** current = first; current <= last; current++) { |
| 431 RawObject* raw_obj = *current; | 431 RawObject* raw_obj = *current; |
| 432 writer_->WriteObject(raw_obj); | 432 writer_->WriteObject(raw_obj); |
| 433 } | 433 } |
| 434 } | 434 } |
| 435 | 435 |
| 436 } // namespace dart | 436 } // namespace dart |
| OLD | NEW |