Commit b2a6f6e0 authored by Omer Katz's avatar Omer Katz Committed by Commit Bot

heap: Prevent allocations during atomic pause marking

Allocations during the atomic pause were never supported.
Enforcing it using scopes helps debugging issues were this
invariant is violated.

Bug: 986235, 993415
Change-Id: I5fd8ecd147403e2a7a89185b55057550d135bac2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1869225
Commit-Queue: Omer Katz <omerkatz@chromium.org>
Reviewed-by: default avatarMichael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#707760}
parent e31461de
...@@ -657,6 +657,7 @@ void ThreadState::AtomicPauseMarkPrologue(BlinkGC::StackState stack_state, ...@@ -657,6 +657,7 @@ void ThreadState::AtomicPauseMarkPrologue(BlinkGC::StackState stack_state,
ThreadHeapStatsCollector::kAtomicPauseMarkPrologue, "epoch", gc_age_, ThreadHeapStatsCollector::kAtomicPauseMarkPrologue, "epoch", gc_age_,
"forced", IsForcedGC(reason)); "forced", IsForcedGC(reason));
EnterAtomicPause(); EnterAtomicPause();
EnterNoAllocationScope();
EnterGCForbiddenScope(); EnterGCForbiddenScope();
// Compaction needs to be canceled when incremental marking ends with a // Compaction needs to be canceled when incremental marking ends with a
// conservative GC. // conservative GC.
...@@ -1268,8 +1269,9 @@ void ThreadState::AtomicPauseMarkEpilogue(BlinkGC::MarkingType marking_type) { ...@@ -1268,8 +1269,9 @@ void ThreadState::AtomicPauseMarkEpilogue(BlinkGC::MarkingType marking_type) {
ThreadHeapStatsCollector::kAtomicPauseMarkEpilogue, "epoch", gc_age_, ThreadHeapStatsCollector::kAtomicPauseMarkEpilogue, "epoch", gc_age_,
"forced", IsForcedGC(current_gc_data_.reason)); "forced", IsForcedGC(current_gc_data_.reason));
MarkPhaseEpilogue(marking_type); MarkPhaseEpilogue(marking_type);
LeaveAtomicPause();
LeaveGCForbiddenScope(); LeaveGCForbiddenScope();
LeaveNoAllocationScope();
LeaveAtomicPause();
static_cast<MutexBase&>(ProcessHeap::CrossThreadPersistentMutex()).unlock(); static_cast<MutexBase&>(ProcessHeap::CrossThreadPersistentMutex()).unlock();
} }
......
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