Commit be1fcdc9 authored by Maya Lekova's avatar Maya Lekova Committed by V8 LUCI CQ

[test] Introduce a d8-only flag for fast calls

This CL introduces a d8-only flag --expose-fast-api which enables the
test FastCAPI object if the --turbo-fast-api-calls flag is enabled. It
also disables --stress-snapshot, which is incompatible with fast calls.

Bug: v8:12137
Change-Id: I01e8321726b78be660fd6554225999bfc94006c3
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3117485Reviewed-by: 's avatarToon Verwaest <verwaest@chromium.org>
Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Commit-Queue: Maya Lekova <mslekova@chromium.org>
Cr-Commit-Position: refs/heads/main@{#76505}
parent 48ed752a
......@@ -3007,7 +3007,7 @@ Local<ObjectTemplate> Shell::CreateD8Template(Isolate* isolate) {
// Correctness fuzzing will attempt to compare results of tests with and
// without turbo_fast_api_calls, so we don't expose the fast_c_api
// constructor when --correctness_fuzzer_suppressions is on.
if (i::FLAG_turbo_fast_api_calls &&
if (options.expose_fast_api && i::FLAG_turbo_fast_api_calls &&
!i::FLAG_correctness_fuzzer_suppressions) {
test_template->Set(isolate, "FastCAPI",
Shell::CreateTestFastCApiTemplate(isolate));
......@@ -4397,6 +4397,9 @@ bool Shell::SetOptions(int argc, char* argv[]) {
options.wasm_trap_handler = false;
argv[i] = nullptr;
#endif // V8_ENABLE_WEBASSEMBLY
} else if (strcmp(argv[i], "--expose-fast-api") == 0) {
options.expose_fast_api = true;
argv[i] = nullptr;
}
}
......@@ -4424,6 +4427,11 @@ bool Shell::SetOptions(int argc, char* argv[]) {
options.multi_mapped_mock_allocator = i::FLAG_multi_mapped_mock_allocator;
#endif
if (i::FLAG_stress_snapshot && options.expose_fast_api &&
check_d8_flag_contradictions) {
FATAL("Flag --expose-fast-api is incompatible with --stress-snapshot.");
}
// Set up isolated source groups.
options.isolate_sources = new SourceGroup[options.num_isolates];
SourceGroup* current = options.isolate_sources;
......
......@@ -443,6 +443,7 @@ class ShellOptions {
#if V8_ENABLE_WEBASSEMBLY
DisallowReassignment<bool> wasm_trap_handler = {"wasm-trap-handler", true};
#endif // V8_ENABLE_WEBASSEMBLY
DisallowReassignment<bool> expose_fast_api = {"expose-fast-api", false};
};
class Shell : public i::AllStatic {
......
......@@ -5,7 +5,7 @@
// This file excercises basic fast API calls and enables fuzzing of this
// functionality.
// Flags: --turbo-fast-api-calls --allow-natives-syntax --opt
// Flags: --turbo-fast-api-calls --expose-fast-api --allow-natives-syntax --opt
// --always-opt is disabled because we rely on particular feedback for
// optimizing to the fastest path.
// Flags: --no-always-opt
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --turbo-fast-api-calls --allow-natives-syntax --opt
// Flags: --turbo-fast-api-calls --expose-fast-api --allow-natives-syntax --opt
// Helper for sequence tests.
function optimize_and_check(func, fast_count, slow_count, expected) {
......
......@@ -4,7 +4,7 @@
// This file interface types used with fast API calls.
// Flags: --turbo-fast-api-calls --allow-natives-syntax --opt
// Flags: --turbo-fast-api-calls --expose-fast-api --allow-natives-syntax --opt
// Flags: --no-always-opt
// Flags: --deopt-every-n-times=0
......
......@@ -4,7 +4,7 @@
// This file adds x64 specific tests to the ones in fast-api-sequence.js.
// Flags: --turbo-fast-api-calls --allow-natives-syntax --opt
// Flags: --turbo-fast-api-calls --expose-fast-api --allow-natives-syntax --opt
// --always-opt is disabled because we rely on particular feedback for
// optimizing to the fastest path.
// Flags: --no-always-opt
......
......@@ -4,7 +4,7 @@
// This file excercises sequences support for fast API calls.
// Flags: --turbo-fast-api-calls --allow-natives-syntax --opt
// Flags: --turbo-fast-api-calls --expose-fast-api --allow-natives-syntax --opt
// --always-opt is disabled because we rely on particular feedback for
// optimizing to the fastest path.
// Flags: --no-always-opt
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --turbo-fast-api-calls
// Flags: --turbo-fast-api-calls --expose-fast-api
const fast_c_api = new d8.test.FastCAPI();
function foo(obj) {
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --turbo-fast-api-calls
// Flags: --turbo-fast-api-calls --expose-fast-api
const fast_c_api = new d8.test.FastCAPI();
const fast_obj = Object.create(fast_c_api);
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --turbo-fast-api-calls
// Flags: --turbo-fast-api-calls --expose-fast-api
const fast_c_api = new d8.test.FastCAPI();
function foo(obj) {
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --turbo-fast-api-calls --allow-natives-syntax --opt
// Flags: --turbo-fast-api-calls --expose-fast-api --allow-natives-syntax --opt
const fast_c_api = new d8.test.FastCAPI();
assertThrows(() => {fast_c_api.add_all_sequence()});
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --turbo-fast-api-calls
// Flags: --turbo-fast-api-calls --expose-fast-api
(function() {
const fast_c_api = new d8.test.FastCAPI();
......
......@@ -64,7 +64,7 @@ INCOMPATIBLE_FLAGS_PER_VARIANT = {
# serialized to the snapshot, so we don't have a
# SerializeInternalFieldsCallback for it, so they are incompatible with
# stress_snapshot.
"stress_snapshot": ["--turbo-fast-api-calls"],
"stress_snapshot": ["--expose-fast-api"],
"stress": ["--always-opt", "--no-always-opt",
"--max-inlined-bytecode-size=*",
"--max-inlined-bytecode-size-cumulative=*", "--stress-inline",
......
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