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 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 } | 48 } |
49 | 49 |
50 | 50 |
51 bool MarkCompactCollector::IsMarked(Object* obj) { | 51 bool MarkCompactCollector::IsMarked(Object* obj) { |
52 DCHECK(obj->IsHeapObject()); | 52 DCHECK(obj->IsHeapObject()); |
53 HeapObject* heap_object = HeapObject::cast(obj); | 53 HeapObject* heap_object = HeapObject::cast(obj); |
54 return Marking::IsBlackOrGrey(Marking::MarkBitFrom(heap_object)); | 54 return Marking::IsBlackOrGrey(Marking::MarkBitFrom(heap_object)); |
55 } | 55 } |
56 | 56 |
57 | 57 |
58 void MarkCompactCollector::RecordSlot(HeapObject* object, Object** slot, | |
59 Object* target, | |
60 SlotsBuffer::AdditionMode mode) { | |
61 Page* target_page = Page::FromAddress(reinterpret_cast<Address>(target)); | |
62 if (target_page->IsEvacuationCandidate() && | |
63 !ShouldSkipEvacuationSlotRecording(object)) { | |
64 if (!SlotsBuffer::AddTo(&slots_buffer_allocator_, | |
65 target_page->slots_buffer_address(), slot, mode)) { | |
66 EvictPopularEvacuationCandidate(target_page); | |
67 } | |
68 } | |
69 } | |
70 | |
71 | |
72 void CodeFlusher::AddCandidate(SharedFunctionInfo* shared_info) { | 58 void CodeFlusher::AddCandidate(SharedFunctionInfo* shared_info) { |
73 if (GetNextCandidate(shared_info) == NULL) { | 59 if (GetNextCandidate(shared_info) == NULL) { |
74 SetNextCandidate(shared_info, shared_function_info_candidates_head_); | 60 SetNextCandidate(shared_info, shared_function_info_candidates_head_); |
75 shared_function_info_candidates_head_ = shared_info; | 61 shared_function_info_candidates_head_ = shared_info; |
76 } | 62 } |
77 } | 63 } |
78 | 64 |
79 | 65 |
80 void CodeFlusher::AddCandidate(JSFunction* function) { | 66 void CodeFlusher::AddCandidate(JSFunction* function) { |
81 DCHECK(function->code() == function->shared()->code()); | 67 DCHECK(function->code() == function->shared()->code()); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 | 138 |
153 void CodeFlusher::ClearNextCodeMap(SharedFunctionInfo* holder) { | 139 void CodeFlusher::ClearNextCodeMap(SharedFunctionInfo* holder) { |
154 FixedArray* code_map = FixedArray::cast(holder->optimized_code_map()); | 140 FixedArray* code_map = FixedArray::cast(holder->optimized_code_map()); |
155 code_map->set_undefined(SharedFunctionInfo::kNextMapIndex); | 141 code_map->set_undefined(SharedFunctionInfo::kNextMapIndex); |
156 } | 142 } |
157 | 143 |
158 } // namespace internal | 144 } // namespace internal |
159 } // namespace v8 | 145 } // namespace v8 |
160 | 146 |
161 #endif // V8_HEAP_MARK_COMPACT_INL_H_ | 147 #endif // V8_HEAP_MARK_COMPACT_INL_H_ |
OLD | NEW |