v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
wasm-feature-flags.h
Go to the documentation of this file.
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#ifndef V8_WASM_WASM_FEATURE_FLAGS_H_
6#define V8_WASM_WASM_FEATURE_FLAGS_H_
7
8#if !V8_ENABLE_WEBASSEMBLY
9#error This header should only be included if WebAssembly is enabled.
10#endif // !V8_ENABLE_WEBASSEMBLY
11
12// Each entry in this file generates a V8 command-line flag with the prefix
13// "--experimental-wasm-".
14//
15// For example, to enable "my_feature", pass
16// --experimental-wasm-my-feature to d8, or
17// --js-flags=--experimental-wasm-my-feature to Chrome.
18//
19// To disable "my_feature", add the "--no-" prefix:
20// --no-experimental-wasm-my-feature.
21//
22// See https://github.com/WebAssembly/proposals for an overview of current
23// WebAssembly proposals.
24
25// Experimental features (disabled by default).
26#define FOREACH_WASM_EXPERIMENTAL_FEATURE_FLAG(V) /* (force 80 columns) */ \
27 /* Type reflection proposal. */ \
28 /* https://github.com/webassembly/js-types */ \
29 /* V8 side owner: ahaas */ \
30 /* Staged in v7.8, unstaged in v13.6 (see https://crbug.com/402340845) */ \
31 V(type_reflection, "wasm type reflection in JS", false) \
32 \
33 /* No official proposal (yet?). */ \
34 /* V8 side owner: clemensb */ \
35 V(compilation_hints, "compilation hints section", false) \
36 \
37 /* Instruction Tracing tool convention (early prototype, might change) */ \
38 /* Tool convention: https://github.com/WebAssembly/tool-conventions */ \
39 /* V8 side owner: jabraham */ \
40 V(instruction_tracing, "instruction tracing section", false) \
41 \
42 /* Old flag for JavaScript Promise Integration proposal. */ \
43 /* Use --experimental-wasm-jspi instead. */ \
44 /* https://github.com/WebAssembly/js-promise-integration */ \
45 /* V8 side owner: thibaudm, fgm */ \
46 V(stack_switching, "stack switching", false) \
47 \
48 /* Custom Descriptors proposal. */ \
49 /* https://github.com/WebAssembly/custom-descriptors */ \
50 /* V8 side owner: jkummerow */ \
51 V(custom_descriptors, "custom descriptors", false) \
52 \
53 /* Shared-Everything Threads proposal. */ \
54 /* https://github.com/WebAssembly/shared-everything-threads */ \
55 /* V8 side owner: manoskouk */ \
56 V(shared, "shared-everything threads", false) \
57 \
58 /* FP16 proposal. */ \
59 /* https://github.com/WebAssembly/half-precision */ \
60 /* V8 side owner: irezvov */ \
61 V(fp16, "fp16", false) \
62 \
63 /* V8 side owner: irezvov */ \
64 V(growable_stacks, "growable stacks for jspi", false) \
65 \
66 /* Memory Control proposal */ \
67 /* https://github.com/WebAssembly/memory-control */ \
68 /* V8 side owner: ahaas */ \
69 V(memory_control, "memory control", false) \
70 \
71 /* Core stack switching, main proposal */ \
72 /* https://github.com/WebAssembly/stack-switching */ \
73 /* V8 side owner: fgm */ \
74 V(wasmfx, "core stack switching", false) \
75 \
76 /* Resizable buffer integration */ \
77 /* https://github.com/WebAssembly/spec/issues/1292 */ \
78 /* V8 side owner: syg */ \
79 V(rab_integration, "resizable buffers integration", false)
80
81// #############################################################################
82// Staged features (disabled by default, but enabled via --wasm-staging (also
83// exposed as chrome://flags/#enable-experimental-webassembly-features). Staged
84// features get limited fuzzer coverage, and should come with their own tests.
85// They are not run through all fuzzers though and don't get much exposure in
86// the wild. Staged features are not necessarily fully stabilized. They should
87// be shipped with enough lead time to the next branch to allow for
88// stabilization.
89// Consider adding a chromium-side use counter if you want to track usage in the
90// wild (also see {V8::UseCounterFeature}).
91#define FOREACH_WASM_STAGING_FEATURE_FLAG(V) /* (force 80 columns) */ \
92 /* Reference-Typed Strings Proposal. */ \
93 /* https://github.com/WebAssembly/stringref */ \
94 /* V8 side owner: jkummerow */ \
95 V(stringref, "reference-typed strings", false) \
96 \
97 /* Imported Strings TextEncoder/TextDecoder post-MVP extension. */ \
98 /* No upstream repo yet. */ \
99 /* V8 side owner: jkummerow */ \
100 V(imported_strings_utf8, "imported strings (utf8 features)", false) \
101 \
102 /* Exnref */ \
103 /* This flag enables the new exception handling proposal */ \
104 /* V8 side owner: thibaudm */ \
105 V(exnref, "exnref", false) \
106 \
107 /* JavaScript Promise Integration proposal. */ \
108 /* https://github.com/WebAssembly/js-promise-integration */ \
109 /* V8 side owner: thibaudm, fgm */ \
110 V(jspi, "javascript promise integration", false)
111
112// #############################################################################
113// Shipped features (enabled by default). Remove the feature flag once they hit
114// stable and are expected to stay enabled.
115#define FOREACH_WASM_SHIPPED_FEATURE_FLAG(V) /* (force 80 columns) */ \
116 /* Legacy exception handling proposal. */ \
117 /* https://github.com/WebAssembly/exception-handling */ \
118 /* V8 side owner: thibaudm */ \
119 /* Staged in v8.9 */ \
120 /* Shipped in v9.5 */ \
121 V(legacy_eh, "legacy exception handling opcodes", true) \
122 \
123 /* Branch Hinting proposal. */ \
124 /* https://github.com/WebAssembly/branch-hinting */ \
125 /* V8 side owner: jkummerow */ \
126 /* Staged in v13.6. */ \
127 /* Shipped in v13.7. */ \
128 V(branch_hinting, "branch hinting", true) \
129 \
130 /* Imported Strings Proposal. */ \
131 /* https://github.com/WebAssembly/js-string-builtins */ \
132 /* V8 side owner: jkummerow */ \
133 /* Shipped in v13.0 */ \
134 V(imported_strings, "imported strings", true)
135
136// Combination of all available wasm feature flags.
137#define FOREACH_WASM_FEATURE_FLAG(V) \
138 FOREACH_WASM_EXPERIMENTAL_FEATURE_FLAG(V) \
139 FOREACH_WASM_STAGING_FEATURE_FLAG(V) \
140 FOREACH_WASM_SHIPPED_FEATURE_FLAG(V)
141
142// Consistency check: Experimental and staged features are off by default.
143#define CHECK_WASM_FEATURE_OFF_BY_DEFAULT(name, desc, enabled) \
144 static_assert(enabled == false);
145#define CHECK_WASM_FEATURE_ON_BY_DEFAULT(name, desc, enabled) \
146 static_assert(enabled == true);
150#undef CHECK_WASM_FEATURE_OFF_BY_DEFAULT
151#undef CHECK_WASM_FEATURE_ON_BY_DEFAULT
152
153#endif // V8_WASM_WASM_FEATURE_FLAGS_H_
#define CHECK_WASM_FEATURE_OFF_BY_DEFAULT(name, desc, enabled)
#define FOREACH_WASM_STAGING_FEATURE_FLAG(V)
#define FOREACH_WASM_SHIPPED_FEATURE_FLAG(V)
#define FOREACH_WASM_EXPERIMENTAL_FEATURE_FLAG(V)
#define CHECK_WASM_FEATURE_ON_BY_DEFAULT(name, desc, enabled)