Commit 9f97606e authored by Ulan Degenbaev's avatar Ulan Degenbaev Committed by Commit Bot

[heap] Fix initialization order of MC collectors after 4af9cfcc.

This fixes the UBSAN failures on the bot.

Bug: chromium:694255
Change-Id: I7fc169bc526e71444ce52eba0285a8cafe9d902d
Reviewed-on: https://chromium-review.googlesource.com/612167Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Commit-Queue: Ulan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#47306}
parent 1092155c
...@@ -5914,6 +5914,7 @@ bool Heap::SetUp() { ...@@ -5914,6 +5914,7 @@ bool Heap::SetUp() {
store_buffer_ = new StoreBuffer(this); store_buffer_ = new StoreBuffer(this);
mark_compact_collector_ = new MarkCompactCollector(this);
incremental_marking_ = new IncrementalMarking(this); incremental_marking_ = new IncrementalMarking(this);
for (int i = 0; i <= LAST_SPACE; i++) { for (int i = 0; i <= LAST_SPACE; i++) {
...@@ -5952,7 +5953,6 @@ bool Heap::SetUp() { ...@@ -5952,7 +5953,6 @@ bool Heap::SetUp() {
} }
tracer_ = new GCTracer(this); tracer_ = new GCTracer(this);
mark_compact_collector_ = new MarkCompactCollector(this);
incremental_marking_->set_marking_worklist( incremental_marking_->set_marking_worklist(
mark_compact_collector_->marking_worklist()); mark_compact_collector_->marking_worklist());
if (FLAG_concurrent_marking) { if (FLAG_concurrent_marking) {
......
...@@ -465,7 +465,7 @@ MarkCompactCollector::MarkCompactCollector(Heap* heap) ...@@ -465,7 +465,7 @@ MarkCompactCollector::MarkCompactCollector(Heap* heap)
black_allocation_(false), black_allocation_(false),
have_code_to_deoptimize_(false), have_code_to_deoptimize_(false),
marking_worklist_(heap), marking_worklist_(heap),
sweeper_(heap) { sweeper_(heap, non_atomic_marking_state()) {
old_to_new_slots_ = -1; old_to_new_slots_ = -1;
} }
...@@ -2111,12 +2111,11 @@ class YoungGenerationMarkingVisitor final ...@@ -2111,12 +2111,11 @@ class YoungGenerationMarkingVisitor final
: public NewSpaceVisitor<YoungGenerationMarkingVisitor> { : public NewSpaceVisitor<YoungGenerationMarkingVisitor> {
public: public:
YoungGenerationMarkingVisitor( YoungGenerationMarkingVisitor(
Heap* heap, MinorMarkCompactCollector::MarkingWorklist* global_worklist, Heap* heap, MinorMarkCompactCollector::MarkingState* marking_state,
int task_id) MinorMarkCompactCollector::MarkingWorklist* global_worklist, int task_id)
: heap_(heap), : heap_(heap),
worklist_(global_worklist, task_id), worklist_(global_worklist, task_id),
marking_state_(heap_->minor_mark_compact_collector()->marking_state()) { marking_state_(marking_state) {}
}
V8_INLINE void VisitPointers(HeapObject* host, Object** start, V8_INLINE void VisitPointers(HeapObject* host, Object** start,
Object** end) final { Object** end) final {
...@@ -2199,7 +2198,7 @@ class YoungGenerationMarkingTask : public ItemParallelJob::Task { ...@@ -2199,7 +2198,7 @@ class YoungGenerationMarkingTask : public ItemParallelJob::Task {
collector_(collector), collector_(collector),
marking_worklist_(global_worklist, task_id), marking_worklist_(global_worklist, task_id),
marking_state_(collector->marking_state()), marking_state_(collector->marking_state()),
visitor_(isolate->heap(), global_worklist, task_id) { visitor_(isolate->heap(), marking_state_, global_worklist, task_id) {
local_live_bytes_.reserve(isolate->heap()->new_space()->Capacity() / local_live_bytes_.reserve(isolate->heap()->new_space()->Capacity() /
Page::kPageSize); Page::kPageSize);
} }
...@@ -2384,8 +2383,8 @@ class GlobalHandlesMarkingItem : public MarkingItem { ...@@ -2384,8 +2383,8 @@ class GlobalHandlesMarkingItem : public MarkingItem {
MinorMarkCompactCollector::MinorMarkCompactCollector(Heap* heap) MinorMarkCompactCollector::MinorMarkCompactCollector(Heap* heap)
: MarkCompactCollectorBase(heap), : MarkCompactCollectorBase(heap),
worklist_(new MinorMarkCompactCollector::MarkingWorklist()), worklist_(new MinorMarkCompactCollector::MarkingWorklist()),
main_marking_visitor_( main_marking_visitor_(new YoungGenerationMarkingVisitor(
new YoungGenerationMarkingVisitor(heap, worklist_, kMainMarker)), heap, marking_state(), worklist_, kMainMarker)),
page_parallel_job_semaphore_(0) { page_parallel_job_semaphore_(0) {
static_assert( static_assert(
kNumMarkers <= MinorMarkCompactCollector::MarkingWorklist::kMaxNumTasks, kNumMarkers <= MinorMarkCompactCollector::MarkingWorklist::kMaxNumTasks,
......
...@@ -611,10 +611,10 @@ class MarkCompactCollector final : public MarkCompactCollectorBase { ...@@ -611,10 +611,10 @@ class MarkCompactCollector final : public MarkCompactCollectorBase {
int RawSweep(Page* p, FreeListRebuildingMode free_list_mode, int RawSweep(Page* p, FreeListRebuildingMode free_list_mode,
FreeSpaceTreatmentMode free_space_mode); FreeSpaceTreatmentMode free_space_mode);
explicit Sweeper(Heap* heap) explicit Sweeper(Heap* heap,
MarkCompactCollector::NonAtomicMarkingState* marking_state)
: heap_(heap), : heap_(heap),
marking_state_( marking_state_(marking_state),
heap->mark_compact_collector()->non_atomic_marking_state()),
num_tasks_(0), num_tasks_(0),
pending_sweeper_tasks_semaphore_(0), pending_sweeper_tasks_semaphore_(0),
sweeping_in_progress_(false), sweeping_in_progress_(false),
......
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