File: variants.py

package info (click to toggle)
chromium 138.0.7204.183-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 6,071,908 kB
  • sloc: cpp: 34,937,088; ansic: 7,176,967; javascript: 4,110,704; python: 1,419,953; asm: 946,768; xml: 739,971; pascal: 187,324; sh: 89,623; perl: 88,663; objc: 79,944; sql: 50,304; cs: 41,786; fortran: 24,137; makefile: 21,806; php: 13,980; tcl: 13,166; yacc: 8,925; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (344 lines) | stat: -rw-r--r-- 13,377 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
# Copyright 2016 the V8 project authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

# Use this to run several variants of the tests.
ALL_VARIANT_FLAGS = {
    "assert_types": [["--assert-types"]],
    "code_serializer": [["--cache=code"]],
    "default": [[]],
    "future": [["--future"]],
    "gc_stats": [["--gc-stats=1"]],
    # Alias of exhaustive variants, but triggering new test framework features.
    "infra_staging": [[]],
    "interpreted_regexp": [["--regexp-interpret-all"]],
    "stress_regexp_jit": [["--regexp-tier-up-ticks=0"]],
    "experimental_regexp": [["--default-to-experimental-regexp-engine"]],
    "jitless": [["--jitless", "--wasm-jitless-if-available-for-testing"]],
    # Jit-fuzzing variants pass --no-fail as most test conditions are violated.
    # We only look for dchecks and crashes. As a result, negative tests like
    # in the bugs/* directory are not supported.
    "jit_fuzzing": [["--fuzzing", "--jit-fuzzing", "--no-fail"]],
    "jit_fuzzing_maglev": [[
        "--fuzzing",
        "--jit-fuzzing",
        "--optimize-on-next-call-optimizes-to-maglev",
        "--no-fail",
    ]],
    "sparkplug": [["--sparkplug"]],
    "maglev": [["--maglev"]],
    "maglev_future": [["--maglev", "--maglev-future"]],
    "maglev_no_turbofan": [[
        "--maglev", "--no-turbofan",
        "--optimize-on-next-call-optimizes-to-maglev"
    ]],
    "stress_maglev": [[
        "--maglev", "--stress-maglev",
        "--optimize-on-next-call-optimizes-to-maglev"
    ]],
    "stress_maglev_future": [[
        "--maglev", "--maglev-future", "--stress-maglev",
        "--optimize-on-next-call-optimizes-to-maglev"
    ]],
    "stress_maglev_no_turbofan": [[
        "--maglev", "--no-turbofan", "--stress-maglev",
        "--optimize-on-next-call-optimizes-to-maglev"
    ]],
    "stress_maglev_non_eager_inlining": [[
        "--maglev", "--stress-maglev", "--maglev-non-eager-inlining",
        "--optimize-on-next-call-optimizes-to-maglev"
    ]],
    "conservative_stack_scanning": [[
        "--conservative-stack-scanning",
        "--scavenger-conservative-object-pinning",
        "--stress-scavenger-conservative-object-pinning"
    ]],
    "precise_pinning": [[
        "--precise-object-pinning", "--scavenger-precise-object-pinning"
    ]],
    # We test both the JS and Wasm Turboshaft pipelines under the same variant.
    # For extended Wasm Turboshaft coverage, we add --no-liftoff to the options.
    "turboshaft": [[
        "--turboshaft",
        "--no-wasm-generic-wrapper",
        "--no-liftoff",
    ]],
    # Turboshaft with Maglev as a frontend
    "turbolev": [[
        "--turboshaft",
        "--turbolev",
    ]],
    "concurrent_sparkplug": [["--concurrent-sparkplug", "--sparkplug"]],
    "always_sparkplug": [["--always-sparkplug", "--sparkplug"]],
    # This combines two orthogonal variants always_sparkplug and
    # stress_regexp_jit to use bot resources more effectively.
    "always_sparkplug_and_stress_regexp_jit": [[
        "--always-sparkplug",
        "--sparkplug",
        "--regexp-tier-up-ticks=0",
    ]],
    "minor_ms": [["--minor-ms"]],
    "no_lfa": [["--no-lazy-feedback-allocation"]],
    "no_memory_protection_keys": [["--no-memory-protection-keys"]],
    # No optimization means disable all optimizations. OptimizeFunctionOnNextCall
    # would not force optimization too. It turns into a Nop. Please see
    # https://chromium-review.googlesource.com/c/452620/ for more discussion.
    # For WebAssembly, we test "Liftoff-only" in the nooptimization variant and
    # "TurboFan-only" in the stress variant. The WebAssembly configuration is
    # independent of JS optimizations, so we can combine those configs. We
    # disable lazy compilation to have one test variant that tests eager
    # compilation. "Liftoff-only" and eager compilation is not a problem,
    # because test functions do typically not get optimized to TurboFan anyways.
    "nooptimization": [[
        "--disable-optimizing-compilers", "--no-wasm-lazy-compilation"
    ]],
    "rehash_snapshot": [["--rehash-snapshot"]],
    "slow_path": [["--force-slow-path"]],
    "stress": [[
        "--no-liftoff",
        "--stress-lazy-source-positions",
        "--no-wasm-generic-wrapper",
        "--no-wasm-lazy-compilation",
    ]],
    "stress_concurrent_allocation": [["--stress-concurrent-allocation"]],
    "stress_concurrent_inlining": [["--stress-concurrent-inlining"]],
    "stress_js_bg_compile_wasm_code_gc": [[
        "--stress-background-compile", "--stress-wasm-code-gc"
    ]],
    "stress_maglev_tests_with_turbofan": [[
        "--turbofan", "--optimize-maglev-optimizes-to-turbofan"
    ]],
    "stress_wasm_stack_switching": [["--stress-wasm-stack-switching"]],
    "stress_incremental_marking": [["--stress-incremental-marking"]],
    "stress_snapshot": [["--stress-snapshot"]],
    # Trigger stress sampling allocation profiler with sample interval = 2^14
    "stress_sampling": [["--stress-sampling-allocation-profiler=16384"]],
    "no_wasm_traps": [["--no-wasm-trap-handler"]],
    "instruction_scheduling": [["--turbo-instruction-scheduling"]],
    "stress_instruction_scheduling": [["--turbo-stress-instruction-scheduling"]
                                     ],
    # Google3 variants.
    "google3_icu": [[]],
    "google3_noicu": [[]],
}

