| 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 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 543 ptr_writer_(isolate, stream, roots == ObjectGraph::kUser), | 543 ptr_writer_(isolate, stream, roots == ObjectGraph::kUser), |
| 544 roots_(roots), | 544 roots_(roots), |
| 545 count_(0) {} | 545 count_(0) {} |
| 546 | 546 |
| 547 virtual Direction VisitObject(ObjectGraph::StackIterator* it) { | 547 virtual Direction VisitObject(ObjectGraph::StackIterator* it) { |
| 548 RawObject* raw_obj = it->Get(); | 548 RawObject* raw_obj = it->Get(); |
| 549 Thread* thread = Thread::Current(); | 549 Thread* thread = Thread::Current(); |
| 550 REUSABLE_OBJECT_HANDLESCOPE(thread); | 550 REUSABLE_OBJECT_HANDLESCOPE(thread); |
| 551 Object& obj = thread->ObjectHandle(); | 551 Object& obj = thread->ObjectHandle(); |
| 552 obj = raw_obj; | 552 obj = raw_obj; |
| 553 if ((roots_ == ObjectGraph::kVM) || obj.IsField() || obj.IsInstance()) { | 553 if ((roots_ == ObjectGraph::kVM) || obj.IsField() || obj.IsInstance() || |
| 554 obj.IsContext()) { |
| 554 // Each object is a header + a zero-terminated list of its neighbors. | 555 // Each object is a header + a zero-terminated list of its neighbors. |
| 555 WriteHeader(raw_obj, raw_obj->Size(), obj.GetClassId(), stream_); | 556 WriteHeader(raw_obj, raw_obj->Size(), obj.GetClassId(), stream_); |
| 556 raw_obj->VisitPointers(&ptr_writer_); | 557 raw_obj->VisitPointers(&ptr_writer_); |
| 557 stream_->WriteUnsigned(0); | 558 stream_->WriteUnsigned(0); |
| 558 ++count_; | 559 ++count_; |
| 559 } | 560 } |
| 560 return kProceed; | 561 return kProceed; |
| 561 } | 562 } |
| 562 | 563 |
| 563 intptr_t count() const { return count_; } | 564 intptr_t count() const { return count_; } |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 654 intptr_t object_count = visitor.count(); | 655 intptr_t object_count = visitor.count(); |
| 655 if (roots == kVM) { | 656 if (roots == kVM) { |
| 656 object_count += 1; // root | 657 object_count += 1; // root |
| 657 } else { | 658 } else { |
| 658 object_count += 2; // root and stack | 659 object_count += 2; // root and stack |
| 659 } | 660 } |
| 660 return object_count; | 661 return object_count; |
| 661 } | 662 } |
| 662 | 663 |
| 663 } // namespace dart | 664 } // namespace dart |
| OLD | NEW |