| 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 #ifndef V8_HEAP_CONCURRENT_MARKING_DEQUE_ | 5 #ifndef V8_HEAP_CONCURRENT_MARKING_DEQUE_ |
| 6 #define V8_HEAP_CONCURRENT_MARKING_DEQUE_ | 6 #define V8_HEAP_CONCURRENT_MARKING_DEQUE_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 | 9 |
| 10 #include "src/base/platform/mutex.h" | 10 #include "src/base/platform/mutex.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 public: | 40 public: |
| 41 // The heap parameter is needed to match the interface | 41 // The heap parameter is needed to match the interface |
| 42 // of the sequential marking deque. | 42 // of the sequential marking deque. |
| 43 explicit ConcurrentMarkingDeque(Heap* heap) {} | 43 explicit ConcurrentMarkingDeque(Heap* heap) {} |
| 44 | 44 |
| 45 // Pushes the object into the specified deque assuming that the function is | 45 // Pushes the object into the specified deque assuming that the function is |
| 46 // called on the specified thread. The main thread can push only to the shared | 46 // called on the specified thread. The main thread can push only to the shared |
| 47 // deque. The concurrent thread can push to both deques. | 47 // deque. The concurrent thread can push to both deques. |
| 48 bool Push(HeapObject* object, MarkingThread thread = MarkingThread::kMain, | 48 bool Push(HeapObject* object, MarkingThread thread = MarkingThread::kMain, |
| 49 TargetDeque target = TargetDeque::kShared) { | 49 TargetDeque target = TargetDeque::kShared) { |
| 50 DCHECK_IMPLIES(thread == MarkingThread::kMain, | |
| 51 target == TargetDeque::kShared); | |
| 52 switch (target) { | 50 switch (target) { |
| 53 case TargetDeque::kShared: | 51 case TargetDeque::kShared: |
| 54 shared_deque_.Push(object); | 52 shared_deque_.Push(object); |
| 55 break; | 53 break; |
| 56 case TargetDeque::kBailout: | 54 case TargetDeque::kBailout: |
| 57 bailout_deque_.Push(object); | 55 bailout_deque_.Push(object); |
| 58 break; | 56 break; |
| 59 } | 57 } |
| 60 return true; | 58 return true; |
| 61 } | 59 } |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 }; | 166 }; |
| 169 Deque bailout_deque_; | 167 Deque bailout_deque_; |
| 170 Deque shared_deque_; | 168 Deque shared_deque_; |
| 171 DISALLOW_COPY_AND_ASSIGN(ConcurrentMarkingDeque); | 169 DISALLOW_COPY_AND_ASSIGN(ConcurrentMarkingDeque); |
| 172 }; | 170 }; |
| 173 | 171 |
| 174 } // namespace internal | 172 } // namespace internal |
| 175 } // namespace v8 | 173 } // namespace v8 |
| 176 | 174 |
| 177 #endif // V8_CONCURRENT_MARKING_DEQUE_ | 175 #endif // V8_CONCURRENT_MARKING_DEQUE_ |
| OLD | NEW |