[sparkplug] Add always_sparkplug variant

Add an always_sparkplug testing variant, and fix a couple of issues it
found.

Bug: v8:11420
Change-Id: I7d87a41e3413f40271a0140118531f075d633b23
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2773047
Reviewed-by: Patrick Thier <pthier@chromium.org>
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Auto-Submit: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/master@{#73529}
This commit is contained in:
Leszek Swirski 2021-03-18 16:34:40 +01:00 committed by Commit Bot
parent baa83b38b7
commit 791e085d2f
9 changed files with 22 additions and 7 deletions

View File

@ -1410,6 +1410,7 @@ bool CompileAllWithBaseline(Isolate* isolate,
Handle<SharedFunctionInfo> shared_info = finalize_data.function_handle(); Handle<SharedFunctionInfo> shared_info = finalize_data.function_handle();
IsCompiledScope is_compiled_scope(*shared_info, isolate); IsCompiledScope is_compiled_scope(*shared_info, isolate);
if (!is_compiled_scope.is_compiled()) continue; if (!is_compiled_scope.is_compiled()) continue;
if (!CanCompileWithBaseline(isolate, shared_info)) continue;
if (!CompileSharedWithBaseline(isolate, shared_info, flag, if (!CompileSharedWithBaseline(isolate, shared_info, flag,
&is_compiled_scope)) { &is_compiled_scope)) {
return false; return false;

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// Flags: --allow-natives-syntax --sparkplug // Flags: --allow-natives-syntax --sparkplug --no-always-sparkplug
// Tier-up across Realms // Tier-up across Realms

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// Flags: --allow-natives-syntax --super-ic --sparkplug // Flags: --allow-natives-syntax --super-ic --sparkplug --no-always-sparkplug
export let exported = 17; export let exported = 17;
import imported from 'test-baseline-module-helper.mjs'; import imported from 'test-baseline-module-helper.mjs';

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// Flags: --allow-natives-syntax --super-ic --sparkplug // Flags: --allow-natives-syntax --super-ic --sparkplug --no-always-sparkplug
function run(f, ...args) { function run(f, ...args) {
try { f(...args); } catch (e) {} try { f(...args); } catch (e) {}

View File

@ -193,6 +193,9 @@ var isInterpreted;
// Returns true if given function in baseline. // Returns true if given function in baseline.
var isBaseline; var isBaseline;
// Returns true if given function in unoptimized (interpreted or baseline).
var isUnoptimized;
// Returns true if given function is optimized. // Returns true if given function is optimized.
var isOptimized; var isOptimized;
@ -681,8 +684,7 @@ var prettyPrinted;
return; return;
} }
var is_optimized = (opt_status & V8OptimizationStatus.kOptimized) !== 0; var is_optimized = (opt_status & V8OptimizationStatus.kOptimized) !== 0;
var is_baseline = (opt_status & V8OptimizationStatus.kBaseline) !== 0; assertFalse(is_optimized, name_opt);
assertFalse(is_optimized && !is_baseline, name_opt);
} }
assertOptimized = function assertOptimized( assertOptimized = function assertOptimized(
@ -745,6 +747,10 @@ var prettyPrinted;
(opt_status & V8OptimizationStatus.kBaseline) !== 0; (opt_status & V8OptimizationStatus.kBaseline) !== 0;
} }
isUnoptimized = function isUnoptimized(fun) {
return isInterpreted(fun) || isBaseline(fun);
}
isOptimized = function isOptimized(fun) { isOptimized = function isOptimized(fun) {
var opt_status = OptimizationStatus(fun, ""); var opt_status = OptimizationStatus(fun, "");
assertTrue((opt_status & V8OptimizationStatus.kIsFunction) !== 0, assertTrue((opt_status & V8OptimizationStatus.kIsFunction) !== 0,

View File

@ -25,7 +25,7 @@ assertFalse(isNeverOptimize());
if (i == 1) { if (i == 1) {
// f must be interpreted code. // f must be interpreted code.
assertTrue(isInterpreted(f)); assertTrue(isUnoptimized(f));
// Run twice (i = 0, 1), then tier-up. // Run twice (i = 0, 1), then tier-up.
%OptimizeFunctionOnNextCall(f); %OptimizeFunctionOnNextCall(f);

View File

@ -23,5 +23,7 @@ assertOptimized = () => {};
isNeverOptimize = () => {}; isNeverOptimize = () => {};
isAlwaysOptimize = () => {}; isAlwaysOptimize = () => {};
isInterpreted = () => {}; isInterpreted = () => {};
isBaseline = () => {};
isUnoptimized = () => {};
isOptimized = () => {}; isOptimized = () => {};
isTurboFanned = () => {}; isTurboFanned = () => {};

View File

@ -89,6 +89,10 @@ try {
isInterpreted = function isInterpreted() {} isInterpreted = function isInterpreted() {}
isBaseline = function isBaseline() {}
isUnoptimized = function isUnoptimized() {}
isOptimized = function isOptimized() {} isOptimized = function isOptimized() {}
isTurboFanned = function isTurboFanned() {} isTurboFanned = function isTurboFanned() {}

View File

@ -15,6 +15,7 @@ ALL_VARIANT_FLAGS = {
"experimental_regexp": [["--default-to-experimental-regexp-engine"]], "experimental_regexp": [["--default-to-experimental-regexp-engine"]],
"jitless": [["--jitless"]], "jitless": [["--jitless"]],
"sparkplug": [["--sparkplug"]], "sparkplug": [["--sparkplug"]],
"always_sparkplug": [[ "--always-sparkplug" ]],
"minor_mc": [["--minor-mc"]], "minor_mc": [["--minor-mc"]],
"no_lfa": [["--no-lazy-feedback-allocation"]], "no_lfa": [["--no-lazy-feedback-allocation"]],
# No optimization means disable all optimizations. OptimizeFunctionOnNextCall # No optimization means disable all optimizations. OptimizeFunctionOnNextCall
@ -61,7 +62,8 @@ INCOMPATIBLE_FLAGS_PER_VARIANT = {
"stress_js_bg_compile_wasm_code_gc": ["--no-stress-background-compile", "--parallel-compile-tasks"], "stress_js_bg_compile_wasm_code_gc": ["--no-stress-background-compile", "--parallel-compile-tasks"],
"stress": ["--no-stress-opt", "--always-opt", "--no-always-opt", "--liftoff", "--max-inlined-bytecode-size=*", "stress": ["--no-stress-opt", "--always-opt", "--no-always-opt", "--liftoff", "--max-inlined-bytecode-size=*",
"--max-inlined-bytecode-size-cumulative=*", "--stress-inline"], "--max-inlined-bytecode-size-cumulative=*", "--stress-inline"],
"sparkplug": ["--jitless"], "sparkplug": ["--jitless", "--no-sparkplug" ],
"always_sparkplug": [ "--jitless", "--no-sparkplug", "--no-always-sparkplug" ],
"turboprop": ["--interrupt-budget=*", "--no-turbo-direct-heap-access", "--no-turboprop"], "turboprop": ["--interrupt-budget=*", "--no-turbo-direct-heap-access", "--no-turboprop"],
"turboprop_as_toptier": ["--interrupt-budget=*", "--no-turbo-direct-heap-access", "--no-turboprop", "--no-turboprop-as-toptier"], "turboprop_as_toptier": ["--interrupt-budget=*", "--no-turbo-direct-heap-access", "--no-turboprop", "--no-turboprop-as-toptier"],
"code_serializer": ["--cache=after-execute", "--cache=full-code-cache", "--cache=none"], "code_serializer": ["--cache=after-execute", "--cache=full-code-cache", "--cache=none"],