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/heap/remembered-set.h" | 9 #include "src/heap/remembered-set.h" |
10 #include "src/isolate.h" | 10 #include "src/isolate.h" |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 void CodeFlusher::SetNextCandidate(SharedFunctionInfo* candidate, | 120 void CodeFlusher::SetNextCandidate(SharedFunctionInfo* candidate, |
121 SharedFunctionInfo* next_candidate) { | 121 SharedFunctionInfo* next_candidate) { |
122 candidate->code()->set_gc_metadata(next_candidate); | 122 candidate->code()->set_gc_metadata(next_candidate); |
123 } | 123 } |
124 | 124 |
125 | 125 |
126 void CodeFlusher::ClearNextCandidate(SharedFunctionInfo* candidate) { | 126 void CodeFlusher::ClearNextCandidate(SharedFunctionInfo* candidate) { |
127 candidate->code()->set_gc_metadata(NULL, SKIP_WRITE_BARRIER); | 127 candidate->code()->set_gc_metadata(NULL, SKIP_WRITE_BARRIER); |
128 } | 128 } |
129 | 129 |
| 130 void CodeFlusher::VisitListHeads(RootVisitor* visitor) { |
| 131 visitor->VisitRootPointer( |
| 132 Root::kCodeFlusher, |
| 133 reinterpret_cast<Object**>(&jsfunction_candidates_head_)); |
| 134 visitor->VisitRootPointer( |
| 135 Root::kCodeFlusher, |
| 136 reinterpret_cast<Object**>(&shared_function_info_candidates_head_)); |
| 137 } |
| 138 |
| 139 template <typename StaticVisitor> |
| 140 void CodeFlusher::IteratePointersToFromSpace() { |
| 141 Heap* heap = isolate_->heap(); |
| 142 JSFunction* candidate = jsfunction_candidates_head_; |
| 143 while (candidate != nullptr) { |
| 144 JSFunction** slot = GetNextCandidateSlot(candidate); |
| 145 if (heap->InFromSpace(*slot)) { |
| 146 StaticVisitor::VisitPointer(heap, candidate, |
| 147 reinterpret_cast<Object**>(slot)); |
| 148 } |
| 149 candidate = GetNextCandidate(candidate); |
| 150 } |
| 151 } |
130 | 152 |
131 template <LiveObjectIterationMode T> | 153 template <LiveObjectIterationMode T> |
132 HeapObject* LiveObjectIterator<T>::Next() { | 154 HeapObject* LiveObjectIterator<T>::Next() { |
133 Map* one_word_filler = heap()->one_pointer_filler_map(); | 155 Map* one_word_filler = heap()->one_pointer_filler_map(); |
134 Map* two_word_filler = heap()->two_pointer_filler_map(); | 156 Map* two_word_filler = heap()->two_pointer_filler_map(); |
135 Map* free_space_map = heap()->free_space_map(); | 157 Map* free_space_map = heap()->free_space_map(); |
136 while (!it_.Done()) { | 158 while (!it_.Done()) { |
137 HeapObject* object = nullptr; | 159 HeapObject* object = nullptr; |
138 while (current_cell_ != 0) { | 160 while (current_cell_ != 0) { |
139 uint32_t trailing_zeros = base::bits::CountTrailingZeros32(current_cell_); | 161 uint32_t trailing_zeros = base::bits::CountTrailingZeros32(current_cell_); |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 } | 252 } |
231 if (object != nullptr) return object; | 253 if (object != nullptr) return object; |
232 } | 254 } |
233 return nullptr; | 255 return nullptr; |
234 } | 256 } |
235 | 257 |
236 } // namespace internal | 258 } // namespace internal |
237 } // namespace v8 | 259 } // namespace v8 |
238 | 260 |
239 #endif // V8_HEAP_MARK_COMPACT_INL_H_ | 261 #endif // V8_HEAP_MARK_COMPACT_INL_H_ |
OLD | NEW |