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 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
484 stream->WriteUnsigned(addr / kObjectAlignment); | 484 stream->WriteUnsigned(addr / kObjectAlignment); |
485 } | 485 } |
486 | 486 |
487 | 487 |
488 class WritePointerVisitor : public ObjectPointerVisitor { | 488 class WritePointerVisitor : public ObjectPointerVisitor { |
489 public: | 489 public: |
490 WritePointerVisitor(Isolate* isolate, WriteStream* stream) | 490 WritePointerVisitor(Isolate* isolate, WriteStream* stream) |
491 : ObjectPointerVisitor(isolate), stream_(stream), count_(0) {} | 491 : ObjectPointerVisitor(isolate), stream_(stream), count_(0) {} |
492 virtual void VisitPointers(RawObject** first, RawObject** last) { | 492 virtual void VisitPointers(RawObject** first, RawObject** last) { |
493 for (RawObject** current = first; current <= last; ++current) { | 493 for (RawObject** current = first; current <= last; ++current) { |
494 if (!(*current)->IsHeapObject() || (*current == Object::null())) { | 494 RawObject* object = *current; |
495 // Ignore smis and nulls for now. | 495 if (!object->IsHeapObject() || object->IsVMHeapObject()) { |
| 496 // Ignore smis and objects in the VM isolate for now. |
496 // TODO(koda): To track which field each pointer corresponds to, | 497 // TODO(koda): To track which field each pointer corresponds to, |
497 // we'll need to encode which fields were omitted here. | 498 // we'll need to encode which fields were omitted here. |
498 continue; | 499 continue; |
499 } | 500 } |
500 WritePtr(*current, stream_); | 501 WritePtr(object, stream_); |
501 ++count_; | 502 ++count_; |
502 } | 503 } |
503 } | 504 } |
504 | 505 |
505 intptr_t count() const { return count_; } | 506 intptr_t count() const { return count_; } |
506 | 507 |
507 private: | 508 private: |
508 WriteStream* stream_; | 509 WriteStream* stream_; |
509 intptr_t count_; | 510 intptr_t count_; |
510 }; | 511 }; |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
564 { | 565 { |
565 WritePointerVisitor ptr_writer(isolate(), stream); | 566 WritePointerVisitor ptr_writer(isolate(), stream); |
566 isolate()->IterateObjectPointers(&ptr_writer, false); | 567 isolate()->IterateObjectPointers(&ptr_writer, false); |
567 } | 568 } |
568 stream->WriteUnsigned(0); | 569 stream->WriteUnsigned(0); |
569 IterateObjects(&visitor); | 570 IterateObjects(&visitor); |
570 return visitor.count() + 1; // + root | 571 return visitor.count() + 1; // + root |
571 } | 572 } |
572 | 573 |
573 } // namespace dart | 574 } // namespace dart |
OLD | NEW |