Reviewers: ulan,
Description:
Reduce context disposal gc overhead.
BUG=
Please review this at https://codereview.chromium.org/750963002/
Base URL: https://chromium.googlesource.com/v8/v8.git@master
Affected files (+15, -5 lines):
M src/heap/gc-idle-time-handler.h
M src/heap/gc-idle-time-handler.cc
M src/heap/gc-tracer.cc
M src/heap/heap.cc
Index: src/heap/gc-idle-time-handler.cc
diff --git a/src/heap/gc-idle-time-handler.cc
b/src/heap/gc-idle-time-handler.cc
index
beede4cdee3723c2d1be759fead90382c5f49304..4103b78a348c81e3be0b60b030a04d107eaa4ea1
100644
--- a/src/heap/gc-idle-time-handler.cc
+++ b/src/heap/gc-idle-time-handler.cc
@@ -142,6 +142,13 @@ bool GCIdleTimeHandler::ShouldDoMarkCompact(
}
+bool GCIdleTimeHandler::ShouldDoContextDisposalMarkCompact(
+ bool context_disposed, double contexts_disposal_rate) {
+ return context_disposed && contexts_disposal_rate > 0 &&
+ contexts_disposal_rate < kHighContextDisposalRate;
+}
+
+
// The following logic is implemented by the controller:
// (1) If we don't have any idle time, do nothing, unless a context was
// disposed, incremental marking is stopped, and the heap is small. Then do
@@ -163,8 +170,9 @@ GCIdleTimeAction GCIdleTimeHandler::Compute(size_t
idle_time_in_ms,
HeapState heap_state) {
if (idle_time_in_ms == 0) {
if (heap_state.incremental_marking_stopped) {
- if (heap_state.contexts_disposed > 0 &&
- heap_state.contexts_disposal_rate < kHighContextDisposalRate) {
+ if (ShouldDoContextDisposalMarkCompact(
+ heap_state.contexts_disposed,
+ heap_state.contexts_disposal_rate)) {
return GCIdleTimeAction::FullGC();
}
}
Index: src/heap/gc-idle-time-handler.h
diff --git a/src/heap/gc-idle-time-handler.h
b/src/heap/gc-idle-time-handler.h
index
afb177d41d6bf7e17bff52570d8cff620c9c9924..e3a74627e56dd7da81fd3699cbae20c3bcfaa719
100644
--- a/src/heap/gc-idle-time-handler.h
+++ b/src/heap/gc-idle-time-handler.h
@@ -162,6 +162,9 @@ class GCIdleTimeHandler {
size_t size_of_objects,
size_t
mark_compact_speed_in_bytes_per_ms);
+ static bool ShouldDoContextDisposalMarkCompact(bool context_disposed,
+ double
contexts_disposal_rate);
+
static bool ShouldDoScavenge(
size_t idle_time_in_ms, size_t new_space_size, size_t
used_new_space_size,
size_t scavenger_speed_in_bytes_per_ms,
Index: src/heap/gc-tracer.cc
diff --git a/src/heap/gc-tracer.cc b/src/heap/gc-tracer.cc
index
6d7231e9eda6ffb949bc6c389961c736ba0e0461..046ac2cd225766d3f3a422df495c1ac37e13a1d9
100644
--- a/src/heap/gc-tracer.cc
+++ b/src/heap/gc-tracer.cc
@@ -490,7 +490,7 @@ intptr_t
GCTracer::NewSpaceAllocationThroughputInBytesPerMillisecond() const {
double GCTracer::ContextDisposalRateInMilliseconds() const {
- if (context_disposal_events_.size() == 0) return 0.0;
+ if (context_disposal_events_.size() < kRingBufferMaxSize) return 0.0;
double begin = base::OS::TimeCurrentMillis();
double end = 0.0;
Index: src/heap/heap.cc
diff --git a/src/heap/heap.cc b/src/heap/heap.cc
index
9785be0b91d59785a5b38a6da7ac38006ed8bfa2..154a1ae8ed62851ef931f58af36d97d84f3da5ac
100644
--- a/src/heap/heap.cc
+++ b/src/heap/heap.cc
@@ -4451,8 +4451,7 @@ bool Heap::IdleNotification(int idle_time_in_ms) {
case DO_FULL_GC: {
HistogramTimerScope scope(isolate_->counters()->gc_context());
if (contexts_disposed_) {
- CollectAllGarbage(kReduceMemoryFootprintMask,
- "idle notification: contexts disposed");
+ CollectAllGarbage(kNoGCFlags, "idle notification: contexts
disposed");
gc_idle_time_handler_.NotifyIdleMarkCompact();
gc_count_at_last_idle_gc_ = gc_count_;
} else {
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.