Rename some things around incremental marking triggers

R=hpayer@chromium.org
BUG=

Review URL: https://codereview.chromium.org/1094843002

Cr-Commit-Position: refs/heads/master@{#27914}
This commit is contained in:
erikcorry 2015-04-17 04:17:33 -07:00 committed by Commit bot
parent 46c4c707e2
commit 1caa269cee
4 changed files with 13 additions and 21 deletions

View File

@ -874,7 +874,8 @@ bool Heap::CollectGarbage(GarbageCollector collector, const char* gc_reason,
// Start incremental marking for the next cycle. The heap snapshot // Start incremental marking for the next cycle. The heap snapshot
// generator needs incremental marking to stay off after it aborted. // generator needs incremental marking to stay off after it aborted.
if (!mark_compact_collector()->abort_incremental_marking() && if (!mark_compact_collector()->abort_incremental_marking() &&
WorthActivatingIncrementalMarking()) { incremental_marking()->IsStopped() &&
incremental_marking()->ShouldActivateEvenWithoutIdleNotification()) {
incremental_marking()->Start(); incremental_marking()->Start();
} }
@ -4545,12 +4546,6 @@ bool Heap::TryFinalizeIdleIncrementalMarking(
} }
bool Heap::WorthActivatingIncrementalMarking() {
return incremental_marking()->IsStopped() &&
incremental_marking()->ShouldActivate();
}
static double MonotonicallyIncreasingTimeInMs() { static double MonotonicallyIncreasingTimeInMs() {
return V8::GetCurrentPlatform()->MonotonicallyIncreasingTime() * return V8::GetCurrentPlatform()->MonotonicallyIncreasingTime() *
static_cast<double>(base::Time::kMillisecondsPerSecond); static_cast<double>(base::Time::kMillisecondsPerSecond);
@ -4588,8 +4583,8 @@ bool Heap::IdleNotification(double deadline_in_seconds) {
} }
heap_state.can_start_incremental_marking = heap_state.can_start_incremental_marking =
incremental_marking()->WorthActivating() && incremental_marking()->CanBeActivated() &&
NextGCIsLikelyToBeFull(limit) && FLAG_incremental_marking && HeapIsFullEnoughToStartIncrementalMarking(limit) &&
!mark_compact_collector()->sweeping_in_progress(); !mark_compact_collector()->sweeping_in_progress();
heap_state.sweeping_in_progress = heap_state.sweeping_in_progress =
mark_compact_collector()->sweeping_in_progress(); mark_compact_collector()->sweeping_in_progress();

View File

@ -1241,9 +1241,7 @@ class Heap {
survived_since_last_expansion_ += survived; survived_since_last_expansion_ += survived;
} }
inline bool NextGCIsLikelyToBeFull(intptr_t limit) { inline bool HeapIsFullEnoughToStartIncrementalMarking(intptr_t limit) {
if (FLAG_gc_global) return true;
if (FLAG_stress_compaction && (gc_count_ & 1) != 0) return true; if (FLAG_stress_compaction && (gc_count_ & 1) != 0) return true;
intptr_t adjusted_allocation_limit = limit - new_space_.Capacity(); intptr_t adjusted_allocation_limit = limit - new_space_.Capacity();
@ -2083,8 +2081,6 @@ class Heap {
double idle_time_in_ms, size_t size_of_objects, double idle_time_in_ms, size_t size_of_objects,
size_t mark_compact_speed_in_bytes_per_ms); size_t mark_compact_speed_in_bytes_per_ms);
bool WorthActivatingIncrementalMarking();
void ClearObjectStats(bool clear_last_time_stats = false); void ClearObjectStats(bool clear_last_time_stats = false);
inline void UpdateAllocationsHash(HeapObject* object); inline void UpdateAllocationsHash(HeapObject* object);

View File

@ -386,9 +386,9 @@ void IncrementalMarking::ActivateIncrementalWriteBarrier() {
} }
bool IncrementalMarking::ShouldActivate() { bool IncrementalMarking::ShouldActivateEvenWithoutIdleNotification() {
return WorthActivating() && return CanBeActivated() &&
heap_->NextGCIsLikelyToBeFull( heap_->HeapIsFullEnoughToStartIncrementalMarking(
heap_->old_generation_allocation_limit()); heap_->old_generation_allocation_limit());
} }
@ -396,7 +396,7 @@ bool IncrementalMarking::ShouldActivate() {
bool IncrementalMarking::WasActivated() { return was_activated_; } bool IncrementalMarking::WasActivated() { return was_activated_; }
bool IncrementalMarking::WorthActivating() { bool IncrementalMarking::CanBeActivated() {
#ifndef DEBUG #ifndef DEBUG
static const intptr_t kActivationThreshold = 8 * MB; static const intptr_t kActivationThreshold = 8 * MB;
#else #else
@ -407,6 +407,7 @@ bool IncrementalMarking::WorthActivating() {
// Only start incremental marking in a safe state: 1) when incremental // Only start incremental marking in a safe state: 1) when incremental
// marking is turned on, 2) when we are currently not in a GC, and // marking is turned on, 2) when we are currently not in a GC, and
// 3) when we are currently not serializing or deserializing the heap. // 3) when we are currently not serializing or deserializing the heap.
// Don't switch on for very small heaps.
return FLAG_incremental_marking && FLAG_incremental_marking_steps && return FLAG_incremental_marking && FLAG_incremental_marking_steps &&
heap_->gc_state() == Heap::NOT_IN_GC && heap_->gc_state() == Heap::NOT_IN_GC &&
heap_->deserialization_complete() && heap_->deserialization_complete() &&
@ -814,7 +815,7 @@ void IncrementalMarking::Epilogue() {
void IncrementalMarking::OldSpaceStep(intptr_t allocated) { void IncrementalMarking::OldSpaceStep(intptr_t allocated) {
if (IsStopped() && ShouldActivate()) { if (IsStopped() && ShouldActivateEvenWithoutIdleNotification()) {
Start(); Start();
} else { } else {
Step(allocated * kOldSpaceAllocationMarkingFactor, GC_VIA_STACK_GUARD); Step(allocated * kOldSpaceAllocationMarkingFactor, GC_VIA_STACK_GUARD);

View File

@ -64,9 +64,9 @@ class IncrementalMarking {
GCRequestType request_type() const { return request_type_; } GCRequestType request_type() const { return request_type_; }
bool WorthActivating(); bool CanBeActivated();
bool ShouldActivate(); bool ShouldActivateEvenWithoutIdleNotification();
bool WasActivated(); bool WasActivated();