[compiler] Add new "no cache reason" enum values

Add enum values to the "no cache reason" API which reflect new types of
no-cache reason we will want to distinguish.

Also, renames one of the enum values (BecauseExtension ->
BecauseV8Extension) because it was confusing. It's a V8-only type of no
cache reason, so it shouldn't affect embedders.

Bug: chromium:769203
Cq-Include-Trybots: master.tryserver.chromium.linux:linux_chromium_rel_ng
Change-Id: I41d4ecfb35b2e91b71562b4f23b15d20f16a943c
Reviewed-on: https://chromium-review.googlesource.com/769010
Reviewed-by: Mythri Alle <mythria@chromium.org>
Reviewed-by: Adam Klein <adamk@chromium.org>
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49367}
This commit is contained in:
Leszek Swirski 2017-11-14 16:48:34 +00:00 committed by Commit Bot
parent 98c40a4bae
commit 61e04e2867
4 changed files with 22 additions and 7 deletions

View File

@ -1449,7 +1449,10 @@ class V8_EXPORT ScriptCompiler {
kNoCacheBecauseInspector,
kNoCacheBecauseScriptTooSmall,
kNoCacheBecauseCacheTooCold,
kNoCacheBecauseExtension,
kNoCacheBecauseV8Extension,
kNoCacheBecauseExtensionModule,
kNoCacheBecausePacScript,
kNoCacheBecauseInDocumentWrite
};
/**

View File

@ -3759,7 +3759,7 @@ bool Genesis::CompileExtension(Isolate* isolate, v8::Extension* extension) {
source, script_name, 0, 0, ScriptOriginOptions(),
MaybeHandle<Object>(), context, extension, nullptr,
ScriptCompiler::kNoCompileOptions,
ScriptCompiler::kNoCacheBecauseExtension, EXTENSION_CODE,
ScriptCompiler::kNoCacheBecauseV8Extension, EXTENSION_CODE,
MaybeHandle<FixedArray>());
if (!maybe_function_info.ToHandle(&function_info)) return false;
cache->Add(name, function_info);

View File

@ -1251,9 +1251,12 @@ struct ScriptCompileTimerScope {
kNoCacheBecauseCachingDisabled,
kNoCacheBecauseModule,
kNoCacheBecauseStreamingSource,
kNoCacheBecauseExtension,
kNoCacheBecauseV8Extension,
kHitIsolateCacheWhenProduceCodeCache,
kHitIsolateCacheWhenConsumeCodeCache,
kNoCacheBecauseExtensionModule,
kNoCacheBecausePacScript,
kNoCacheBecauseInDocumentWrite,
kCount
};
@ -1350,8 +1353,14 @@ struct ScriptCompileTimerScope {
return CacheBehaviour::kNoCacheBecauseModule;
case ScriptCompiler::kNoCacheBecauseStreamingSource:
return CacheBehaviour::kNoCacheBecauseStreamingSource;
case ScriptCompiler::kNoCacheBecauseExtension:
return CacheBehaviour::kNoCacheBecauseExtension;
case ScriptCompiler::kNoCacheBecauseV8Extension:
return CacheBehaviour::kNoCacheBecauseV8Extension;
case ScriptCompiler::kNoCacheBecauseExtensionModule:
return CacheBehaviour::kNoCacheBecauseExtensionModule;
case ScriptCompiler::kNoCacheBecausePacScript:
return CacheBehaviour::kNoCacheBecausePacScript;
case ScriptCompiler::kNoCacheBecauseInDocumentWrite:
return CacheBehaviour::kNoCacheBecauseInDocumentWrite;
}
UNREACHABLE();
}
@ -1394,7 +1403,10 @@ struct ScriptCompileTimerScope {
// TODO(leszeks): Count separately or remove entirely once we have
// background compilation.
case CacheBehaviour::kNoCacheBecauseStreamingSource:
case CacheBehaviour::kNoCacheBecauseExtension:
case CacheBehaviour::kNoCacheBecauseV8Extension:
case CacheBehaviour::kNoCacheBecauseExtensionModule:
case CacheBehaviour::kNoCacheBecausePacScript:
case CacheBehaviour::kNoCacheBecauseInDocumentWrite:
return isolate_->counters()->compile_script_no_cache_other();
case CacheBehaviour::kCount:

View File

@ -1065,7 +1065,7 @@ class RuntimeCallTimerScope {
20) \
HR(wasm_lazy_compilation_throughput, V8.WasmLazyCompilationThroughput, 1, \
10000, 50) \
HR(compile_script_cache_behaviour, V8.CompileScript.CacheBehaviour, 0, 15, 16)
HR(compile_script_cache_behaviour, V8.CompileScript.CacheBehaviour, 0, 18, 19)
#define HISTOGRAM_TIMER_LIST(HT) \
/* Garbage collection timers. */ \