agents/skills/v8-regression-testing/SKILL.md
Use this skill to design, write, minimize, and refine high-quality regression
tests in the V8 codebase (typically under test/mjsunit/ or its
component-specific subfolders like compiler/, turboshaft/, maglev/, etc.).
When constructing a reproducer for a bug, always prefer writing it from scratch based on a deep conceptual understanding of the issue, rather than starting from a fuzzer-generated crash script and trying to minimize it.
__wrapTC), redundant
try-catches, and magic numbers because you are afraid to break the fragile
reproduction state.DCHECK or invariant to understand the exact
abstract state machine failure (e.g., "an incorrect type representation
selection, a specific Map transition mismatch, or a loop-carried
side-effect").%PrepareFunctionForOptimization, %OptimizeFunctionOnNextCall).When writing a reproducer from scratch, it is common for the first attempt to not trigger the crash. When this happens, do not give up or fall back to blindly copying the fuzzer script. Instead, treat the reproducer's failure as a debugging task and enter a scientific feedback loop.
--trace-turbo-graph, --trace-ic,
--trace-deopt...), and insert custom instruction (eg, using PrintF) as
needed if the existing flags are too coarse.[!IMPORTANT] The Ultimate Conceptual Checkpoint: If you repeatedly fail to construct a clean, working reproducer from scratch, this almost always means your conceptual understanding of the bug is either incorrect or too shallow. Do not waste days trying to brute-force random JavaScript tweaks. When this checkpoint is hit, you must go back to the drawing board, challenge what you think you know about the bug, and deepen your understanding.
// Flags: ... must be
thoroughly understood and strictly necessary to reproduce the issue. Remove
all useless or redundant flags.--jit-fuzzing or --fuzzing because it implies a massive,
ever-changing bundle of underlying behaviors.--no-lazy-feedback-allocation, --homomorphic-ic,
--stress-concurrent-inlining-attach-code).Avoid default fuzzer variable and function names (__f_0, __v_10, v17,
a6, a7).
large_arr, global_var,
testGenerator).foo, bar,
obj, f, x, y).catch (e) {}) or dummy wrapper functions
(__wrapTC) unless they are semantically required to trigger the crash path.for (let i = 0; i < 100000; i++)) to
trigger JIT tier-up, unless the bug specifically relates to loop-scaling or
profiling feedback.%PrepareFunctionForOptimization(foo);%OptimizeFunctionOnNextCall(foo); or %OptimizeMaglevOnNextCall(foo);--allow-natives-syntax is included in the Flags header when using
percent (%) intrinsics.