| 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 19 matching lines...) Expand all Loading... |
| 30 explicit ConcurrentMarkingVisitor(ConcurrentMarkingDeque* deque) | 30 explicit ConcurrentMarkingVisitor(ConcurrentMarkingDeque* deque) |
| 31 : deque_(deque) {} | 31 : deque_(deque) {} |
| 32 | 32 |
| 33 bool ShouldVisit(HeapObject* object) override { | 33 bool ShouldVisit(HeapObject* object) override { |
| 34 return ObjectMarking::GreyToBlack<MarkBit::AccessMode::ATOMIC>( | 34 return ObjectMarking::GreyToBlack<MarkBit::AccessMode::ATOMIC>( |
| 35 object, marking_state(object)); | 35 object, marking_state(object)); |
| 36 } | 36 } |
| 37 | 37 |
| 38 void VisitPointers(HeapObject* host, Object** start, Object** end) override { | 38 void VisitPointers(HeapObject* host, Object** start, Object** end) override { |
| 39 for (Object** p = start; p < end; p++) { | 39 for (Object** p = start; p < end; p++) { |
| 40 if (!(*p)->IsHeapObject()) continue; | 40 Object* object = reinterpret_cast<Object*>( |
| 41 MarkObject(HeapObject::cast(*p)); | 41 base::NoBarrier_Load(reinterpret_cast<const base::AtomicWord*>(p))); |
| 42 if (!object->IsHeapObject()) continue; |
| 43 MarkObject(HeapObject::cast(object)); |
| 42 } | 44 } |
| 43 } | 45 } |
| 44 | 46 |
| 45 // =========================================================================== | 47 // =========================================================================== |
| 46 // JS object ================================================================= | 48 // JS object ================================================================= |
| 47 // =========================================================================== | 49 // =========================================================================== |
| 48 | 50 |
| 49 int VisitJSObject(Map* map, JSObject* object) override { | 51 int VisitJSObject(Map* map, JSObject* object) override { |
| 50 // TODO(ulan): impement snapshot iteration. | 52 // TODO(ulan): impement snapshot iteration. |
| 51 return BaseClass::VisitJSObject(map, object); | 53 return BaseClass::VisitJSObject(map, object); |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 } | 214 } |
| 213 | 215 |
| 214 void ConcurrentMarking::EnsureTaskCompleted() { | 216 void ConcurrentMarking::EnsureTaskCompleted() { |
| 215 if (IsTaskPending()) { | 217 if (IsTaskPending()) { |
| 216 WaitForTaskToComplete(); | 218 WaitForTaskToComplete(); |
| 217 } | 219 } |
| 218 } | 220 } |
| 219 | 221 |
| 220 } // namespace internal | 222 } // namespace internal |
| 221 } // namespace v8 | 223 } // namespace v8 |
| OLD | NEW |