Migrate several boolean-like enums to base::StrongAlias<Tag, bool> to
improve type safety and align with the Blink C++ style guide. This
change replaces plain enums and "enum class : bool" with StrongAlias,
providing stronger typing while maintaining semantic clarity.
For most types, direct constructor calls (e.g., SharedFlag{true}) are
used at call sites to follow the style guide's recommendation for
explicit boolean-like StrongAlias usage. StrongAlias instances wrapping
bool are used directly in boolean expressions (e.g., if (flag)),
leveraging contextual conversion to bool.
Enums migrated to StrongAlias:
- SharedFlag, AllowAllocation, PerformHeapLimitCheck,
PerformIneffectiveMarkCompactCheck, NeedsContext, AdaptArguments
- CanThrow, LazyDeoptOnThrow
- AlignmentCheck, EnforceBoundsCheck (fully migrated from enum class)
- CreateSourcePositions, CodeObjectRequired
- MarkAsIndirectJumpTarget
- ResizableFlag, ImmutableFlag
- Validation, EmptyNames, UpdateResult
- InitializedFlag, InSharedSpace
Newly introduced StrongAlias types:
- HasGuardRegions (for BackingStore/Wasm memory)
- CustomDeleter (for BackingStore)
- EmptyDeleter (for BackingStore)
Key Improvements and Cleanups:
- Used direct brace initialization (e.g., Type{true}) instead of named
constants for MarkAsIndirectJumpTarget, AlignmentCheck, and
InSharedSpace to leverage the expressiveness of the type names.
- Leveraged contextual boolean conversion for StrongAlias types to
simplify checks (e.g., using 'if (flag)' instead of explicit equality
comparisons with constants or literal values).
- Refactored the BackingStore constructor to replace five raw boolean
parameters with type-safe StrongAlias and WasmMemoryFlag types,
preventing accidental parameter swapping.
- Improved Turboshaft PrintOptions to use the custom operator<< for
SharedFlag, ensuring consistent terminology in debug output.
Infrastructure support was added to base::StrongAlias for hashing and
Turboshaft integration (is_strong_alias_v).
TAG=agy
R=clemensb@chromium.org
NO_IFTTT=renaming only
Change-Id: Id703bdd17327b46177b74ffd633f3362a1c2b503
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/8005975
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
SLSA-Policy-Verified: SLSA Policy Verification Service <devtools-gerritcodereview-exitgate@google.com>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Maksim Ivanov <emaxx@google.com>
Cr-Commit-Position: refs/heads/main@{#108374}
Start an attempt at documenting V8's internals, from high-level concepts
to low-level implementation details. These docs are intended to be
readable to both humans and AI agents, with the hope that documentation
like this can help both humans and AIs maintain a concept of the overall
design and design constraints when making changes. It merges in the
existing documentation we had along with a bunch of AI-assisted extra
docs.
Includes a web viewer that renders the markdown and mermaid diagrams.
The viewer supports commenting, where comments are saved in
docs/viewer/comments.json, and can be manually or agentically resolved.
#ai-assisted
Bug: 500280354
Change-Id: Ie9ffc2f2f85de1496b8266027ca8b5b455acdb63
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/7761899
Auto-Submit: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/main@{#106585}