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

[heap] Simplify PageParallelJob

Remove FinalizePageSequentially as it had only a single use case that
was tied to the full collector.

Bug: chromium:651354
Change-Id: I03299ddbd439ea273e02dd33f12c005371694130
Reviewed-on: https://chromium-review.googlesource.com/504508Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#45280}
parent dd9ac62c
This diff is collapsed.
...@@ -322,8 +322,7 @@ class MarkCompactCollectorBase { ...@@ -322,8 +322,7 @@ class MarkCompactCollectorBase {
void CreateAndExecuteEvacuationTasks( void CreateAndExecuteEvacuationTasks(
Collector* collector, PageParallelJob<EvacuationJobTraits>* job, Collector* collector, PageParallelJob<EvacuationJobTraits>* job,
RecordMigratedSlotVisitor* record_visitor, RecordMigratedSlotVisitor* record_visitor,
MigrationObserver* migration_observer, const intptr_t live_bytes, MigrationObserver* migration_observer, const intptr_t live_bytes);
const int& abandoned_pages);
// Returns whether this page should be moved according to heuristics. // Returns whether this page should be moved according to heuristics.
bool ShouldMovePage(Page* p, intptr_t live_bytes); bool ShouldMovePage(Page* p, intptr_t live_bytes);
...@@ -695,6 +694,7 @@ class MarkCompactCollector final : public MarkCompactCollectorBase { ...@@ -695,6 +694,7 @@ class MarkCompactCollector final : public MarkCompactCollectorBase {
void UpdatePointersAfterEvacuation() override; void UpdatePointersAfterEvacuation() override;
void ReleaseEvacuationCandidates(); void ReleaseEvacuationCandidates();
void PostProcessEvacuationCandidates();
base::Semaphore page_parallel_job_semaphore_; base::Semaphore page_parallel_job_semaphore_;
......
...@@ -20,16 +20,10 @@ class Isolate; ...@@ -20,16 +20,10 @@ class Isolate;
// The JobTraits class needs to define: // The JobTraits class needs to define:
// - PerPageData type - state associated with each page. // - PerPageData type - state associated with each page.
// - PerTaskData type - state associated with each task. // - PerTaskData type - state associated with each task.
// - static bool ProcessPageInParallel(Heap* heap, // - static void ProcessPageInParallel(Heap* heap,
// PerTaskData task_data, // PerTaskData task_data,
// MemoryChunk* page, // MemoryChunk* page,
// PerPageData page_data) // PerPageData page_data)
// The function should return true iff processing succeeded.
// - static const bool NeedSequentialFinalization
// - static void FinalizePageSequentially(Heap* heap,
// bool processing_succeeded,
// MemoryChunk* page,
// PerPageData page_data)
template <typename JobTraits> template <typename JobTraits>
class PageParallelJob { class PageParallelJob {
public: public:
...@@ -108,21 +102,12 @@ class PageParallelJob { ...@@ -108,21 +102,12 @@ class PageParallelJob {
pending_tasks_->Wait(); pending_tasks_->Wait();
} }
} }
if (JobTraits::NeedSequentialFinalization) {
Item* item = items_;
while (item != nullptr) {
bool success = (item->state.Value() == kFinished);
JobTraits::FinalizePageSequentially(heap_, item->chunk, success,
item->data);
item = item->next;
}
}
} }
private: private:
static const int kMaxNumberOfTasks = 32; static const int kMaxNumberOfTasks = 32;
enum ProcessingState { kAvailable, kProcessing, kFinished, kFailed }; enum ProcessingState { kAvailable, kProcessing, kFinished };
struct Item : public Malloced { struct Item : public Malloced {
Item(MemoryChunk* chunk, typename JobTraits::PerPageData data, Item* next) Item(MemoryChunk* chunk, typename JobTraits::PerPageData data, Item* next)
...@@ -158,9 +143,9 @@ class PageParallelJob { ...@@ -158,9 +143,9 @@ class PageParallelJob {
} }
for (int i = 0; i < num_items_; i++) { for (int i = 0; i < num_items_; i++) {
if (current->state.TrySetValue(kAvailable, kProcessing)) { if (current->state.TrySetValue(kAvailable, kProcessing)) {
bool success = JobTraits::ProcessPageInParallel( JobTraits::ProcessPageInParallel(heap_, data_, current->chunk,
heap_, data_, current->chunk, current->data); current->data);
current->state.SetValue(success ? kFinished : kFailed); current->state.SetValue(kFinished);
} }
current = current->next; current = current->next;
// Wrap around if needed. // Wrap around if needed.
......
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