Add new options to CompileOptions and NoCacheReason

Now that we have an API to request code cache, we want to decouple
compilation from serialization. As a first step, we will add CompileEager
option (used when we want to produce full code cache) and
DeferredProduceCodeOption to NoCacheReason. This is so that we can
properly bucket the compilation time and collect statistics about the
cache behaviour. Once, blink and node start using the new API, we can
remove the code to produce code cache from the compilation.

Bug: chromium:783124
Cq-Include-Trybots: master.tryserver.chromium.linux:linux_chromium_rel_ng
Change-Id: I35dbb6b0af39940450d412ff75b769603398b2f6
Reviewed-on: https://chromium-review.googlesource.com/828977
Commit-Queue: Mythri Alle <mythria@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#50336}
This commit is contained in:
Mythri 2017-12-18 10:18:34 +00:00 committed by Commit Bot
parent ca16cc2337
commit c5eb79e6aa
2 changed files with 14 additions and 4 deletions

View File

@ -1423,7 +1423,8 @@ class V8_EXPORT ScriptCompiler {
kConsumeParserCache,
kProduceCodeCache,
kProduceFullCodeCache,
kConsumeCodeCache
kConsumeCodeCache,
kEagerCompile
};
/**
@ -1443,7 +1444,8 @@ class V8_EXPORT ScriptCompiler {
kNoCacheBecauseExtensionModule,
kNoCacheBecausePacScript,
kNoCacheBecauseInDocumentWrite,
kNoCacheBecauseResourceWithNoCacheHandler
kNoCacheBecauseResourceWithNoCacheHandler,
kNoCacheBecauseDeferredProduceCodeCache
};
/**

View File

@ -1412,6 +1412,13 @@ struct ScriptCompileTimerScope {
return CacheBehaviour::kNoCacheBecauseInDocumentWrite;
case ScriptCompiler::kNoCacheBecauseResourceWithNoCacheHandler:
return CacheBehaviour::kNoCacheBecauseResourceWithNoCacheHandler;
case ScriptCompiler::kNoCacheBecauseDeferredProduceCodeCache: {
if (hit_isolate_cache_) {
return CacheBehaviour::kHitIsolateCacheWhenProduceCodeCache;
} else {
return CacheBehaviour::kProduceCodeCache;
}
}
}
UNREACHABLE();
}
@ -1602,8 +1609,9 @@ MaybeHandle<SharedFunctionInfo> Compiler::GetSharedFunctionInfoForScript(
if (!context->IsNativeContext()) {
parse_info.set_outer_scope_info(handle(context->scope_info()));
}
parse_info.set_eager(compile_options ==
ScriptCompiler::kProduceFullCodeCache);
parse_info.set_eager(
(compile_options == ScriptCompiler::kProduceFullCodeCache) ||
(compile_options == ScriptCompiler::kEagerCompile));
parse_info.set_language_mode(
stricter_language_mode(parse_info.language_mode(), language_mode));