Commit bce2a50d authored by Michael Lippautz's avatar Michael Lippautz Committed by Commit Bot

[heap] Unify computation of parallel tasks

- Create getters for number of tasks for all parallel stages
- Count slots for the minor MC and limit tasks by the overall number of slots.
- Cleanup existing getters.

Bug: chromium:651354
Change-Id: I9f67cca4474cbe1800faff4a549fbec019b096ce
Reviewed-on: https://chromium-review.googlesource.com/512862
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Reviewed-by: 's avatarHannes Payer <hpayer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#45513}
parent a8421ddd
This diff is collapsed.
...@@ -250,7 +250,8 @@ class MarkCompactCollectorBase { ...@@ -250,7 +250,8 @@ class MarkCompactCollectorBase {
inline Isolate* isolate() { return heap()->isolate(); } inline Isolate* isolate() { return heap()->isolate(); }
protected: protected:
explicit MarkCompactCollectorBase(Heap* heap) : heap_(heap) {} explicit MarkCompactCollectorBase(Heap* heap)
: heap_(heap), old_to_new_slots_(0) {}
// Marking operations for objects reachable from roots. // Marking operations for objects reachable from roots.
virtual void MarkLiveObjects() = 0; virtual void MarkLiveObjects() = 0;
...@@ -266,9 +267,6 @@ class MarkCompactCollectorBase { ...@@ -266,9 +267,6 @@ class MarkCompactCollectorBase {
virtual void EvacuatePagesInParallel() = 0; virtual void EvacuatePagesInParallel() = 0;
virtual void UpdatePointersAfterEvacuation() = 0; virtual void UpdatePointersAfterEvacuation() = 0;
// The number of parallel compaction tasks, including the main thread.
int NumberOfParallelCompactionTasks(int pages, intptr_t live_bytes);
template <class Evacuator, class Collector> template <class Evacuator, class Collector>
void CreateAndExecuteEvacuationTasks( void CreateAndExecuteEvacuationTasks(
Collector* collector, PageParallelJob<EvacuationJobTraits>* job, Collector* collector, PageParallelJob<EvacuationJobTraits>* job,
...@@ -279,13 +277,17 @@ class MarkCompactCollectorBase { ...@@ -279,13 +277,17 @@ class MarkCompactCollectorBase {
bool ShouldMovePage(Page* p, intptr_t live_bytes); bool ShouldMovePage(Page* p, intptr_t live_bytes);
template <RememberedSetType type> template <RememberedSetType type>
void UpdatePointersInParallel(Heap* heap, base::Semaphore* semaphore, void UpdatePointersInParallel(base::Semaphore* semaphore);
const MarkCompactCollectorBase* collector); void UpdateToSpacePointersInParallel(base::Semaphore* semaphore);
int NumberOfParallelCompactionTasks(int pages); int NumberOfParallelCompactionTasks(int pages);
int NumberOfPointerUpdateTasks(int pages); int NumberOfParallelPointerUpdateTasks(int pages, int slots);
int NumberOfParallelToSpacePointerUpdateTasks(int pages);
Heap* heap_; Heap* heap_;
// Number of old to new slots. Should be computed during MarkLiveObjects.
// -1 indicates that the value couldn't be computed.
int old_to_new_slots_;
}; };
// Collector for young-generation only. // Collector for young-generation only.
...@@ -314,7 +316,7 @@ class MinorMarkCompactCollector final : public MarkCompactCollectorBase { ...@@ -314,7 +316,7 @@ class MinorMarkCompactCollector final : public MarkCompactCollectorBase {
class RootMarkingVisitorSeedOnly; class RootMarkingVisitorSeedOnly;
class RootMarkingVisitor; class RootMarkingVisitor;
static const int kNumMarkers = 4; static const int kNumMarkers = 8;
static const int kMainMarker = 0; static const int kMainMarker = 0;
inline WorkStealingMarkingDeque* marking_deque() { return marking_deque_; } inline WorkStealingMarkingDeque* marking_deque() { return marking_deque_; }
...@@ -335,7 +337,7 @@ class MinorMarkCompactCollector final : public MarkCompactCollectorBase { ...@@ -335,7 +337,7 @@ class MinorMarkCompactCollector final : public MarkCompactCollectorBase {
void EvacuatePagesInParallel() override; void EvacuatePagesInParallel() override;
void UpdatePointersAfterEvacuation() override; void UpdatePointersAfterEvacuation() override;
int NumberOfMarkingTasks(); int NumberOfParallelMarkingTasks(int pages);
WorkStealingMarkingDeque* marking_deque_; WorkStealingMarkingDeque* marking_deque_;
YoungGenerationMarkingVisitor* main_marking_visitor_; YoungGenerationMarkingVisitor* main_marking_visitor_;
......
...@@ -115,7 +115,7 @@ class SegmentedStack { ...@@ -115,7 +115,7 @@ class SegmentedStack {
// TODO(mlippautz): Implement actual work stealing. // TODO(mlippautz): Implement actual work stealing.
class WorkStealingMarkingDeque { class WorkStealingMarkingDeque {
public: public:
static const int kMaxNumTasks = 4; static const int kMaxNumTasks = 8;
bool Push(int task_id, HeapObject* object) { bool Push(int task_id, HeapObject* object) {
DCHECK_LT(task_id, kMaxNumTasks); DCHECK_LT(task_id, kMaxNumTasks);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment