|
62 | 62 |
|
63 | 63 | CLOSED_WORLD_FLAG = '--closed-world' |
64 | 64 |
|
| 65 | +# V8 does not support shared memories when running with |
| 66 | +# shared-everything enabled, so do not fuzz shared-everything |
| 67 | +# for now. The remaining features are not yet implemented in v8. |
| 68 | +DISALLOWED_FEATURES_IN_V8 = ['shared-everything', 'strings', 'stack-switching', 'relaxed-atomics'] |
| 69 | + |
65 | 70 |
|
66 | 71 | # utilities |
67 | 72 |
|
@@ -143,19 +148,15 @@ def randomize_feature_opts(): |
143 | 148 | if possible in IMPLIED_FEATURE_OPTS: |
144 | 149 | FEATURE_OPTS.extend(IMPLIED_FEATURE_OPTS[possible]) |
145 | 150 | elif random.random() < 0.9: |
146 | | - # 2/3 of the remaining 90% use them all. This is useful to maximize |
| 151 | + # 90% of the remaining (2/3 * 0.9) use them all (0.54 probability). This is useful to maximize |
147 | 152 | # coverage, as enabling more features enables more optimizations and |
148 | 153 | # code paths, and also allows all initial contents to run. |
149 | 154 |
|
150 | | - # The shared-everything feature is new and we want to fuzz it, but it |
151 | | - # also currently disables fuzzing V8, so disable it most of the time. |
152 | | - # Same with strings. Relaxed SIMD's nondeterminism disables much but not |
153 | | - # all of our V8 fuzzing, so avoid it too. Stack Switching, as well, is |
154 | | - # not yet ready in V8. |
155 | | - FEATURE_OPTS.append('--disable-shared-everything') |
156 | | - FEATURE_OPTS.append('--disable-strings') |
| 155 | + # Disable features not allowed in V8 to increase V8 fuzzing. |
| 156 | + FEATURE_OPTS.extend(f'--disable-{feature}' for feature in DISALLOWED_FEATURES_IN_V8) |
| 157 | + # Relaxed SIMD's nondeterminism disables much but not |
| 158 | + # all of our V8 fuzzing, so avoid it. |
157 | 159 | FEATURE_OPTS.append('--disable-relaxed-simd') |
158 | | - FEATURE_OPTS.append('--disable-stack-switching') |
159 | 160 |
|
160 | 161 | print('randomized feature opts:', '\n ' + '\n '.join(FEATURE_OPTS)) |
161 | 162 |
|
@@ -824,11 +825,7 @@ def run(self, wasm, extra_d8_flags=[]): |
824 | 825 | return run_vm([shared.V8, get_fuzz_shell_js()] + shared.V8_OPTS + get_v8_extra_flags() + extra_d8_flags + ['--', wasm]) |
825 | 826 |
|
826 | 827 | def can_run(self, wasm): |
827 | | - # V8 does not support shared memories when running with |
828 | | - # shared-everything enabled, so do not fuzz shared-everything |
829 | | - # for now. It also does not yet support strings, nor stack |
830 | | - # switching |
831 | | - return all_disallowed(['shared-everything', 'strings', 'stack-switching']) |
| 828 | + return all_disallowed(DISALLOWED_FEATURES_IN_V8) |
832 | 829 |
|
833 | 830 | def can_compare_to_self(self): |
834 | 831 | # With nans, VM differences can confuse us, so only very simple VMs |
@@ -886,7 +883,7 @@ def can_run(self, wasm): |
886 | 883 | if random.random() < 0.5: |
887 | 884 | return False |
888 | 885 | # wasm2c doesn't support most features |
889 | | - return all_disallowed(['exception-handling', 'simd', 'threads', 'bulk-memory', 'nontrapping-float-to-int', 'tail-call', 'sign-ext', 'reference-types', 'multivalue', 'gc', 'custom-descriptors']) |
| 886 | + return all_disallowed(['exception-handling', 'simd', 'threads', 'bulk-memory', 'nontrapping-float-to-int', 'tail-call', 'sign-ext', 'reference-types', 'multivalue', 'gc', 'custom-descriptors', 'relaxed-atomics']) |
890 | 887 |
|
891 | 888 | def run(self, wasm): |
892 | 889 | run([in_bin('wasm-opt'), wasm, '--emit-wasm2c-wrapper=main.c'] + FEATURE_OPTS) |
@@ -1187,7 +1184,7 @@ def can_run_on_wasm(self, wasm): |
1187 | 1184 | # implement wasm suspending using JS async/await. |
1188 | 1185 | if JSPI: |
1189 | 1186 | return False |
1190 | | - return all_disallowed(['exception-handling', 'simd', 'threads', 'bulk-memory', 'nontrapping-float-to-int', 'tail-call', 'sign-ext', 'reference-types', 'multivalue', 'gc', 'multimemory', 'memory64', 'custom-descriptors']) |
| 1187 | + return all_disallowed(['exception-handling', 'simd', 'threads', 'bulk-memory', 'nontrapping-float-to-int', 'tail-call', 'sign-ext', 'reference-types', 'multivalue', 'gc', 'multimemory', 'memory64', 'custom-descriptors', 'relaxed-atomics']) |
1191 | 1188 |
|
1192 | 1189 |
|
1193 | 1190 | # Returns the wat for a wasm file. If it is already wat, it just returns that |
@@ -1655,7 +1652,7 @@ def can_run_on_wasm(self, wasm): |
1655 | 1652 | return False |
1656 | 1653 |
|
1657 | 1654 | # see D8.can_run |
1658 | | - return all_disallowed(['shared-everything', 'strings', 'stack-switching']) |
| 1655 | + return all_disallowed(DISALLOWED_FEATURES_IN_V8) |
1659 | 1656 |
|
1660 | 1657 |
|
1661 | 1658 | # Check that the text format round-trips without error. |
@@ -1944,7 +1941,7 @@ def handle(self, wasm): |
1944 | 1941 | # (as optimizations can lead to different outputs), and we must |
1945 | 1942 | # disallow some features. |
1946 | 1943 | # TODO: relax some of these |
1947 | | - if NANS or not all_disallowed(['shared-everything', 'strings', 'stack-switching']): |
| 1944 | + if NANS or not all_disallowed(DISALLOWED_FEATURES_IN_V8): |
1948 | 1945 | return |
1949 | 1946 |
|
1950 | 1947 | output = run_d8_wasm(wasm, args=[second_wasm]) |
|
0 commit comments