| 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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 if (SerializedHeaderData::decode(class_header) == kInstanceId) { | 177 if (SerializedHeaderData::decode(class_header) == kInstanceId) { |
| 178 // Object is regular dart instance. | 178 // Object is regular dart instance. |
| 179 Instance& result = Instance::ZoneHandle(isolate(), Instance::null()); | 179 Instance& result = Instance::ZoneHandle(isolate(), Instance::null()); |
| 180 AddBackwardReference(object_id, &result); | 180 AddBackwardReference(object_id, &result); |
| 181 | 181 |
| 182 cls ^= ReadObject(); | 182 cls ^= ReadObject(); |
| 183 ASSERT(!cls.IsNull()); | 183 ASSERT(!cls.IsNull()); |
| 184 intptr_t instance_size = cls.instance_size(); | 184 intptr_t instance_size = cls.instance_size(); |
| 185 ASSERT(instance_size > 0); | 185 ASSERT(instance_size > 0); |
| 186 // Allocate the instance and read in all the fields for the object. | 186 // Allocate the instance and read in all the fields for the object. |
| 187 RawObject* raw = Object::Allocate(cls, instance_size, Heap::kNew); | 187 RawObject* raw = Instance::New(cls, Heap::kNew); |
| 188 result ^= raw; | 188 result ^= raw; |
| 189 intptr_t offset = Object::InstanceSize(); | 189 intptr_t offset = Object::InstanceSize(); |
| 190 while (offset < instance_size) { | 190 while (offset < instance_size) { |
| 191 obj = ReadObject(); | 191 obj = ReadObject(); |
| 192 result.SetFieldAtOffset(offset, obj); | 192 result.SetFieldAtOffset(offset, obj); |
| 193 offset += kWordSize; | 193 offset += kWordSize; |
| 194 } | 194 } |
| 195 if (kind_ == Snapshot::kFull) { | 195 if (kind_ == Snapshot::kFull) { |
| 196 result.SetCreatedFromSnapshot(); | 196 result.SetCreatedFromSnapshot(); |
| 197 } else if (result.IsCanonical()) { | 197 } else if (result.IsCanonical()) { |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 | 445 |
| 446 | 446 |
| 447 void SnapshotWriterVisitor::VisitPointers(RawObject** first, RawObject** last) { | 447 void SnapshotWriterVisitor::VisitPointers(RawObject** first, RawObject** last) { |
| 448 for (RawObject** current = first; current <= last; current++) { | 448 for (RawObject** current = first; current <= last; current++) { |
| 449 RawObject* raw_obj = *current; | 449 RawObject* raw_obj = *current; |
| 450 writer_->WriteObject(raw_obj); | 450 writer_->WriteObject(raw_obj); |
| 451 } | 451 } |
| 452 } | 452 } |
| 453 | 453 |
| 454 } // namespace dart | 454 } // namespace dart |
| OLD | NEW |