Commit c5eb79e6 authored by Mythri's avatar Mythri Committed by Commit Bot

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: 's avatarYang Guo <yangguo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#50336}
parent ca16cc23
...@@ -1423,7 +1423,8 @@ class V8_EXPORT ScriptCompiler { ...@@ -1423,7 +1423,8 @@ class V8_EXPORT ScriptCompiler {
kConsumeParserCache, kConsumeParserCache,
kProduceCodeCache, kProduceCodeCache,
kProduceFullCodeCache, kProduceFullCodeCache,
kConsumeCodeCache kConsumeCodeCache,
kEagerCompile
}; };
/** /**
...@@ -1443,7 +1444,8 @@ class V8_EXPORT ScriptCompiler { ...@@ -1443,7 +1444,8 @@ class V8_EXPORT ScriptCompiler {
kNoCacheBecauseExtensionModule, kNoCacheBecauseExtensionModule,
kNoCacheBecausePacScript, kNoCacheBecausePacScript,
kNoCacheBecauseInDocumentWrite, kNoCacheBecauseInDocumentWrite,
kNoCacheBecauseResourceWithNoCacheHandler kNoCacheBecauseResourceWithNoCacheHandler,
kNoCacheBecauseDeferredProduceCodeCache
}; };
/** /**
......
...@@ -1412,6 +1412,13 @@ struct ScriptCompileTimerScope { ...@@ -1412,6 +1412,13 @@ struct ScriptCompileTimerScope {
return CacheBehaviour::kNoCacheBecauseInDocumentWrite; return CacheBehaviour::kNoCacheBecauseInDocumentWrite;
case ScriptCompiler::kNoCacheBecauseResourceWithNoCacheHandler: case ScriptCompiler::kNoCacheBecauseResourceWithNoCacheHandler:
return CacheBehaviour::kNoCacheBecauseResourceWithNoCacheHandler; return CacheBehaviour::kNoCacheBecauseResourceWithNoCacheHandler;
case ScriptCompiler::kNoCacheBecauseDeferredProduceCodeCache: {
if (hit_isolate_cache_) {
return CacheBehaviour::kHitIsolateCacheWhenProduceCodeCache;
} else {
return CacheBehaviour::kProduceCodeCache;
}
}
} }
UNREACHABLE(); UNREACHABLE();
} }
...@@ -1602,8 +1609,9 @@ MaybeHandle<SharedFunctionInfo> Compiler::GetSharedFunctionInfoForScript( ...@@ -1602,8 +1609,9 @@ MaybeHandle<SharedFunctionInfo> Compiler::GetSharedFunctionInfoForScript(
if (!context->IsNativeContext()) { if (!context->IsNativeContext()) {
parse_info.set_outer_scope_info(handle(context->scope_info())); parse_info.set_outer_scope_info(handle(context->scope_info()));
} }
parse_info.set_eager(compile_options == parse_info.set_eager(
ScriptCompiler::kProduceFullCodeCache); (compile_options == ScriptCompiler::kProduceFullCodeCache) ||
(compile_options == ScriptCompiler::kEagerCompile));
parse_info.set_language_mode( parse_info.set_language_mode(
stricter_language_mode(parse_info.language_mode(), language_mode)); stricter_language_mode(parse_info.language_mode(), language_mode));
......
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