OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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_PAGE_PARALLEL_JOB_ | 5 #ifndef V8_HEAP_PAGE_PARALLEL_JOB_ |
6 #define V8_HEAP_PAGE_PARALLEL_JOB_ | 6 #define V8_HEAP_PAGE_PARALLEL_JOB_ |
7 | 7 |
8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
9 #include "src/cancelable-task.h" | 9 #include "src/cancelable-task.h" |
10 #include "src/utils.h" | 10 #include "src/utils.h" |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 while (item != nullptr) { | 113 while (item != nullptr) { |
114 bool success = (item->state.Value() == kFinished); | 114 bool success = (item->state.Value() == kFinished); |
115 JobTraits::FinalizePageSequentially(heap_, item->chunk, success, | 115 JobTraits::FinalizePageSequentially(heap_, item->chunk, success, |
116 item->data); | 116 item->data); |
117 item = item->next; | 117 item = item->next; |
118 } | 118 } |
119 } | 119 } |
120 } | 120 } |
121 | 121 |
122 private: | 122 private: |
123 static const int kMaxNumberOfTasks = 10; | 123 static const int kMaxNumberOfTasks = 32; |
124 | 124 |
125 enum ProcessingState { kAvailable, kProcessing, kFinished, kFailed }; | 125 enum ProcessingState { kAvailable, kProcessing, kFinished, kFailed }; |
126 | 126 |
127 struct Item : public Malloced { | 127 struct Item : public Malloced { |
128 Item(MemoryChunk* chunk, typename JobTraits::PerPageData data, Item* next) | 128 Item(MemoryChunk* chunk, typename JobTraits::PerPageData data, Item* next) |
129 : chunk(chunk), state(kAvailable), data(data), next(next) {} | 129 : chunk(chunk), state(kAvailable), data(data), next(next) {} |
130 MemoryChunk* chunk; | 130 MemoryChunk* chunk; |
131 base::AtomicValue<ProcessingState> state; | 131 base::AtomicValue<ProcessingState> state; |
132 typename JobTraits::PerPageData data; | 132 typename JobTraits::PerPageData data; |
133 Item* next; | 133 Item* next; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 int num_items_; | 186 int num_items_; |
187 int num_tasks_; | 187 int num_tasks_; |
188 base::Semaphore* pending_tasks_; | 188 base::Semaphore* pending_tasks_; |
189 DISALLOW_COPY_AND_ASSIGN(PageParallelJob); | 189 DISALLOW_COPY_AND_ASSIGN(PageParallelJob); |
190 }; | 190 }; |
191 | 191 |
192 } // namespace internal | 192 } // namespace internal |
193 } // namespace v8 | 193 } // namespace v8 |
194 | 194 |
195 #endif // V8_HEAP_PAGE_PARALLEL_JOB_ | 195 #endif // V8_HEAP_PAGE_PARALLEL_JOB_ |
OLD | NEW |