[heap] Add flags for predictable GC schedule
Provide flag to set a deterministic GC schedule. The GC still uses multiple tasks but on a fixed growing strategy. Change-Id: I937cf77ae0b0d1e513d4976a23c7f23a151d77c5 Reviewed-on: https://chromium-review.googlesource.com/c/1270838 Commit-Queue: Michael Lippautz <mlippautz@chromium.org> Reviewed-by: Ulan Degenbaev <ulan@chromium.org> Cr-Commit-Position: refs/heads/master@{#56498}
This commit is contained in:
parent
9f89328416
commit
a9f74f22a0
@ -825,6 +825,8 @@ DEFINE_BOOL(young_generation_large_objects, false,
|
||||
"allocates large objects by default in the young generation large "
|
||||
"object space")
|
||||
|
||||
DEFINE_BOOL(idle_time_scavenge, true, "Perform scavenges in idle time.")
|
||||
|
||||
// assembler-ia32.cc / assembler-arm.cc / assembler-x64.cc
|
||||
DEFINE_BOOL(debug_code, DEBUG_BOOL,
|
||||
"generate extra code (assertions) for debugging")
|
||||
@ -1393,6 +1395,15 @@ DEFINE_NEG_IMPLICATION(predictable, memory_reducer)
|
||||
DEFINE_VALUE_IMPLICATION(single_threaded, wasm_num_compilation_tasks, 0)
|
||||
DEFINE_NEG_IMPLICATION(single_threaded, wasm_async_compilation)
|
||||
|
||||
DEFINE_BOOL(predictable_gc_schedule, false,
|
||||
"Predictable garbage collection schedule. Fixes heap growing, "
|
||||
"idle, and memory reducing behavior.")
|
||||
DEFINE_VALUE_IMPLICATION(predictable_gc_schedule, min_semi_space_size, 4)
|
||||
DEFINE_VALUE_IMPLICATION(predictable_gc_schedule, max_semi_space_size, 4)
|
||||
DEFINE_VALUE_IMPLICATION(predictable_gc_schedule, heap_growing_percent, 30)
|
||||
DEFINE_NEG_IMPLICATION(predictable_gc_schedule, idle_time_scavenge)
|
||||
DEFINE_NEG_IMPLICATION(predictable_gc_schedule, memory_reducer)
|
||||
|
||||
//
|
||||
// Threading related flags.
|
||||
//
|
||||
|
@ -982,6 +982,8 @@ void Heap::HandleGCRequest() {
|
||||
|
||||
|
||||
void Heap::ScheduleIdleScavengeIfNeeded(int bytes_allocated) {
|
||||
DCHECK(FLAG_idle_time_scavenge);
|
||||
DCHECK_NOT_NULL(scavenge_job_);
|
||||
scavenge_job_->ScheduleIdleTaskIfNeeded(this, bytes_allocated);
|
||||
}
|
||||
|
||||
@ -4387,7 +4389,6 @@ void Heap::SetUp() {
|
||||
live_object_stats_ = new ObjectStats(this);
|
||||
dead_object_stats_ = new ObjectStats(this);
|
||||
}
|
||||
scavenge_job_ = new ScavengeJob();
|
||||
local_embedder_heap_tracer_ = new LocalEmbedderHeapTracer(isolate());
|
||||
|
||||
LOG(isolate_, IntPtrTEvent("heap-capacity", Capacity()));
|
||||
@ -4402,9 +4403,12 @@ void Heap::SetUp() {
|
||||
}
|
||||
#endif // ENABLE_MINOR_MC
|
||||
|
||||
if (FLAG_idle_time_scavenge) {
|
||||
scavenge_job_ = new ScavengeJob();
|
||||
idle_scavenge_observer_ = new IdleScavengeObserver(
|
||||
*this, ScavengeJob::kBytesAllocatedBeforeNextIdleTask);
|
||||
new_space()->AddAllocationObserver(idle_scavenge_observer_);
|
||||
}
|
||||
|
||||
SetGetExternallyAllocatedMemoryInBytesCallback(
|
||||
DefaultGetExternallyAllocatedMemoryInBytesCallback);
|
||||
@ -4568,9 +4572,13 @@ void Heap::TearDown() {
|
||||
}
|
||||
}
|
||||
|
||||
if (FLAG_idle_time_scavenge) {
|
||||
new_space()->RemoveAllocationObserver(idle_scavenge_observer_);
|
||||
delete idle_scavenge_observer_;
|
||||
idle_scavenge_observer_ = nullptr;
|
||||
delete scavenge_job_;
|
||||
scavenge_job_ = nullptr;
|
||||
}
|
||||
|
||||
if (FLAG_stress_marking > 0) {
|
||||
RemoveAllocationObserversFromAllSpaces(stress_marking_observer_,
|
||||
@ -4641,9 +4649,6 @@ void Heap::TearDown() {
|
||||
delete local_embedder_heap_tracer_;
|
||||
local_embedder_heap_tracer_ = nullptr;
|
||||
|
||||
delete scavenge_job_;
|
||||
scavenge_job_ = nullptr;
|
||||
|
||||
external_string_table_.TearDown();
|
||||
|
||||
// Tear down all ArrayBuffers before tearing down the heap since their
|
||||
|
Loading…
Reference in New Issue
Block a user