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

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

Issue 1490753003: Revert of [heap] Cleanup mark bit usage. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years 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 | « src/heap/mark-compact.h ('k') | src/heap/spaces.cc » ('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/heap/mark-compact.h" 5 #include "src/heap/mark-compact.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/base/sys-info.h" 9 #include "src/base/sys-info.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 1399 matching lines...) Expand 10 before | Expand all | Expand 10 after
1410 1410
1411 typedef StringTableCleaner<false> InternalizedStringTableCleaner; 1411 typedef StringTableCleaner<false> InternalizedStringTableCleaner;
1412 typedef StringTableCleaner<true> ExternalStringTableCleaner; 1412 typedef StringTableCleaner<true> ExternalStringTableCleaner;
1413 1413
1414 1414
1415 // Implementation of WeakObjectRetainer for mark compact GCs. All marked objects 1415 // Implementation of WeakObjectRetainer for mark compact GCs. All marked objects
1416 // are retained. 1416 // are retained.
1417 class MarkCompactWeakObjectRetainer : public WeakObjectRetainer { 1417 class MarkCompactWeakObjectRetainer : public WeakObjectRetainer {
1418 public: 1418 public:
1419 virtual Object* RetainAs(Object* object) { 1419 virtual Object* RetainAs(Object* object) {
1420 MarkBit mark_bit = Marking::MarkBitFrom(HeapObject::cast(object)); 1420 if (Marking::IsBlackOrGrey(
1421 DCHECK(!Marking::IsGrey(mark_bit)); 1421 Marking::MarkBitFrom(HeapObject::cast(object)))) {
1422 if (Marking::IsBlack(mark_bit)) {
1423 return object; 1422 return object;
1424 } else if (object->IsAllocationSite() && 1423 } else if (object->IsAllocationSite() &&
1425 !(AllocationSite::cast(object)->IsZombie())) { 1424 !(AllocationSite::cast(object)->IsZombie())) {
1426 // "dead" AllocationSites need to live long enough for a traversal of new 1425 // "dead" AllocationSites need to live long enough for a traversal of new
1427 // space. These sites get a one-time reprieve. 1426 // space. These sites get a one-time reprieve.
1428 AllocationSite* site = AllocationSite::cast(object); 1427 AllocationSite* site = AllocationSite::cast(object);
1429 site->MarkZombie(); 1428 site->MarkZombie();
1430 site->GetHeap()->mark_compact_collector()->MarkAllocationSite(site); 1429 site->GetHeap()->mark_compact_collector()->MarkAllocationSite(site);
1431 return object; 1430 return object;
1432 } else { 1431 } else {
(...skipping 888 matching lines...) Expand 10 before | Expand all | Expand 10 after
2321 } 2320 }
2322 2321
2323 2322
2324 void MarkCompactCollector::ClearNonLiveMapTransitions(Map* map) { 2323 void MarkCompactCollector::ClearNonLiveMapTransitions(Map* map) {
2325 Object* potential_parent = map->GetBackPointer(); 2324 Object* potential_parent = map->GetBackPointer();
2326 if (!potential_parent->IsMap()) return; 2325 if (!potential_parent->IsMap()) return;
2327 Map* parent = Map::cast(potential_parent); 2326 Map* parent = Map::cast(potential_parent);
2328 2327
2329 // Follow back pointer, check whether we are dealing with a map transition 2328 // Follow back pointer, check whether we are dealing with a map transition
2330 // from a live map to a dead path and in case clear transitions of parent. 2329 // from a live map to a dead path and in case clear transitions of parent.
2331 DCHECK(!Marking::IsGrey(Marking::MarkBitFrom(map))); 2330 DCHECK(!Marking::IsBlackOrGrey(Marking::MarkBitFrom(map)));
2332 bool parent_is_alive = Marking::IsBlack(Marking::MarkBitFrom(parent)); 2331 bool parent_is_alive = Marking::IsBlackOrGrey(Marking::MarkBitFrom(parent));
2333 if (parent_is_alive) { 2332 if (parent_is_alive) {
2334 ClearMapTransitions(parent, map); 2333 ClearMapTransitions(parent, map);
2335 } 2334 }
2336 } 2335 }
2337 2336
2338 2337
2339 // Clear a possible back pointer in case the transition leads to a dead map. 2338 // Clear a possible back pointer in case the transition leads to a dead map.
2340 // Return true in case a back pointer has been cleared and false otherwise. 2339 // Return true in case a back pointer has been cleared and false otherwise.
2341 bool MarkCompactCollector::ClearMapBackPointer(Map* target) { 2340 bool MarkCompactCollector::ClearMapBackPointer(Map* target) {
2342 DCHECK(!Marking::IsGrey(Marking::MarkBitFrom(target))); 2341 if (Marking::IsBlackOrGrey(Marking::MarkBitFrom(target))) return false;
2343 if (Marking::IsBlack(Marking::MarkBitFrom(target))) return false;
2344 target->SetBackPointer(heap_->undefined_value(), SKIP_WRITE_BARRIER); 2342 target->SetBackPointer(heap_->undefined_value(), SKIP_WRITE_BARRIER);
2345 return true; 2343 return true;
2346 } 2344 }
2347 2345
2348 2346
2349 void MarkCompactCollector::ClearMapTransitions(Map* map, Map* dead_transition) { 2347 void MarkCompactCollector::ClearMapTransitions(Map* map, Map* dead_transition) {
2350 Object* transitions = map->raw_transitions(); 2348 Object* transitions = map->raw_transitions();
2351 int num_transitions = TransitionArray::NumberOfTransitions(transitions); 2349 int num_transitions = TransitionArray::NumberOfTransitions(transitions);
2352 2350
2353 int number_of_own_descriptors = map->NumberOfOwnDescriptors(); 2351 int number_of_own_descriptors = map->NumberOfOwnDescriptors();
(...skipping 1770 matching lines...) Expand 10 before | Expand all | Expand 10 after
4124 MarkBit mark_bit = Marking::MarkBitFrom(host); 4122 MarkBit mark_bit = Marking::MarkBitFrom(host);
4125 if (Marking::IsBlack(mark_bit)) { 4123 if (Marking::IsBlack(mark_bit)) {
4126 RelocInfo rinfo(pc, RelocInfo::CODE_TARGET, 0, host); 4124 RelocInfo rinfo(pc, RelocInfo::CODE_TARGET, 0, host);
4127 RecordRelocSlot(&rinfo, target); 4125 RecordRelocSlot(&rinfo, target);
4128 } 4126 }
4129 } 4127 }
4130 } 4128 }
4131 4129
4132 } // namespace internal 4130 } // namespace internal
4133 } // namespace v8 4131 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/mark-compact.h ('k') | src/heap/spaces.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698