| 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 #include "vm/snapshot.h" | 5 #include "vm/snapshot.h" |
| 6 | 6 |
| 7 #include "platform/assert.h" | 7 #include "platform/assert.h" |
| 8 #include "vm/bigint_operations.h" | 8 #include "vm/bigint_operations.h" |
| 9 #include "vm/bootstrap.h" | 9 #include "vm/bootstrap.h" |
| 10 #include "vm/exceptions.h" | 10 #include "vm/exceptions.h" |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 Instance& result = Instance::ZoneHandle(isolate(), Instance::null()); | 170 Instance& result = Instance::ZoneHandle(isolate(), Instance::null()); |
| 171 AddBackRef(object_id, &result, kIsNotDeserialized); | 171 AddBackRef(object_id, &result, kIsNotDeserialized); |
| 172 | 172 |
| 173 cls_ ^= ReadObjectImpl(); // Read class information. | 173 cls_ ^= ReadObjectImpl(); // Read class information. |
| 174 ASSERT(!cls_.IsNull()); | 174 ASSERT(!cls_.IsNull()); |
| 175 intptr_t instance_size = cls_.instance_size(); | 175 intptr_t instance_size = cls_.instance_size(); |
| 176 ASSERT(instance_size > 0); | 176 ASSERT(instance_size > 0); |
| 177 if (kind_ == Snapshot::kFull) { | 177 if (kind_ == Snapshot::kFull) { |
| 178 result ^= AllocateUninitialized(cls_, instance_size); | 178 result ^= AllocateUninitialized(cls_, instance_size); |
| 179 } else { | 179 } else { |
| 180 result ^= Object::Allocate(cls_, instance_size, Heap::kNew); | 180 result ^= Object::Allocate(cls_.id(), instance_size, Heap::kNew); |
| 181 } | 181 } |
| 182 return result.raw(); | 182 return result.raw(); |
| 183 } else { | 183 } else { |
| 184 ASSERT((class_header & kSmiTagMask) != 0); | 184 ASSERT((class_header & kSmiTagMask) != 0); |
| 185 cls_ = LookupInternalClass(class_header); | 185 cls_ = LookupInternalClass(class_header); |
| 186 ASSERT(!cls_.IsNull()); | 186 ASSERT(!cls_.IsNull()); |
| 187 } | 187 } |
| 188 | 188 |
| 189 // Similarly Array and ImmutableArray objects are also similarly only | 189 // Similarly Array and ImmutableArray objects are also similarly only |
| 190 // allocated here, the individual array elements are read later. | 190 // allocated here, the individual array elements are read later. |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 549 result = &(Instance::ZoneHandle(isolate(), Instance::null())); | 549 result = &(Instance::ZoneHandle(isolate(), Instance::null())); |
| 550 AddBackRef(object_id, result, kIsDeserialized); | 550 AddBackRef(object_id, result, kIsDeserialized); |
| 551 cls_ ^= ReadObjectImpl(); | 551 cls_ ^= ReadObjectImpl(); |
| 552 ASSERT(!cls_.IsNull()); | 552 ASSERT(!cls_.IsNull()); |
| 553 instance_size = cls_.instance_size(); | 553 instance_size = cls_.instance_size(); |
| 554 ASSERT(instance_size > 0); | 554 ASSERT(instance_size > 0); |
| 555 // Allocate the instance and read in all the fields for the object. | 555 // Allocate the instance and read in all the fields for the object. |
| 556 if (kind_ == Snapshot::kFull) { | 556 if (kind_ == Snapshot::kFull) { |
| 557 *result ^= AllocateUninitialized(cls_, instance_size); | 557 *result ^= AllocateUninitialized(cls_, instance_size); |
| 558 } else { | 558 } else { |
| 559 *result ^= Object::Allocate(cls_, instance_size, Heap::kNew); | 559 *result ^= Object::Allocate(cls_.id(), instance_size, Heap::kNew); |
| 560 } | 560 } |
| 561 } else { | 561 } else { |
| 562 cls_ ^= ReadObjectImpl(); | 562 cls_ ^= ReadObjectImpl(); |
| 563 ASSERT(!cls_.IsNull()); | 563 ASSERT(!cls_.IsNull()); |
| 564 instance_size = cls_.instance_size(); | 564 instance_size = cls_.instance_size(); |
| 565 } | 565 } |
| 566 intptr_t offset = Object::InstanceSize(); | 566 intptr_t offset = Object::InstanceSize(); |
| 567 while (offset < instance_size) { | 567 while (offset < instance_size) { |
| 568 obj_ = ReadObjectRef(); | 568 obj_ = ReadObjectRef(); |
| 569 result->SetFieldAtOffset(offset, obj_); | 569 result->SetFieldAtOffset(offset, obj_); |
| (...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1009 RawObject* raw_obj = *current; | 1009 RawObject* raw_obj = *current; |
| 1010 if (as_references_) { | 1010 if (as_references_) { |
| 1011 writer_->WriteObjectRef(raw_obj); | 1011 writer_->WriteObjectRef(raw_obj); |
| 1012 } else { | 1012 } else { |
| 1013 writer_->WriteObjectImpl(raw_obj); | 1013 writer_->WriteObjectImpl(raw_obj); |
| 1014 } | 1014 } |
| 1015 } | 1015 } |
| 1016 } | 1016 } |
| 1017 | 1017 |
| 1018 } // namespace dart | 1018 } // namespace dart |
| OLD | NEW |