Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Gives coding conventions for writing, modifying, and reviewing Turboshaft C++ code in V8's src/compiler/turboshaft/ directory.
45% 100%+55 ptsof test cases passed
Passed 22 of 22 test cases with the skill, and 10 of 22 without it.
3 of 3 safety checks passed
Not used yet
Prefer V<T> and OptionalV<T> over raw OpIndex and OptionalOpIndex
(e.g., V<Word32>, V<JSReceiver>, V<Any>, V<None>). Use
V<T>::Invalid() instead of OpIndex::Invalid().
Use the most precise V<T> type possible (e.g., V<JSArray> over
V<JSReceiver> over V<Object>). Define new union types when needed:
Union<...> for tagged types and UntaggedUnion<...> for untagged types.
Use V<T>::Cast only when downcasting another V<U>. Never use V<T>::Cast
on OpIndex or for upcasting (V<T> is implicitly constructible from
OpIndex and from V<SubType>). For calls, use __ Call<T>(...) instead of
V<T>::Cast(__ Call(...)).
Prefer structured control flow (IF / IF_NOT / ELSE, using ScopedVar<T>
to merge values across branches) over Label<T> with GOTO / GOTO_IF /
GOTO_IF_NOT when possible.
With ScopedVar<T>, use direct assignment (var = ...) and implicit reads
instead of .Set() / .Get().
Avoid explicit __ Word32Constant(...) / __ Float64Constant(...) calls:
most functions taking untagged value inputs use ConstOrV<T> parameters (and
new helpers should too), which accept raw C++ constants directly.
When matching operations, prefer a single op.TryCast<Op>() (with
Opmask::k... when checking Kind/operands) over op.Is<Op>() +
op.Cast<Op>().
Use named, typed input getters on operations (e.g., op.left(), op.input())
instead of generic indexed op.input(0) (and define them on new operations in
operations.h).
Prefer BuiltinCallDescriptor with __ CallBuiltin<builtin::Foo>(...) over
manual Call descriptors.
In REDUCE methods, use early returns or
LABEL_BLOCK(no_change) { return Next::Reduce...(...); } with
goto no_change; to avoid deep nesting or repeated Next::Reduce... calls.
Next to this one in the catalogue, plus more from the same author.