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

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

Issue 1480873003: Introduce instance type for transition arrays. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix zapping 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/object-stats.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 813 matching lines...) Expand 10 before | Expand all | Expand 10 after
824 // If concurrent unmapping tasks are still running, we should wait for 824 // If concurrent unmapping tasks are still running, we should wait for
825 // them here. 825 // them here.
826 heap()->WaitUntilUnmappingOfFreeChunksCompleted(); 826 heap()->WaitUntilUnmappingOfFreeChunksCompleted();
827 827
828 // Clear marking bits if incremental marking is aborted. 828 // Clear marking bits if incremental marking is aborted.
829 if (was_marked_incrementally_ && heap_->ShouldAbortIncrementalMarking()) { 829 if (was_marked_incrementally_ && heap_->ShouldAbortIncrementalMarking()) {
830 heap()->incremental_marking()->Stop(); 830 heap()->incremental_marking()->Stop();
831 ClearMarkbits(); 831 ClearMarkbits();
832 AbortWeakCollections(); 832 AbortWeakCollections();
833 AbortWeakCells(); 833 AbortWeakCells();
834 AbortTransitionArrays();
834 AbortCompaction(); 835 AbortCompaction();
835 was_marked_incrementally_ = false; 836 was_marked_incrementally_ = false;
836 } 837 }
837 838
838 // Don't start compaction if we are in the middle of incremental 839 // Don't start compaction if we are in the middle of incremental
839 // marking cycle. We did not collect any slots. 840 // marking cycle. We did not collect any slots.
840 if (!FLAG_never_compact && !was_marked_incrementally_) { 841 if (!FLAG_never_compact && !was_marked_incrementally_) {
841 StartCompaction(NON_INCREMENTAL_COMPACTION); 842 StartCompaction(NON_INCREMENTAL_COMPACTION);
842 } 843 }
843 844
(...skipping 1478 matching lines...) Expand 10 before | Expand all | Expand 10 after
2322 // Process weak cells before MarkCodeForDeoptimization and 2323 // Process weak cells before MarkCodeForDeoptimization and
2323 // ClearNonLiveReferences so that weak cells in dependent code arrays are 2324 // ClearNonLiveReferences so that weak cells in dependent code arrays are
2324 // cleared or contain only live code objects. 2325 // cleared or contain only live code objects.
2325 ProcessAndClearWeakCells(); 2326 ProcessAndClearWeakCells();
2326 2327
2327 MarkDependentCodeListForDeoptimization(dependent_code_list); 2328 MarkDependentCodeListForDeoptimization(dependent_code_list);
2328 2329
2329 ClearNonLiveReferences(); 2330 ClearNonLiveReferences();
2330 2331
2331 ClearWeakCollections(); 2332 ClearWeakCollections();
2332
2333 heap_->set_encountered_weak_cells(Smi::FromInt(0));
2334 } 2333 }
2335 2334
2336 2335
2337 void MarkCompactCollector::ClearNonLiveReferences() { 2336 void MarkCompactCollector::ClearNonLiveReferences() {
2338 GCTracer::Scope gc_scope(heap()->tracer(), 2337 GCTracer::Scope gc_scope(heap()->tracer(),
2339 GCTracer::Scope::MC_NONLIVEREFERENCES); 2338 GCTracer::Scope::MC_NONLIVEREFERENCES);
2339
2340 ProcessAndClearTransitionArrays();
2341
2340 // Iterate over the map space, setting map transitions that go from 2342 // Iterate over the map space, setting map transitions that go from
2341 // a marked map to an unmarked map to null transitions. This action 2343 // a marked map to an unmarked map to null transitions. This action
2342 // is carried out only on maps of JSObjects and related subtypes. 2344 // is carried out only on maps of JSObjects and related subtypes.
2343 HeapObjectIterator map_iterator(heap()->map_space()); 2345 HeapObjectIterator map_iterator(heap()->map_space());
2344 for (HeapObject* obj = map_iterator.Next(); obj != NULL; 2346 for (HeapObject* obj = map_iterator.Next(); obj != NULL;
2345 obj = map_iterator.Next()) { 2347 obj = map_iterator.Next()) {
2346 Map* map = Map::cast(obj); 2348 Map* map = Map::cast(obj);
2347 if (!map->CanTransition()) continue; 2349 if (!map->CanTransition()) continue;
2348 MarkBit map_mark = Marking::MarkBitFrom(map); 2350 MarkBit map_mark = Marking::MarkBitFrom(map);
2349 if (Marking::IsWhite(map_mark)) { 2351 if (Marking::IsWhite(map_mark)) {
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
2648 Object* weak_cell_obj = heap()->encountered_weak_cells(); 2650 Object* weak_cell_obj = heap()->encountered_weak_cells();
2649 while (weak_cell_obj != Smi::FromInt(0)) { 2651 while (weak_cell_obj != Smi::FromInt(0)) {
2650 WeakCell* weak_cell = reinterpret_cast<WeakCell*>(weak_cell_obj); 2652 WeakCell* weak_cell = reinterpret_cast<WeakCell*>(weak_cell_obj);
2651 weak_cell_obj = weak_cell->next(); 2653 weak_cell_obj = weak_cell->next();
2652 weak_cell->clear_next(heap()); 2654 weak_cell->clear_next(heap());
2653 } 2655 }
2654 heap()->set_encountered_weak_cells(Smi::FromInt(0)); 2656 heap()->set_encountered_weak_cells(Smi::FromInt(0));
2655 } 2657 }
2656 2658
2657 2659
2660 void MarkCompactCollector::ProcessAndClearTransitionArrays() {
2661 HeapObject* undefined = heap()->undefined_value();
2662 Object* obj = heap()->encountered_transition_arrays();
2663 while (obj != Smi::FromInt(0)) {
2664 TransitionArray* array = TransitionArray::cast(obj);
2665 // TODO(ulan): move logic from ClearMapTransitions here.
2666 obj = array->next_link();
2667 array->set_next_link(undefined, SKIP_WRITE_BARRIER);
2668 }
2669 heap()->set_encountered_transition_arrays(Smi::FromInt(0));
2670 }
2671
2672
2673 void MarkCompactCollector::AbortTransitionArrays() {
2674 HeapObject* undefined = heap()->undefined_value();
2675 Object* obj = heap()->encountered_transition_arrays();
2676 while (obj != Smi::FromInt(0)) {
2677 TransitionArray* array = TransitionArray::cast(obj);
2678 obj = array->next_link();
2679 array->set_next_link(undefined, SKIP_WRITE_BARRIER);
2680 }
2681 heap()->set_encountered_transition_arrays(Smi::FromInt(0));
2682 }
2683
2684
2658 void MarkCompactCollector::RecordMigratedSlot( 2685 void MarkCompactCollector::RecordMigratedSlot(
2659 Object* value, Address slot, SlotsBuffer** evacuation_slots_buffer) { 2686 Object* value, Address slot, SlotsBuffer** evacuation_slots_buffer) {
2660 // When parallel compaction is in progress, store and slots buffer entries 2687 // When parallel compaction is in progress, store and slots buffer entries
2661 // require synchronization. 2688 // require synchronization.
2662 if (heap_->InNewSpace(value)) { 2689 if (heap_->InNewSpace(value)) {
2663 if (compaction_in_progress_) { 2690 if (compaction_in_progress_) {
2664 heap_->store_buffer()->MarkSynchronized(slot); 2691 heap_->store_buffer()->MarkSynchronized(slot);
2665 } else { 2692 } else {
2666 heap_->store_buffer()->Mark(slot); 2693 heap_->store_buffer()->Mark(slot);
2667 } 2694 }
(...skipping 1500 matching lines...) Expand 10 before | Expand all | Expand 10 after
4168 MarkBit mark_bit = Marking::MarkBitFrom(host); 4195 MarkBit mark_bit = Marking::MarkBitFrom(host);
4169 if (Marking::IsBlack(mark_bit)) { 4196 if (Marking::IsBlack(mark_bit)) {
4170 RelocInfo rinfo(isolate(), pc, RelocInfo::CODE_TARGET, 0, host); 4197 RelocInfo rinfo(isolate(), pc, RelocInfo::CODE_TARGET, 0, host);
4171 RecordRelocSlot(&rinfo, target); 4198 RecordRelocSlot(&rinfo, target);
4172 } 4199 }
4173 } 4200 }
4174 } 4201 }
4175 4202
4176 } // namespace internal 4203 } // namespace internal
4177 } // namespace v8 4204 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/mark-compact.h ('k') | src/heap/object-stats.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698