From 3e65c4ba3dac22d5389c2c623d90cc2ec3ba6941 Mon Sep 17 00:00:00 2001 From: Sam Clegg Date: Wed, 25 Mar 2026 08:47:23 -0700 Subject: [PATCH] Convert more JS strings to use template literals. NFC --- src/jsifier.mjs | 2 +- src/lib/libbrowser.js | 4 +- src/lib/libccall.js | 4 +- src/lib/libcore.js | 2 +- src/lib/libsdl.js | 27 +++++++------ src/lib/libstrings.js | 4 +- src/lib/libsyscall.js | 2 +- src/lib/libwasmfs_node.js | 2 +- src/lib/libwebaudio.js | 2 +- src/lib/libwebgl2.js | 38 +++++++++---------- src/memoryprofiler.js | 8 ++-- src/preamble.js | 2 +- src/runtime_debug.js | 6 +-- src/runtime_init_memory.js | 2 +- test/codesize/test_codesize_cxx_ctors1.json | 8 ++-- test/codesize/test_codesize_cxx_ctors2.json | 8 ++-- test/codesize/test_codesize_cxx_except.json | 8 ++-- .../test_codesize_cxx_except_wasm.json | 8 ++-- .../test_codesize_cxx_except_wasm_legacy.json | 8 ++-- test/codesize/test_codesize_cxx_lto.json | 8 ++-- test/codesize/test_codesize_cxx_mangle.json | 8 ++-- test/codesize/test_codesize_cxx_noexcept.json | 8 ++-- test/codesize/test_codesize_cxx_wasmfs.json | 8 ++-- .../test_codesize_file_preload.expected.js | 2 +- test/codesize/test_codesize_file_preload.json | 8 ++-- test/codesize/test_codesize_files_js_fs.json | 8 ++-- test/codesize/test_codesize_files_wasmfs.json | 8 ++-- test/codesize/test_codesize_hello_O0.json | 8 ++-- test/codesize/test_codesize_hello_O1.json | 8 ++-- test/codesize/test_codesize_hello_O2.json | 8 ++-- test/codesize/test_codesize_hello_O3.json | 8 ++-- test/codesize/test_codesize_hello_Os.json | 8 ++-- test/codesize/test_codesize_hello_Oz.json | 8 ++-- test/codesize/test_codesize_hello_dylink.json | 8 ++-- .../test_codesize_hello_dylink_all.json | 4 +- .../test_codesize_hello_export_nothing.json | 8 ++-- .../test_codesize_hello_single_file.json | 4 +- test/codesize/test_codesize_hello_wasmfs.json | 8 ++-- .../test_codesize_libcxxabi_message_O3.json | 8 ++-- ...esize_libcxxabi_message_O3_standalone.json | 8 ++-- test/codesize/test_codesize_mem_O3.json | 8 ++-- test/codesize/test_codesize_mem_O3_grow.json | 8 ++-- .../test_codesize_mem_O3_grow_standalone.json | 8 ++-- .../test_codesize_mem_O3_standalone.json | 8 ++-- .../test_codesize_mem_O3_standalone_lib.json | 8 ++-- .../test_codesize_mem_O3_standalone_narg.json | 8 ++-- ..._codesize_mem_O3_standalone_narg_flto.json | 8 ++-- test/codesize/test_codesize_minimal_64.json | 8 ++-- .../test_codesize_minimal_O0.expected.js | 2 +- test/codesize/test_codesize_minimal_O0.json | 8 ++-- test/codesize/test_codesize_minimal_O1.json | 4 +- test/codesize/test_codesize_minimal_O2.json | 8 ++-- test/codesize/test_codesize_minimal_O3.json | 8 ++-- test/codesize/test_codesize_minimal_Os.json | 8 ++-- .../test_codesize_minimal_Oz-ctors.json | 8 ++-- test/codesize/test_codesize_minimal_Oz.json | 8 ++-- test/codesize/test_codesize_minimal_esm.json | 8 ++-- .../test_codesize_minimal_pthreads.json | 8 ++-- ...t_codesize_minimal_pthreads_memgrowth.json | 8 ++-- .../test_codesize_minimal_wasmfs.json | 8 ++-- test/codesize/test_small_js_flags.json | 4 +- test/codesize/test_unoptimized_code_size.json | 14 +++---- test/fs/test_lz4fs.c | 2 +- test/pthread/call_async_on_main_thread.js | 2 +- test/webidl/post.js | 2 +- .../websocket/nodejs_websocket_echo_server.js | 8 ++-- 66 files changed, 240 insertions(+), 241 deletions(-) diff --git a/src/jsifier.mjs b/src/jsifier.mjs index dbe20035574e1..fe71069110e28 100644 --- a/src/jsifier.mjs +++ b/src/jsifier.mjs @@ -107,7 +107,7 @@ function stringifyWithFunctions(obj) { if (typeof value === 'function' && (str.startsWith(key) || str.startsWith('async ' + key))) { rtn += str + ',\n'; } else { - rtn += escapeJSONKey(key) + ':' + str + ',\n'; + rtn += `${escapeJSONKey(key)}:${str},\n`; } } return rtn + '}'; diff --git a/src/lib/libbrowser.js b/src/lib/libbrowser.js index ab971fcc6734a..0b9a043776edb 100644 --- a/src/lib/libbrowser.js +++ b/src/lib/libbrowser.js @@ -596,8 +596,8 @@ var LibraryBrowser = { emscripten_run_preload_plugins_data: (data, size, suffix, arg, onload, onerror) => { {{{ runtimeKeepalivePush() }}} - var _suffix = UTF8ToString(suffix); - var name = 'prepare_data_' + (Browser_asyncPrepareDataCounter++) + '.' + _suffix; + suffix = UTF8ToString(suffix); + var name = `prepare_data_${Browser_asyncPrepareDataCounter++}.${suffix}`; var cname = stringToNewUTF8(name); FS.createPreloadedFile( '/', diff --git a/src/lib/libccall.js b/src/lib/libccall.js index 9803fbe26808f..bf48d9a912d5c 100644 --- a/src/lib/libccall.js +++ b/src/lib/libccall.js @@ -13,7 +13,7 @@ addToLibrary({ $getCFunc: (ident) => { var func = Module['_' + ident]; // closure exported function #if ASSERTIONS - assert(func, 'Cannot call unknown function ' + ident + ', make sure it is exported'); + assert(func, `Cannot call unknown function ${ident}, make sure it is exported`); #endif return func; }, @@ -112,7 +112,7 @@ addToLibrary({ // We need to return a Promise that resolves the return value // once the stack is rewound and execution finishes. #if ASSERTIONS - assert(asyncMode, 'The call to ' + ident + ' is running asynchronously. If this was intended, add the async option to the ccall/cwrap call.'); + assert(asyncMode, `The call to ${ident} is running asynchronously. If this was intended, add the async option to the ccall/cwrap call.`); #endif return Asyncify.whenDone().then(onDone); } diff --git a/src/lib/libcore.js b/src/lib/libcore.js index d9516f1477ea5..39b581db8a074 100644 --- a/src/lib/libcore.js +++ b/src/lib/libcore.js @@ -2593,7 +2593,7 @@ function wrapSyscallFunction(x, library, isWasi) { t = modifyJSFunction(t, (args, body, async_) => `${async_}function (${args}) {\n${pre}${body}${post}}\n`); } - library[x] = eval('(' + t + ')'); + library[x] = eval(`(${t})`); // Automatically add dependency on `$SYSCALLS` if (!WASMFS && t.includes('SYSCALLS')) { library[x + '__deps'].push('$SYSCALLS'); diff --git a/src/lib/libsdl.js b/src/lib/libsdl.js index fae111096cdef..b17b1da60e805 100644 --- a/src/lib/libsdl.js +++ b/src/lib/libsdl.js @@ -1066,16 +1066,16 @@ var LibrarySDL = { {{{ makeSetValue('ptr', C_STRUCTS.SDL_WindowEvent.event, 'visibilityEventID' , 'i8') }}}; break; } - default: abort('Unhandled SDL event: ' + event.type); + default: abort(`Unhandled SDL event: ${event.type}`); } }, makeFontString(height, fontName) { - if (fontName.charAt(0) != "'" && fontName.charAt(0) != '"') { + if (fontName[0] != "'" && fontName[0] != '"') { // https://developer.mozilla.org/ru/docs/Web/CSS/font-family // Font family names containing whitespace should be quoted. // BTW, quote all font names is easier than searching spaces - fontName = '"' + fontName + '"'; + fontName = `"${fontName}"`; } return height + 'px ' + fontName + ', serif'; }, @@ -1222,7 +1222,7 @@ var LibrarySDL = { for (var c = 0; c < numChannels; ++c) { var channelData = dstAudioBuffer['getChannelData'](c); if (channelData.length != sizeSamplesPerChannel) { - abort('Web Audio output buffer length mismatch! Destination size: ' + channelData.length + ' samples vs expected ' + sizeSamplesPerChannel + ' samples!'); + abort(`Web Audio output buffer length mismatch! Destination size: ${channelData.length} samples vs expected ${sizeSamplesPerChannel} samples!`); } if (audio.format == {{{ cDefs.AUDIO_S16LSB }}}) { for (var j = 0; j < sizeSamplesPerChannel; ++j) { @@ -1238,7 +1238,7 @@ var LibrarySDL = { channelData[j] = ({{{ makeGetValue('heapPtr', '(j*numChannels + c)*4', 'float') }}}); } } else { - abort('Invalid SDL audio format ' + audio.format + '!'); + abort(`Invalid SDL audio format ${audio.format}!`); } } }, @@ -2264,8 +2264,8 @@ var LibrarySDL = { raw = callStbImage('stbi_load', [name]); if (!raw) return 0; #else - warnOnce('Cannot find preloaded image ' + filename); - warnOnce('Cannot find preloaded image ' + filename + '. Consider using STB_IMAGE=1 if you want synchronous image decoding (see settings.js), or package files with --use-preload-plugins'); + warnOnce(`Cannot find preloaded image ${filename}`); + warnOnce(`Cannot find preloaded image ${filename}. Consider using STB_IMAGE=1 if you want synchronous image decoding (see settings.js), or package files with --use-preload-plugins`); return 0; #endif } else if (Module['freePreloadedMediaOnUse']) { @@ -2275,7 +2275,7 @@ var LibrarySDL = { var surf = SDL.makeSurface(raw.width, raw.height, 0, false, 'load:' + filename); var surfData = SDL.surfaces[surf]; - surfData.ctx.globalCompositeOperation = "copy"; + surfData.ctx.globalCompositeOperation = 'copy'; if (!raw.rawData) { surfData.ctx.drawImage(raw, 0, 0, raw.width, raw.height, 0, 0, raw.width, raw.height); } else { @@ -2385,12 +2385,12 @@ var LibrarySDL = { } else if (SDL.audio.format == {{{ cDefs.AUDIO_F32 }}}) { SDL.audio.silence = 0.0; // Float data in range [-1.0, 1.0], silence is 0.0 } else { - abort('Invalid SDL audio format ' + SDL.audio.format + '!'); + abort(`Invalid SDL audio format ${SDL.audio.format}!`); } // Round the desired audio frequency up to the next 'common' frequency value. // Web Audio API spec states 'An implementation must support sample-rates in at least the range 22050 to 96000.' if (SDL.audio.freq <= 0) { - abort('Unsupported sound frequency ' + SDL.audio.freq + '!'); + abort(`Unsupported sound frequency ${SDL.audio.freq}!`); } else if (SDL.audio.freq <= 22050) { SDL.audio.freq = 22050; // Take it safe and clamp everything lower than 22kHz to that. } else if (SDL.audio.freq <= 32000) { @@ -3137,8 +3137,7 @@ var LibrarySDL = { #if ASSERTIONS // Check the final context looks valid. See // https://github.com/emscripten-core/emscripten/issues/16242 - assert(typeof SDL.ttfContext.measureText == 'function', - 'context ' + SDL.ttfContext + 'must provide valid methods'); + assert(typeof SDL.ttfContext.measureText == 'function', `context ${SDL.ttfContext} must provide valid methods`); #endif return 0; }, @@ -3357,7 +3356,7 @@ var LibrarySDL = { SDL_GL_SetAttribute__proxy: 'sync', SDL_GL_SetAttribute: (attr, value) => { if (!(attr in SDL.glAttributes)) { - abort('Unknown SDL GL attribute (' + attr + '). Please check if your SDL version is supported.'); + abort(`Unknown SDL GL attribute (${attr}). Please check if your SDL version is supported.`); } SDL.glAttributes[attr] = value; @@ -3366,7 +3365,7 @@ var LibrarySDL = { SDL_GL_GetAttribute__proxy: 'sync', SDL_GL_GetAttribute: (attr, value) => { if (!(attr in SDL.glAttributes)) { - abort('Unknown SDL GL attribute (' + attr + '). Please check if your SDL version is supported.'); + abort(`Unknown SDL GL attribute (${attr}). Please check if your SDL version is supported.`); } if (value) {{{ makeSetValue('value', 0, 'SDL.glAttributes[attr]', 'i32') }}}; diff --git a/src/lib/libstrings.js b/src/lib/libstrings.js index 82152e2c89438..a048f0ec31613 100644 --- a/src/lib/libstrings.js +++ b/src/lib/libstrings.js @@ -76,7 +76,7 @@ addToLibrary({ u0 = ((u0 & 15) << 12) | (u1 << 6) | u2; } else { #if ASSERTIONS - if ((u0 & 0xF8) != 0xF0) warnOnce('Invalid UTF-8 leading byte ' + ptrToString(u0) + ' encountered when deserializing a UTF-8 string in wasm memory to a JS string!'); + if ((u0 & 0xF8) != 0xF0) warnOnce(`Invalid UTF-8 leading byte ${ptrToString(u0)} encountered when deserializing a UTF-8 string in wasm memory to a JS string!`); #endif u0 = ((u0 & 7) << 18) | (u1 << 12) | (u2 << 6) | (heapOrArray[idx++] & 63); } @@ -186,7 +186,7 @@ addToLibrary({ } else { if (outIdx + 3 >= endIdx) break; #if ASSERTIONS - if (u > 0x10FFFF) warnOnce('Invalid Unicode code point ' + ptrToString(u) + ' encountered when serializing a JS string to a UTF-8 string in wasm memory! (Valid unicode code points should be in range 0-0x10FFFF).'); + if (u > 0x10FFFF) warnOnce(`Invalid Unicode code point ${ptrToString(u)} encountered when serializing a JS string to a UTF-8 string in wasm memory! (Valid unicode code points should be in range 0-0x10FFFF).`); #endif heap[outIdx++] = 0xF0 | (u >> 18); heap[outIdx++] = 0x80 | ((u >> 12) & 63); diff --git a/src/lib/libsyscall.js b/src/lib/libsyscall.js index 1e1976cf41875..cbc5d3d0a5774 100644 --- a/src/lib/libsyscall.js +++ b/src/lib/libsyscall.js @@ -339,7 +339,7 @@ var SyscallsLibrary = { if (info.errno) throw new FS.ErrnoError(info.errno); info.addr = DNS.lookup_addr(info.addr) || info.addr; #if SYSCALL_DEBUG - dbg(' (socketaddress: "' + [info.addr, info.port] + '")'); + dbg(` (socketaddress: "${[info.addr, info.port]}")`); #endif return info; }, diff --git a/src/lib/libwasmfs_node.js b/src/lib/libwasmfs_node.js index bf749467ffdc6..586eb3c77722f 100644 --- a/src/lib/libwasmfs_node.js +++ b/src/lib/libwasmfs_node.js @@ -11,7 +11,7 @@ addToLibrary({ $wasmfsNodeConvertNodeCode: (e) => { var code = e.code; #if ASSERTIONS - assert(code in ERRNO_CODES, 'unexpected node error code: ' + code + ' (' + e + ')'); + assert(code in ERRNO_CODES, `unexpected node error code: ${code} (${e})`); #endif return ERRNO_CODES[code]; }, diff --git a/src/lib/libwebaudio.js b/src/lib/libwebaudio.js index af78d29ff6940..421852d367e67 100644 --- a/src/lib/libwebaudio.js +++ b/src/lib/libwebaudio.js @@ -185,7 +185,7 @@ var LibraryWebAudio = { assert(stackLowestAddress % 16 == 0, `AudioWorklet stack should be aligned to 16 bytes! (was ${stackLowestAddress} == ${stackLowestAddress%16} mod 16) Use e.g. memalign(16, stackSize) to align the stack!`); assert(stackSize != 0, 'AudioWorklets require a dedicated stack space for audio data marshalling between Wasm and JS!'); assert(stackSize % 16 == 0, `AudioWorklet stack size should be a multiple of 16 bytes! (was ${stackSize} == ${stackSize%16} mod 16)`); - assert(!audioContext.audioWorkletInitialized, 'emscripten_create_wasm_audio_worklet() was already called for AudioContext ' + contextHandle + '! Only call this function once per AudioContext!'); + assert(!audioContext.audioWorkletInitialized, `emscripten_create_wasm_audio_worklet() was already called for AudioContext ${contextHandle}! Only call this function once per AudioContext!`); audioContext.audioWorkletInitialized = 1; #endif diff --git a/src/lib/libwebgl2.js b/src/lib/libwebgl2.js index 0764469c2feb4..e03277d08c2aa 100644 --- a/src/lib/libwebgl2.js +++ b/src/lib/libwebgl2.js @@ -16,7 +16,7 @@ var LibraryWebGL2 = { if (index < 0 || index >= stringiCache.length) { GL.recordError(0x501/*GL_INVALID_VALUE*/); #if GL_ASSERTIONS - err('GL_INVALID_VALUE in glGetStringi: index out of range (' + index + ')!'); + err(`GL_INVALID_VALUE in glGetStringi: index out of range (${index})!`); #endif return 0; } @@ -29,7 +29,7 @@ var LibraryWebGL2 = { if (index < 0 || index >= stringiCache.length) { GL.recordError(0x501/*GL_INVALID_VALUE*/); #if GL_ASSERTIONS - err('GL_INVALID_VALUE in glGetStringi: index out of range (' + index + ') in a call to GL_EXTENSIONS!'); + err(`GL_INVALID_VALUE in glGetStringi: index out of range (${index}) in a call to GL_EXTENSIONS!`); #endif return 0; } @@ -37,7 +37,7 @@ var LibraryWebGL2 = { default: GL.recordError(0x500/*GL_INVALID_ENUM*/); #if GL_ASSERTIONS - err('GL_INVALID_ENUM in glGetStringi: Unknown parameter ' + name + '!'); + err(`GL_INVALID_ENUM in glGetStringi: Unknown parameter ${name}!`); #endif return 0; } @@ -52,7 +52,7 @@ var LibraryWebGL2 = { #if GL_TRACK_ERRORS if (bufSize < 0) { #if GL_ASSERTIONS - err('GL_INVALID_VALUE in glGetInternalformativ(target=' + target + ', internalformat=' + internalformat + ', pname=' + pname + ', bufSize=' + bufSize + ', params=' + params + '): Function called with bufSize < 0!'); + err(`GL_INVALID_VALUE in glGetInternalformativ(target=${target}, internalformat=${internalformat}, pname=${pname}, bufSize=${bufSize}, params=${params}): Function called with bufSize < 0!`); #endif GL.recordError(0x501 /* GL_INVALID_VALUE */); return; @@ -61,7 +61,7 @@ var LibraryWebGL2 = { // GLES3 specification does not specify how to behave if values is a null pointer. Since calling this function does not make sense // if values == null, issue a GL error to notify user about it. #if GL_ASSERTIONS - err('GL_INVALID_VALUE in glGetInternalformativ(target=' + target + ', internalformat=' + internalformat + ', pname=' + pname + ', bufSize=' + bufSize + ', params=0): Function called with null out pointer!'); + err(`GL_INVALID_VALUE in glGetInternalformativ(target=${target}, internalformat=${internalformat}, pname=${pname}, bufSize=${bufSize}, params=0): Function called with null out pointer!`); #endif GL.recordError(0x501 /* GL_INVALID_VALUE */); return; @@ -97,7 +97,7 @@ var LibraryWebGL2 = { // GLES2 specification does not specify how to behave if data is a null pointer. Since calling this function does not make sense // if data == null, issue a GL error to notify user about it. #if GL_ASSERTIONS - err('GL_INVALID_VALUE in glGetBufferParameteri64v(target=' + target + ', value=' + value + ', data=0): Function called with null out data pointer!'); + err(`GL_INVALID_VALUE in glGetBufferParameteri64v(target=${target}, value=${value}, data=0): Function called with null out data pointer!`); #endif GL.recordError(0x501 /* GL_INVALID_VALUE */); return; @@ -112,7 +112,7 @@ var LibraryWebGL2 = { // GLES2 specification does not specify how to behave if data is a null pointer. Since calling this function does not make sense // if data == null, issue a GL error to notify user about it. #if GL_ASSERTIONS - err('GL_INVALID_VALUE in glGetBufferSubData(target=' + target + ', offset=' + offset + ', size=' + size + ', data=0): Function called with null out data pointer!'); + err(`GL_INVALID_VALUE in glGetBufferSubData(target=${target}, offset=${offset}, size=${size}, data=0): Function called with null out data pointer!`); #endif GL.recordError(0x501 /* GL_INVALID_VALUE */); return; @@ -128,7 +128,7 @@ var LibraryWebGL2 = { glInvalidateFramebuffer__deps: ['$tempFixedLengthArray'], glInvalidateFramebuffer: (target, numAttachments, attachments) => { #if GL_ASSERTIONS - assert(numAttachments < tempFixedLengthArray.length, 'Invalid count of numAttachments=' + numAttachments + ' passed to glInvalidateFramebuffer (that many attachment points do not exist in GL)'); + assert(numAttachments < tempFixedLengthArray.length, `Invalid count of numAttachments=${numAttachments} passed to glInvalidateFramebuffer (that many attachment points do not exist in GL)`); #endif var list = tempFixedLengthArray[numAttachments]; for (var i = 0; i < numAttachments; i++) { @@ -141,7 +141,7 @@ var LibraryWebGL2 = { glInvalidateSubFramebuffer__deps: ['$tempFixedLengthArray'], glInvalidateSubFramebuffer: (target, numAttachments, attachments, x, y, width, height) => { #if GL_ASSERTIONS - assert(numAttachments < tempFixedLengthArray.length, 'Invalid count of numAttachments=' + numAttachments + ' passed to glInvalidateSubFramebuffer (that many attachment points do not exist in GL)'); + assert(numAttachments < tempFixedLengthArray.length, `Invalid count of numAttachments=${numAttachments} passed to glInvalidateSubFramebuffer (that many attachment points do not exist in GL)`); #endif var list = tempFixedLengthArray[numAttachments]; for (var i = 0; i < numAttachments; i++) { @@ -222,7 +222,7 @@ var LibraryWebGL2 = { // GLES2 specification does not specify how to behave if params is a null pointer. Since calling this function does not make sense // if p == null, issue a GL error to notify user about it. #if GL_ASSERTIONS - err('GL_INVALID_VALUE in glGetQueryiv(target=' + target +', pname=' + pname + ', params=0): Function called with null out pointer!'); + err(`GL_INVALID_VALUE in glGetQueryiv(target=${target}, pname=${pname}, params=0): Function called with null out pointer!`); #endif GL.recordError(0x501 /* GL_INVALID_VALUE */); return; @@ -237,7 +237,7 @@ var LibraryWebGL2 = { // GLES2 specification does not specify how to behave if params is a null pointer. Since calling this function does not make sense // if p == null, issue a GL error to notify user about it. #if GL_ASSERTIONS - err('GL_INVALID_VALUE in glGetQueryObjectuiv(id=' + id +', pname=' + pname + ', params=0): Function called with null out pointer!'); + err(`GL_INVALID_VALUE in glGetQueryObjectuiv(id=${id}, pname=${pname}, params=0): Function called with null out pointer!`); #endif GL.recordError(0x501 /* GL_INVALID_VALUE */); return; @@ -326,7 +326,7 @@ var LibraryWebGL2 = { // GLES3 specification does not specify how to behave if params is a null pointer. Since calling this function does not make sense // if p == null, issue a GL error to notify user about it. #if GL_ASSERTIONS - err('GL_INVALID_VALUE in glGetSamplerParameterfv(sampler=' + sampler +', pname=' + pname + ', params=0): Function called with null out pointer!'); + err(`GL_INVALID_VALUE in glGetSamplerParameterfv(sampler=${sampler}, pname=${pname}, params=0): Function called with null out pointer!`); #endif GL.recordError(0x501 /* GL_INVALID_VALUE */); return; @@ -341,7 +341,7 @@ var LibraryWebGL2 = { // GLES3 specification does not specify how to behave if params is a null pointer. Since calling this function does not make sense // if p == null, issue a GL error to notify user about it. #if GL_ASSERTIONS - err('GL_INVALID_VALUE in glGetSamplerParameteriv(sampler=' + sampler +', pname=' + pname + ', params=0): Function called with null out pointer!'); + err(`GL_INVALID_VALUE in glGetSamplerParameteriv(sampler=${sampler}, pname=${pname}, params=0): Function called with null out pointer!`); #endif GL.recordError(0x501 /* GL_INVALID_VALUE */); return; @@ -417,7 +417,7 @@ var LibraryWebGL2 = { // GLES2 specification does not specify how to behave if data is a null pointer. Since calling this function does not make sense // if data == null, issue a GL error to notify user about it. #if GL_ASSERTIONS - err('GL_INVALID_VALUE in glGetInteger(64)i_v(target=' + target + ', index=' + index + ', data=0): Function called with null out pointer!'); + err(`GL_INVALID_VALUE in glGetInteger(64)i_v(target=${target}, index=${index}, data=0): Function called with null out pointer!`); #endif GL.recordError(0x501 /* GL_INVALID_VALUE */); return; @@ -506,7 +506,7 @@ var LibraryWebGL2 = { // GLES2 specification does not specify how to behave if uniformIndices is a null pointer. Since calling this function does not make sense // if uniformIndices == null, issue a GL error to notify user about it. #if GL_ASSERTIONS - err('GL_INVALID_VALUE in glGetUniformIndices(program=' + program + ', uniformCount=' + uniformCount + ', uniformNames=' + uniformNames + ', uniformIndices=0): Function called with null out pointer!'); + err(`GL_INVALID_VALUE in glGetUniformIndices(program=${program}, uniformCount=${uniformCount}, uniformNames=${uniformNames}, uniformIndices=0): Function called with null out pointer!`); #endif GL.recordError(0x501 /* GL_INVALID_VALUE */); return; @@ -539,7 +539,7 @@ var LibraryWebGL2 = { // GLES2 specification does not specify how to behave if params is a null pointer. Since calling this function does not make sense // if params == null, issue a GL error to notify user about it. #if GL_ASSERTIONS - err('GL_INVALID_VALUE in glGetActiveUniformsiv(program=' + program + ', uniformCount=' + uniformCount + ', uniformIndices=' + uniformIndices + ', pname=' + pname + ', params=0): Function called with null out pointer!'); + err(`GL_INVALID_VALUE in glGetActiveUniformsiv(program=${program}, uniformCount=${uniformCount}, uniformIndices=${uniformIndices}, pname=${pname}, params=0): Function called with null out pointer!`); #endif GL.recordError(0x501 /* GL_INVALID_VALUE */); return; @@ -577,7 +577,7 @@ var LibraryWebGL2 = { // GLES2 specification does not specify how to behave if params is a null pointer. Since calling this function does not make sense // if params == null, issue a GL error to notify user about it. #if GL_ASSERTIONS - err('GL_INVALID_VALUE in glGetActiveUniformBlockiv(program=' + program + ', uniformBlockIndex=' + uniformBlockIndex + ', pname=' + pname + ', params=0): Function called with null out pointer!'); + err(`GL_INVALID_VALUE in glGetActiveUniformBlockiv(program=${program}, uniformBlockIndex=${uniformBlockIndex}, pname=${pname}, params=0): Function called with null out pointer!`); #endif GL.recordError(0x501 /* GL_INVALID_VALUE */); return; @@ -704,7 +704,7 @@ var LibraryWebGL2 = { // GLES3 specification does not specify how to behave if bufSize < 0, however in the spec wording for glGetInternalformativ, it does say that GL_INVALID_VALUE should be raised, // so raise GL_INVALID_VALUE here as well. #if GL_ASSERTIONS - err('GL_INVALID_VALUE in glGetSynciv(sync=' + sync + ', pname=' + pname + ', bufSize=' + bufSize + ', length=' + length + ', values='+values+'): Function called with bufSize < 0!'); + err(`GL_INVALID_VALUE in glGetSynciv(sync=${sync}, pname=${pname}, bufSize=${bufSize}, length=${length}, values=${values}): Function called with bufSize < 0!`); #endif GL.recordError(0x501 /* GL_INVALID_VALUE */); return; @@ -713,7 +713,7 @@ var LibraryWebGL2 = { // GLES3 specification does not specify how to behave if values is a null pointer. Since calling this function does not make sense // if values == null, issue a GL error to notify user about it. #if GL_ASSERTIONS - err('GL_INVALID_VALUE in glGetSynciv(sync=' + sync + ', pname=' + pname + ', bufSize=' + bufSize + ', length=' + length + ', values=0): Function called with null out pointer!'); + err(`GL_INVALID_VALUE in glGetSynciv(sync=${sync}, pname=${pname}, bufSize=${bufSize}, length=${length}, values=0): Function called with null out pointer!`); #endif GL.recordError(0x501 /* GL_INVALID_VALUE */); return; diff --git a/src/memoryprofiler.js b/src/memoryprofiler.js index e2ea9be8d0cd5..44b545115be98 100644 --- a/src/memoryprofiler.js +++ b/src/memoryprofiler.js @@ -159,7 +159,7 @@ var emscriptenMemoryProfiler = { end: newSize, color: self.resizeMemorySources.length % 2 ? '#ff00ff' : '#ff80ff' }); - console.log('memory resize: ' + oldSize + ' ' + newSize); + console.log(`memory resize: ${oldSize} ${newSize}`); }, recordStackWatermark() { @@ -174,9 +174,9 @@ var emscriptenMemoryProfiler = { if (emscriptenMemoryProfiler.sizeOfAllocatedPtr[ptr]) { // Uncomment to debug internal workings of tracing: -// console.error('Allocation error in onMalloc! Pointer ' + ptr + ' had already been tracked as allocated!'); -// console.error('Previous site of allocation: ' + emscriptenMemoryProfiler.allocationSitePtrs[ptr]); -// console.error('This doubly attempted site of allocation: ' + new Error().stack.toString()); +// console.error(`Allocation error in onMalloc! Pointer ${ptr} had already been tracked as allocated!`); +// console.error(`Previous site of allocation: ${emscriptenMemoryProfiler.allocationSitePtrs[ptr]}`); +// console.error(`This doubly attempted site of allocation: ${new Error().stack.toString()}`); // abort('malloc internal inconsistency!'); return; } diff --git a/src/preamble.js b/src/preamble.js index 2b247c7ee2eaf..97b2227e3dde9 100644 --- a/src/preamble.js +++ b/src/preamble.js @@ -241,7 +241,7 @@ function abort(what) { Module['onAbort']?.(what); #endif - what = 'Aborted(' + what + ')'; + what = `Aborted(${what})`; // TODO(sbc): Should we remove printing and leave it up to whoever // catches the exception? err(what); diff --git a/src/runtime_debug.js b/src/runtime_debug.js index 7c1170a3b3010..4752179a8d188 100644 --- a/src/runtime_debug.js +++ b/src/runtime_debug.js @@ -249,7 +249,7 @@ function prettyPrint(arg) { if (typeof arg == 'boolean') arg = arg + 0; if (!arg) return arg; var index = printObjectList.indexOf(arg); - if (index >= 0) return '<' + arg + '|' + index + '>'; + if (index >= 0) return `<${arg}|${index}>`; if (arg.toString() == '[object HTMLImageElement]') { return arg + '\n\n'; } @@ -260,9 +260,9 @@ function prettyPrint(arg) { return ''; } else if (typeof arg == 'object') { printObjectList.push(arg); - return '<' + arg + '|' + (printObjectList.length-1) + '>'; + return `<${arg}|${printObjectList.length-1}>`; } else if (typeof arg == 'number') { - if (arg > 0) return ptrToString(arg) + ' (' + arg + ')'; + if (arg > 0) return `${ptrToString(arg)} (${arg})`; } return arg; } diff --git a/src/runtime_init_memory.js b/src/runtime_init_memory.js index b7e7b4d233f62..fa84be28ed6aa 100644 --- a/src/runtime_init_memory.js +++ b/src/runtime_init_memory.js @@ -31,7 +31,7 @@ function initMemory() { var INITIAL_MEMORY = {{{ makeModuleReceiveExpr('INITIAL_MEMORY', INITIAL_MEMORY) }}}; #if ASSERTIONS - assert(INITIAL_MEMORY >= {{{STACK_SIZE}}}, 'INITIAL_MEMORY should be larger than STACK_SIZE, was ' + INITIAL_MEMORY + '! (STACK_SIZE=' + {{{STACK_SIZE}}} + ')'); + assert(INITIAL_MEMORY >= {{{ STACK_SIZE }}}, `INITIAL_MEMORY should be larger than STACK_SIZE, was ${INITIAL_MEMORY}! (STACK_SIZE={{{ STACK_SIZE }}})`); #endif /** @suppress {checkTypes} */ #if MINIMAL_RUNTIME && WASM_WORKERS diff --git a/test/codesize/test_codesize_cxx_ctors1.json b/test/codesize/test_codesize_cxx_ctors1.json index 18689606b91f1..dff56a4063fb0 100644 --- a/test/codesize/test_codesize_cxx_ctors1.json +++ b/test/codesize/test_codesize_cxx_ctors1.json @@ -1,10 +1,10 @@ { - "a.out.js": 19195, - "a.out.js.gz": 7973, + "a.out.js": 19194, + "a.out.js.gz": 7969, "a.out.nodebug.wasm": 132638, "a.out.nodebug.wasm.gz": 49927, - "total": 151833, - "total_gz": 57900, + "total": 151832, + "total_gz": 57896, "sent": [ "__cxa_throw", "_abort_js", diff --git a/test/codesize/test_codesize_cxx_ctors2.json b/test/codesize/test_codesize_cxx_ctors2.json index 0352ce530c044..fb2e77ec4ae92 100644 --- a/test/codesize/test_codesize_cxx_ctors2.json +++ b/test/codesize/test_codesize_cxx_ctors2.json @@ -1,10 +1,10 @@ { - "a.out.js": 19172, - "a.out.js.gz": 7960, + "a.out.js": 19171, + "a.out.js.gz": 7957, "a.out.nodebug.wasm": 132064, "a.out.nodebug.wasm.gz": 49586, - "total": 151236, - "total_gz": 57546, + "total": 151235, + "total_gz": 57543, "sent": [ "__cxa_throw", "_abort_js", diff --git a/test/codesize/test_codesize_cxx_except.json b/test/codesize/test_codesize_cxx_except.json index 435c47f5499e1..c29dbd2b26b46 100644 --- a/test/codesize/test_codesize_cxx_except.json +++ b/test/codesize/test_codesize_cxx_except.json @@ -1,10 +1,10 @@ { - "a.out.js": 23175, - "a.out.js.gz": 8964, + "a.out.js": 23174, + "a.out.js.gz": 8960, "a.out.nodebug.wasm": 172516, "a.out.nodebug.wasm.gz": 57438, - "total": 195691, - "total_gz": 66402, + "total": 195690, + "total_gz": 66398, "sent": [ "__cxa_begin_catch", "__cxa_end_catch", diff --git a/test/codesize/test_codesize_cxx_except_wasm.json b/test/codesize/test_codesize_cxx_except_wasm.json index f71cc060337a5..cb737cf73678b 100644 --- a/test/codesize/test_codesize_cxx_except_wasm.json +++ b/test/codesize/test_codesize_cxx_except_wasm.json @@ -1,10 +1,10 @@ { - "a.out.js": 19027, - "a.out.js.gz": 7908, + "a.out.js": 19026, + "a.out.js.gz": 7904, "a.out.nodebug.wasm": 147922, "a.out.nodebug.wasm.gz": 55312, - "total": 166949, - "total_gz": 63220, + "total": 166948, + "total_gz": 63216, "sent": [ "_abort_js", "_tzset_js", diff --git a/test/codesize/test_codesize_cxx_except_wasm_legacy.json b/test/codesize/test_codesize_cxx_except_wasm_legacy.json index b8b4d629e37bc..71fbc6b06eb6d 100644 --- a/test/codesize/test_codesize_cxx_except_wasm_legacy.json +++ b/test/codesize/test_codesize_cxx_except_wasm_legacy.json @@ -1,10 +1,10 @@ { - "a.out.js": 19101, - "a.out.js.gz": 7933, + "a.out.js": 19100, + "a.out.js.gz": 7929, "a.out.nodebug.wasm": 145729, "a.out.nodebug.wasm.gz": 54945, - "total": 164830, - "total_gz": 62878, + "total": 164829, + "total_gz": 62874, "sent": [ "_abort_js", "_tzset_js", diff --git a/test/codesize/test_codesize_cxx_lto.json b/test/codesize/test_codesize_cxx_lto.json index d07c6925e5f67..9d0adf026ea81 100644 --- a/test/codesize/test_codesize_cxx_lto.json +++ b/test/codesize/test_codesize_cxx_lto.json @@ -1,10 +1,10 @@ { - "a.out.js": 18564, - "a.out.js.gz": 7670, + "a.out.js": 18563, + "a.out.js.gz": 7666, "a.out.nodebug.wasm": 101954, "a.out.nodebug.wasm.gz": 39462, - "total": 120518, - "total_gz": 47132, + "total": 120517, + "total_gz": 47128, "sent": [ "a (emscripten_resize_heap)", "b (_setitimer_js)", diff --git a/test/codesize/test_codesize_cxx_mangle.json b/test/codesize/test_codesize_cxx_mangle.json index 6ee20ff2d62c4..f2ddec2dbd75d 100644 --- a/test/codesize/test_codesize_cxx_mangle.json +++ b/test/codesize/test_codesize_cxx_mangle.json @@ -1,10 +1,10 @@ { - "a.out.js": 23225, - "a.out.js.gz": 8986, + "a.out.js": 23224, + "a.out.js.gz": 8983, "a.out.nodebug.wasm": 238957, "a.out.nodebug.wasm.gz": 79847, - "total": 262182, - "total_gz": 88833, + "total": 262181, + "total_gz": 88830, "sent": [ "__cxa_begin_catch", "__cxa_end_catch", diff --git a/test/codesize/test_codesize_cxx_noexcept.json b/test/codesize/test_codesize_cxx_noexcept.json index d2b27cfde08b3..4881c4a93cac7 100644 --- a/test/codesize/test_codesize_cxx_noexcept.json +++ b/test/codesize/test_codesize_cxx_noexcept.json @@ -1,10 +1,10 @@ { - "a.out.js": 19195, - "a.out.js.gz": 7973, + "a.out.js": 19194, + "a.out.js.gz": 7969, "a.out.nodebug.wasm": 134661, "a.out.nodebug.wasm.gz": 50777, - "total": 153856, - "total_gz": 58750, + "total": 153855, + "total_gz": 58746, "sent": [ "__cxa_throw", "_abort_js", diff --git a/test/codesize/test_codesize_cxx_wasmfs.json b/test/codesize/test_codesize_cxx_wasmfs.json index ff569694f2807..9d83f3e7f89b1 100644 --- a/test/codesize/test_codesize_cxx_wasmfs.json +++ b/test/codesize/test_codesize_cxx_wasmfs.json @@ -1,10 +1,10 @@ { - "a.out.js": 7024, - "a.out.js.gz": 3312, + "a.out.js": 7023, + "a.out.js.gz": 3310, "a.out.nodebug.wasm": 172714, "a.out.nodebug.wasm.gz": 63316, - "total": 179738, - "total_gz": 66628, + "total": 179737, + "total_gz": 66626, "sent": [ "__cxa_throw", "_abort_js", diff --git a/test/codesize/test_codesize_file_preload.expected.js b/test/codesize/test_codesize_file_preload.expected.js index 885599e146a08..479bdb9329a68 100644 --- a/test/codesize/test_codesize_file_preload.expected.js +++ b/test/codesize/test_codesize_file_preload.expected.js @@ -362,7 +362,7 @@ function preMain() {} function postRun() {} /** @param {string|number=} what */ function abort(what) { - what = "Aborted(" + what + ")"; + what = `Aborted(${what})`; // TODO(sbc): Should we remove printing and leave it up to whoever // catches the exception? err(what); diff --git a/test/codesize/test_codesize_file_preload.json b/test/codesize/test_codesize_file_preload.json index b7b9f15a04e0e..a84ee7c65dad3 100644 --- a/test/codesize/test_codesize_file_preload.json +++ b/test/codesize/test_codesize_file_preload.json @@ -1,10 +1,10 @@ { - "a.out.js": 22142, - "a.out.js.gz": 9188, + "a.out.js": 22141, + "a.out.js.gz": 9184, "a.out.nodebug.wasm": 1648, "a.out.nodebug.wasm.gz": 939, - "total": 23790, - "total_gz": 10127, + "total": 23789, + "total_gz": 10123, "sent": [ "a (fd_write)" ], diff --git a/test/codesize/test_codesize_files_js_fs.json b/test/codesize/test_codesize_files_js_fs.json index fbec85b5ddf28..78a3cf7f21ebf 100644 --- a/test/codesize/test_codesize_files_js_fs.json +++ b/test/codesize/test_codesize_files_js_fs.json @@ -1,10 +1,10 @@ { - "a.out.js": 17835, - "a.out.js.gz": 7313, + "a.out.js": 17834, + "a.out.js.gz": 7308, "a.out.nodebug.wasm": 381, "a.out.nodebug.wasm.gz": 260, - "total": 18216, - "total_gz": 7573, + "total": 18215, + "total_gz": 7568, "sent": [ "a (fd_write)", "b (fd_read)", diff --git a/test/codesize/test_codesize_files_wasmfs.json b/test/codesize/test_codesize_files_wasmfs.json index 7e9e29dc554e9..327251e75f6b3 100644 --- a/test/codesize/test_codesize_files_wasmfs.json +++ b/test/codesize/test_codesize_files_wasmfs.json @@ -1,10 +1,10 @@ { - "a.out.js": 5466, - "a.out.js.gz": 2578, + "a.out.js": 5465, + "a.out.js.gz": 2575, "a.out.nodebug.wasm": 58418, "a.out.nodebug.wasm.gz": 18067, - "total": 63884, - "total_gz": 20645, + "total": 63883, + "total_gz": 20642, "sent": [ "a (emscripten_date_now)", "b (emscripten_err)", diff --git a/test/codesize/test_codesize_hello_O0.json b/test/codesize/test_codesize_hello_O0.json index 5928ffbd66323..ed7a13ce715c6 100644 --- a/test/codesize/test_codesize_hello_O0.json +++ b/test/codesize/test_codesize_hello_O0.json @@ -1,10 +1,10 @@ { - "a.out.js": 24271, - "a.out.js.gz": 8724, + "a.out.js": 24261, + "a.out.js.gz": 8714, "a.out.nodebug.wasm": 14850, "a.out.nodebug.wasm.gz": 7311, - "total": 39121, - "total_gz": 16035, + "total": 39111, + "total_gz": 16025, "sent": [ "fd_write" ], diff --git a/test/codesize/test_codesize_hello_O1.json b/test/codesize/test_codesize_hello_O1.json index 561cb58a6773a..b078c77c56f44 100644 --- a/test/codesize/test_codesize_hello_O1.json +++ b/test/codesize/test_codesize_hello_O1.json @@ -1,10 +1,10 @@ { - "a.out.js": 6350, - "a.out.js.gz": 2461, + "a.out.js": 6345, + "a.out.js.gz": 2456, "a.out.nodebug.wasm": 2530, "a.out.nodebug.wasm.gz": 1423, - "total": 8880, - "total_gz": 3884, + "total": 8875, + "total_gz": 3879, "sent": [ "fd_write" ], diff --git a/test/codesize/test_codesize_hello_O2.json b/test/codesize/test_codesize_hello_O2.json index 467eba3ed47e9..f3986cb629424 100644 --- a/test/codesize/test_codesize_hello_O2.json +++ b/test/codesize/test_codesize_hello_O2.json @@ -1,10 +1,10 @@ { - "a.out.js": 4324, - "a.out.js.gz": 2132, + "a.out.js": 4323, + "a.out.js.gz": 2130, "a.out.nodebug.wasm": 1898, "a.out.nodebug.wasm.gz": 1122, - "total": 6222, - "total_gz": 3254, + "total": 6221, + "total_gz": 3252, "sent": [ "fd_write" ], diff --git a/test/codesize/test_codesize_hello_O3.json b/test/codesize/test_codesize_hello_O3.json index c97c8bee7cbbe..4c25347b54b72 100644 --- a/test/codesize/test_codesize_hello_O3.json +++ b/test/codesize/test_codesize_hello_O3.json @@ -1,10 +1,10 @@ { - "a.out.js": 4266, - "a.out.js.gz": 2092, + "a.out.js": 4265, + "a.out.js.gz": 2089, "a.out.nodebug.wasm": 1648, "a.out.nodebug.wasm.gz": 939, - "total": 5914, - "total_gz": 3031, + "total": 5913, + "total_gz": 3028, "sent": [ "a (fd_write)" ], diff --git a/test/codesize/test_codesize_hello_Os.json b/test/codesize/test_codesize_hello_Os.json index 52eec1902c42b..2e784fcceb96b 100644 --- a/test/codesize/test_codesize_hello_Os.json +++ b/test/codesize/test_codesize_hello_Os.json @@ -1,10 +1,10 @@ { - "a.out.js": 4266, - "a.out.js.gz": 2092, + "a.out.js": 4265, + "a.out.js.gz": 2089, "a.out.nodebug.wasm": 1638, "a.out.nodebug.wasm.gz": 942, - "total": 5904, - "total_gz": 3034, + "total": 5903, + "total_gz": 3031, "sent": [ "a (fd_write)" ], diff --git a/test/codesize/test_codesize_hello_Oz.json b/test/codesize/test_codesize_hello_Oz.json index 3c3774b674330..6b94087d7d37d 100644 --- a/test/codesize/test_codesize_hello_Oz.json +++ b/test/codesize/test_codesize_hello_Oz.json @@ -1,10 +1,10 @@ { - "a.out.js": 3901, - "a.out.js.gz": 1899, + "a.out.js": 3900, + "a.out.js.gz": 1896, "a.out.nodebug.wasm": 1172, "a.out.nodebug.wasm.gz": 724, - "total": 5073, - "total_gz": 2623, + "total": 5072, + "total_gz": 2620, "sent": [ "a (fd_write)" ], diff --git a/test/codesize/test_codesize_hello_dylink.json b/test/codesize/test_codesize_hello_dylink.json index d01f86aa85cd3..efb0f7d1c501f 100644 --- a/test/codesize/test_codesize_hello_dylink.json +++ b/test/codesize/test_codesize_hello_dylink.json @@ -1,10 +1,10 @@ { - "a.out.js": 26186, - "a.out.js.gz": 11175, + "a.out.js": 26185, + "a.out.js.gz": 11171, "a.out.nodebug.wasm": 17668, "a.out.nodebug.wasm.gz": 8921, - "total": 43854, - "total_gz": 20096, + "total": 43853, + "total_gz": 20092, "sent": [ "__syscall_stat64", "emscripten_resize_heap", diff --git a/test/codesize/test_codesize_hello_dylink_all.json b/test/codesize/test_codesize_hello_dylink_all.json index 36ad7f0aad5ae..cc1a38764c569 100644 --- a/test/codesize/test_codesize_hello_dylink_all.json +++ b/test/codesize/test_codesize_hello_dylink_all.json @@ -1,7 +1,7 @@ { - "a.out.js": 244320, + "a.out.js": 244300, "a.out.nodebug.wasm": 577506, - "total": 821826, + "total": 821806, "sent": [ "IMG_Init", "IMG_Load", diff --git a/test/codesize/test_codesize_hello_export_nothing.json b/test/codesize/test_codesize_hello_export_nothing.json index fbfe75ffeaff4..08c480d47c3bd 100644 --- a/test/codesize/test_codesize_hello_export_nothing.json +++ b/test/codesize/test_codesize_hello_export_nothing.json @@ -1,10 +1,10 @@ { - "a.out.js": 3177, - "a.out.js.gz": 1483, + "a.out.js": 3176, + "a.out.js.gz": 1484, "a.out.nodebug.wasm": 43, "a.out.nodebug.wasm.gz": 59, - "total": 3220, - "total_gz": 1542, + "total": 3219, + "total_gz": 1543, "sent": [], "imports": [], "exports": [ diff --git a/test/codesize/test_codesize_hello_single_file.json b/test/codesize/test_codesize_hello_single_file.json index f65a9d3d548a1..221cb519bb48d 100644 --- a/test/codesize/test_codesize_hello_single_file.json +++ b/test/codesize/test_codesize_hello_single_file.json @@ -1,6 +1,6 @@ { - "a.out.js": 5224, - "a.out.js.gz": 2892, + "a.out.js": 5223, + "a.out.js.gz": 2886, "sent": [ "a (fd_write)" ] diff --git a/test/codesize/test_codesize_hello_wasmfs.json b/test/codesize/test_codesize_hello_wasmfs.json index c97c8bee7cbbe..4c25347b54b72 100644 --- a/test/codesize/test_codesize_hello_wasmfs.json +++ b/test/codesize/test_codesize_hello_wasmfs.json @@ -1,10 +1,10 @@ { - "a.out.js": 4266, - "a.out.js.gz": 2092, + "a.out.js": 4265, + "a.out.js.gz": 2089, "a.out.nodebug.wasm": 1648, "a.out.nodebug.wasm.gz": 939, - "total": 5914, - "total_gz": 3031, + "total": 5913, + "total_gz": 3028, "sent": [ "a (fd_write)" ], diff --git a/test/codesize/test_codesize_libcxxabi_message_O3.json b/test/codesize/test_codesize_libcxxabi_message_O3.json index bb31d9d714f0f..9bc8a0968e6dd 100644 --- a/test/codesize/test_codesize_libcxxabi_message_O3.json +++ b/test/codesize/test_codesize_libcxxabi_message_O3.json @@ -1,10 +1,10 @@ { - "a.out.js": 3528, - "a.out.js.gz": 1668, + "a.out.js": 3527, + "a.out.js.gz": 1666, "a.out.nodebug.wasm": 89, "a.out.nodebug.wasm.gz": 98, - "total": 3617, - "total_gz": 1766, + "total": 3616, + "total_gz": 1764, "sent": [], "imports": [], "exports": [ diff --git a/test/codesize/test_codesize_libcxxabi_message_O3_standalone.json b/test/codesize/test_codesize_libcxxabi_message_O3_standalone.json index 7c642202b392d..9b2c94d8d22cc 100644 --- a/test/codesize/test_codesize_libcxxabi_message_O3_standalone.json +++ b/test/codesize/test_codesize_libcxxabi_message_O3_standalone.json @@ -1,10 +1,10 @@ { - "a.out.js": 3575, - "a.out.js.gz": 1704, + "a.out.js": 3574, + "a.out.js.gz": 1701, "a.out.nodebug.wasm": 132, "a.out.nodebug.wasm.gz": 140, - "total": 3707, - "total_gz": 1844, + "total": 3706, + "total_gz": 1841, "sent": [ "proc_exit" ], diff --git a/test/codesize/test_codesize_mem_O3.json b/test/codesize/test_codesize_mem_O3.json index f00ab5150927a..f75a6347c61d7 100644 --- a/test/codesize/test_codesize_mem_O3.json +++ b/test/codesize/test_codesize_mem_O3.json @@ -1,10 +1,10 @@ { - "a.out.js": 4355, - "a.out.js.gz": 2094, + "a.out.js": 4354, + "a.out.js.gz": 2091, "a.out.nodebug.wasm": 5260, "a.out.nodebug.wasm.gz": 2419, - "total": 9615, - "total_gz": 4513, + "total": 9614, + "total_gz": 4510, "sent": [ "a (emscripten_resize_heap)" ], diff --git a/test/codesize/test_codesize_mem_O3_grow.json b/test/codesize/test_codesize_mem_O3_grow.json index 1540860692a68..527a3ce581a7a 100644 --- a/test/codesize/test_codesize_mem_O3_grow.json +++ b/test/codesize/test_codesize_mem_O3_grow.json @@ -1,10 +1,10 @@ { - "a.out.js": 4640, - "a.out.js.gz": 2247, + "a.out.js": 4639, + "a.out.js.gz": 2244, "a.out.nodebug.wasm": 5261, "a.out.nodebug.wasm.gz": 2419, - "total": 9901, - "total_gz": 4666, + "total": 9900, + "total_gz": 4663, "sent": [ "a (emscripten_resize_heap)" ], diff --git a/test/codesize/test_codesize_mem_O3_grow_standalone.json b/test/codesize/test_codesize_mem_O3_grow_standalone.json index 870a50a68edad..e238e8a5ba9f2 100644 --- a/test/codesize/test_codesize_mem_O3_grow_standalone.json +++ b/test/codesize/test_codesize_mem_O3_grow_standalone.json @@ -1,10 +1,10 @@ { - "a.out.js": 4107, - "a.out.js.gz": 1992, + "a.out.js": 4106, + "a.out.js.gz": 1990, "a.out.nodebug.wasm": 5548, "a.out.nodebug.wasm.gz": 2600, - "total": 9655, - "total_gz": 4592, + "total": 9654, + "total_gz": 4590, "sent": [ "args_get", "args_sizes_get", diff --git a/test/codesize/test_codesize_mem_O3_standalone.json b/test/codesize/test_codesize_mem_O3_standalone.json index d861394930631..c83ea49154968 100644 --- a/test/codesize/test_codesize_mem_O3_standalone.json +++ b/test/codesize/test_codesize_mem_O3_standalone.json @@ -1,10 +1,10 @@ { - "a.out.js": 4040, - "a.out.js.gz": 1956, + "a.out.js": 4039, + "a.out.js.gz": 1953, "a.out.nodebug.wasm": 5472, "a.out.nodebug.wasm.gz": 2539, - "total": 9512, - "total_gz": 4495, + "total": 9511, + "total_gz": 4492, "sent": [ "args_get", "args_sizes_get", diff --git a/test/codesize/test_codesize_mem_O3_standalone_lib.json b/test/codesize/test_codesize_mem_O3_standalone_lib.json index 7d7fbbd10778e..6975f7c3f9768 100644 --- a/test/codesize/test_codesize_mem_O3_standalone_lib.json +++ b/test/codesize/test_codesize_mem_O3_standalone_lib.json @@ -1,10 +1,10 @@ { - "a.out.js": 3568, - "a.out.js.gz": 1692, + "a.out.js": 3567, + "a.out.js.gz": 1691, "a.out.nodebug.wasm": 5239, "a.out.nodebug.wasm.gz": 2359, - "total": 8807, - "total_gz": 4051, + "total": 8806, + "total_gz": 4050, "sent": [], "imports": [], "exports": [ diff --git a/test/codesize/test_codesize_mem_O3_standalone_narg.json b/test/codesize/test_codesize_mem_O3_standalone_narg.json index 6a8940ba4291f..c68d61c00d940 100644 --- a/test/codesize/test_codesize_mem_O3_standalone_narg.json +++ b/test/codesize/test_codesize_mem_O3_standalone_narg.json @@ -1,10 +1,10 @@ { - "a.out.js": 3575, - "a.out.js.gz": 1704, + "a.out.js": 3574, + "a.out.js.gz": 1701, "a.out.nodebug.wasm": 5265, "a.out.nodebug.wasm.gz": 2396, - "total": 8840, - "total_gz": 4100, + "total": 8839, + "total_gz": 4097, "sent": [ "proc_exit" ], diff --git a/test/codesize/test_codesize_mem_O3_standalone_narg_flto.json b/test/codesize/test_codesize_mem_O3_standalone_narg_flto.json index 21c4d8707ed3d..08dbd2878bde6 100644 --- a/test/codesize/test_codesize_mem_O3_standalone_narg_flto.json +++ b/test/codesize/test_codesize_mem_O3_standalone_narg_flto.json @@ -1,10 +1,10 @@ { - "a.out.js": 3575, - "a.out.js.gz": 1704, + "a.out.js": 3574, + "a.out.js.gz": 1701, "a.out.nodebug.wasm": 4201, "a.out.nodebug.wasm.gz": 2098, - "total": 7776, - "total_gz": 3802, + "total": 7775, + "total_gz": 3799, "sent": [ "proc_exit" ], diff --git a/test/codesize/test_codesize_minimal_64.json b/test/codesize/test_codesize_minimal_64.json index a3efe1f7f92d7..f92e63ab8efc5 100644 --- a/test/codesize/test_codesize_minimal_64.json +++ b/test/codesize/test_codesize_minimal_64.json @@ -1,10 +1,10 @@ { - "a.out.js": 2609, - "a.out.js.gz": 1250, + "a.out.js": 2608, + "a.out.js.gz": 1252, "a.out.nodebug.wasm": 75, "a.out.nodebug.wasm.gz": 88, - "total": 2684, - "total_gz": 1338, + "total": 2683, + "total_gz": 1340, "sent": [], "imports": [], "exports": [ diff --git a/test/codesize/test_codesize_minimal_O0.expected.js b/test/codesize/test_codesize_minimal_O0.expected.js index f4a791a3dee4c..687b827e2d16b 100644 --- a/test/codesize/test_codesize_minimal_O0.expected.js +++ b/test/codesize/test_codesize_minimal_O0.expected.js @@ -511,7 +511,7 @@ function postRun() { /** @param {string|number=} what */ function abort(what) { - what = 'Aborted(' + what + ')'; + what = `Aborted(${what})`; // TODO(sbc): Should we remove printing and leave it up to whoever // catches the exception? err(what); diff --git a/test/codesize/test_codesize_minimal_O0.json b/test/codesize/test_codesize_minimal_O0.json index 6e7ceb3f32244..8d4cc47adfaba 100644 --- a/test/codesize/test_codesize_minimal_O0.json +++ b/test/codesize/test_codesize_minimal_O0.json @@ -1,10 +1,10 @@ { - "a.out.js": 19457, - "a.out.js.gz": 7002, + "a.out.js": 19452, + "a.out.js.gz": 6998, "a.out.nodebug.wasm": 1015, "a.out.nodebug.wasm.gz": 602, - "total": 20472, - "total_gz": 7604, + "total": 20467, + "total_gz": 7600, "sent": [], "imports": [], "exports": [ diff --git a/test/codesize/test_codesize_minimal_O1.json b/test/codesize/test_codesize_minimal_O1.json index 1ee812afcbccf..c3853bbc29e96 100644 --- a/test/codesize/test_codesize_minimal_O1.json +++ b/test/codesize/test_codesize_minimal_O1.json @@ -1,9 +1,9 @@ { - "a.out.js": 3066, + "a.out.js": 3061, "a.out.js.gz": 1302, "a.out.nodebug.wasm": 449, "a.out.nodebug.wasm.gz": 337, - "total": 3515, + "total": 3510, "total_gz": 1639, "sent": [], "imports": [], diff --git a/test/codesize/test_codesize_minimal_O2.json b/test/codesize/test_codesize_minimal_O2.json index ab0eb13fd26e5..548a14bb0cbf6 100644 --- a/test/codesize/test_codesize_minimal_O2.json +++ b/test/codesize/test_codesize_minimal_O2.json @@ -1,10 +1,10 @@ { - "a.out.js": 2357, - "a.out.js.gz": 1175, + "a.out.js": 2356, + "a.out.js.gz": 1176, "a.out.nodebug.wasm": 280, "a.out.nodebug.wasm.gz": 226, - "total": 2637, - "total_gz": 1401, + "total": 2636, + "total_gz": 1402, "sent": [], "imports": [], "exports": [ diff --git a/test/codesize/test_codesize_minimal_O3.json b/test/codesize/test_codesize_minimal_O3.json index 2bc3eca6c115a..3ae2ea0d04c70 100644 --- a/test/codesize/test_codesize_minimal_O3.json +++ b/test/codesize/test_codesize_minimal_O3.json @@ -1,10 +1,10 @@ { - "a.out.js": 2298, - "a.out.js.gz": 1140, + "a.out.js": 2297, + "a.out.js.gz": 1142, "a.out.nodebug.wasm": 75, "a.out.nodebug.wasm.gz": 87, - "total": 2373, - "total_gz": 1227, + "total": 2372, + "total_gz": 1229, "sent": [], "imports": [], "exports": [ diff --git a/test/codesize/test_codesize_minimal_Os.json b/test/codesize/test_codesize_minimal_Os.json index 2bc3eca6c115a..3ae2ea0d04c70 100644 --- a/test/codesize/test_codesize_minimal_Os.json +++ b/test/codesize/test_codesize_minimal_Os.json @@ -1,10 +1,10 @@ { - "a.out.js": 2298, - "a.out.js.gz": 1140, + "a.out.js": 2297, + "a.out.js.gz": 1142, "a.out.nodebug.wasm": 75, "a.out.nodebug.wasm.gz": 87, - "total": 2373, - "total_gz": 1227, + "total": 2372, + "total_gz": 1229, "sent": [], "imports": [], "exports": [ diff --git a/test/codesize/test_codesize_minimal_Oz-ctors.json b/test/codesize/test_codesize_minimal_Oz-ctors.json index f299e2edd82f8..c889b60fc3675 100644 --- a/test/codesize/test_codesize_minimal_Oz-ctors.json +++ b/test/codesize/test_codesize_minimal_Oz-ctors.json @@ -1,10 +1,10 @@ { - "a.out.js": 2277, - "a.out.js.gz": 1126, + "a.out.js": 2276, + "a.out.js.gz": 1127, "a.out.nodebug.wasm": 64, "a.out.nodebug.wasm.gz": 80, - "total": 2341, - "total_gz": 1206, + "total": 2340, + "total_gz": 1207, "sent": [], "imports": [], "exports": [ diff --git a/test/codesize/test_codesize_minimal_Oz.json b/test/codesize/test_codesize_minimal_Oz.json index 2bc3eca6c115a..3ae2ea0d04c70 100644 --- a/test/codesize/test_codesize_minimal_Oz.json +++ b/test/codesize/test_codesize_minimal_Oz.json @@ -1,10 +1,10 @@ { - "a.out.js": 2298, - "a.out.js.gz": 1140, + "a.out.js": 2297, + "a.out.js.gz": 1142, "a.out.nodebug.wasm": 75, "a.out.nodebug.wasm.gz": 87, - "total": 2373, - "total_gz": 1227, + "total": 2372, + "total_gz": 1229, "sent": [], "imports": [], "exports": [ diff --git a/test/codesize/test_codesize_minimal_esm.json b/test/codesize/test_codesize_minimal_esm.json index 5a870e26915e3..742d414e173f6 100644 --- a/test/codesize/test_codesize_minimal_esm.json +++ b/test/codesize/test_codesize_minimal_esm.json @@ -1,10 +1,10 @@ { - "a.out.js": 2449, - "a.out.js.gz": 1174, + "a.out.js": 2448, + "a.out.js.gz": 1175, "a.out.nodebug.wasm": 75, "a.out.nodebug.wasm.gz": 87, - "total": 2524, - "total_gz": 1261, + "total": 2523, + "total_gz": 1262, "sent": [], "imports": [], "exports": [ diff --git a/test/codesize/test_codesize_minimal_pthreads.json b/test/codesize/test_codesize_minimal_pthreads.json index 4334c5ce45902..46134024d4f69 100644 --- a/test/codesize/test_codesize_minimal_pthreads.json +++ b/test/codesize/test_codesize_minimal_pthreads.json @@ -1,10 +1,10 @@ { - "a.out.js": 7364, - "a.out.js.gz": 3607, + "a.out.js": 7363, + "a.out.js.gz": 3604, "a.out.nodebug.wasm": 19259, "a.out.nodebug.wasm.gz": 8931, - "total": 26623, - "total_gz": 12538, + "total": 26622, + "total_gz": 12535, "sent": [ "a (memory)", "b (emscripten_get_now)", diff --git a/test/codesize/test_codesize_minimal_pthreads_memgrowth.json b/test/codesize/test_codesize_minimal_pthreads_memgrowth.json index 7cb95cec5b4b6..bd269f796de58 100644 --- a/test/codesize/test_codesize_minimal_pthreads_memgrowth.json +++ b/test/codesize/test_codesize_minimal_pthreads_memgrowth.json @@ -1,10 +1,10 @@ { - "a.out.js": 7766, - "a.out.js.gz": 3812, + "a.out.js": 7765, + "a.out.js.gz": 3810, "a.out.nodebug.wasm": 19260, "a.out.nodebug.wasm.gz": 8933, - "total": 27026, - "total_gz": 12745, + "total": 27025, + "total_gz": 12743, "sent": [ "a (memory)", "b (emscripten_get_now)", diff --git a/test/codesize/test_codesize_minimal_wasmfs.json b/test/codesize/test_codesize_minimal_wasmfs.json index 2bc3eca6c115a..3ae2ea0d04c70 100644 --- a/test/codesize/test_codesize_minimal_wasmfs.json +++ b/test/codesize/test_codesize_minimal_wasmfs.json @@ -1,10 +1,10 @@ { - "a.out.js": 2298, - "a.out.js.gz": 1140, + "a.out.js": 2297, + "a.out.js.gz": 1142, "a.out.nodebug.wasm": 75, "a.out.nodebug.wasm.gz": 87, - "total": 2373, - "total_gz": 1227, + "total": 2372, + "total_gz": 1229, "sent": [], "imports": [], "exports": [ diff --git a/test/codesize/test_small_js_flags.json b/test/codesize/test_small_js_flags.json index 215b91d47ed81..a3a2491cf4586 100644 --- a/test/codesize/test_small_js_flags.json +++ b/test/codesize/test_small_js_flags.json @@ -1,4 +1,4 @@ { - "a.out.js": 2726, - "a.out.js.gz": 1496 + "a.out.js": 2725, + "a.out.js.gz": 1492 } diff --git a/test/codesize/test_unoptimized_code_size.json b/test/codesize/test_unoptimized_code_size.json index e38569d8c4b6b..88de96a2eb7d5 100644 --- a/test/codesize/test_unoptimized_code_size.json +++ b/test/codesize/test_unoptimized_code_size.json @@ -1,16 +1,16 @@ { - "hello_world.js": 57052, - "hello_world.js.gz": 17748, + "hello_world.js": 57042, + "hello_world.js.gz": 17743, "hello_world.wasm": 14850, "hello_world.wasm.gz": 7311, - "no_asserts.js": 26623, + "no_asserts.js": 26618, "no_asserts.js.gz": 8888, "no_asserts.wasm": 12010, "no_asserts.wasm.gz": 5880, - "strict.js": 54870, - "strict.js.gz": 17055, + "strict.js": 54860, + "strict.js.gz": 17049, "strict.wasm": 14850, "strict.wasm.gz": 7311, - "total": 180255, - "total_gz": 64193 + "total": 180230, + "total_gz": 64182 } diff --git a/test/fs/test_lz4fs.c b/test/fs/test_lz4fs.c index 1545d31a35481..934df3c88b20c 100644 --- a/test/fs/test_lz4fs.c +++ b/test/fs/test_lz4fs.c @@ -158,7 +158,7 @@ int main() { var compressedSize = Module['compressedData']['data'].length; var low = COMPLETE_SIZE/3; var high = COMPLETE_SIZE/2; - console.log('seeing compressed size of ' + compressedSize + ', expect in ' + [low, high]); + console.log(`seeing compressed size of ${compressedSize}, expect in ${[low, high]}`); assert(compressedSize > low && compressedSize < high); // more than 1/3, because 1/3 is uncompressible, but still, less than 1/2 ccall('finish'); diff --git a/test/pthread/call_async_on_main_thread.js b/test/pthread/call_async_on_main_thread.js index 0862be67714e9..386398f04371a 100644 --- a/test/pthread/call_async_on_main_thread.js +++ b/test/pthread/call_async_on_main_thread.js @@ -6,7 +6,7 @@ addToLibrary({ if (typeof ENVIRONMENT_IS_WORKER !== 'undefined' && ENVIRONMENT_IS_WORKER) { console.error('This function should be getting called on the main thread!'); } - console.log('got ' + param1 + ' ' + param2 + ' ' + param3); + console.log(`got ${param1} ${param2} ${param3}`); reportResultToServer(param1 + param2 * param3); } }); diff --git a/test/webidl/post.js b/test/webidl/post.js index 69e58c7821434..b0c30dc90e889 100644 --- a/test/webidl/post.js +++ b/test/webidl/post.js @@ -98,7 +98,7 @@ c3.virtualFunc2 = function() { console.log('*js virtualf2 replacement*'); }; c3.virtualFunc3 = function(x) { - console.log('*js virtualf3 replacement ' + x + '*'); + console.log(`*js virtualf3 replacement ${x}*`); }; c3.virtualFunc(); diff --git a/test/websocket/nodejs_websocket_echo_server.js b/test/websocket/nodejs_websocket_echo_server.js index 6e4c57470c0bf..0df76b175c00e 100644 --- a/test/websocket/nodejs_websocket_echo_server.js +++ b/test/websocket/nodejs_websocket_echo_server.js @@ -20,16 +20,16 @@ var decoder = new TextDecoder('utf-8'); var port = 8089; var ws = require('ws'); var wss = new ws.WebSocketServer({ port: port }); -console.log('WebSocket server listening on ws://localhost:' + port + '/'); +console.log(`WebSocket server listening on ws://localhost:${port}/`); wss.on('connection', function(ws) { console.log('Client connected!'); ws.on('message', function(message, isBinary) { if (!isBinary) { var text = decoder.decode((new Uint8Array(message)).buffer); - console.log('received TEXT: ' + text.length + ' characters:'); - console.log(' "' + text + '"'); + console.log(`received TEXT: ${text.length} characters:`); + console.log(` "${text}"`); } else { - console.log('received BINARY: ' + message.length + ' bytes:'); + console.log(`received BINARY: ${message.length} bytes:`); hexDump(message); } console.log('');