Chromium Code Reviews| 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) { | |
|
Michael Lippautz
2015/08/14 12:44:36
Suggestion: We could return the status of the oper
Michael Starzinger
2015/08/14 13:23:13
Acknowledged. Would you be fine with doing this as
Michael Lippautz
2015/08/14 13:26:46
Sure.
| |
| 27 if (marking_deque_.PushBlack(obj)) { | |
| 28 MemoryChunk::IncrementLiveBytesFromGC(obj, obj->Size()); | |
| 29 } else { | |
| 30 Marking::BlackToGrey(obj); | |
| 31 } | |
| 32 } | |
| 33 | |
| 34 | |
| 26 void MarkCompactCollector::MarkObject(HeapObject* obj, MarkBit mark_bit) { | 35 void MarkCompactCollector::MarkObject(HeapObject* obj, MarkBit mark_bit) { |
| 27 DCHECK(Marking::MarkBitFrom(obj) == mark_bit); | 36 DCHECK(Marking::MarkBitFrom(obj) == mark_bit); |
| 28 if (Marking::IsWhite(mark_bit)) { | 37 if (Marking::IsWhite(mark_bit)) { |
| 29 Marking::WhiteToBlack(mark_bit); | 38 Marking::WhiteToBlack(mark_bit); |
| 30 MemoryChunk::IncrementLiveBytesFromGC(obj, obj->Size()); | |
| 31 DCHECK(obj->GetIsolate()->heap()->Contains(obj)); | 39 DCHECK(obj->GetIsolate()->heap()->Contains(obj)); |
| 32 marking_deque_.PushBlack(obj); | 40 PushBlack(obj); |
| 33 } | 41 } |
| 34 } | 42 } |
| 35 | 43 |
| 36 | 44 |
| 37 void MarkCompactCollector::SetMark(HeapObject* obj, MarkBit mark_bit) { | 45 void MarkCompactCollector::SetMark(HeapObject* obj, MarkBit mark_bit) { |
| 38 DCHECK(Marking::IsWhite(mark_bit)); | 46 DCHECK(Marking::IsWhite(mark_bit)); |
| 39 DCHECK(Marking::MarkBitFrom(obj) == mark_bit); | 47 DCHECK(Marking::MarkBitFrom(obj) == mark_bit); |
| 40 Marking::WhiteToBlack(mark_bit); | 48 Marking::WhiteToBlack(mark_bit); |
| 41 MemoryChunk::IncrementLiveBytesFromGC(obj, obj->Size()); | 49 MemoryChunk::IncrementLiveBytesFromGC(obj, obj->Size()); |
| 42 } | 50 } |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 146 | 154 |
| 147 void CodeFlusher::ClearNextCodeMap(SharedFunctionInfo* holder) { | 155 void CodeFlusher::ClearNextCodeMap(SharedFunctionInfo* holder) { |
| 148 FixedArray* code_map = FixedArray::cast(holder->optimized_code_map()); | 156 FixedArray* code_map = FixedArray::cast(holder->optimized_code_map()); |
| 149 code_map->set_undefined(SharedFunctionInfo::kNextMapIndex); | 157 code_map->set_undefined(SharedFunctionInfo::kNextMapIndex); |
| 150 } | 158 } |
| 151 | 159 |
| 152 } // namespace internal | 160 } // namespace internal |
| 153 } // namespace v8 | 161 } // namespace v8 |
| 154 | 162 |
| 155 #endif // V8_HEAP_MARK_COMPACT_INL_H_ | 163 #endif // V8_HEAP_MARK_COMPACT_INL_H_ |
| OLD | NEW |