| 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 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 uword address = heap->TryAllocate(size, Heap::kOld); | 361 uword address = heap->TryAllocate(size, Heap::kOld); |
| 362 if (address == 0) { | 362 if (address == 0) { |
| 363 // Use the preallocated out of memory exception to avoid calling | 363 // Use the preallocated out of memory exception to avoid calling |
| 364 // into dart code or allocating any code. | 364 // into dart code or allocating any code. |
| 365 const Instance& exception = | 365 const Instance& exception = |
| 366 Instance::Handle(object_store()->out_of_memory()); | 366 Instance::Handle(object_store()->out_of_memory()); |
| 367 Exceptions::Throw(exception); | 367 Exceptions::Throw(exception); |
| 368 UNREACHABLE(); | 368 UNREACHABLE(); |
| 369 } | 369 } |
| 370 RawObject* raw_obj = reinterpret_cast<RawObject*>(address + kHeapObjectTag); | 370 RawObject* raw_obj = reinterpret_cast<RawObject*>(address + kHeapObjectTag); |
| 371 raw_obj->ptr()->class_ = cls.raw(); | |
| 372 uword tags = 0; | 371 uword tags = 0; |
| 373 intptr_t index = cls.id(); | 372 intptr_t index = cls.id(); |
| 374 ASSERT(index != kIllegalObjectKind); | 373 ASSERT(index != kIllegalObjectKind); |
| 375 tags = RawObject::ClassIdTag::update(index, tags); | 374 tags = RawObject::ClassIdTag::update(index, tags); |
| 376 tags = RawObject::SizeTag::update(size, tags); | 375 tags = RawObject::SizeTag::update(size, tags); |
| 377 raw_obj->ptr()->tags_ = tags; | 376 raw_obj->ptr()->tags_ = tags; |
| 378 return raw_obj; | 377 return raw_obj; |
| 379 } | 378 } |
| 380 | 379 |
| 381 | 380 |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 705 | 704 |
| 706 | 705 |
| 707 void SnapshotWriterVisitor::VisitPointers(RawObject** first, RawObject** last) { | 706 void SnapshotWriterVisitor::VisitPointers(RawObject** first, RawObject** last) { |
| 708 for (RawObject** current = first; current <= last; current++) { | 707 for (RawObject** current = first; current <= last; current++) { |
| 709 RawObject* raw_obj = *current; | 708 RawObject* raw_obj = *current; |
| 710 writer_->WriteObject(raw_obj); | 709 writer_->WriteObject(raw_obj); |
| 711 } | 710 } |
| 712 } | 711 } |
| 713 | 712 |
| 714 } // namespace dart | 713 } // namespace dart |
| OLD | NEW |