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

Unified Diff: runtime/vm/scavenger.cc

Issue 11055007: Scavenge watched objects by scavenging their watchers. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: address review comments Created 8 years, 2 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/tests/vm/vm.status ('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 9767e03c6760ecca0f233b057a1b4a3ccda67af5..b5696a1f1b6ad781a5dff96f57e36ed603c778e0 100644
--- a/runtime/vm/scavenger.cc
+++ b/runtime/vm/scavenger.cc
@@ -122,18 +122,26 @@ class ScavengerVisitor : public ObjectPointerVisitor {
if (IsForwarding(header)) {
// Get the new location of the object.
new_addr = ForwardedAddr(header);
- } else {
- if (raw_obj->IsWatched()) {
- std::pair<DelaySet::iterator, DelaySet::iterator> ret;
- // Visit all elements with a key equal to raw_obj.
- ret = delay_set_.equal_range(raw_obj);
- for (DelaySet::iterator it = ret.first; it != ret.second; ++it) {
- // Visit through the associated WeakProperty at this time.
- it->second->VisitPointers(this);
- }
- delay_set_.erase(ret.first, ret.second);
- raw_obj->ClearWatchedBit();
+ } else if (raw_obj->IsWatched()) {
+ // Forward the object by scavenging its watchers.
+ raw_obj->ClearWatchedBit();
+ std::pair<DelaySet::iterator, DelaySet::iterator> ret;
+ // Visit all elements with a key equal to raw_obj.
+ ret = delay_set_.equal_range(raw_obj);
+ for (DelaySet::iterator it = ret.first; it != ret.second; ++it) {
+ // Scavenge the delayed WeakProperty. These objects have been
+ // forwarded but have not been scavenged because their key
+ // object was not known to be reachable. Now that the key
+ // object is known to be reachable we can scavenge the key and
+ // value pointers.
+ it->second->VisitPointers(this);
}
+ delay_set_.erase(ret.first, ret.second);
+ // Reread the header word to get the new location of the object.
+ header = *reinterpret_cast<uword*>(raw_addr);
+ ASSERT(IsForwarding(header));
+ new_addr = ForwardedAddr(header);
+ } else {
intptr_t size = raw_obj->Size();
// Check whether object should be promoted.
if (scavenger_->survivor_end_ <= raw_addr) {
« no previous file with comments | « runtime/tests/vm/vm.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698