| 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) { |
| 27 if (marking_deque_.PushBlack(obj)) { |
| 28 MemoryChunk::IncrementLiveBytesFromGC(obj, obj->Size()); |
| 29 } else { |
| 30 Marking::BlackToGrey(obj); |
| 31 } |
| 32 } |
| 33 |
| 34 |
| 35 void MarkCompactCollector::UnshiftBlack(HeapObject* obj) { |
| 36 if (!marking_deque_.UnshiftBlack(obj)) { |
| 37 MemoryChunk::IncrementLiveBytesFromGC(obj, -obj->Size()); |
| 38 Marking::BlackToGrey(obj); |
| 39 } |
| 40 } |
| 41 |
| 42 |
| 26 void MarkCompactCollector::MarkObject(HeapObject* obj, MarkBit mark_bit) { | 43 void MarkCompactCollector::MarkObject(HeapObject* obj, MarkBit mark_bit) { |
| 27 DCHECK(Marking::MarkBitFrom(obj) == mark_bit); | 44 DCHECK(Marking::MarkBitFrom(obj) == mark_bit); |
| 28 if (Marking::IsWhite(mark_bit)) { | 45 if (Marking::IsWhite(mark_bit)) { |
| 29 Marking::WhiteToBlack(mark_bit); | 46 Marking::WhiteToBlack(mark_bit); |
| 30 MemoryChunk::IncrementLiveBytesFromGC(obj, obj->Size()); | |
| 31 DCHECK(obj->GetIsolate()->heap()->Contains(obj)); | 47 DCHECK(obj->GetIsolate()->heap()->Contains(obj)); |
| 32 marking_deque_.PushBlack(obj); | 48 PushBlack(obj); |
| 33 } | 49 } |
| 34 } | 50 } |
| 35 | 51 |
| 36 | 52 |
| 37 void MarkCompactCollector::SetMark(HeapObject* obj, MarkBit mark_bit) { | 53 void MarkCompactCollector::SetMark(HeapObject* obj, MarkBit mark_bit) { |
| 38 DCHECK(Marking::IsWhite(mark_bit)); | 54 DCHECK(Marking::IsWhite(mark_bit)); |
| 39 DCHECK(Marking::MarkBitFrom(obj) == mark_bit); | 55 DCHECK(Marking::MarkBitFrom(obj) == mark_bit); |
| 40 Marking::WhiteToBlack(mark_bit); | 56 Marking::WhiteToBlack(mark_bit); |
| 41 MemoryChunk::IncrementLiveBytesFromGC(obj, obj->Size()); | 57 MemoryChunk::IncrementLiveBytesFromGC(obj, obj->Size()); |
| 42 } | 58 } |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 | 162 |
| 147 void CodeFlusher::ClearNextCodeMap(SharedFunctionInfo* holder) { | 163 void CodeFlusher::ClearNextCodeMap(SharedFunctionInfo* holder) { |
| 148 FixedArray* code_map = FixedArray::cast(holder->optimized_code_map()); | 164 FixedArray* code_map = FixedArray::cast(holder->optimized_code_map()); |
| 149 code_map->set_undefined(SharedFunctionInfo::kNextMapIndex); | 165 code_map->set_undefined(SharedFunctionInfo::kNextMapIndex); |
| 150 } | 166 } |
| 151 | 167 |
| 152 } // namespace internal | 168 } // namespace internal |
| 153 } // namespace v8 | 169 } // namespace v8 |
| 154 | 170 |
| 155 #endif // V8_HEAP_MARK_COMPACT_INL_H_ | 171 #endif // V8_HEAP_MARK_COMPACT_INL_H_ |
| OLD | NEW |