Index: src/heap/heap.cc |
diff --git a/src/heap/heap.cc b/src/heap/heap.cc |
index 31b93e71991e219b5c6050bd0f17bd890f6018ec..66f6f71c72adc0cfe2162294bc85eebfa1c3846f 100644 |
--- a/src/heap/heap.cc |
+++ b/src/heap/heap.cc |
@@ -27,6 +27,7 @@ |
#include "src/heap/object-stats.h" |
#include "src/heap/objects-visiting-inl.h" |
#include "src/heap/objects-visiting.h" |
+#include "src/heap/scavenge-job.h" |
#include "src/heap/scavenger-inl.h" |
#include "src/heap/store-buffer.h" |
#include "src/heap-profiler.h" |
@@ -127,6 +128,7 @@ Heap::Heap() |
incremental_marking_(this), |
memory_reducer_(nullptr), |
object_stats_(nullptr), |
+ scavenge_job_(nullptr), |
full_codegen_bytes_generated_(0), |
crankshaft_codegen_bytes_generated_(0), |
new_space_allocation_counter_(0), |
@@ -779,6 +781,11 @@ void Heap::HandleGCRequest() { |
} |
+void Heap::ScheduleIdleScavengeIfNeeded(int bytes_allocated) { |
+ scavenge_job_->ScheduleIdleTaskIfNeeded(this, bytes_allocated); |
+} |
+ |
+ |
void Heap::OverApproximateWeakClosure(const char* gc_reason) { |
if (FLAG_trace_incremental_marking) { |
PrintF("[IncrementalMarking] Overapproximate weak closure (%s).\n", |
@@ -4100,12 +4107,6 @@ GCIdleTimeHandler::HeapState Heap::ComputeHeapState() { |
heap_state.incremental_marking_stopped = incremental_marking()->IsStopped(); |
heap_state.mark_compact_speed_in_bytes_per_ms = |
static_cast<size_t>(tracer()->MarkCompactSpeedInBytesPerMillisecond()); |
- heap_state.scavenge_speed_in_bytes_per_ms = |
- static_cast<size_t>(tracer()->ScavengeSpeedInBytesPerMillisecond()); |
- heap_state.used_new_space_size = new_space_.Size(); |
- heap_state.new_space_capacity = new_space_.Capacity(); |
- heap_state.new_space_allocation_throughput_in_bytes_per_ms = |
- tracer()->NewSpaceAllocationThroughputInBytesPerMillisecond(); |
return heap_state; |
} |
@@ -4162,9 +4163,6 @@ bool Heap::PerformIdleTimeAction(GCIdleTimeAction action, |
CollectAllGarbage(kNoGCFlags, "idle notification: contexts disposed"); |
break; |
} |
- case DO_SCAVENGE: |
- CollectGarbage(NEW_SPACE, "idle notification: scavenge"); |
- break; |
case DO_NOTHING: |
break; |
} |
@@ -4991,6 +4989,17 @@ void Heap::DisableInlineAllocation() { |
} |
+void Heap::LowerInlineAllocationLimit(intptr_t step) { |
+ new_space()->LowerInlineAllocationLimit(step); |
+} |
+ |
+ |
+void Heap::ResetInlineAllocationLimit() { |
+ new_space()->LowerInlineAllocationLimit( |
+ ScavengeJob::kBytesAllocatedBeforeNextIdleTask); |
+} |
+ |
+ |
V8_DECLARE_ONCE(initialize_gc_once); |
static void InitializeGCOnce() { |
@@ -5081,6 +5090,8 @@ bool Heap::SetUp() { |
object_stats_ = new ObjectStats(this); |
object_stats_->ClearObjectStats(true); |
+ scavenge_job_ = new ScavengeJob(); |
+ |
array_buffer_tracker_ = new ArrayBufferTracker(this); |
LOG(isolate_, IntPtrTEvent("heap-capacity", Capacity())); |
@@ -5090,6 +5101,8 @@ bool Heap::SetUp() { |
mark_compact_collector()->SetUp(); |
+ ResetInlineAllocationLimit(); |
+ |
return true; |
} |
@@ -5199,6 +5212,9 @@ void Heap::TearDown() { |
delete object_stats_; |
object_stats_ = nullptr; |
+ delete scavenge_job_; |
+ scavenge_job_ = nullptr; |
+ |
WaitUntilUnmappingOfFreeChunksCompleted(); |
delete array_buffer_tracker_; |