Commit 693d7adb authored by Leszek Swirski's avatar Leszek Swirski Committed by Commit Bot

[compiler] Log isolate cache hits conflicting with code cache

Keep separate track of isolate cache hits that conflict with
producing/consuming the code cache, so that we can see how many code
cache hits are "stolen" by the isolate cache, and how many isolate cache
entries are "wasted" by recompiling for cache production.

Bug: chromium:769203
Change-Id: I3d8dbfc6a8981b779eb073176454ad43dfbcbaaf
Reviewed-on: https://chromium-review.googlesource.com/763368Reviewed-by: 's avatarMythri Alle <mythria@chromium.org>
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49293}
parent 359e69e1
......@@ -1232,7 +1232,7 @@ struct ScriptCompileTimerScope {
public:
enum class CacheBehaviour {
kProduceCodeCache,
kHitIsolateCache,
kHitIsolateCacheWhenNoCache,
kConsumeCodeCache,
kConsumeCodeCacheFailed,
kNoCacheBecauseInlineScript,
......@@ -1245,6 +1245,8 @@ struct ScriptCompileTimerScope {
kNoCacheBecauseModule,
kNoCacheBecauseStreamingSource,
kNoCacheBecauseExtension,
kHitIsolateCacheWhenProduceCodeCache,
kHitIsolateCacheWhenConsumeCodeCache,
kCount
};
......@@ -1300,24 +1302,28 @@ struct ScriptCompileTimerScope {
CacheBehaviour GetCacheBehaviour() {
if (producing_code_cache_) {
// Even if we hit the isolate's compilation cache, we currently recompile
// when we want to produce the code cache.
return CacheBehaviour::kProduceCodeCache;
}
if (hit_isolate_cache_) {
// There's probably no need to distinguish the different isolate cache
// hits.
return CacheBehaviour::kHitIsolateCache;
if (hit_isolate_cache_) {
return CacheBehaviour::kHitIsolateCacheWhenProduceCodeCache;
} else {
return CacheBehaviour::kProduceCodeCache;
}
}
if (consuming_code_cache_) {
if (consuming_code_cache_failed_) {
if (hit_isolate_cache_) {
return CacheBehaviour::kHitIsolateCacheWhenConsumeCodeCache;
} else if (consuming_code_cache_failed_) {
return CacheBehaviour::kConsumeCodeCacheFailed;
}
return CacheBehaviour::kConsumeCodeCache;
}
if (hit_isolate_cache_) {
// There's probably no need to distinguish the different isolate cache
// hits.
return CacheBehaviour::kHitIsolateCacheWhenNoCache;
}
switch (no_cache_reason_) {
case ScriptCompiler::kNoCacheBecauseInlineScript:
return CacheBehaviour::kNoCacheBecauseInlineScript;
......@@ -1347,8 +1353,12 @@ struct ScriptCompileTimerScope {
CacheBehaviour cache_behaviour) {
switch (cache_behaviour) {
case CacheBehaviour::kProduceCodeCache:
// Even if we hit the isolate's compilation cache, we currently recompile
// when we want to produce the code cache.
case CacheBehaviour::kHitIsolateCacheWhenProduceCodeCache:
return isolate_->counters()->compile_script_with_produce_cache();
case CacheBehaviour::kHitIsolateCache:
case CacheBehaviour::kHitIsolateCacheWhenNoCache:
case CacheBehaviour::kHitIsolateCacheWhenConsumeCodeCache:
return isolate_->counters()->compile_script_with_isolate_cache_hit();
case CacheBehaviour::kConsumeCodeCacheFailed:
return isolate_->counters()->compile_script_consume_failed();
......
......@@ -1060,7 +1060,7 @@ class RuntimeCallTimerScope {
20) \
HR(wasm_lazy_compilation_throughput, V8.WasmLazyCompilationThroughput, 1, \
10000, 50) \
HR(compile_script_cache_behaviour, V8.CompileScript.CacheBehaviour, 0, 13, 14)
HR(compile_script_cache_behaviour, V8.CompileScript.CacheBehaviour, 0, 15, 16)
#define HISTOGRAM_TIMER_LIST(HT) \
/* Garbage collection timers. */ \
......
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