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>
This commit is contained in:
Ruben Bridgewater
2023-02-18 11:18:04 +01:00
committed by GitHub
parent 9bbde3d7ba
commit fbd55a8139
5 changed files with 72 additions and 16 deletions

View File

@@ -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, {