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

Unified Diff: src/heap/mark-compact.cc

Issue 1157943003: Replace ad-hoc weakness in transition array with WeakCell. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Remove redundant dchecks Created 5 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
« no previous file with comments | « no previous file | src/heap/objects-visiting.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/mark-compact.cc
diff --git a/src/heap/mark-compact.cc b/src/heap/mark-compact.cc
index 90fc13616c65f750b974ce58ff821742603486f8..7ee78083ce049b7ecfb3ac6c37684f489c853cf0 100644
--- a/src/heap/mark-compact.cc
+++ b/src/heap/mark-compact.cc
@@ -2468,25 +2468,39 @@ void MarkCompactCollector::ClearMapTransitions(Map* map, Map* dead_transition) {
int transition_index = 0;
- bool descriptors_owner_died = false;
+ // This flag will be cleared if we find the live owner in the loop below.
+ bool descriptors_owner_died = true;
// Compact all live descriptors to the left.
- for (int i = 0; i < num_transitions; ++i) {
- Map* target = TransitionArray::GetTarget(transitions, i);
- if (ClearMapBackPointer(target)) {
- if (target->instance_descriptors() == descriptors) {
- descriptors_owner_died = true;
+ if (TransitionArray::IsFullTransitionArray(transitions)) {
+ for (int i = 0; i < num_transitions; ++i) {
+ WeakCell* target_cell =
+ TransitionArray::cast(transitions)->GetTargetCell(i);
+ if (!target_cell->cleared()) {
+ if (Map::cast(target_cell->value())->instance_descriptors() ==
+ descriptors) {
+ descriptors_owner_died = false;
+ }
+ if (i != transition_index) {
+ TransitionArray* t = TransitionArray::cast(transitions);
+ Name* key = t->GetKey(i);
+ t->SetKey(transition_index, key);
+ Object** key_slot = t->GetKeySlot(transition_index);
+ RecordSlot(key_slot, key_slot, key);
+ WeakCell* target_cell = t->GetTargetCell(i);
brucedawson 2015/06/20 00:08:03 This variable declaration shadows the target_cell
+ t->SetTargetCell(transition_index, target_cell);
+ Object** target_slot = t->GetTargetSlot(transition_index);
+ RecordSlot(target_slot, target_slot, target_cell);
+ }
+ transition_index++;
}
- } else {
- if (i != transition_index) {
- DCHECK(TransitionArray::IsFullTransitionArray(transitions));
- TransitionArray* t = TransitionArray::cast(transitions);
- Name* key = t->GetKey(i);
- t->SetKey(transition_index, key);
- Object** key_slot = t->GetKeySlot(transition_index);
- RecordSlot(key_slot, key_slot, key);
- // Target slots do not need to be recorded since maps are not compacted.
- t->SetTarget(transition_index, t->GetTarget(i));
+ }
+ } else if (transitions->IsWeakCell()) {
+ WeakCell* target_cell = WeakCell::cast(transitions);
+ if (!target_cell->cleared()) {
+ if (Map::cast(target_cell->value())->instance_descriptors() ==
+ descriptors) {
+ descriptors_owner_died = false;
}
transition_index++;
}
« no previous file with comments | « no previous file | src/heap/objects-visiting.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698