Skip to content

Commit

Permalink
[Compile] Track cases where a script is in the isolate cache but was …
Browse files Browse the repository at this point in the history
…streaming parse/compiled.

We want to limit these cases since they result in unecessary work on background threads
doing the streaming parse / compile, and delay the script execution unecessarily
while waiting for the streamer to complete.

BUG=chromium:865098

Change-Id: Ibb3346c2e644bb333521d876d00aeb9cc063b6aa
Reviewed-on: https://chromium-review.googlesource.com/1163669
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Ross McIlroy <rmcilroy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#54929}
  • Loading branch information
rmcilroy authored and Commit Bot committed Aug 6, 2018
1 parent c38f52f commit 083c5a6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 5 additions & 2 deletions src/compiler.cc
Expand Up @@ -1383,6 +1383,7 @@ struct ScriptCompileTimerScope {
kNoCacheBecausePacScript,
kNoCacheBecauseInDocumentWrite,
kNoCacheBecauseResourceWithNoCacheHandler,
kHitIsolateCacheWhenStreamingSource,
kCount
};

Expand Down Expand Up @@ -1455,8 +1456,9 @@ struct ScriptCompileTimerScope {
}

if (hit_isolate_cache_) {
// There's probably no need to distinguish the different isolate cache
// hits.
if (no_cache_reason_ == ScriptCompiler::kNoCacheBecauseStreamingSource) {
return CacheBehaviour::kHitIsolateCacheWhenStreamingSource;
}
return CacheBehaviour::kHitIsolateCacheWhenNoCache;
}

Expand Down Expand Up @@ -1510,6 +1512,7 @@ struct ScriptCompileTimerScope {
return isolate_->counters()->compile_script_with_produce_cache();
case CacheBehaviour::kHitIsolateCacheWhenNoCache:
case CacheBehaviour::kHitIsolateCacheWhenConsumeCodeCache:
case CacheBehaviour::kHitIsolateCacheWhenStreamingSource:
return isolate_->counters()->compile_script_with_isolate_cache_hit();
case CacheBehaviour::kConsumeCodeCacheFailed:
return isolate_->counters()->compile_script_consume_failed();
Expand Down
4 changes: 2 additions & 2 deletions src/counters.h
Expand Up @@ -1171,8 +1171,8 @@ class RuntimeCallTimerScope {
20) \
HR(wasm_lazy_compilation_throughput, V8.WasmLazyCompilationThroughput, 1, \
10000, 50) \
HR(compile_script_cache_behaviour, V8.CompileScript.CacheBehaviour, 0, 19, \
20) \
HR(compile_script_cache_behaviour, V8.CompileScript.CacheBehaviour, 0, 20, \
21) \
HR(wasm_memory_allocation_result, V8.WasmMemoryAllocationResult, 0, 3, 4) \
HR(wasm_address_space_usage_mb, V8.WasmAddressSpaceUsageMiB, 0, 1 << 20, \
128) \
Expand Down

0 comments on commit 083c5a6

Please sign in to comment.