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

[heap] Remove dead code related to idle finalization rounds.

Bug: 
Change-Id: I9e4b2e1157f36dacb24f7a0d0c43d31c84de8488
Reviewed-on: https://chromium-review.googlesource.com/712397Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Reviewed-by: 's avatarHannes Payer <hpayer@chromium.org>
Commit-Queue: Ulan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#48484}
parent 69bd294a
......@@ -618,11 +618,6 @@ DEFINE_BOOL(minor_mc_parallel_marking, true,
"use parallel marking for the young generation")
DEFINE_BOOL(trace_minor_mc_parallel_marking, false,
"trace parallel marking for the young generation")
DEFINE_INT(min_progress_during_incremental_marking_finalization, 32,
"keep finalizing incremental marking as long as we discover at "
"least this many unmarked objects")
DEFINE_INT(max_incremental_marking_finalization_rounds, 3,
"at most try this many times to finalize incremental marking")
DEFINE_BOOL(minor_mc, false, "perform young generation mark compact GCs")
DEFINE_BOOL(black_allocation, true, "use black allocation")
DEFINE_BOOL(concurrent_store_buffer, true,
......
......@@ -1145,8 +1145,7 @@ void Heap::ReportExternalMemoryPressure() {
current_gc_callback_flags_ = static_cast<GCCallbackFlags>(
current_gc_callback_flags_ | kGCCallbackFlagsForExternalMemory);
incremental_marking()->AdvanceIncrementalMarking(
deadline, IncrementalMarking::GC_VIA_STACK_GUARD,
IncrementalMarking::FORCE_COMPLETION, StepOrigin::kV8);
deadline, IncrementalMarking::GC_VIA_STACK_GUARD, StepOrigin::kV8);
}
}
......@@ -4165,7 +4164,7 @@ bool Heap::PerformIdleTimeAction(GCIdleTimeAction action,
const double remaining_idle_time_in_ms =
incremental_marking()->AdvanceIncrementalMarking(
deadline_in_ms, IncrementalMarking::NO_GC_VIA_STACK_GUARD,
IncrementalMarking::FORCE_COMPLETION, StepOrigin::kTask);
StepOrigin::kTask);
if (remaining_idle_time_in_ms > 0.0) {
FinalizeIncrementalMarkingIfComplete(
GarbageCollectionReason::kFinalizeMarkingViaTask);
......
......@@ -35,7 +35,7 @@ void IncrementalMarkingJob::Task::Step(Heap* heap) {
heap->MonotonicallyIncreasingTimeInMs() + kIncrementalMarkingDelayMs;
heap->incremental_marking()->AdvanceIncrementalMarking(
deadline, i::IncrementalMarking::NO_GC_VIA_STACK_GUARD,
i::IncrementalMarking::FORCE_COMPLETION, i::StepOrigin::kTask);
i::StepOrigin::kTask);
heap->FinalizeIncrementalMarkingIfComplete(
GarbageCollectionReason::kFinalizeMarkingViaTask);
}
......
......@@ -51,8 +51,6 @@ IncrementalMarking::IncrementalMarking(Heap* heap)
initial_old_generation_size_(0),
bytes_marked_ahead_of_schedule_(0),
unscanned_bytes_of_large_object_(0),
idle_marking_delay_counter_(0),
incremental_marking_finalization_rounds_(0),
is_compacting_(false),
should_hurry_(false),
was_activated_(false),
......@@ -692,34 +690,11 @@ void IncrementalMarking::FinalizeIncrementally() {
// do not need processing during GC.
MarkRoots();
if (incremental_marking_finalization_rounds_ == 0) {
// Map retaining is needed for perfromance, not correctness,
// so we can do it only once at the beginning of the finalization.
RetainMaps();
}
int marking_progress =
heap_->mark_compact_collector()->marking_worklist()->Size() +
static_cast<int>(
heap_->local_embedder_heap_tracer()->NumberOfCachedWrappersToTrace());
// Map retaining is needed for perfromance, not correctness,
// so we can do it only once at the beginning of the finalization.
RetainMaps();
double end = heap_->MonotonicallyIncreasingTimeInMs();
double delta = end - start;
if (FLAG_trace_incremental_marking) {
heap()->isolate()->PrintWithTimestamp(
"[IncrementalMarking] Finalize incrementally round %d, "
"spent %d ms, marking progress %d.\n",
static_cast<int>(delta), incremental_marking_finalization_rounds_,
marking_progress);
}
++incremental_marking_finalization_rounds_;
if ((incremental_marking_finalization_rounds_ >=
FLAG_max_incremental_marking_finalization_rounds) ||
(marking_progress <
FLAG_min_progress_during_incremental_marking_finalization)) {
finalize_marking_completed_ = true;
}
finalize_marking_completed_ = true;
if (FLAG_black_allocation && !heap()->ShouldReduceMemory() &&
!black_allocation_) {
......@@ -727,6 +702,13 @@ void IncrementalMarking::FinalizeIncrementally() {
// progress.
StartBlackAllocation();
}
if (FLAG_trace_incremental_marking) {
double end = heap_->MonotonicallyIncreasingTimeInMs();
double delta = end - start;
heap()->isolate()->PrintWithTimestamp(
"[IncrementalMarking] Finalize incrementally spent %.1f ms.\n", delta);
}
}
void IncrementalMarking::UpdateMarkingWorklistAfterScavenge() {
......@@ -959,12 +941,11 @@ void IncrementalMarking::MarkingComplete(CompletionAction action) {
void IncrementalMarking::Epilogue() {
was_activated_ = false;
finalize_marking_completed_ = false;
incremental_marking_finalization_rounds_ = 0;
}
double IncrementalMarking::AdvanceIncrementalMarking(
double deadline_in_ms, CompletionAction completion_action,
ForceCompletionAction force_completion, StepOrigin step_origin) {
StepOrigin step_origin) {
HistogramTimerScope incremental_marking_scope(
heap_->isolate()->counters()->gc_incremental_marking());
TRACE_EVENT0("v8", "V8.GCIncrementalMarking");
......@@ -995,8 +976,7 @@ double IncrementalMarking::AdvanceIncrementalMarking(
DO_NOT_FORCE_COMPLETION));
}
} else {
Step(step_size_in_bytes, completion_action, force_completion,
step_origin);
Step(step_size_in_bytes, completion_action, step_origin);
}
trace_wrappers_toggle_ = !trace_wrappers_toggle_;
remaining_time_in_ms =
......@@ -1089,8 +1069,8 @@ void IncrementalMarking::AdvanceIncrementalMarkingOnAllocation() {
heap_->isolate()->counters()->gc_incremental_marking());
TRACE_EVENT0("v8", "V8.GCIncrementalMarking");
TRACE_GC(heap_->tracer(), GCTracer::Scope::MC_INCREMENTAL);
bytes_processed = Step(bytes_to_process, GC_VIA_STACK_GUARD,
FORCE_COMPLETION, StepOrigin::kV8);
bytes_processed =
Step(bytes_to_process, GC_VIA_STACK_GUARD, StepOrigin::kV8);
}
bytes_allocated_ -= Min(bytes_allocated_, bytes_processed);
}
......@@ -1098,7 +1078,6 @@ void IncrementalMarking::AdvanceIncrementalMarkingOnAllocation() {
size_t IncrementalMarking::Step(size_t bytes_to_process,
CompletionAction action,
ForceCompletionAction completion,
StepOrigin step_origin) {
double start = heap_->MonotonicallyIncreasingTimeInMs();
......@@ -1129,15 +1108,10 @@ size_t IncrementalMarking::Step(size_t bytes_to_process,
if (marking_worklist()->IsEmpty()) {
if (heap_->local_embedder_heap_tracer()
->ShouldFinalizeIncrementalMarking()) {
if (completion == FORCE_COMPLETION ||
IsIdleMarkingDelayCounterLimitReached()) {
if (!finalize_marking_completed_) {
FinalizeMarking(action);
} else {
MarkingComplete(action);
}
if (!finalize_marking_completed_) {
FinalizeMarking(action);
} else {
IncrementIdleMarkingDelayCounter();
MarkingComplete(action);
}
} else {
heap_->local_embedder_heap_tracer()->NotifyV8MarkingWorklistWasEmpty();
......@@ -1168,20 +1142,5 @@ size_t IncrementalMarking::Step(size_t bytes_to_process,
return bytes_processed;
}
bool IncrementalMarking::IsIdleMarkingDelayCounterLimitReached() {
return idle_marking_delay_counter_ > kMaxIdleMarkingDelayCounter;
}
void IncrementalMarking::IncrementIdleMarkingDelayCounter() {
idle_marking_delay_counter_++;
}
void IncrementalMarking::ClearIdleMarkingDelayCounter() {
idle_marking_delay_counter_ = 0;
}
} // namespace internal
} // namespace v8
......@@ -95,10 +95,6 @@ class V8_EXPORT_PRIVATE IncrementalMarking {
static const int kStepSizeInMs = 1;
static const int kMaxStepSizeInMs = 5;
// This is the upper bound for how many times we allow finalization of
// incremental marking to be postponed.
static const int kMaxIdleMarkingDelayCounter = 3;
#ifndef DEBUG
static const intptr_t kActivationThreshold = 8 * MB;
#else
......@@ -207,13 +203,12 @@ class V8_EXPORT_PRIVATE IncrementalMarking {
// anymore because a single step would exceed the deadline.
double AdvanceIncrementalMarking(double deadline_in_ms,
CompletionAction completion_action,
ForceCompletionAction force_completion,
StepOrigin step_origin);
void FinalizeSweeping();
size_t Step(size_t bytes_to_process, CompletionAction action,
ForceCompletionAction completion, StepOrigin step_origin);
StepOrigin step_origin);
inline void RestartIfNotMarking();
......@@ -260,10 +255,6 @@ class V8_EXPORT_PRIVATE IncrementalMarking {
unscanned_bytes_of_large_object_ = unscanned_bytes;
}
void ClearIdleMarkingDelayCounter();
bool IsIdleMarkingDelayCounterLimitReached();
void ProcessBlackAllocatedObject(HeapObject* obj);
Heap* heap() const { return heap_; }
......@@ -367,9 +358,6 @@ class V8_EXPORT_PRIVATE IncrementalMarking {
// Must use SetState() above to update state_
State state_;
int idle_marking_delay_counter_;
int incremental_marking_finalization_rounds_;
bool is_compacting_;
bool should_hurry_;
bool was_activated_;
......
......@@ -1073,8 +1073,6 @@ void MarkCompactCollector::Finish() {
Deoptimizer::DeoptimizeMarkedCode(isolate());
have_code_to_deoptimize_ = false;
}
heap_->incremental_marking()->ClearIdleMarkingDelayCounter();
}
class MarkCompactMarkingVisitor final
......
......@@ -79,7 +79,7 @@ void MemoryReducer::NotifyTimer(const Event& event) {
kIncrementalMarkingDelayMs;
heap()->incremental_marking()->AdvanceIncrementalMarking(
deadline, IncrementalMarking::NO_GC_VIA_STACK_GUARD,
IncrementalMarking::FORCE_COMPLETION, StepOrigin::kTask);
StepOrigin::kTask);
heap()->FinalizeIncrementalMarkingIfComplete(
GarbageCollectionReason::kFinalizeMarkingViaTask);
}
......
......@@ -162,7 +162,7 @@ void SimulateIncrementalMarking(i::Heap* heap, bool force_completion) {
while (!marking->IsComplete()) {
marking->Step(i::MB, i::IncrementalMarking::NO_GC_VIA_STACK_GUARD,
i::IncrementalMarking::FORCE_COMPLETION, i::StepOrigin::kV8);
i::StepOrigin::kV8);
if (marking->IsReadyToOverApproximateWeakClosure()) {
marking->FinalizeIncrementally();
}
......
......@@ -2103,7 +2103,7 @@ TEST(InstanceOfStubWriteBarrier) {
// Discard any pending GC requests otherwise we will get GC when we enter
// code below.
marking->Step(MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD,
IncrementalMarking::FORCE_COMPLETION, StepOrigin::kV8);
StepOrigin::kV8);
}
CHECK(marking->IsMarking());
......@@ -2167,28 +2167,12 @@ TEST(IdleNotificationFinishMarking) {
CHECK_EQ(CcTest::heap()->gc_count(), initial_gc_count);
// TODO(hpayer): We cannot write proper unit test right now for heap.
// The ideal test would call kMaxIdleMarkingDelayCounter to test the
// marking delay counter.
// Perform a huge incremental marking step but don't complete marking.
do {
marking->Step(1 * MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD,
IncrementalMarking::DO_NOT_FORCE_COMPLETION, StepOrigin::kV8);
CHECK(!marking->IsIdleMarkingDelayCounterLimitReached());
StepOrigin::kV8);
} while (
!CcTest::heap()->mark_compact_collector()->marking_worklist()->IsEmpty());
// The next invocations of incremental marking are not going to complete
// marking
// since the completion threshold is not reached
for (size_t i = 0; i < IncrementalMarking::kMaxIdleMarkingDelayCounter - 2;
i++) {
marking->Step(1 * MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD,
IncrementalMarking::DO_NOT_FORCE_COMPLETION, StepOrigin::kV8);
CHECK(!marking->IsIdleMarkingDelayCounterLimitReached());
}
marking->SetWeakClosureWasOverApproximatedForTesting(true);
// The next idle notification has to finish incremental marking.
......@@ -3378,8 +3362,7 @@ TEST(LargeObjectSlotRecording) {
// Start incremental marking to active write barrier.
heap::SimulateIncrementalMarking(heap, false);
heap->incremental_marking()->AdvanceIncrementalMarking(
10000000, IncrementalMarking::NO_GC_VIA_STACK_GUARD,
IncrementalMarking::FORCE_COMPLETION, StepOrigin::kV8);
10000000, IncrementalMarking::NO_GC_VIA_STACK_GUARD, StepOrigin::kV8);
// Create references from the large object to the object on the evacuation
// candidate.
......@@ -3443,7 +3426,7 @@ TEST(IncrementalMarkingStepMakesBigProgressWithLargeObjects) {
}
// This big step should be sufficient to mark the whole array.
marking->Step(100 * MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD,
IncrementalMarking::FORCE_COMPLETION, StepOrigin::kV8);
StepOrigin::kV8);
CHECK(marking->IsComplete() ||
marking->IsReadyToOverApproximateWeakClosure());
}
......@@ -4338,7 +4321,7 @@ TEST(WeakCellsWithIncrementalMarking) {
i::GarbageCollectionReason::kTesting);
}
marking->Step(128, IncrementalMarking::NO_GC_VIA_STACK_GUARD,
IncrementalMarking::FORCE_COMPLETION, StepOrigin::kV8);
StepOrigin::kV8);
CcTest::CollectGarbage(NEW_SPACE);
CHECK(weak_cell->value()->IsFixedArray());
weak_cells[i] = inner_scope.CloseAndEscape(weak_cell);
......@@ -4588,7 +4571,7 @@ TEST(Regress3631) {
IncrementalMarking::MarkingState* marking_state = marking->marking_state();
while (!marking_state->IsBlack(weak_map_table) && !marking->IsStopped()) {
marking->Step(MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD,
IncrementalMarking::FORCE_COMPLETION, StepOrigin::kV8);
StepOrigin::kV8);
}
// Stash the backing store in a handle.
Handle<Object> save(weak_map->table(), isolate);
......@@ -5316,7 +5299,7 @@ TEST(Regress598319) {
// only partially marked the large object.
while (!marking->IsComplete()) {
marking->Step(i::KB, i::IncrementalMarking::NO_GC_VIA_STACK_GUARD,
IncrementalMarking::FORCE_COMPLETION, StepOrigin::kV8);
StepOrigin::kV8);
if (page->IsFlagSet(Page::HAS_PROGRESS_BAR) && page->progress_bar() > 0) {
CHECK_NE(page->progress_bar(), arr.get()->Size());
{
......@@ -5334,7 +5317,7 @@ TEST(Regress598319) {
// Finish marking with bigger steps to speed up test.
while (!marking->IsComplete()) {
marking->Step(10 * i::MB, i::IncrementalMarking::NO_GC_VIA_STACK_GUARD,
IncrementalMarking::FORCE_COMPLETION, StepOrigin::kV8);
StepOrigin::kV8);
if (marking->IsReadyToOverApproximateWeakClosure()) {
marking->FinalizeIncrementally();
}
......@@ -5417,7 +5400,7 @@ TEST(Regress615489) {
}
while (!marking->IsComplete()) {
marking->Step(i::MB, i::IncrementalMarking::NO_GC_VIA_STACK_GUARD,
IncrementalMarking::FORCE_COMPLETION, StepOrigin::kV8);
StepOrigin::kV8);
if (marking->IsReadyToOverApproximateWeakClosure()) {
marking->FinalizeIncrementally();
}
......@@ -5478,7 +5461,7 @@ TEST(Regress631969) {
IncrementalMarking* marking = heap->incremental_marking();
while (!marking->IsComplete()) {
marking->Step(MB, i::IncrementalMarking::NO_GC_VIA_STACK_GUARD,
IncrementalMarking::FORCE_COMPLETION, StepOrigin::kV8);
StepOrigin::kV8);
if (marking->IsReadyToOverApproximateWeakClosure()) {
marking->FinalizeIncrementally();
}
......@@ -5805,8 +5788,7 @@ HEAP_TEST(Regress670675) {
if (marking->IsStopped()) break;
double deadline = heap->MonotonicallyIncreasingTimeInMs() + 1;
marking->AdvanceIncrementalMarking(
deadline, IncrementalMarking::GC_VIA_STACK_GUARD,
IncrementalMarking::FORCE_COMPLETION, StepOrigin::kV8);
deadline, IncrementalMarking::GC_VIA_STACK_GUARD, StepOrigin::kV8);
}
DCHECK(marking->IsStopped());
}
......
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