| 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 3647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3658 EvacuationScope evacuation_scope(this); | 3658 EvacuationScope evacuation_scope(this); |
| 3659 | 3659 |
| 3660 EvacuateNewSpacePrologue(); | 3660 EvacuateNewSpacePrologue(); |
| 3661 EvacuatePagesInParallel(); | 3661 EvacuatePagesInParallel(); |
| 3662 EvacuateNewSpaceEpilogue(); | 3662 EvacuateNewSpaceEpilogue(); |
| 3663 heap()->new_space()->set_age_mark(heap()->new_space()->top()); | 3663 heap()->new_space()->set_age_mark(heap()->new_space()->top()); |
| 3664 } | 3664 } |
| 3665 | 3665 |
| 3666 UpdatePointersAfterEvacuation(); | 3666 UpdatePointersAfterEvacuation(); |
| 3667 | 3667 |
| 3668 // Give pages that are queued to be freed back to the OS. Note that filtering |
| 3669 // slots only handles old space (for unboxed doubles), and thus map space can |
| 3670 // still contain stale pointers. We only free the chunks after pointer updates |
| 3671 // to still have access to page headers. |
| 3672 heap()->FreeQueuedChunks(); |
| 3673 |
| 3668 { | 3674 { |
| 3669 GCTracer::Scope gc_scope(heap()->tracer(), | 3675 GCTracer::Scope gc_scope(heap()->tracer(), |
| 3670 GCTracer::Scope::MC_EVACUATE_CLEAN_UP); | 3676 GCTracer::Scope::MC_EVACUATE_CLEAN_UP); |
| 3671 // After updating all pointers, we can finally sweep the aborted pages, | 3677 // After updating all pointers, we can finally sweep the aborted pages, |
| 3672 // effectively overriding any forward pointers. | 3678 // effectively overriding any forward pointers. |
| 3673 SweepAbortedPages(); | 3679 SweepAbortedPages(); |
| 3674 | 3680 |
| 3675 // EvacuateNewSpaceAndCandidates iterates over new space objects and for | 3681 // EvacuateNewSpaceAndCandidates iterates over new space objects and for |
| 3676 // ArrayBuffers either re-registers them as live or promotes them. This is | 3682 // ArrayBuffers either re-registers them as live or promotes them. This is |
| 3677 // needed to properly free them. | 3683 // needed to properly free them. |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3972 StartSweepSpace(heap()->map_space()); | 3978 StartSweepSpace(heap()->map_space()); |
| 3973 } | 3979 } |
| 3974 if (FLAG_concurrent_sweeping) { | 3980 if (FLAG_concurrent_sweeping) { |
| 3975 StartSweeperThreads(); | 3981 StartSweeperThreads(); |
| 3976 } | 3982 } |
| 3977 } | 3983 } |
| 3978 | 3984 |
| 3979 // Deallocate unmarked large objects. | 3985 // Deallocate unmarked large objects. |
| 3980 heap_->lo_space()->FreeUnmarkedObjects(); | 3986 heap_->lo_space()->FreeUnmarkedObjects(); |
| 3981 | 3987 |
| 3982 // Give pages that are queued to be freed back to the OS. Invalid store | |
| 3983 // buffer entries are already filter out. We can just release the memory. | |
| 3984 heap()->FreeQueuedChunks(); | |
| 3985 | |
| 3986 if (FLAG_print_cumulative_gc_stat) { | 3988 if (FLAG_print_cumulative_gc_stat) { |
| 3987 heap_->tracer()->AddSweepingTime(heap_->MonotonicallyIncreasingTimeInMs() - | 3989 heap_->tracer()->AddSweepingTime(heap_->MonotonicallyIncreasingTimeInMs() - |
| 3988 start_time); | 3990 start_time); |
| 3989 } | 3991 } |
| 3990 } | 3992 } |
| 3991 | 3993 |
| 3992 | 3994 |
| 3993 void MarkCompactCollector::ParallelSweepSpacesComplete() { | 3995 void MarkCompactCollector::ParallelSweepSpacesComplete() { |
| 3994 sweeping_list(heap()->old_space()).clear(); | 3996 sweeping_list(heap()->old_space()).clear(); |
| 3995 sweeping_list(heap()->code_space()).clear(); | 3997 sweeping_list(heap()->code_space()).clear(); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4064 MarkBit mark_bit = Marking::MarkBitFrom(host); | 4066 MarkBit mark_bit = Marking::MarkBitFrom(host); |
| 4065 if (Marking::IsBlack(mark_bit)) { | 4067 if (Marking::IsBlack(mark_bit)) { |
| 4066 RelocInfo rinfo(isolate(), pc, RelocInfo::CODE_TARGET, 0, host); | 4068 RelocInfo rinfo(isolate(), pc, RelocInfo::CODE_TARGET, 0, host); |
| 4067 RecordRelocSlot(&rinfo, target); | 4069 RecordRelocSlot(&rinfo, target); |
| 4068 } | 4070 } |
| 4069 } | 4071 } |
| 4070 } | 4072 } |
| 4071 | 4073 |
| 4072 } // namespace internal | 4074 } // namespace internal |
| 4073 } // namespace v8 | 4075 } // namespace v8 |
| OLD | NEW |