Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Unified Diff: src/heap/heap.cc

Issue 1352453004: Perform scavenge in idle tasks. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/heap/heap.h ('k') | src/heap/incremental-marking.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/heap.cc
diff --git a/src/heap/heap.cc b/src/heap/heap.cc
index ae77e1eeee1ec5fdb59c6e794b41bea62e7be892..92f5a508e8a697e1a11c700c86f228e0de290b6c 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"
@@ -128,6 +129,7 @@ Heap::Heap()
gc_idle_time_handler_(nullptr),
memory_reducer_(nullptr),
object_stats_(nullptr),
+ scavenge_job_(nullptr),
full_codegen_bytes_generated_(0),
crankshaft_codegen_bytes_generated_(0),
new_space_allocation_counter_(0),
@@ -780,6 +782,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",
@@ -4098,12 +4105,6 @@ GCIdleTimeHeapState 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;
}
@@ -4160,9 +4161,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;
}
@@ -4989,6 +4987,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;
}
@@ -5202,6 +5215,9 @@ void Heap::TearDown() {
delete object_stats_;
object_stats_ = nullptr;
+ delete scavenge_job_;
+ scavenge_job_ = nullptr;
+
WaitUntilUnmappingOfFreeChunksCompleted();
delete array_buffer_tracker_;
« no previous file with comments | « src/heap/heap.h ('k') | src/heap/incremental-marking.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698