[heap] Remove TryFinalizeIdleIncrementalMarking.

We can use FinalizeIncrementalMarking instead since the only caller of
TryFinalizeIdleIncrementalMarking is IdleNotification, for which staying
within idle deadline is not critical.

This also fixes a bug caused by inconsistent code duplication in
finalization condition in the two functions.

BUG=v8:6325,chromium:715457

Review-Url: https://codereview.chromium.org/2851743002
Cr-Commit-Position: refs/heads/master@{#45054}
This commit is contained in:
ulan 2017-05-03 03:05:41 -07:00 committed by Commit bot
parent 23ee74310b
commit a525d7c164
2 changed files with 1 additions and 31 deletions

View File

@ -4230,32 +4230,6 @@ void Heap::FinalizeIncrementalMarkingIfComplete(
} }
} }
bool Heap::TryFinalizeIdleIncrementalMarking(
double idle_time_in_ms, GarbageCollectionReason gc_reason) {
size_t size_of_objects = static_cast<size_t>(SizeOfObjects());
double final_incremental_mark_compact_speed_in_bytes_per_ms =
tracer()->FinalIncrementalMarkCompactSpeedInBytesPerMillisecond();
if (incremental_marking()->IsReadyToOverApproximateWeakClosure() ||
(!incremental_marking()->finalize_marking_completed() &&
mark_compact_collector()->marking_deque()->IsEmpty() &&
local_embedder_heap_tracer()->ShouldFinalizeIncrementalMarking() &&
gc_idle_time_handler_->ShouldDoOverApproximateWeakClosure(
idle_time_in_ms))) {
FinalizeIncrementalMarking(gc_reason);
return true;
} else if (incremental_marking()->IsComplete() ||
(mark_compact_collector()->marking_deque()->IsEmpty() &&
local_embedder_heap_tracer()
->ShouldFinalizeIncrementalMarking() &&
gc_idle_time_handler_->ShouldDoFinalIncrementalMarkCompact(
idle_time_in_ms, size_of_objects,
final_incremental_mark_compact_speed_in_bytes_per_ms))) {
CollectAllGarbage(current_gc_flags_, gc_reason);
return true;
}
return false;
}
void Heap::RegisterReservationsForBlackAllocation(Reservation* reservations) { void Heap::RegisterReservationsForBlackAllocation(Reservation* reservations) {
// TODO(hpayer): We do not have to iterate reservations on black objects // TODO(hpayer): We do not have to iterate reservations on black objects
// for marking. We just have to execute the special visiting side effect // for marking. We just have to execute the special visiting side effect
@ -4332,8 +4306,7 @@ bool Heap::PerformIdleTimeAction(GCIdleTimeAction action,
deadline_in_ms, IncrementalMarking::NO_GC_VIA_STACK_GUARD, deadline_in_ms, IncrementalMarking::NO_GC_VIA_STACK_GUARD,
IncrementalMarking::FORCE_COMPLETION, StepOrigin::kTask); IncrementalMarking::FORCE_COMPLETION, StepOrigin::kTask);
if (remaining_idle_time_in_ms > 0.0) { if (remaining_idle_time_in_ms > 0.0) {
TryFinalizeIdleIncrementalMarking( FinalizeIncrementalMarkingIfComplete(
remaining_idle_time_in_ms,
GarbageCollectionReason::kFinalizeMarkingViaTask); GarbageCollectionReason::kFinalizeMarkingViaTask);
} }
result = incremental_marking()->IsStopped(); result = incremental_marking()->IsStopped();

View File

@ -1257,9 +1257,6 @@ class Heap {
void FinalizeIncrementalMarkingIfComplete(GarbageCollectionReason gc_reason); void FinalizeIncrementalMarkingIfComplete(GarbageCollectionReason gc_reason);
bool TryFinalizeIdleIncrementalMarking(double idle_time_in_ms,
GarbageCollectionReason gc_reason);
void RegisterReservationsForBlackAllocation(Reservation* reservations); void RegisterReservationsForBlackAllocation(Reservation* reservations);
IncrementalMarking* incremental_marking() { return incremental_marking_; } IncrementalMarking* incremental_marking() { return incremental_marking_; }