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 {
inline Isolate* isolate() { return heap()->isolate(); }
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.
virtual void MarkLiveObjects() = 0;
......@@ -266,9 +267,6 @@ class MarkCompactCollectorBase {
virtual void EvacuatePagesInParallel() = 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>
void CreateAndExecuteEvacuationTasks(
Collector* collector, PageParallelJob<EvacuationJobTraits>* job,
......@@ -279,13 +277,17 @@ class MarkCompactCollectorBase {
bool ShouldMovePage(Page* p, intptr_t live_bytes);
template <RememberedSetType type>
void UpdatePointersInParallel(Heap* heap, base::Semaphore* semaphore,
const MarkCompactCollectorBase* collector);
void UpdatePointersInParallel(base::Semaphore* semaphore);
void UpdateToSpacePointersInParallel(base::Semaphore* semaphore);
int NumberOfParallelCompactionTasks(int pages);
int NumberOfPointerUpdateTasks(int pages);
int NumberOfParallelPointerUpdateTasks(int pages, int slots);
int NumberOfParallelToSpacePointerUpdateTasks(int pages);
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.
......@@ -314,7 +316,7 @@ class MinorMarkCompactCollector final : public MarkCompactCollectorBase {
class RootMarkingVisitorSeedOnly;
class RootMarkingVisitor;
static const int kNumMarkers = 4;
static const int kNumMarkers = 8;
static const int kMainMarker = 0;
inline WorkStealingMarkingDeque* marking_deque() { return marking_deque_; }
......@@ -335,7 +337,7 @@ class MinorMarkCompactCollector final : public MarkCompactCollectorBase {
void EvacuatePagesInParallel() override;
void UpdatePointersAfterEvacuation() override;
int NumberOfMarkingTasks();
int NumberOfParallelMarkingTasks(int pages);
WorkStealingMarkingDeque* marking_deque_;
YoungGenerationMarkingVisitor* main_marking_visitor_;
......
......@@ -115,7 +115,7 @@ class SegmentedStack {
// TODO(mlippautz): Implement actual work stealing.
class WorkStealingMarkingDeque {
public:
static const int kMaxNumTasks = 4;
static const int kMaxNumTasks = 8;
bool Push(int task_id, HeapObject* object) {
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