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

Side by Side Diff: vm/scavenger.cc

Issue 11038004: - WeakProperty keys in other generations are black. Avoid trying to (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: 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 unified diff | Download patch | Annotate | Revision Log
« vm/object_test.cc ('K') | « vm/object_test.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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/scavenger.h" 5 #include "vm/scavenger.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 } 492 }
493 visitor->VisitingOldPointers(false); 493 visitor->VisitingOldPointers(false);
494 } 494 }
495 } 495 }
496 496
497 497
498 uword Scavenger::ProcessWeakProperty(RawWeakProperty* raw_weak, 498 uword Scavenger::ProcessWeakProperty(RawWeakProperty* raw_weak,
499 ScavengerVisitor* visitor) { 499 ScavengerVisitor* visitor) {
500 // The fate of the weak property is determined by its key. 500 // The fate of the weak property is determined by its key.
501 RawObject* raw_key = raw_weak->ptr()->key_; 501 RawObject* raw_key = raw_weak->ptr()->key_;
502 uword raw_addr = RawObject::ToAddr(raw_key); 502 if (raw_key->IsHeapObject() && raw_key->IsNewObject()) {
503 uword header = *reinterpret_cast<uword*>(raw_addr); 503 uword raw_addr = RawObject::ToAddr(raw_key);
504 if (!IsForwarding(header)) { 504 uword header = *reinterpret_cast<uword*>(raw_addr);
505 // Key is white. Delay the weak property. 505 if (!IsForwarding(header)) {
506 visitor->DelayWeakProperty(raw_weak); 506 // Key is white. Delay the weak property.
507 return raw_weak->Size(); 507 visitor->DelayWeakProperty(raw_weak);
508 } else { 508 return raw_weak->Size();
509 // Key is gray or black. Make the weak property black. 509 }
510 return raw_weak->VisitPointers(visitor);
511 } 510 }
511 // Key is gray or black. Make the weak property black.
512 return raw_weak->VisitPointers(visitor);
512 } 513 }
513 514
514 515
515 void Scavenger::ProcessPeerReferents() { 516 void Scavenger::ProcessPeerReferents() {
516 PeerTable prev; 517 PeerTable prev;
517 std::swap(prev, peer_table_); 518 std::swap(prev, peer_table_);
518 for (PeerTable::iterator it = prev.begin(); it != prev.end(); ++it) { 519 for (PeerTable::iterator it = prev.begin(); it != prev.end(); ++it) {
519 RawObject* raw_obj = it->first; 520 RawObject* raw_obj = it->first;
520 ASSERT(raw_obj->IsHeapObject()); 521 ASSERT(raw_obj->IsHeapObject());
521 uword raw_addr = RawObject::ToAddr(raw_obj); 522 uword raw_addr = RawObject::ToAddr(raw_obj);
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
625 PeerTable::iterator it = peer_table_.find(raw_obj); 626 PeerTable::iterator it = peer_table_.find(raw_obj);
626 return (it == peer_table_.end()) ? NULL : it->second; 627 return (it == peer_table_.end()) ? NULL : it->second;
627 } 628 }
628 629
629 630
630 int64_t Scavenger::PeerCount() const { 631 int64_t Scavenger::PeerCount() const {
631 return static_cast<int64_t>(peer_table_.size()); 632 return static_cast<int64_t>(peer_table_.size());
632 } 633 }
633 634
634 } // namespace dart 635 } // namespace dart
OLDNEW
« vm/object_test.cc ('K') | « vm/object_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698