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

Side by Side Diff: src/heap/mark-compact.cc

Issue 1194673002: Revert of Replace ad-hoc weakness in transition array with WeakCell. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « no previous file | src/heap/objects-visiting.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/base/atomicops.h" 7 #include "src/base/atomicops.h"
8 #include "src/base/bits.h" 8 #include "src/base/bits.h"
9 #include "src/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/compilation-cache.h" 10 #include "src/compilation-cache.h"
(...skipping 2450 matching lines...) Expand 10 before | Expand all | Expand 10 after
2461 descriptors == dead_transition->instance_descriptors() && 2461 descriptors == dead_transition->instance_descriptors() &&
2462 number_of_own_descriptors > 0) { 2462 number_of_own_descriptors > 0) {
2463 TrimDescriptorArray(map, descriptors, number_of_own_descriptors); 2463 TrimDescriptorArray(map, descriptors, number_of_own_descriptors);
2464 DCHECK(descriptors->number_of_descriptors() == number_of_own_descriptors); 2464 DCHECK(descriptors->number_of_descriptors() == number_of_own_descriptors);
2465 map->set_owns_descriptors(true); 2465 map->set_owns_descriptors(true);
2466 return; 2466 return;
2467 } 2467 }
2468 2468
2469 int transition_index = 0; 2469 int transition_index = 0;
2470 2470
2471 // This flag will be cleared if we find the live owner in the loop below. 2471 bool descriptors_owner_died = false;
2472 bool descriptors_owner_died = true;
2473 2472
2474 // Compact all live descriptors to the left. 2473 // Compact all live descriptors to the left.
2475 if (TransitionArray::IsFullTransitionArray(transitions)) { 2474 for (int i = 0; i < num_transitions; ++i) {
2476 for (int i = 0; i < num_transitions; ++i) { 2475 Map* target = TransitionArray::GetTarget(transitions, i);
2477 WeakCell* target_cell = 2476 if (ClearMapBackPointer(target)) {
2478 TransitionArray::cast(transitions)->GetTargetCell(i); 2477 if (target->instance_descriptors() == descriptors) {
2479 if (!target_cell->cleared()) { 2478 descriptors_owner_died = true;
2480 if (Map::cast(target_cell->value())->instance_descriptors() ==
2481 descriptors) {
2482 descriptors_owner_died = false;
2483 }
2484 if (i != transition_index) {
2485 TransitionArray* t = TransitionArray::cast(transitions);
2486 Name* key = t->GetKey(i);
2487 t->SetKey(transition_index, key);
2488 Object** key_slot = t->GetKeySlot(transition_index);
2489 RecordSlot(key_slot, key_slot, key);
2490 WeakCell* target_cell = t->GetTargetCell(i);
2491 t->SetTargetCell(transition_index, target_cell);
2492 Object** target_slot = t->GetTargetSlot(transition_index);
2493 RecordSlot(target_slot, target_slot, target_cell);
2494 }
2495 transition_index++;
2496 } 2479 }
2497 } 2480 } else {
2498 } else if (transitions->IsWeakCell()) { 2481 if (i != transition_index) {
2499 WeakCell* target_cell = WeakCell::cast(transitions); 2482 DCHECK(TransitionArray::IsFullTransitionArray(transitions));
2500 if (!target_cell->cleared()) { 2483 TransitionArray* t = TransitionArray::cast(transitions);
2501 if (Map::cast(target_cell->value())->instance_descriptors() == 2484 Name* key = t->GetKey(i);
2502 descriptors) { 2485 t->SetKey(transition_index, key);
2503 descriptors_owner_died = false; 2486 Object** key_slot = t->GetKeySlot(transition_index);
2487 RecordSlot(key_slot, key_slot, key);
2488 // Target slots do not need to be recorded since maps are not compacted.
2489 t->SetTarget(transition_index, t->GetTarget(i));
2504 } 2490 }
2505 transition_index++; 2491 transition_index++;
2506 } 2492 }
2507 } 2493 }
2508 2494
2509 // If there are no transitions to be cleared, return. 2495 // If there are no transitions to be cleared, return.
2510 // TODO(verwaest) Should be an assert, otherwise back pointers are not 2496 // TODO(verwaest) Should be an assert, otherwise back pointers are not
2511 // properly cleared. 2497 // properly cleared.
2512 if (transition_index == num_transitions) return; 2498 if (transition_index == num_transitions) return;
2513 2499
(...skipping 2236 matching lines...) Expand 10 before | Expand all | Expand 10 after
4750 SlotsBuffer* buffer = *buffer_address; 4736 SlotsBuffer* buffer = *buffer_address;
4751 while (buffer != NULL) { 4737 while (buffer != NULL) {
4752 SlotsBuffer* next_buffer = buffer->next(); 4738 SlotsBuffer* next_buffer = buffer->next();
4753 DeallocateBuffer(buffer); 4739 DeallocateBuffer(buffer);
4754 buffer = next_buffer; 4740 buffer = next_buffer;
4755 } 4741 }
4756 *buffer_address = NULL; 4742 *buffer_address = NULL;
4757 } 4743 }
4758 } // namespace internal 4744 } // namespace internal
4759 } // namespace v8 4745 } // namespace v8
OLDNEW
« 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