Commit 16a7150b authored by Seth Brenith's avatar Seth Brenith Committed by V8 LUCI CQ

Reland "Disable recompilation of existing Scripts from Isolate compilation cache"

This is a reland of commit a7607221

The bug exposed by landing this change the first time has been fixed
separately in https://crrev.com/c/3654413 .

Original change's description:
> Disable recompilation of existing Scripts from Isolate compilation cache
>
> My previous change https://crrev.com/c/3597106 led to some performance
> regressions in time spent on parsing and compilation. This change
> disables the ability to recompile an existing uncompiled Script, as an
> attempt to both fix the regressions and isolate which part of the
> previous change was the cause of those problems.
>
> Bug: v8:12808, chromium:1325566, chromium:1325567, chromium:1325601
> Change-Id: Ifa086bf27070da8f4b3c0e4415af5ca7b6706b0a
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3652252
> Reviewed-by: Leszek Swirski <leszeks@chromium.org>
> Commit-Queue: Seth Brenith <seth.brenith@microsoft.com>
> Cr-Commit-Position: refs/heads/main@{#80616}

Bug: v8:12808, chromium:1325566, chromium:1325567, chromium:1325601
Change-Id: Ib31864bef90ff3340d1dfd4e25e21bef121f2d49
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3655011Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Commit-Queue: Seth Brenith <seth.brenith@microsoft.com>
Cr-Commit-Position: refs/heads/main@{#80645}
parent 4a6e65bf
...@@ -3043,7 +3043,9 @@ MaybeHandle<SharedFunctionInfo> GetSharedFunctionInfoForScriptImpl( ...@@ -3043,7 +3043,9 @@ MaybeHandle<SharedFunctionInfo> GetSharedFunctionInfoForScriptImpl(
// First check per-isolate compilation cache. // First check per-isolate compilation cache.
CompilationCacheScript::LookupResult lookup_result = CompilationCacheScript::LookupResult lookup_result =
compilation_cache->LookupScript(source, script_details, language_mode); compilation_cache->LookupScript(source, script_details, language_mode);
maybe_script = lookup_result.script(); if (FLAG_isolate_script_cache_recompilation) {
maybe_script = lookup_result.script();
}
maybe_result = lookup_result.toplevel_sfi(); maybe_result = lookup_result.toplevel_sfi();
is_compiled_scope = lookup_result.is_compiled_scope(); is_compiled_scope = lookup_result.is_compiled_scope();
if (!maybe_result.is_null()) { if (!maybe_result.is_null()) {
......
...@@ -959,6 +959,9 @@ DEFINE_BOOL(turbo_collect_feedback_in_generic_lowering, true, ...@@ -959,6 +959,9 @@ DEFINE_BOOL(turbo_collect_feedback_in_generic_lowering, true,
"enable experimental feedback collection in generic lowering.") "enable experimental feedback collection in generic lowering.")
DEFINE_BOOL(isolate_script_cache_ageing, true, DEFINE_BOOL(isolate_script_cache_ageing, true,
"enable ageing of the isolate script cache.") "enable ageing of the isolate script cache.")
DEFINE_BOOL(isolate_script_cache_recompilation, false,
"enable recompiling an existing Script from the Isolate cache when "
"there is not a compiled top-level SharedFunctionInfo")
DEFINE_FLOAT(script_delay, 0, "busy wait [ms] on every Script::Run") DEFINE_FLOAT(script_delay, 0, "busy wait [ms] on every Script::Run")
DEFINE_FLOAT(script_delay_once, 0, "busy wait [ms] on the first Script::Run") DEFINE_FLOAT(script_delay_once, 0, "busy wait [ms] on the first Script::Run")
......
...@@ -1578,6 +1578,12 @@ void CompilationCacheRegeneration(bool retain_root_sfi, bool flush_root_sfi, ...@@ -1578,6 +1578,12 @@ void CompilationCacheRegeneration(bool retain_root_sfi, bool flush_root_sfi,
return; return;
} }
// If the compiler is configured to not recompile a flushed root SFI, then
// this test is invalid.
if (flush_root_sfi && !FLAG_isolate_script_cache_recompilation) {
return;
}
// TODO(v8:12808): Remove this check once background compilation is capable of // TODO(v8:12808): Remove this check once background compilation is capable of
// reusing an existing Script. // reusing an existing Script.
if (flush_root_sfi && FLAG_stress_background_compile) { if (flush_root_sfi && FLAG_stress_background_compile) {
......
...@@ -23951,6 +23951,12 @@ TEST(StreamingWithIsolateScriptCacheClearingRootSFI) { ...@@ -23951,6 +23951,12 @@ TEST(StreamingWithIsolateScriptCacheClearingRootSFI) {
return; return;
} }
// If the compiler is configured to not recompile a flushed root SFI, then
// this test is invalid.
if (!v8::internal::FLAG_isolate_script_cache_recompilation) {
return;
}
StreamingWithIsolateScriptCache(true); StreamingWithIsolateScriptCache(true);
} }
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