File tree Expand file tree Collapse file tree 1 file changed +19
-4
lines changed Expand file tree Collapse file tree 1 file changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -64,11 +64,26 @@ function lazyllhttp () {
6464 const llhttpWasmData = process . env . JEST_WORKER_ID ? require ( '../llhttp/llhttp-wasm.js' ) : undefined
6565
6666 let mod
67- try {
68- mod = new WebAssembly . Module ( require ( '../llhttp/llhttp_simd-wasm.js' ) )
69- } catch {
70- /* istanbul ignore next */
7167
68+ // We disable wasm SIMD on ppc64 as it seems to be broken on Power 9 architectures.
69+ let useWasmSIMD = process . arch !== 'ppc64'
70+ // The Env Variable UNDICI_NO_WASM_SIMD allows explicitly overriding the default behavior
71+ if ( process . env . UNDICI_NO_WASM_SIMD === '1' ) {
72+ useWasmSIMD = true
73+ } else if ( process . env . UNDICI_NO_WASM_SIMD === '0' ) {
74+ useWasmSIMD = false
75+ }
76+
77+ if ( useWasmSIMD ) {
78+ try {
79+ mod = new WebAssembly . Module ( require ( '../llhttp/llhttp_simd-wasm.js' ) )
80+ /* istanbul ignore next */
81+ } catch {
82+ }
83+ }
84+
85+ /* istanbul ignore next */
86+ if ( ! mod ) {
7287 // We could check if the error was caused by the simd option not
7388 // being enabled, but the occurring of this other error
7489 // * https://github.com/emscripten-core/emscripten/issues/11495
You can’t perform that action at this time.
0 commit comments