[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/763368
Reviewed-by: Mythri Alle <mythria@chromium.org>
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49293}
This commit is contained in:
Leszek Swirski 2017-11-10 11:45:30 +00:00 committed by Commit Bot
parent 359e69e183
commit 693d7adb9f
2 changed files with 24 additions and 14 deletions

View File

@ -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,22 +1302,26 @@ 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_) {
return CacheBehaviour::kHitIsolateCacheWhenProduceCodeCache;
} else {
return CacheBehaviour::kProduceCodeCache;
}
}
if (consuming_code_cache_) {
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::kHitIsolateCache;
}
if (consuming_code_cache_) {
if (consuming_code_cache_failed_) {
return CacheBehaviour::kConsumeCodeCacheFailed;
}
return CacheBehaviour::kConsumeCodeCache;
return CacheBehaviour::kHitIsolateCacheWhenNoCache;
}
switch (no_cache_reason_) {
@ -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();

View File

@ -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. */ \