1// Copyright 2018 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#if !V8_ENABLE_WEBASSEMBLY
6#error This header should only be included if WebAssembly is enabled.
7#endif  // !V8_ENABLE_WEBASSEMBLY
8
9#ifndef V8_WASM_WASM_FEATURE_FLAGS_H_
10#define V8_WASM_WASM_FEATURE_FLAGS_H_
11
12// See https://github.com/WebAssembly/proposals for an overview of current
13// WebAssembly proposals.
14
15// Experimental features (disabled by default).
16#define FOREACH_WASM_EXPERIMENTAL_FEATURE_FLAG(V) /*     (force 80 columns) */ \
17  /* No official proposal (yet?). */                                           \
18  /* V8 side owner: clemensb */                                                \
19  V(compilation_hints, "compilation hints section", false)                     \
20                                                                               \
21  /* GC proposal (early prototype, might change dramatically) */               \
22  /* Official proposal: https://github.com/WebAssembly/gc */                   \
23  /* Prototype engineering spec: https://bit.ly/3cWcm6Q */                     \
24  /* V8 side owner: jkummerow */                                               \
25  V(gc, "garbage collection", false)                                           \
26                                                                               \
27  /* Non-specified, V8-only experimental additions to the GC proposal */       \
28  /* V8 side owner: jkummerow */                                               \
29  V(nn_locals,                                                                 \
30    "allow non-defaultable/non-nullable locals, validated with 'until end of " \
31    "block' semantics",                                                        \
32    false)                                                                     \
33  V(unsafe_nn_locals,                                                          \
34    "allow non-defaultable/non-nullable locals, no validation", false)         \
35  V(assume_ref_cast_succeeds,                                                  \
36    "assume ref.cast always succeeds and skip the related type check "         \
37    "(unsafe)",                                                                \
38    false)                                                                     \
39  V(skip_null_checks,                                                          \
40    "skip null checks for call.ref and array and struct operations (unsafe)",  \
41    false)                                                                     \
42  V(skip_bounds_checks, "skip array bounds checks (unsafe)", false)            \
43                                                                               \
44  /* Typed function references proposal. */                                    \
45  /* Official proposal: https://github.com/WebAssembly/function-references */  \
46  /* V8 side owner: manoskouk */                                               \
47  V(typed_funcref, "typed function references", false)                         \
48                                                                               \
49  /* Memory64 proposal. */                                                     \
50  /* https://github.com/WebAssembly/memory64 */                                \
51  /* V8 side owner: clemensb */                                                \
52  V(memory64, "memory64", false)                                               \
53                                                                               \
54  /* Relaxed SIMD proposal. */                                                 \
55  /* https://github.com/WebAssembly/relaxed-simd */                            \
56  /* V8 side owner: zhin */                                                    \
57  V(relaxed_simd, "relaxed simd", false)                                       \
58                                                                               \
59  /* Branch Hinting proposal. */                                               \
60  /* https://github.com/WebAssembly/branch-hinting */                          \
61  /* V8 side owner: jkummerow */                                               \
62  V(branch_hinting, "branch hinting", false)                                   \
63                                                                               \
64  /* Stack Switching proposal. */                                              \
65  /* https://github.com/WebAssembly/stack-switching */                         \
66  /* V8 side owner: thibaudm, fgm */                                           \
67  V(stack_switching, "stack switching", false)                                 \
68                                                                               \
69  /* Extended Constant Expressions Proposal. */                                \
70  /* https://github.com/WebAssembly/extended-const */                          \
71  /* V8 side owner: manoskouk */                                               \
72  V(extended_const, "extended constant expressions", false)
73
74// #############################################################################
75// Staged features (disabled by default, but enabled via --wasm-staging (also
76// exposed as chrome://flags/#enable-experimental-webassembly-features). Staged
77// features get limited fuzzer coverage, and should come with their own tests.
78// They are not run through all fuzzers though and don't get much exposure in
79// the wild. Staged features do not necessarily be fully stabilized. They should
80// be shipped with enough lead time to the next branch to allow for
81// stabilization.
82#define FOREACH_WASM_STAGING_FEATURE_FLAG(V) /*          (force 80 columns) */ \
83  /* Tail call / return call proposal. */                                      \
84  /* https://github.com/webassembly/tail-call */                               \
85  /* V8 side owner: thibaudm */                                                \
86  /* Staged in v8.7 * */                                                       \
87  V(return_call, "return call opcodes", false)                                 \
88                                                                               \
89  /* Type reflection proposal. */                                              \
90  /* https://github.com/webassembly/js-types */                                \
91  /* V8 side owner: ahaas */                                                   \
92  /* Staged in v7.8. */                                                        \
93  V(type_reflection, "wasm type reflection in JS", false)
94
95// #############################################################################
96// Shipped features (enabled by default). Remove the feature flag once they hit
97// stable and are expected to stay enabled.
98#define FOREACH_WASM_SHIPPED_FEATURE_FLAG(V) /*          (force 80 columns) */ \
99  /* Fixed-width SIMD operations. */                                           \
100  /* https://github.com/webassembly/simd */                                    \
101  /* V8 side owner: gdeepti, zhin */                                           \
102  /* Staged in v8.7 * */                                                       \
103  /* Shipped in v9.1 * */                                                      \
104  V(simd, "SIMD opcodes", true)                                                \
105                                                                               \
106  /* Threads proposal. */                                                      \
107  /* https://github.com/webassembly/threads */                                 \
108  /* NOTE: This is enabled via chromium flag on desktop systems since v7.4, */ \
109  /* and on android from 9.1. Threads are only available when */               \
110  /* SharedArrayBuffers are enabled as well, and are gated by COOP/COEP */     \
111  /* headers, more fine grained control is in the chromium codebase */         \
112  /* ITS: https://groups.google.com/a/chromium.org/d/msg/blink-dev/ */         \
113  /* tD6np-OG2PU/rcNGROOMFQAJ */                                               \
114  /* V8 side owner: gdeepti */                                                 \
115  V(threads, "thread opcodes", true)                                           \
116                                                                               \
117  /* Exception handling proposal. */                                           \
118  /* https://github.com/WebAssembly/exception-handling */                      \
119  /* V8 side owner: thibaudm */                                                \
120  /* Staged in v8.9 */                                                         \
121  /* Shipped in v9.5 */                                                        \
122  V(eh, "exception handling opcodes", true)                                    \
123                                                                               \
124// Combination of all available wasm feature flags.
125#define FOREACH_WASM_FEATURE_FLAG(V)        \
126  FOREACH_WASM_EXPERIMENTAL_FEATURE_FLAG(V) \
127  FOREACH_WASM_STAGING_FEATURE_FLAG(V)      \
128  FOREACH_WASM_SHIPPED_FEATURE_FLAG(V)
129
130#endif  // V8_WASM_WASM_FEATURE_FLAGS_H_
131