Commit 2fe02ed4 authored by Michael Lippautz's avatar Michael Lippautz Committed by Commit Bot

Reland "[heap] Add histogram counter for young generation handling"

This reverts commit 9a407a43.

BUG=chromium:693413

Change-Id: I469dbba6b45982f3a083b30546c60e5dacc5d8a2
Reviewed-on: https://chromium-review.googlesource.com/445198
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#43334}
parent f5609a6c
......@@ -941,6 +941,7 @@ class RuntimeCallTimerScope {
HR(incremental_marking_reason, V8.GCIncrementalMarkingReason, 0, 21, 22) \
HR(mark_compact_reason, V8.GCMarkCompactReason, 0, 21, 22) \
HR(scavenge_reason, V8.GCScavengeReason, 0, 21, 22) \
HR(young_generation_handling, V8.GCYoungGenerationHandling, 0, 2, 3) \
/* Asm/Wasm. */ \
HR(wasm_functions_per_module, V8.WasmFunctionsPerModule, 1, 10000, 51)
......
......@@ -140,6 +140,13 @@ void GCTracer::ResetForTesting() {
start_counter_ = 0;
}
void GCTracer::NotifyYoungGenerationHandling(
YoungGenerationHandling young_generation_handling) {
DCHECK(current_.type == Event::SCAVENGER || start_counter_ > 1);
heap_->isolate()->counters()->young_generation_handling()->AddSample(
static_cast<int>(young_generation_handling));
}
void GCTracer::Start(GarbageCollector collector,
GarbageCollectionReason gc_reason,
const char* collector_reason) {
......
......@@ -236,6 +236,9 @@ class V8_EXPORT_PRIVATE GCTracer {
// Stop collecting data and print results.
void Stop(GarbageCollector collector);
void NotifyYoungGenerationHandling(
YoungGenerationHandling young_generation_handling);
// Sample and accumulate bytes allocated since the last GC.
void SampleAllocation(double current_ms, size_t new_space_counter_bytes,
size_t old_generation_counter_bytes);
......
......@@ -1358,10 +1358,17 @@ bool Heap::PerformGarbageCollection(
MinorMarkCompact();
break;
case SCAVENGER:
if (fast_promotion_mode_ && CanExpandOldGeneration(new_space()->Size()))
if (fast_promotion_mode_ &&
CanExpandOldGeneration(new_space()->Size())) {
tracer()->NotifyYoungGenerationHandling(
YoungGenerationHandling::kFastPromotionDuringScavenge);
EvacuateYoungGeneration();
else
} else {
tracer()->NotifyYoungGenerationHandling(
YoungGenerationHandling::kRegularScavenge);
Scavenge();
}
break;
}
......
......@@ -377,6 +377,17 @@ enum class GarbageCollectionReason {
// Also update src/tools/metrics/histograms/histograms.xml in chromium.
};
enum class YoungGenerationHandling {
kRegularScavenge = 0,
kFastPromotionDuringScavenge = 1,
// Histogram::InspectConstructionArguments in chromium requires us to have at
// least three buckets.
kUnusedBucket = 2,
// If you add new items here, then update the young_generation_handling in
// counters.h.
// Also update src/tools/metrics/histograms/histograms.xml in chromium.
};
// A queue of objects promoted during scavenge. Each object is accompanied by
// its size to avoid dereferencing a map pointer for scanning. The last page in
// to-space is used for the promotion queue. On conflict during scavenge, the
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment