OLD | NEW |
1 // Copyright 2017 the V8 project authors. All rights reserved. | 1 // Copyright 2017 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 #include "src/heap/concurrent-marking.h" | 5 #include "src/heap/concurrent-marking.h" |
6 | 6 |
7 #include <stack> | 7 #include <stack> |
8 #include <unordered_map> | 8 #include <unordered_map> |
9 | 9 |
10 #include "src/heap/concurrent-marking-deque.h" | 10 #include "src/heap/concurrent-marking-deque.h" |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 base::NoBarrier_Load(reinterpret_cast<const base::AtomicWord*>(p))); | 186 base::NoBarrier_Load(reinterpret_cast<const base::AtomicWord*>(p))); |
187 slot_snapshot_->add(p, object); | 187 slot_snapshot_->add(p, object); |
188 } | 188 } |
189 } | 189 } |
190 | 190 |
191 private: | 191 private: |
192 SlotSnapshot* slot_snapshot_; | 192 SlotSnapshot* slot_snapshot_; |
193 }; | 193 }; |
194 | 194 |
195 const SlotSnapshot& MakeSlotSnapshot(Map* map, HeapObject* object, int size) { | 195 const SlotSnapshot& MakeSlotSnapshot(Map* map, HeapObject* object, int size) { |
| 196 // TODO(ulan): Iterate only the existing fields and skip slack at the end |
| 197 // of the object. |
196 SlotSnapshottingVisitor visitor(&slot_snapshot_); | 198 SlotSnapshottingVisitor visitor(&slot_snapshot_); |
197 visitor.VisitPointer(object, | 199 visitor.VisitPointer(object, |
198 reinterpret_cast<Object**>(object->map_slot())); | 200 reinterpret_cast<Object**>(object->map_slot())); |
199 JSObject::BodyDescriptor::IterateBody(object, size, &visitor); | 201 JSObject::BodyDescriptor::IterateBody(object, size, &visitor); |
200 return slot_snapshot_; | 202 return slot_snapshot_; |
201 } | 203 } |
202 | 204 |
203 MarkingState marking_state(HeapObject* object) const { | 205 MarkingState marking_state(HeapObject* object) const { |
204 return MarkingState::Internal(object); | 206 return MarkingState::Internal(object); |
205 } | 207 } |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 } | 280 } |
279 | 281 |
280 void ConcurrentMarking::EnsureTaskCompleted() { | 282 void ConcurrentMarking::EnsureTaskCompleted() { |
281 if (IsTaskPending()) { | 283 if (IsTaskPending()) { |
282 WaitForTaskToComplete(); | 284 WaitForTaskToComplete(); |
283 } | 285 } |
284 } | 286 } |
285 | 287 |
286 } // namespace internal | 288 } // namespace internal |
287 } // namespace v8 | 289 } // namespace v8 |
OLD | NEW |