Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(832)

Unified Diff: runtime/vm/scavenger.cc

Issue 2930943002: Debug garbage collector does not correctly remove cross-gen garbage (Closed)
Patch Set: Rewrites Evacuate() to use one Scavenge() Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« runtime/vm/heap.cc ('K') | « runtime/vm/scavenger.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/scavenger.cc
diff --git a/runtime/vm/scavenger.cc b/runtime/vm/scavenger.cc
index 7445e77d26478ea91b087f44be9943f352039437..faabf4bc3af6e31bdb14fee87a7e3ccc15192af4 100644
--- a/runtime/vm/scavenger.cc
+++ b/runtime/vm/scavenger.cc
@@ -157,6 +157,7 @@ class ScavengerVisitor : public ObjectPointerVisitor {
NOT_IN_PRODUCT(class_table->UpdateAllocatedOld(cid, size));
} else {
// Promotion did not succeed. Copy into the to space instead.
+ scavenger_->failed_to_promote_ = true;
new_addr = scavenger_->TryAllocate(size);
NOT_IN_PRODUCT(class_table->UpdateLiveNew(cid, size));
}
@@ -338,7 +339,8 @@ Scavenger::Scavenger(Heap* heap,
delayed_weak_properties_(NULL),
gc_time_micros_(0),
collections_(0),
- external_size_(0) {
+ external_size_(0),
+ failed_to_promote_(false) {
// Verify assumptions about the first word in objects which the scavenger is
// going to use for forwarding pointers.
ASSERT(Object::tags_offset() == 0);
@@ -796,6 +798,8 @@ void Scavenger::Scavenge(bool invoke_api_callbacks) {
ASSERT(!scavenging_);
scavenging_ = true;
+ failed_to_promote_ = false;
+
PageSpace* page_space = heap_->old_space();
NoSafepointScope no_safepoints;
@@ -905,4 +909,15 @@ void Scavenger::FreeExternal(intptr_t size) {
ASSERT(external_size_ >= 0);
}
+
+void Scavenger::Evacuate() {
+ SafepointOperationScope scope(Thread::Current());
+ survivor_end_ = top_;
rmacnak 2017/06/22 21:59:33 Add a comment that this forces promotion of all su
danunez 2017/06/22 22:07:48 Done.
+ Scavenge();
+
+ // It is possible for objects to stay in the new space
+ // if the VM cannot create more pages for these objects.
+ ASSERT(UsedInWords() == 0 || failed_to_promote_);
rmacnak 2017/06/22 21:59:33 (UsedInWords() == 0)
danunez 2017/06/22 22:07:47 Add parens. Got it.
+}
+
} // namespace dart
« runtime/vm/heap.cc ('K') | « runtime/vm/scavenger.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698