| 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 1990 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2001 } | 2001 } |
| 2002 ref_groups->Rewind(last); | 2002 ref_groups->Rewind(last); |
| 2003 } | 2003 } |
| 2004 | 2004 |
| 2005 | 2005 |
| 2006 // Mark all objects reachable from the objects on the marking stack. | 2006 // Mark all objects reachable from the objects on the marking stack. |
| 2007 // Before: the marking stack contains zero or more heap object pointers. | 2007 // Before: the marking stack contains zero or more heap object pointers. |
| 2008 // After: the marking stack is empty, and all objects reachable from the | 2008 // After: the marking stack is empty, and all objects reachable from the |
| 2009 // marking stack have been marked, or are overflowed in the heap. | 2009 // marking stack have been marked, or are overflowed in the heap. |
| 2010 void MarkCompactCollector::EmptyMarkingDeque() { | 2010 void MarkCompactCollector::EmptyMarkingDeque() { |
| 2011 Map* filler_map = heap_->one_pointer_filler_map(); | |
| 2012 while (!marking_deque_.IsEmpty()) { | 2011 while (!marking_deque_.IsEmpty()) { |
| 2013 HeapObject* object = marking_deque_.Pop(); | 2012 HeapObject* object = marking_deque_.Pop(); |
| 2014 // Explicitly skip one word fillers. Incremental markbit patterns are | |
| 2015 // correct only for objects that occupy at least two words. | |
| 2016 Map* map = object->map(); | |
| 2017 if (map == filler_map) continue; | |
| 2018 | 2013 |
| 2014 DCHECK(!object->IsFiller()); |
| 2019 DCHECK(object->IsHeapObject()); | 2015 DCHECK(object->IsHeapObject()); |
| 2020 DCHECK(heap()->Contains(object)); | 2016 DCHECK(heap()->Contains(object)); |
| 2021 DCHECK(!Marking::IsWhite(ObjectMarking::MarkBitFrom(object))); | 2017 DCHECK(!Marking::IsWhite(ObjectMarking::MarkBitFrom(object))); |
| 2022 | 2018 |
| 2019 Map* map = object->map(); |
| 2023 MarkBit map_mark = ObjectMarking::MarkBitFrom(map); | 2020 MarkBit map_mark = ObjectMarking::MarkBitFrom(map); |
| 2024 MarkObject(map, map_mark); | 2021 MarkObject(map, map_mark); |
| 2025 | 2022 |
| 2026 MarkCompactMarkingVisitor::IterateBody(map, object); | 2023 MarkCompactMarkingVisitor::IterateBody(map, object); |
| 2027 } | 2024 } |
| 2028 } | 2025 } |
| 2029 | 2026 |
| 2030 | 2027 |
| 2031 // Sweep the heap for overflowed objects, clear their overflow bits, and | 2028 // Sweep the heap for overflowed objects, clear their overflow bits, and |
| 2032 // push them on the marking stack. Stop early if the marking stack fills | 2029 // push them on the marking stack. Stop early if the marking stack fills |
| (...skipping 2008 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4041 // The target is always in old space, we don't have to record the slot in | 4038 // The target is always in old space, we don't have to record the slot in |
| 4042 // the old-to-new remembered set. | 4039 // the old-to-new remembered set. |
| 4043 DCHECK(!heap()->InNewSpace(target)); | 4040 DCHECK(!heap()->InNewSpace(target)); |
| 4044 RecordRelocSlot(host, &rinfo, target); | 4041 RecordRelocSlot(host, &rinfo, target); |
| 4045 } | 4042 } |
| 4046 } | 4043 } |
| 4047 } | 4044 } |
| 4048 | 4045 |
| 4049 } // namespace internal | 4046 } // namespace internal |
| 4050 } // namespace v8 | 4047 } // namespace v8 |
| OLD | NEW |