summaryrefslogtreecommitdiff
path: root/benchmark
diff options
context:
space:
mode:
authorRuben Bridgewater <ruben@bridgewater.de>2023-02-18 11:18:04 +0100
committerGitHub <noreply@github.com>2023-02-18 11:18:04 +0100
commitfbd55a81390ca29954ada4c82c34f8d0a0b5c34e (patch)
tree216660c35299a6f4ef721bd815465f9c8408b23a /benchmark
parent9bbde3d7baef584f14569ef79f116e9d288c7aaa (diff)
downloadnode-new-fbd55a81390ca29954ada4c82c34f8d0a0b5c34e.tar.gz
lib: do not crash using workers with disabled shared array buffers
This allows the repl to function normally while using the `--no-harmony-sharedarraybuffer` V8 flag. It also fixes using workers while using the `--no-harmony-atomics` V8 flag. Fixes: https://github.com/nodejs/node/issues/39717 Signed-off-by: Ruben Bridgewater <ruben@bridgewater.de> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> PR-URL: https://github.com/nodejs/node/pull/41023 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Diffstat (limited to 'benchmark')
-rw-r--r--benchmark/worker/atomics-wait.js9
1 files changed, 8 insertions, 1 deletions
diff --git a/benchmark/worker/atomics-wait.js b/benchmark/worker/atomics-wait.js
index 7270f9f01c..2e6e01f881 100644
--- a/benchmark/worker/atomics-wait.js
+++ b/benchmark/worker/atomics-wait.js
@@ -1,5 +1,12 @@
'use strict';
-/* global SharedArrayBuffer */
+
+if (typeof SharedArrayBuffer === 'undefined') {
+ throw new Error('SharedArrayBuffers must be enabled to run this benchmark');
+}
+
+if (typeof Atomics === 'undefined') {
+ throw new Error('Atomics must be enabled to run this benchmark');
+}
const common = require('../common.js');
const bench = common.createBenchmark(main, {