# Note these are specifically for the case when Turbofan is either fully
# disabled (i.e. not part of the binary), or when all codegen is disallowed (in
# jitless mode).
kIncompatibleFlagsForNoTurbofan = [
    "--turbofan", "--always-turbofan", "--liftoff", "--validate-asm",
    "--maglev", "--stress-concurrent-inlining"
]

# Flags that lead to a contradiction with the flags provided by the respective
# variant. This depends on the flags specified in ALL_VARIANT_FLAGS and on the
# implications defined in flag-definitions.h.
INCOMPATIBLE_FLAGS_PER_VARIANT = {
    "jitless":
        kIncompatibleFlagsForNoTurbofan + [
            "--track-field-types",
            "--sparkplug",
            "--concurrent-sparkplug",
            "--always-sparkplug",
            "--regexp-tier-up",
            "--no-regexp-interpret-all",
            "--interpreted-frames-native-stack",
            "--additive-safe-int-feedback",
            "--script-context-cells",
        ],
    "nooptimization": [
        "--turbofan",
        "--always-turbofan",
        "--turboshaft",
        "--turboshaft-wasm-in-js-inlining",
        "--maglev",
        "--no-liftoff",
        "--wasm-tier-up",
        "--wasm-dynamic-tiering",
        "--validate-asm",
        "--track-field-types",
        "--stress-concurrent-inlining",
        "--additive-safe-int-feedback",
        "--script-context-cells",
    ],
    "slow_path": ["--no-force-slow-path"],
    "stress_concurrent_allocation": [
        "--single-threaded", "--single-threaded-gc", "--predictable"
    ],
    "stress_concurrent_inlining": [
        "--single-threaded", "--predictable", "--lazy-feedback-allocation",
        "--assert-types", "--turboshaft-assert-types",
        "--no-concurrent-recompilation", "--no-turbofan", "--jitless"
    ],
    # The fast API tests initialize an embedder object that never needs to be
    # serialized to the snapshot, so we don't have a
    # SerializeInternalFieldsCallback for it, so they are incompatible with
    # stress_snapshot.
    "stress_snapshot": ["--expose-fast-api"],
    "stress": [
        # 'stress' disables Liftoff, which conflicts with flags that require
        # Liftoff support.
        "--liftoff-only",
        "--wasm-dynamic-tiering"
    ],
    "sparkplug": ["--jitless", "--no-sparkplug"],
    "turboshaft": [
        # 'turboshaft' disables Liftoff, which conflicts with flags that require
        # Liftoff support.
        "--liftoff-only",
        "--wasm-dynamic-tiering"
    ],
    "concurrent_sparkplug": ["--jitless"],
    "maglev": ["--jitless", "--no-maglev"],
    "maglev_future": ["--jitless", "--no-maglev", "--no-maglev-future"],
    "maglev_no_turbofan": [
        "--jitless",
        "--no-maglev",
        "--turbofan",
        "--always-turbofan",
        "--stress-concurrent-inlining",
    ],
    "stress_maglev": ["--jitless"],
    "stress_maglev_non_eager_inlining": ["--jitless"],
    "stress_maglev_future": ["--jitless", "--no-maglev", "--no-maglev-future"],
    "stress_maglev_no_turbofan": [
        "--jitless",
        "--no-maglev",
        "--turbofan",
        "--always-turbofan",
        "--stress-concurrent-inlining",
    ],
    "stress_maglev_tests_with_turbofan": ["--jitless"],
    "always_sparkplug": ["--jitless", "--no-sparkplug"],
    "always_sparkplug_and_stress_regexp_jit": ["--jitless", "--no-sparkplug"],
    "code_serializer": [
        "--cache=after-execute", "--cache=full-code-cache", "--cache=none"
    ],
    "interpreted_regexp": ["--regexp-tier-up"],
    "stress_regexp_jit": ["--regexp-interpret-all"],
    "experimental_regexp": ["--no-enable-experimental-regexp-engine"],
    "assert_types": [
        "--concurrent-recompilation", "--stress_concurrent_inlining",
        "--no-assert-types"
    ],
    "stress_wasm_stack_switching": ["--no-stress-wasm-stack-switching"],
    "--turboshaft-assert-types": [
        "--concurrent-recompilation", "--stress_concurrent_inlining",
        "--no-turboshaft-assert-types"
    ],
}

