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

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

Issue 1483003002: Revert of Introduce instance type for transition arrays. (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/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();
835 AbortCompaction(); 834 AbortCompaction();
836 was_marked_incrementally_ = false; 835 was_marked_incrementally_ = false;
837 } 836 }
838 837
839 // Don't start compaction if we are in the middle of incremental 838 // Don't start compaction if we are in the middle of incremental
840 // marking cycle. We did not collect any slots. 839 // marking cycle. We did not collect any slots.
841 if (!FLAG_never_compact && !was_marked_incrementally_) { 840 if (!FLAG_never_compact && !was_marked_incrementally_) {
842 StartCompaction(NON_INCREMENTAL_COMPACTION); 841 StartCompaction(NON_INCREMENTAL_COMPACTION);
843 } 842 }
844 843
(...skipping 1478 matching lines...) Expand 10 before | Expand all | Expand 10 after
2323 // Process weak cells before MarkCodeForDeoptimization and 2322 // Process weak cells before MarkCodeForDeoptimization and
2324 // ClearNonLiveReferences so that weak cells in dependent code arrays are 2323 // ClearNonLiveReferences so that weak cells in dependent code arrays are
2325 // cleared or contain only live code objects. 2324 // cleared or contain only live code objects.
2326 ProcessAndClearWeakCells(); 2325 ProcessAndClearWeakCells();
2327 2326
2328 MarkDependentCodeListForDeoptimization(dependent_code_list); 2327 MarkDependentCodeListForDeoptimization(dependent_code_list);
2329 2328
2330 ClearNonLiveReferences(); 2329 ClearNonLiveReferences();
2331 2330
2332 ClearWeakCollections(); 2331 ClearWeakCollections();
2332
2333 heap_->set_encountered_weak_cells(Smi::FromInt(0));
2333 } 2334 }
2334 2335
2335 2336
2336 void MarkCompactCollector::ClearNonLiveReferences() { 2337 void MarkCompactCollector::ClearNonLiveReferences() {
2337 GCTracer::Scope gc_scope(heap()->tracer(), 2338 GCTracer::Scope gc_scope(heap()->tracer(),
2338 GCTracer::Scope::MC_NONLIVEREFERENCES); 2339 GCTracer::Scope::MC_NONLIVEREFERENCES);
2339
2340 ProcessAndClearTransitionArrays();
2341
2342 // Iterate over the map space, setting map transitions that go from 2340 // Iterate over the map space, setting map transitions that go from
2343 // a marked map to an unmarked map to null transitions. This action 2341 // a marked map to an unmarked map to null transitions. This action
2344 // is carried out only on maps of JSObjects and related subtypes. 2342 // is carried out only on maps of JSObjects and related subtypes.
2345 HeapObjectIterator map_iterator(heap()->map_space()); 2343 HeapObjectIterator map_iterator(heap()->map_space());
2346 for (HeapObject* obj = map_iterator.Next(); obj != NULL; 2344 for (HeapObject* obj = map_iterator.Next(); obj != NULL;
2347 obj = map_iterator.Next()) { 2345 obj = map_iterator.Next()) {
2348 Map* map = Map::cast(obj); 2346 Map* map = Map::cast(obj);
2349 if (!map->CanTransition()) continue; 2347 if (!map->CanTransition()) continue;
2350 MarkBit map_mark = Marking::MarkBitFrom(map); 2348 MarkBit map_mark = Marking::MarkBitFrom(map);
2351 if (Marking::IsWhite(map_mark)) { 2349 if (Marking::IsWhite(map_mark)) {
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
2650 Object* weak_cell_obj = heap()->encountered_weak_cells(); 2648 Object* weak_cell_obj = heap()->encountered_weak_cells();
2651 while (weak_cell_obj != Smi::FromInt(0)) { 2649 while (weak_cell_obj != Smi::FromInt(0)) {
2652 WeakCell* weak_cell = reinterpret_cast<WeakCell*>(weak_cell_obj); 2650 WeakCell* weak_cell = reinterpret_cast<WeakCell*>(weak_cell_obj);
2653 weak_cell_obj = weak_cell->next(); 2651 weak_cell_obj = weak_cell->next();
2654 weak_cell->clear_next(heap()); 2652 weak_cell->clear_next(heap());
2655 } 2653 }
2656 heap()->set_encountered_weak_cells(Smi::FromInt(0)); 2654 heap()->set_encountered_weak_cells(Smi::FromInt(0));
2657 } 2655 }
2658 2656
2659 2657
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
2685 void MarkCompactCollector::RecordMigratedSlot( 2658 void MarkCompactCollector::RecordMigratedSlot(
2686 Object* value, Address slot, SlotsBuffer** evacuation_slots_buffer) { 2659 Object* value, Address slot, SlotsBuffer** evacuation_slots_buffer) {
2687 // When parallel compaction is in progress, store and slots buffer entries 2660 // When parallel compaction is in progress, store and slots buffer entries
2688 // require synchronization. 2661 // require synchronization.
2689 if (heap_->InNewSpace(value)) { 2662 if (heap_->InNewSpace(value)) {
2690 if (compaction_in_progress_) { 2663 if (compaction_in_progress_) {
2691 heap_->store_buffer()->MarkSynchronized(slot); 2664 heap_->store_buffer()->MarkSynchronized(slot);
2692 } else { 2665 } else {
2693 heap_->store_buffer()->Mark(slot); 2666 heap_->store_buffer()->Mark(slot);
2694 } 2667 }
(...skipping 1500 matching lines...) Expand 10 before | Expand all | Expand 10 after
4195 MarkBit mark_bit = Marking::MarkBitFrom(host); 4168 MarkBit mark_bit = Marking::MarkBitFrom(host);
4196 if (Marking::IsBlack(mark_bit)) { 4169 if (Marking::IsBlack(mark_bit)) {
4197 RelocInfo rinfo(isolate(), pc, RelocInfo::CODE_TARGET, 0, host); 4170 RelocInfo rinfo(isolate(), pc, RelocInfo::CODE_TARGET, 0, host);
4198 RecordRelocSlot(&rinfo, target); 4171 RecordRelocSlot(&rinfo, target);
4199 } 4172 }
4200 } 4173 }
4201 } 4174 }
4202 4175
4203 } // namespace internal 4176 } // namespace internal
4204 } // namespace v8 4177 } // 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