OLD | NEW |
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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 // ------------------------------------------------------------------------- | 46 // ------------------------------------------------------------------------- |
47 // MarkCompactCollector | 47 // MarkCompactCollector |
48 | 48 |
49 MarkCompactCollector::MarkCompactCollector(Heap* heap) | 49 MarkCompactCollector::MarkCompactCollector(Heap* heap) |
50 : // NOLINT | 50 : // NOLINT |
51 heap_(heap), | 51 heap_(heap), |
52 page_parallel_job_semaphore_(0), | 52 page_parallel_job_semaphore_(0), |
53 #ifdef DEBUG | 53 #ifdef DEBUG |
54 state_(IDLE), | 54 state_(IDLE), |
55 #endif | 55 #endif |
56 marking_parity_(ODD_MARKING_PARITY), | |
57 was_marked_incrementally_(false), | 56 was_marked_incrementally_(false), |
58 evacuation_(false), | 57 evacuation_(false), |
59 compacting_(false), | 58 compacting_(false), |
60 black_allocation_(false), | 59 black_allocation_(false), |
61 have_code_to_deoptimize_(false), | 60 have_code_to_deoptimize_(false), |
62 marking_deque_(heap), | 61 marking_deque_(heap), |
63 code_flusher_(nullptr), | 62 code_flusher_(nullptr), |
64 sweeper_(heap) { | 63 sweeper_(heap) { |
65 } | 64 } |
66 | 65 |
(...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
865 isolate()->load_stub_cache()->Clear(); | 864 isolate()->load_stub_cache()->Clear(); |
866 isolate()->store_stub_cache()->Clear(); | 865 isolate()->store_stub_cache()->Clear(); |
867 | 866 |
868 if (have_code_to_deoptimize_) { | 867 if (have_code_to_deoptimize_) { |
869 // Some code objects were marked for deoptimization during the GC. | 868 // Some code objects were marked for deoptimization during the GC. |
870 Deoptimizer::DeoptimizeMarkedCode(isolate()); | 869 Deoptimizer::DeoptimizeMarkedCode(isolate()); |
871 have_code_to_deoptimize_ = false; | 870 have_code_to_deoptimize_ = false; |
872 } | 871 } |
873 | 872 |
874 heap_->incremental_marking()->ClearIdleMarkingDelayCounter(); | 873 heap_->incremental_marking()->ClearIdleMarkingDelayCounter(); |
875 | |
876 if (marking_parity_ == EVEN_MARKING_PARITY) { | |
877 marking_parity_ = ODD_MARKING_PARITY; | |
878 } else { | |
879 DCHECK(marking_parity_ == ODD_MARKING_PARITY); | |
880 marking_parity_ = EVEN_MARKING_PARITY; | |
881 } | |
882 } | 874 } |
883 | 875 |
884 | 876 |
885 // ------------------------------------------------------------------------- | 877 // ------------------------------------------------------------------------- |
886 // Phase 1: tracing and marking live objects. | 878 // Phase 1: tracing and marking live objects. |
887 // before: all objects are in normal state. | 879 // before: all objects are in normal state. |
888 // after: a live object's map pointer is marked as '00'. | 880 // after: a live object's map pointer is marked as '00'. |
889 | 881 |
890 // Marking all live objects in the heap as part of mark-sweep or mark-compact | 882 // Marking all live objects in the heap as part of mark-sweep or mark-compact |
891 // collection. Before marking, all objects are in their normal state. After | 883 // collection. Before marking, all objects are in their normal state. After |
(...skipping 3196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4088 // The target is always in old space, we don't have to record the slot in | 4080 // The target is always in old space, we don't have to record the slot in |
4089 // the old-to-new remembered set. | 4081 // the old-to-new remembered set. |
4090 DCHECK(!heap()->InNewSpace(target)); | 4082 DCHECK(!heap()->InNewSpace(target)); |
4091 RecordRelocSlot(host, &rinfo, target); | 4083 RecordRelocSlot(host, &rinfo, target); |
4092 } | 4084 } |
4093 } | 4085 } |
4094 } | 4086 } |
4095 | 4087 |
4096 } // namespace internal | 4088 } // namespace internal |
4097 } // namespace v8 | 4089 } // namespace v8 |
OLD | NEW |