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() {
store_buffer_ = new StoreBuffer(this);
mark_compact_collector_ = new MarkCompactCollector(this);
incremental_marking_ = new IncrementalMarking(this);
for (int i = 0; i <= LAST_SPACE; i++) {
......@@ -5952,7 +5953,6 @@ bool Heap::SetUp() {
}
tracer_ = new GCTracer(this);
mark_compact_collector_ = new MarkCompactCollector(this);
incremental_marking_->set_marking_worklist(
mark_compact_collector_->marking_worklist());
if (FLAG_concurrent_marking) {
......
......@@ -465,7 +465,7 @@ MarkCompactCollector::MarkCompactCollector(Heap* heap)
black_allocation_(false),
have_code_to_deoptimize_(false),
marking_worklist_(heap),
sweeper_(heap) {
sweeper_(heap, non_atomic_marking_state()) {
old_to_new_slots_ = -1;
}
......@@ -2111,12 +2111,11 @@ class YoungGenerationMarkingVisitor final
: public NewSpaceVisitor<YoungGenerationMarkingVisitor> {
public:
YoungGenerationMarkingVisitor(
Heap* heap, MinorMarkCompactCollector::MarkingWorklist* global_worklist,
int task_id)
Heap* heap, MinorMarkCompactCollector::MarkingState* marking_state,
MinorMarkCompactCollector::MarkingWorklist* global_worklist, int task_id)
: heap_(heap),
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,
Object** end) final {
......@@ -2199,7 +2198,7 @@ class YoungGenerationMarkingTask : public ItemParallelJob::Task {
collector_(collector),
marking_worklist_(global_worklist, task_id),
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() /
Page::kPageSize);
}
......@@ -2384,8 +2383,8 @@ class GlobalHandlesMarkingItem : public MarkingItem {
MinorMarkCompactCollector::MinorMarkCompactCollector(Heap* heap)
: MarkCompactCollectorBase(heap),
worklist_(new MinorMarkCompactCollector::MarkingWorklist()),
main_marking_visitor_(
new YoungGenerationMarkingVisitor(heap, worklist_, kMainMarker)),
main_marking_visitor_(new YoungGenerationMarkingVisitor(
heap, marking_state(), worklist_, kMainMarker)),
page_parallel_job_semaphore_(0) {
static_assert(
kNumMarkers <= MinorMarkCompactCollector::MarkingWorklist::kMaxNumTasks,
......
......@@ -611,10 +611,10 @@ class MarkCompactCollector final : public MarkCompactCollectorBase {
int RawSweep(Page* p, FreeListRebuildingMode free_list_mode,
FreeSpaceTreatmentMode free_space_mode);
explicit Sweeper(Heap* heap)
explicit Sweeper(Heap* heap,
MarkCompactCollector::NonAtomicMarkingState* marking_state)
: heap_(heap),
marking_state_(
heap->mark_compact_collector()->non_atomic_marking_state()),
marking_state_(marking_state),
num_tasks_(0),
pending_sweeper_tasks_semaphore_(0),
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