[vm, gc] As a debugging aid, remember the previous object during heap iteration.

Bug: https://github.com/dart-lang/sdk/issues/36906
Change-Id: Id7214aaa475929e33e5e5ae5bc58c99eb927b74b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127743
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
This commit is contained in:
Ryan Macnak 2019-12-10 00:57:23 +00:00 committed by commit-bot@chromium.org
parent 964c9d8c20
commit 617933c3c1
2 changed files with 8 additions and 0 deletions

View file

@ -96,10 +96,12 @@ void HeapPage::VisitObjects(ObjectVisitor* visitor) const {
NoSafepointScope no_safepoint;
uword obj_addr = object_start();
uword end_addr = object_end();
RawObject* volatile debugging_prev = 0; // TODO(36906): Remove.
while (obj_addr < end_addr) {
RawObject* raw_obj = RawObject::FromAddr(obj_addr);
visitor->VisitObject(raw_obj);
obj_addr += raw_obj->HeapSize();
debugging_prev = raw_obj;
}
ASSERT(obj_addr == end_addr);
}
@ -110,9 +112,11 @@ void HeapPage::VisitObjectPointers(ObjectPointerVisitor* visitor) const {
NoSafepointScope no_safepoint;
uword obj_addr = object_start();
uword end_addr = object_end();
RawObject* volatile debugging_prev = 0; // TODO(36906): Remove.
while (obj_addr < end_addr) {
RawObject* raw_obj = RawObject::FromAddr(obj_addr);
obj_addr += raw_obj->VisitPointers(visitor);
debugging_prev = raw_obj;
}
ASSERT(obj_addr == end_addr);
}

View file

@ -956,9 +956,11 @@ void Scavenger::VisitObjectPointers(ObjectPointerVisitor* visitor) const {
(Thread::Current()->task_kind() == Thread::kCompactorTask));
MakeNewSpaceIterable();
uword cur = FirstObjectStart();
RawObject* volatile debugging_prev = 0; // TODO(36906): Remove.
while (cur < top_) {
RawObject* raw_obj = RawObject::FromAddr(cur);
cur += raw_obj->VisitPointers(visitor);
debugging_prev = raw_obj;
}
}
@ -967,10 +969,12 @@ void Scavenger::VisitObjects(ObjectVisitor* visitor) const {
(Thread::Current()->task_kind() == Thread::kMarkerTask));
MakeNewSpaceIterable();
uword cur = FirstObjectStart();
RawObject* volatile debugging_prev = 0; // TODO(36906): Remove.
while (cur < top_) {
RawObject* raw_obj = RawObject::FromAddr(cur);
visitor->VisitObject(raw_obj);
cur += raw_obj->HeapSize();
debugging_prev = raw_obj;
}
}