| 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 #ifndef V8_HEAP_MARK_COMPACT_INL_H_ | 5 #ifndef V8_HEAP_MARK_COMPACT_INL_H_ |
| 6 #define V8_HEAP_MARK_COMPACT_INL_H_ | 6 #define V8_HEAP_MARK_COMPACT_INL_H_ |
| 7 | 7 |
| 8 #include "src/heap/mark-compact.h" | 8 #include "src/heap/mark-compact.h" |
| 9 #include "src/isolate.h" | 9 #include "src/isolate.h" |
| 10 | 10 |
| 11 | 11 |
| 12 namespace v8 { | 12 namespace v8 { |
| 13 namespace internal { | 13 namespace internal { |
| 14 | 14 |
| 15 | 15 |
| 16 void MarkCompactCollector::SetFlags(int flags) { | 16 void MarkCompactCollector::SetFlags(int flags) { |
| 17 reduce_memory_footprint_ = ((flags & Heap::kReduceMemoryFootprintMask) != 0); | 17 reduce_memory_footprint_ = ((flags & Heap::kReduceMemoryFootprintMask) != 0); |
| 18 abort_incremental_marking_ = | 18 abort_incremental_marking_ = |
| 19 ((flags & Heap::kAbortIncrementalMarkingMask) != 0); | 19 ((flags & Heap::kAbortIncrementalMarkingMask) != 0); |
| 20 finalize_incremental_marking_ = | 20 finalize_incremental_marking_ = |
| 21 ((flags & Heap::kFinalizeIncrementalMarkingMask) != 0); | 21 ((flags & Heap::kFinalizeIncrementalMarkingMask) != 0); |
| 22 DCHECK(!finalize_incremental_marking_ || !abort_incremental_marking_); | 22 DCHECK(!finalize_incremental_marking_ || !abort_incremental_marking_); |
| 23 } | 23 } |
| 24 | 24 |
| 25 | 25 |
| 26 void MarkCompactCollector::PushBlack(HeapObject* obj) { | 26 void MarkCompactCollector::PushBlack(HeapObject* obj) { |
| 27 if (marking_deque_.PushBlack(obj)) { | 27 DCHECK(Marking::IsBlack(Marking::MarkBitFrom(obj))); |
| 28 if (marking_deque_.Push(obj)) { |
| 28 MemoryChunk::IncrementLiveBytesFromGC(obj, obj->Size()); | 29 MemoryChunk::IncrementLiveBytesFromGC(obj, obj->Size()); |
| 29 } else { | 30 } else { |
| 30 Marking::BlackToGrey(obj); | 31 Marking::BlackToGrey(obj); |
| 31 } | 32 } |
| 32 } | 33 } |
| 33 | 34 |
| 34 | 35 |
| 35 void MarkCompactCollector::UnshiftBlack(HeapObject* obj) { | 36 void MarkCompactCollector::UnshiftBlack(HeapObject* obj) { |
| 36 if (!marking_deque_.UnshiftBlack(obj)) { | 37 DCHECK(Marking::IsBlack(Marking::MarkBitFrom(obj))); |
| 38 if (!marking_deque_.Unshift(obj)) { |
| 37 MemoryChunk::IncrementLiveBytesFromGC(obj, -obj->Size()); | 39 MemoryChunk::IncrementLiveBytesFromGC(obj, -obj->Size()); |
| 38 Marking::BlackToGrey(obj); | 40 Marking::BlackToGrey(obj); |
| 39 } | 41 } |
| 40 } | 42 } |
| 41 | 43 |
| 42 | 44 |
| 43 void MarkCompactCollector::MarkObject(HeapObject* obj, MarkBit mark_bit) { | 45 void MarkCompactCollector::MarkObject(HeapObject* obj, MarkBit mark_bit) { |
| 44 DCHECK(Marking::MarkBitFrom(obj) == mark_bit); | 46 DCHECK(Marking::MarkBitFrom(obj) == mark_bit); |
| 45 if (Marking::IsWhite(mark_bit)) { | 47 if (Marking::IsWhite(mark_bit)) { |
| 46 Marking::WhiteToBlack(mark_bit); | 48 Marking::WhiteToBlack(mark_bit); |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 | 164 |
| 163 void CodeFlusher::ClearNextCodeMap(SharedFunctionInfo* holder) { | 165 void CodeFlusher::ClearNextCodeMap(SharedFunctionInfo* holder) { |
| 164 FixedArray* code_map = FixedArray::cast(holder->optimized_code_map()); | 166 FixedArray* code_map = FixedArray::cast(holder->optimized_code_map()); |
| 165 code_map->set_undefined(SharedFunctionInfo::kNextMapIndex); | 167 code_map->set_undefined(SharedFunctionInfo::kNextMapIndex); |
| 166 } | 168 } |
| 167 | 169 |
| 168 } // namespace internal | 170 } // namespace internal |
| 169 } // namespace v8 | 171 } // namespace v8 |
| 170 | 172 |
| 171 #endif // V8_HEAP_MARK_COMPACT_INL_H_ | 173 #endif // V8_HEAP_MARK_COMPACT_INL_H_ |
| OLD | NEW |