Commit 9137237b authored by Jakob Gruber's avatar Jakob Gruber Committed by Commit Bot

[nci] Add flags to configure NCI codegen and ageing

Codegen timing and cache ageing are two important parameters for NCI
performance. This adds runtime flags for them:

 --turbo-nci-cache-ageing (default: false)
 --turbo-nci-delayed-codegen (default: true)

Note the behavioral change of disabling ageing by default for now.

Bug: v8:8888
Change-Id: Id9611185566f5c4828ad48e58c42424833d3323b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2438456
Commit-Queue: Michael Stanton <mvstanton@chromium.org>
Reviewed-by: 's avatarMichael Stanton <mvstanton@chromium.org>
Auto-Submit: Jakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#70303}
parent 471a8937
......@@ -76,8 +76,10 @@ void CompilationCacheScript::Age() { AgeCustom(this); }
void CompilationCacheEval::Age() { AgeCustom(this); }
void CompilationCacheRegExp::Age() { AgeByGeneration(this); }
void CompilationCacheCode::Age() {
if (FLAG_turbo_nci_cache_ageing) {
if (FLAG_trace_turbo_nci) CompilationCacheCode::TraceAgeing();
AgeByGeneration(this);
}
}
void CompilationSubCache::Iterate(RootVisitor* v) {
......
......@@ -740,6 +740,14 @@ DEFINE_BOOL(print_nci_code, false, "print native context independent code.")
DEFINE_BOOL(trace_turbo_nci, false, "trace native context independent code.")
DEFINE_BOOL(turbo_collect_feedback_in_generic_lowering, true,
"enable experimental feedback collection in generic lowering.")
// TODO(jgruber,v8:8888): Remove this flag once we've settled on a codegen
// strategy.
DEFINE_BOOL(turbo_nci_delayed_codegen, true,
"delay NCI codegen to reduce useless compilation work.")
// TODO(jgruber,v8:8888): Remove this flag once we've settled on an ageing
// strategy.
DEFINE_BOOL(turbo_nci_cache_ageing, false,
"enable ageing of the NCI code cache.")
// Favor memory over execution speed.
DEFINE_BOOL(optimize_for_size, false,
......
......@@ -78,12 +78,13 @@ Object CompileOptimized(Isolate* isolate, Handle<JSFunction> function,
// Possibly compile for NCI caching.
if (MaybeSpawnNativeContextIndependentCompilationJob()) {
// The first optimization request does not trigger NCI compilation,
// since we try to avoid compiling Code that remains unused in the future.
// Repeated optimization (possibly in different native contexts) is taken
// as a signal that this SFI will continue to be used in the future, thus
// we trigger NCI compilation.
if (function->shared().has_optimized_at_least_once()) {
// If delayed codegen is enabled, the first optimization request does not
// trigger NCI compilation, since we try to avoid compiling Code that
// remains unused in the future. Repeated optimization (possibly in
// different native contexts) is taken as a signal that this SFI will
// continue to be used in the future, thus we trigger NCI compilation.
if (!FLAG_turbo_nci_delayed_codegen ||
function->shared().has_optimized_at_least_once()) {
if (!Compiler::CompileOptimized(function, mode,
CodeKind::NATIVE_CONTEXT_INDEPENDENT)) {
return ReadOnlyRoots(isolate).exception();
......
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