| 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/dart_api_state.h" | 8 #include "vm/dart_api_state.h" |
| 9 #include "vm/growable_array.h" | 9 #include "vm/growable_array.h" |
| 10 #include "vm/isolate.h" | 10 #include "vm/isolate.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 : ObjectPointerVisitor(isolate), | 30 : ObjectPointerVisitor(isolate), |
| 31 include_vm_objects_(true), | 31 include_vm_objects_(true), |
| 32 data_(kInitialCapacity) {} | 32 data_(kInitialCapacity) {} |
| 33 | 33 |
| 34 // Marks and pushes. Used to initialize this stack with roots. | 34 // Marks and pushes. Used to initialize this stack with roots. |
| 35 virtual void VisitPointers(RawObject** first, RawObject** last) { | 35 virtual void VisitPointers(RawObject** first, RawObject** last) { |
| 36 for (RawObject** current = first; current <= last; ++current) { | 36 for (RawObject** current = first; current <= last; ++current) { |
| 37 if ((*current)->IsHeapObject() && !(*current)->IsMarked()) { | 37 if ((*current)->IsHeapObject() && !(*current)->IsMarked()) { |
| 38 if (!include_vm_objects_) { | 38 if (!include_vm_objects_) { |
| 39 intptr_t cid = (*current)->GetClassId(); | 39 intptr_t cid = (*current)->GetClassId(); |
| 40 if ((cid < kInstanceCid) && (cid != kContextCid) && | 40 if (((cid < kInstanceCid) || (cid == kTypeArgumentsCid)) && |
| 41 (cid != kFieldCid)) { | 41 (cid != kContextCid) && (cid != kFieldCid)) { |
| 42 continue; | 42 continue; |
| 43 } | 43 } |
| 44 } | 44 } |
| 45 (*current)->SetMarkBit(); | 45 (*current)->SetMarkBit(); |
| 46 Node node; | 46 Node node; |
| 47 node.ptr = current; | 47 node.ptr = current; |
| 48 node.obj = *current; | 48 node.obj = *current; |
| 49 data_.Add(node); | 49 data_.Add(node); |
| 50 } | 50 } |
| 51 } | 51 } |
| (...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 528 count_(0) {} | 528 count_(0) {} |
| 529 virtual void VisitPointers(RawObject** first, RawObject** last) { | 529 virtual void VisitPointers(RawObject** first, RawObject** last) { |
| 530 for (RawObject** current = first; current <= last; ++current) { | 530 for (RawObject** current = first; current <= last; ++current) { |
| 531 RawObject* object = *current; | 531 RawObject* object = *current; |
| 532 if (!object->IsHeapObject() || object->IsVMHeapObject()) { | 532 if (!object->IsHeapObject() || object->IsVMHeapObject()) { |
| 533 // Ignore smis and objects in the VM isolate for now. | 533 // Ignore smis and objects in the VM isolate for now. |
| 534 // TODO(koda): To track which field each pointer corresponds to, | 534 // TODO(koda): To track which field each pointer corresponds to, |
| 535 // we'll need to encode which fields were omitted here. | 535 // we'll need to encode which fields were omitted here. |
| 536 continue; | 536 continue; |
| 537 } | 537 } |
| 538 if (only_instances_ && (object->GetClassId() < kInstanceCid)) { | 538 if (only_instances_ && ((object->GetClassId() < kInstanceCid) || |
| 539 (object->GetClassId() == kTypeArgumentsCid))) { |
| 539 continue; | 540 continue; |
| 540 } | 541 } |
| 541 WritePtr(object, stream_); | 542 WritePtr(object, stream_); |
| 542 ++count_; | 543 ++count_; |
| 543 } | 544 } |
| 544 } | 545 } |
| 545 | 546 |
| 546 intptr_t count() const { return count_; } | 547 intptr_t count() const { return count_; } |
| 547 | 548 |
| 548 private: | 549 private: |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 671 intptr_t object_count = visitor.count(); | 672 intptr_t object_count = visitor.count(); |
| 672 if (roots == kVM) { | 673 if (roots == kVM) { |
| 673 object_count += 1; // root | 674 object_count += 1; // root |
| 674 } else { | 675 } else { |
| 675 object_count += 2; // root and stack | 676 object_count += 2; // root and stack |
| 676 } | 677 } |
| 677 return object_count; | 678 return object_count; |
| 678 } | 679 } |
| 679 | 680 |
| 680 } // namespace dart | 681 } // namespace dart |
| OLD | NEW |