Commit ecc61b30 authored by Ulan Degenbaev's avatar Ulan Degenbaev Committed by Commit Bot

[heap] Add a flag for performing incremental marking on allocation

The flag is true by default and passing
--noincremental-marking-on-allocation disables starting of incremental
marking on allocation and incremental marking steps on allocation.

Change-Id: I4537e0eeaaf93fb713fcacd3860e29b98df441fc
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2154194Reviewed-by: 's avatarHannes Payer <hpayer@chromium.org>
Commit-Queue: Ulan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67228}
parent 6079966b
......@@ -892,6 +892,8 @@ DEFINE_BOOL(incremental_marking, true, "use incremental marking")
DEFINE_BOOL(incremental_marking_wrappers, true,
"use incremental marking for marking wrappers")
DEFINE_BOOL(incremental_marking_task, true, "use tasks for incremental marking")
DEFINE_BOOL(incremental_marking_on_allocation, false,
"incremental marking on allocation")
DEFINE_INT(incremental_marking_soft_trigger, 0,
"threshold for starting incremental marking via a task in percent "
"of available space: limit - size")
......
......@@ -1670,6 +1670,11 @@ int Heap::NotifyContextDisposed(bool dependant_context) {
void Heap::StartIncrementalMarking(int gc_flags,
GarbageCollectionReason gc_reason,
GCCallbackFlags gc_callback_flags) {
if (V8_UNLIKELY(!FLAG_incremental_marking_on_allocation) &&
(gc_reason == GarbageCollectionReason::kAllocationLimit ||
gc_reason == GarbageCollectionReason::kGlobalAllocationLimit)) {
return;
}
DCHECK(incremental_marking()->IsStopped());
set_current_gc_flags(gc_flags);
current_gc_callback_flags_ = gc_callback_flags;
......
......@@ -1036,7 +1036,8 @@ void IncrementalMarking::AdvanceOnAllocation() {
// Code using an AlwaysAllocateScope assumes that the GC state does not
// change; that implies that no marking steps must be performed.
if (heap_->gc_state() != Heap::NOT_IN_GC || !FLAG_incremental_marking ||
(state_ != SWEEPING && state_ != MARKING) || heap_->always_allocate()) {
(state_ != SWEEPING && state_ != MARKING) || heap_->always_allocate() ||
V8_UNLIKELY(!FLAG_incremental_marking_on_allocation)) {
return;
}
HistogramTimerScope incremental_marking_scope(
......
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