| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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/object_graph.h" | 5 #include "vm/object_graph.h" |
| 6 | 6 |
| 7 #include "vm/dart.h" | 7 #include "vm/dart.h" |
| 8 #include "vm/growable_array.h" | 8 #include "vm/growable_array.h" |
| 9 #include "vm/isolate.h" | 9 #include "vm/isolate.h" |
| 10 #include "vm/object.h" | 10 #include "vm/object.h" |
| (...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 606 } | 606 } |
| 607 | 607 |
| 608 | 608 |
| 609 intptr_t ObjectGraph::Serialize(WriteStream* stream, | 609 intptr_t ObjectGraph::Serialize(WriteStream* stream, |
| 610 SnapshotRoots roots, | 610 SnapshotRoots roots, |
| 611 bool collect_garbage) { | 611 bool collect_garbage) { |
| 612 if (collect_garbage) { | 612 if (collect_garbage) { |
| 613 isolate()->heap()->CollectAllGarbage(); | 613 isolate()->heap()->CollectAllGarbage(); |
| 614 } | 614 } |
| 615 // Current encoding assumes objects do not move, so promote everything to old. | 615 // Current encoding assumes objects do not move, so promote everything to old. |
| 616 isolate()->heap()->new_space()->Evacuate(); | 616 isolate()->heap()->new_space()->Evacuate(isolate()->mutator_thread()); |
| 617 HeapIterationScope iteration_scope(true); | 617 HeapIterationScope iteration_scope(true); |
| 618 | 618 |
| 619 RawObject* kRootAddress = reinterpret_cast<RawObject*>(kHeapObjectTag); | 619 RawObject* kRootAddress = reinterpret_cast<RawObject*>(kHeapObjectTag); |
| 620 const intptr_t kRootCid = kIllegalCid; | 620 const intptr_t kRootCid = kIllegalCid; |
| 621 RawObject* kStackAddress = | 621 RawObject* kStackAddress = |
| 622 reinterpret_cast<RawObject*>(kObjectAlignment + kHeapObjectTag); | 622 reinterpret_cast<RawObject*>(kObjectAlignment + kHeapObjectTag); |
| 623 | 623 |
| 624 stream->WriteUnsigned(kObjectAlignment); | 624 stream->WriteUnsigned(kObjectAlignment); |
| 625 stream->WriteUnsigned(kStackCid); | 625 stream->WriteUnsigned(kStackCid); |
| 626 | 626 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 655 intptr_t object_count = visitor.count(); | 655 intptr_t object_count = visitor.count(); |
| 656 if (roots == kVM) { | 656 if (roots == kVM) { |
| 657 object_count += 1; // root | 657 object_count += 1; // root |
| 658 } else { | 658 } else { |
| 659 object_count += 2; // root and stack | 659 object_count += 2; // root and stack |
| 660 } | 660 } |
| 661 return object_count; | 661 return object_count; |
| 662 } | 662 } |
| 663 | 663 |
| 664 } // namespace dart | 664 } // namespace dart |
| OLD | NEW |