# Flags that lead to a contradiction under certain build variables.
# This corresponds to the build variables usable in status files as generated
# in _get_statusfile_variables in base_runner.py.
# The conflicts might be directly contradictory flags or be caused by the
# implications defined in flag-definitions.h.
# The keys of the following map support negation through '!', e.g. rule
#
#   "!code_comments": [...]
#
# applies when the code_comments build variable is NOT set.
INCOMPATIBLE_FLAGS_PER_BUILD_VARIABLE = {
    "!code_comments": ["--code-comments"],
    "!DEBUG_defined": [
        "--check_handle_count",
        "--code_stats",
        "--dump_wasm_module",
        "--enable_testing_opcode_in_wasm",
        "--gc_verbose",
        "--no-wasm-opt",
        "--print_ast",
        "--print_break_location",
        "--print_global_handles",
        "--print_handles",
        "--print_scopes",
        "--regexp_possessive_quantifier",
        "--trace_backing_store",
        "--trace_contexts",
        "--trace_isolates",
        "--trace_lazy",
        "--trace_liftoff",
        "--trace_module_status",
        "--trace_normalization",
        "--trace_turbo_escape",
        "--trace_wasm_compiler",
        "--trace_wasm_decoder",
        "--trace_wasm_instances",
        "--trace_wasm_lazy_compilation",
        "--trace_wasm_native_heap",
        "--trace_wasm_serialization",
        "--trace_wasm_stack_switching",
        "--trace_wasm_streaming",
    ],
    "!verify_heap": ["--verify-heap"],
    "!debug_code": ["--debug-code"],
    "!disassembler": [
        "--print_all_code", "--print_code", "--print_opt_code",
        "--print_code_verbose", "--print_builtin_code", "--print_regexp_code"
    ],
    "!slow_dchecks": ["--enable-slow-asserts"],
    "!gdbjit": ["--gdbjit", "--gdbjit_full", "--gdbjit_dump"],
    "!has_maglev": ["--maglev"],
    "!has_turbofan": kIncompatibleFlagsForNoTurbofan,
    "has_jitless": INCOMPATIBLE_FLAGS_PER_VARIANT["jitless"],
    "lite_mode": INCOMPATIBLE_FLAGS_PER_VARIANT["jitless"],
    "verify_predictable": [
        "--parallel-compile-tasks-for-eager-toplevel",
        "--parallel-compile-tasks-for-lazy", "--concurrent-recompilation",
        "--stress-concurrent-allocation", "--stress-concurrent-inlining"
    ],
    "dict_property_const_tracking": ["--stress-concurrent-inlining"],
}

# Flags that lead to a contradiction when a certain extra-flag is present.
# Such extra-flags are defined for example in infra/testing/builders.pyl or in
# standard_runner.py.
# The conflicts might be directly contradictory flags or be caused by the
# implications defined in flag-definitions.h.
INCOMPATIBLE_FLAGS_PER_EXTRA_FLAG = {
    "--concurrent-recompilation": [
        "--predictable", "--assert-types", "--turboshaft-assert-types",
        "--single-threaded"
    ],
    "--parallel-compile-tasks-for-eager-toplevel": ["--predictable"],
    "--parallel-compile-tasks-for-lazy": ["--predictable"],
    "--gc-interval=*": ["--gc-interval=*"],
    "--stress_concurrent_allocation":
        INCOMPATIBLE_FLAGS_PER_VARIANT["stress_concurrent_allocation"],
    "--stress-concurrent-inlining":
        INCOMPATIBLE_FLAGS_PER_VARIANT["stress_concurrent_inlining"],
    "--turboshaft-assert-types": [
        "--concurrent-recompilation", "--stress-concurrent-inlining"
    ],
}

SLOW_VARIANTS = set([
  'stress',
  'stress_snapshot',
  'nooptimization',
])

FAST_VARIANTS = set([
  'default'
])


def _variant_order_key(v):
  if v in SLOW_VARIANTS:
    return 0
  if v in FAST_VARIANTS:
    return 100
  return 50

ALL_VARIANTS = sorted(ALL_VARIANT_FLAGS.keys(),
                      key=_variant_order_key)

# For internal integrity checking.
REQUIRED_BUILD_VARIABLES = [
    var.lstrip('!') for var in INCOMPATIBLE_FLAGS_PER_BUILD_VARIABLE.keys()
]

# Check {SLOW,FAST}_VARIANTS entries
for variants in [SLOW_VARIANTS, FAST_VARIANTS]:
  for v in variants:
    assert v in ALL_VARIANT_FLAGS