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

Unified Diff: runtime/vm/scavenger.cc

Issue 1287333007: - Avoid scavenging the same location twice. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 4 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
« no previous file with comments | « runtime/vm/dart_api_impl_test.cc ('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 caf0d51d9d5bb68db3abdfccb14f2529b65e450c..f154078809a9e83688f25035e2199f177a4074d9 100644
--- a/runtime/vm/scavenger.cc
+++ b/runtime/vm/scavenger.cc
@@ -158,10 +158,7 @@ class ScavengerVisitor : public ObjectPointerVisitor {
}
uword raw_addr = RawObject::ToAddr(raw_obj);
- // The scavenger is only interested in objects located in the from space.
- if (scavenger_->to_->Contains(raw_addr)) {
- return;
- }
+ // The scavenger is only expects objects located in the from space.
ASSERT(from_->Contains(raw_addr));
// Read the header word of the object and determine if the object has
// already been copied.
@@ -618,7 +615,16 @@ void Scavenger::IterateWeakReferences(Isolate* isolate,
for (intptr_t k = 0; k < num_keys; ++k) {
if (!IsUnreachable(reference_set->get_key(k))) {
for (intptr_t v = 0; v < num_values; ++v) {
- visitor->VisitPointer(reference_set->get_value(v));
+ RawObject** raw_obj_addr = reference_set->get_value(v);
+ RawObject* raw_obj = *raw_obj_addr;
+ // Only visit heap objects which are in from space, aka new objects
+ // not in to space. This avoids visiting a value multiple times
+ // during a scavenge.
+ if (raw_obj->IsHeapObject() &&
+ raw_obj->IsNewObject() &&
+ !to_->Contains(RawObject::ToAddr(raw_obj))) {
+ visitor->VisitPointer(raw_obj_addr);
+ }
}
is_unreachable = false;
// Since we have found a key object that is reachable and all
« no previous file with comments | « runtime/vm/dart_api_impl_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698