From 002fbb46fbee89b0ad60390f60c77ea2b99b6aab Mon Sep 17 00:00:00 2001 From: Sam Clegg Date: Wed, 29 Jul 2026 13:08:18 -0700 Subject: [PATCH 1/2] [jslib] Minor cleanups to JS library files. NFC Similar to #27425 but applied to the whole JS library - Replace explicit zero checks (`=== 0`, `!== 0`) with implicit truthy/falsy checks (`!x`, `x`). - Replace `.length === 0` checks with `!arr.length`. - Simplify null/undefined/zero check in `src/lib/libccall.js` to `if (str)`. - Use `for (var byte of data)` loop in `src/lib/libbrowser.js`. --- src/lib/libasync.js | 4 ++-- src/lib/libbootstrap.js | 2 +- src/lib/libbrowser.js | 6 +++--- src/lib/libccall.js | 4 ++-- src/lib/libcore.js | 35 +++++++++++++++++++---------------- src/lib/libdylink.js | 4 ++-- src/lib/libembind_gen.js | 4 ++-- src/lib/libembind_shared.js | 2 +- src/lib/libeventloop.js | 2 +- src/lib/libexceptions.js | 2 +- src/lib/libfs.js | 8 ++++---- src/lib/libglemu.js | 2 +- src/lib/libhtml5.js | 4 ++-- src/lib/libmemfs.js | 4 ++-- src/lib/libnodefs.js | 2 +- src/lib/libpipefs.js | 6 +++--- src/lib/libpthread.js | 4 ++-- src/lib/libsdl.js | 10 +++++----- src/lib/libsockfs_node.js | 6 +++--- src/lib/libsyscall.js | 2 +- src/lib/libtty.js | 2 +- src/lib/libwasi.js | 4 ++-- src/lib/libwasmfs.js | 4 ++-- src/lib/libwebgl.js | 2 +- 24 files changed, 64 insertions(+), 61 deletions(-) diff --git a/src/lib/libasync.js b/src/lib/libasync.js index 74bf06c588ce8..9f9a2d315b1f5 100644 --- a/src/lib/libasync.js +++ b/src/lib/libasync.js @@ -232,7 +232,7 @@ addToLibrary({ #endif if (Asyncify.currData && Asyncify.state === Asyncify.State.Unwinding && - Asyncify.exportCallStack.length === 0) { + !Asyncify.exportCallStack.length) { // We just finished unwinding. // Be sure to set the state before calling any other functions to avoid // possible infinite recursion here (For example in debug pthread builds @@ -548,7 +548,7 @@ addToLibrary({ var entryPoint = {{{ makeGetValue('newFiber', C_STRUCTS.emscripten_fiber_s.entry, '*') }}}; - if (entryPoint !== 0) { + if (entryPoint) { #if STACK_OVERFLOW_CHECK writeStackCookie(); #endif diff --git a/src/lib/libbootstrap.js b/src/lib/libbootstrap.js index b1d381bf1d00e..c2200b7475a76 100644 --- a/src/lib/libbootstrap.js +++ b/src/lib/libbootstrap.js @@ -11,7 +11,7 @@ assert(false, 'libbootstrap.js only designed for use with BOOTSTRAPPING_STRUCT_INFO') #endif -assert(Object.keys(LibraryManager.library).length === 0); +assert(!Object.keys(LibraryManager.library).length); addToLibrary({ $callRuntimeCallbacks: () => {}, diff --git a/src/lib/libbrowser.js b/src/lib/libbrowser.js index 3a854b5c26ae9..5844baaa17933 100644 --- a/src/lib/libbrowser.js +++ b/src/lib/libbrowser.js @@ -107,8 +107,8 @@ var LibraryBrowser = { var ret = ''; var leftchar = 0; var leftbits = 0; - for (var i = 0; i < data.length; i++) { - leftchar = (leftchar << 8) | data[i]; + for (var byte of data) { + leftchar = (leftchar << 8) | byte; leftbits += 8; while (leftbits >= 6) { var curr = (leftchar >> (leftbits-6)) & 0x3f; @@ -601,7 +601,7 @@ var LibraryBrowser = { } #endif #if ASSERTIONS - assert(runDependencies === 0, 'async_load_script must be run when no other dependencies are active'); + assert(!runDependencies, 'async_load_script must be run when no other dependencies are active'); #endif {{{ runtimeKeepalivePush() }}} diff --git a/src/lib/libccall.js b/src/lib/libccall.js index 4d40b8dbf884c..492f8a74343ee 100644 --- a/src/lib/libccall.js +++ b/src/lib/libccall.js @@ -70,7 +70,7 @@ addToLibrary({ for (var i = 0; i < args.length; i++) { var converter = toC[argTypes[i]]; if (converter) { - if (stack === 0) stack = stackSave(); + if (!stack) stack = stackSave(); cArgs[i] = converter(args[i]); } else { cArgs[i] = args[i]; @@ -86,7 +86,7 @@ addToLibrary({ #if ASYNCIFY == 1 runtimeKeepalivePop(); #endif - if (stack !== 0) stackRestore(stack); + if (stack) stackRestore(stack); return convertReturnValue(ret); } #if ASYNCIFY diff --git a/src/lib/libcore.js b/src/lib/libcore.js index c1304de600bed..16b653de01de3 100644 --- a/src/lib/libcore.js +++ b/src/lib/libcore.js @@ -764,7 +764,10 @@ addToLibrary({ var v4part = ''; // check if the 10 high-order bytes are all zeros (first 5 words) for (i = 0; i < 5; i++) { - if (parts[i] !== 0) { hasipv4 = false; break; } + if (parts[i]) { + hasipv4 = false; + break; + } } if (hasipv4) { @@ -777,7 +780,7 @@ addToLibrary({ return str; } // IPv4-compatible IPv6 address if 16-bit value (bytes 11 and 12) == 0x0000 (6th word) - if (parts[5] === 0) { + if (!parts[5]) { str = '::'; // special case IPv6 addresses if (v4part === '0.0.0.0') v4part = ''; // any/unspecified address @@ -791,7 +794,7 @@ addToLibrary({ // first run to find the longest contiguous zero words for (word = 0; word < 8; word++) { - if (parts[word] === 0) { + if (!parts[word]) { if (word - lastzero > 1) { len = 0; } @@ -807,10 +810,10 @@ addToLibrary({ for (word = 0; word < 8; word++) { if (longest > 1) { // compress contiguous zeros - to produce '::' - if (parts[word] === 0 && word >= zstart && word < (zstart + longest) ) { + if (!parts[word] && word >= zstart && word < (zstart + longest) ) { if (word === zstart) { str += ':'; - if (zstart === 0) str += ':'; //leading zeros case + if (!zstart) str += ':'; //leading zeros case } continue; } @@ -844,7 +847,7 @@ addToLibrary({ var pathLen = salen - {{{ C_STRUCTS.sockaddr_un.sun_path }}}; var path = ''; if (pathLen > 0) { - if (HEAPU8[pathStart] === 0) { + if (!HEAPU8[pathStart]) { path = '\0' + UTF8ToString(pathStart + 1, pathLen - 1, /*ignoreNul=*/true); } else { // A pathname address is NUL-terminated; stop at the first NUL. @@ -894,7 +897,7 @@ addToLibrary({ // terminator), any other path is written NUL-terminated. An empty path // is the unnamed address (family only). addr ||= ''; - var abstract = addr.charCodeAt(0) === 0; + var abstract = !addr.charCodeAt(0); // Pathname addresses include the trailing NUL in the reported length; // abstract addresses do not; an empty address is family-only (unnamed). var bytes = addr ? lengthBytesUTF8(addr) + (abstract ? 0 : 1) : 0; @@ -1067,10 +1070,10 @@ addToLibrary({ // If type or proto are set to zero in hints we should really be returning multiple addrinfo values, but for // now default to a TCP STREAM socket so we can at least return a sensible addrinfo given NULL hints. - if (proto === 0) { + if (!proto) { proto = {{{ cDefs.IPPROTO_TCP }}}; } - if (type === 0) { + if (!type) { type = {{{ cDefs.SOCK_STREAM }}}; } @@ -1081,14 +1084,14 @@ addToLibrary({ {{{ cDefs.AI_NUMERICSERV }}}|{{{ cDefs.AI_V4MAPPED }}}|{{{ cDefs.AI_ALL }}}|{{{ cDefs.AI_ADDRCONFIG }}})) { return {{{ cDefs.EAI_BADFLAGS }}}; } - if (hint !== 0 && ({{{ makeGetValue('hint', C_STRUCTS.addrinfo.ai_flags, 'i32') }}} & {{{ cDefs.AI_CANONNAME }}}) && !node) { + if (hint && ({{{ makeGetValue('hint', C_STRUCTS.addrinfo.ai_flags, 'i32') }}} & {{{ cDefs.AI_CANONNAME }}}) && !node) { return {{{ cDefs.EAI_BADFLAGS }}}; } if (flags & {{{ cDefs.AI_ADDRCONFIG }}}) { // TODO return {{{ cDefs.EAI_NONAME }}}; } - if (type !== 0 && type !== {{{ cDefs.SOCK_STREAM }}} && type !== {{{ cDefs.SOCK_DGRAM }}}) { + if (type && type !== {{{ cDefs.SOCK_STREAM }}} && type !== {{{ cDefs.SOCK_DGRAM }}}) { return {{{ cDefs.EAI_SOCKTYPE }}}; } if (family !== {{{ cDefs.AF_UNSPEC }}} && family !== {{{ cDefs.AF_INET }}} && family !== {{{ cDefs.AF_INET6 }}}) { @@ -1113,7 +1116,7 @@ addToLibrary({ if (family === {{{ cDefs.AF_UNSPEC }}}) { family = {{{ cDefs.AF_INET }}}; } - if ((flags & {{{ cDefs.AI_PASSIVE }}}) === 0) { + if (!(flags & {{{ cDefs.AI_PASSIVE }}})) { if (family === {{{ cDefs.AF_INET }}}) { addr = _htonl({{{ cDefs.INADDR_LOOPBACK }}}); } else { @@ -1263,7 +1266,7 @@ addToLibrary({ // to add extra entries from /etc/protocols if desired - though not sure if that'd actually be useful. var list = Protocols.list; var map = Protocols.map; - if (list.length === 0) { + if (!list.length) { var entry = allocprotoent('tcp', 6, ['TCP']); list.push(entry); map['tcp'] = map['6'] = entry; @@ -1737,9 +1740,9 @@ addToLibrary({ _Unwind_Backtrace: (func, arg) => { var trace = getCallstack(); var parts = trace.split('\n'); - for (var i = 0; i < parts.length; i++) { + for (var _ of parts) { var ret = {{{ makeDynCall('iii', 'func') }}}(0, arg); - if (ret !== 0) return; + if (ret) return; } }, @@ -2364,7 +2367,7 @@ addToLibrary({ assert(id, 'addRunDependency requires an ID') assert(!runDependencyTracking[id]); runDependencyTracking[id] = 1; - if (runDependencyWatcher === null && globalThis.setInterval) { + if (!runDependencyWatcher && globalThis.setInterval) { // Check for missing dependencies every few seconds runDependencyWatcher = setInterval(() => { if (ABORT) { diff --git a/src/lib/libdylink.js b/src/lib/libdylink.js index 83db08cd217a9..cb420a32191fd 100644 --- a/src/lib/libdylink.js +++ b/src/lib/libdylink.js @@ -478,7 +478,7 @@ var LibraryDylink = { if (binary instanceof WebAssembly.Module) { var dylinkSection = WebAssembly.Module.customSections(binary, 'dylink.0'); - failIf(dylinkSection.length === 0, 'need dylink section'); + failIf(!dylinkSection.length, 'need dylink section'); binary = new Uint8Array(dylinkSection[0]); end = binary.length } else { @@ -490,7 +490,7 @@ var LibraryDylink = { #endif failIf(!magicNumberFound, 'need to see wasm magic number'); // \0asm // we should see the dylink custom section right after the magic number and wasm version - failIf(binary[8] !== 0, 'need the dylink section to be first') + failIf(binary[8], 'need the dylink section to be first') offset = 9; var section_size = getLEB(); // section size end = offset + section_size; diff --git a/src/lib/libembind_gen.js b/src/lib/libembind_gen.js index 6198845ea22e5..c20082e94daf1 100644 --- a/src/lib/libembind_gen.js +++ b/src/lib/libembind_gen.js @@ -311,7 +311,7 @@ var LibraryEmbind = { out.push(' value: T;\n}\n'); } out.push(`export type ${this.name} = `); - if (this.items.length === 0) { + if (!this.items.length) { out.push('never/* Empty Enumerator */'); } else { const outItems = []; @@ -715,7 +715,7 @@ var LibraryEmbind = { setter, setterContext) { fieldName = AsciiToString(fieldName); - const readonly = setter === 0; + const readonly = !setter; if (!(readonly || getterReturnType === setterArgumentType)) { throw new error('Mismatched getter and setter types are not supported.'); } diff --git a/src/lib/libembind_shared.js b/src/lib/libembind_shared.js index 4f2f2ad2e5cc3..7bda2c575430d 100644 --- a/src/lib/libembind_shared.js +++ b/src/lib/libembind_shared.js @@ -195,7 +195,7 @@ var LibraryEmbindShared = { $getEnumValueType(rawValueType) { // This must match the values of enum_value_type in wire.h - return rawValueType === 0 ? 'object' : (rawValueType === 1 ? 'number' : 'string'); + return !rawValueType ? 'object' : (rawValueType === 1 ? 'number' : 'string'); }, $getRequiredArgCount(argTypes) { diff --git a/src/lib/libeventloop.js b/src/lib/libeventloop.js index 097878560b9da..6457dc4f55318 100644 --- a/src/lib/libeventloop.js +++ b/src/lib/libeventloop.js @@ -290,7 +290,7 @@ LibraryJSEventLoop = { fakeRequestAnimationFrame(func) { // try to keep 60fps between calls to here var now = Date.now(); - if (MainLoop.nextRAF === 0) { + if (!MainLoop.nextRAF) { MainLoop.nextRAF = now + 1000/60; } else { while (now + 2 >= MainLoop.nextRAF) { // fudge a little, to avoid timer jitter causing us to do lots of delay:0 diff --git a/src/lib/libexceptions.js b/src/lib/libexceptions.js index de464f872e5e6..0f4c8d9dd21ad 100644 --- a/src/lib/libexceptions.js +++ b/src/lib/libexceptions.js @@ -275,7 +275,7 @@ var LibraryExceptions = { // type of the thrown object. Find one which matches, and // return the type of the catch block which should be called. for (var caughtType of args) { - if (caughtType === 0 || caughtType === thrownType) { + if (!caughtType || caughtType === thrownType) { // Catch all clause matched or exactly the same type is caught break; } diff --git a/src/lib/libfs.js b/src/lib/libfs.js index 0db29fb018303..70d3fda1334e7 100644 --- a/src/lib/libfs.js +++ b/src/lib/libfs.js @@ -1384,8 +1384,8 @@ FS.staticInit();`; // to write to file opened in read-only mode with MAP_PRIVATE flag, // as all modifications will be visible only in the memory of // the current process. - if ((prot & {{{ cDefs.PROT_WRITE }}}) !== 0 - && (flags & {{{ cDefs.MAP_PRIVATE}}}) === 0 + if ((prot & {{{ cDefs.PROT_WRITE }}}) + && !(flags & {{{ cDefs.MAP_PRIVATE}}}) && (stream.flags & {{{ cDefs.O_ACCMODE }}}) !== {{{ cDefs.O_RDWR}}}) { throw new FS.ErrnoError({{{ cDefs.EACCES }}}); } @@ -1487,7 +1487,7 @@ FS.staticInit();`; // use a buffer to avoid overhead of individual crypto calls per byte var randomBuffer = new Uint8Array(1024), randomLeft = 0; var randomByte = () => { - if (randomLeft === 0) { + if (!randomLeft) { randomFill(randomBuffer); randomLeft = randomBuffer.byteLength; } @@ -1734,7 +1734,7 @@ FS.staticInit();`; } catch (e) { throw new FS.ErrnoError({{{ cDefs.EIO }}}); } - if (result === undefined && bytesRead === 0) { + if (result === undefined && !bytesRead) { throw new FS.ErrnoError({{{ cDefs.EAGAIN }}}); } if (result === null || result === undefined) break; diff --git a/src/lib/libglemu.js b/src/lib/libglemu.js index c92bfd3a8d591..0dbcad1d93e45 100644 --- a/src/lib/libglemu.js +++ b/src/lib/libglemu.js @@ -2474,7 +2474,7 @@ var LibraryGLEmulation = { this.hasNormal = GLImmediate.enabledClientAttributes[GLImmediate.NORMAL] && GLImmediate.clientAttributes[GLImmediate.NORMAL].size > 0 && this.normalLocation >= 0; - this.hasColor = (this.colorLocation === 0) || this.colorLocation > 0; + this.hasColor = this.colorLocation >= 0; this.floatType = GLctx.FLOAT; // minor optimization diff --git a/src/lib/libhtml5.js b/src/lib/libhtml5.js index 2f64008cd7148..135074b31c3dd 100644 --- a/src/lib/libhtml5.js +++ b/src/lib/libhtml5.js @@ -85,7 +85,7 @@ var LibraryHTML5 = { function arraysHaveEqualContent(arrA, arrB) { if (arrA.length != arrB.length) return false; - for (var i in arrA) { + for (var i = 0; i < arrA.length; i++) { if (arrA[i] != arrB[i]) return false; } return true; @@ -2140,7 +2140,7 @@ var LibraryHTML5 = { if (canvas.GLctxObject?.GLctx) { var prevViewport = canvas.GLctxObject.GLctx.getParameter(0xBA2 /* GL_VIEWPORT */); // TODO: Perhaps autoResizeViewport should only be true if FBO 0 is currently active? - autoResizeViewport = (prevViewport[0] === 0 && prevViewport[1] === 0 && prevViewport[2] === canvas.width && prevViewport[3] === canvas.height); + autoResizeViewport = (!prevViewport[0] && !prevViewport[1] && prevViewport[2] === canvas.width && prevViewport[3] === canvas.height); #if GL_DEBUG dbg(`Resizing canvas from ${canvas.width}x${canvas.height} to ${width}x${height}. Previous GL viewport size was ${prevViewport}, so autoResizeViewport=${autoResizeViewport}`); #endif diff --git a/src/lib/libmemfs.js b/src/lib/libmemfs.js index 4540d3b4b98d2..5c0b4d4f53eda 100644 --- a/src/lib/libmemfs.js +++ b/src/lib/libmemfs.js @@ -282,11 +282,11 @@ addToLibrary({ if (canOwn) { #if ASSERTIONS - assert(position === 0, 'canOwn must imply no weird position inside the file'); + assert(!position, 'canOwn must imply no weird position inside the file'); #endif node.contents = buffer.subarray(offset, offset + length); node.usedBytes = length; - } else if (node.usedBytes === 0 && position === 0) { // If this is a simple first write to an empty file, do a fast set since we don't need to care about old data. + } else if (!node.usedBytes && !position) { // If this is a simple first write to an empty file, do a fast set since we don't need to care about old data. node.contents = buffer.slice(offset, offset + length); node.usedBytes = length; } else { diff --git a/src/lib/libnodefs.js b/src/lib/libnodefs.js index 41f237c2b438b..dd839a36f93fd 100644 --- a/src/lib/libnodefs.js +++ b/src/lib/libnodefs.js @@ -266,7 +266,7 @@ addToLibrary({ }, close(stream) { NODEFS.tryFSOperation(() => { - if (stream.nfd && --stream.shared.refcount === 0) { + if (stream.nfd && !--stream.shared.refcount) { fs.closeSync(stream.nfd); } }); diff --git a/src/lib/libpipefs.js b/src/lib/libpipefs.js index 6afca721414d9..5285f05f26fcc 100644 --- a/src/lib/libpipefs.js +++ b/src/lib/libpipefs.js @@ -280,17 +280,17 @@ addToLibrary({ // When the last write end closes, wake any poll/epoll waiter on the read // end with POLLHUP so a reader blocked on the writer dropping unblocks. if ((stream.flags & {{{ cDefs.O_ACCMODE }}}) === {{{ cDefs.O_WRONLY }}}) { - if (--pipe.writerCount === 0) { + if (!--pipe.writerCount) { pipe.writeClosed = true; pipe.readNode.notifyListeners({{{ cDefs.POLLHUP }}} | {{{ cDefs.POLLRDNORM }}} | {{{ cDefs.POLLIN }}}); } - } else if (--pipe.readerCount === 0) { + } else if (!--pipe.readerCount) { // Mirror: when the last read end closes, wake any poll/epoll waiter on // the write end with POLLERR (a further write would get EPIPE). pipe.readClosed = true; pipe.writeNode.notifyListeners({{{ cDefs.POLLERR }}} | {{{ cDefs.POLLWRNORM }}} | {{{ cDefs.POLLOUT }}}); } - if (pipe.readerCount === 0 && pipe.writerCount === 0) { + if (!pipe.readerCount && !pipe.writerCount) { pipe.buckets = null; } } diff --git a/src/lib/libpthread.js b/src/lib/libpthread.js index e092fe4f20f39..2f65bfa8ae739 100644 --- a/src/lib/libpthread.js +++ b/src/lib/libpthread.js @@ -904,7 +904,7 @@ var LibraryPThread = { // Synchronously proxy the thread creation to main thread if possible. If we // need to transfer ownership of objects, then proxy asynchronously via // postMessage. - if (ENVIRONMENT_IS_PTHREAD && (transferList.length === 0 || error)) { + if (ENVIRONMENT_IS_PTHREAD && (!transferList.length || error)) { return pthreadCreateProxied(pthread_ptr, attr, startRoutine, arg); } @@ -1232,7 +1232,7 @@ var LibraryPThread = { #endif #if ASSERTIONS assert(!ENVIRONMENT_IS_PTHREAD, 'dlsyncThreadsAsync() should only be called from the main thread'); - assert(Object.keys(PThread.outstandingPromises).length === 0); + assert(!Object.keys(PThread.outstandingPromises).length); #endif const promises = []; diff --git a/src/lib/libsdl.js b/src/lib/libsdl.js index 3a09fee01bc95..589f0a0d13415 100644 --- a/src/lib/libsdl.js +++ b/src/lib/libsdl.js @@ -508,8 +508,8 @@ var LibrarySDL = { dr = { x: 0, y: 0, w: srcData.width, h: srcData.height }; } if (dstData.clipRect) { - var widthScale = (!scale || sr.w === 0) ? 1 : sr.w / dr.w; - var heightScale = (!scale || sr.h === 0) ? 1 : sr.h / dr.h; + var widthScale = (!scale || !sr.w) ? 1 : sr.w / dr.w; + var heightScale = (!scale || !sr.h) ? 1 : sr.h / dr.h; dr = SDL.intersectionOfRects(dstData.clipRect, dr); @@ -526,7 +526,7 @@ var LibrarySDL = { } else { blitw = sr.w; blith = sr.h; } - if (sr.w === 0 || sr.h === 0 || blitw === 0 || blith === 0) { + if (!sr.w || !sr.h || !blitw || !blith) { return 0; } var oldAlpha = dstData.ctx.globalAlpha; @@ -992,7 +992,7 @@ var LibrarySDL = { var dx = x - lx; var dy = y - ly; touch.deviceID ??= SDL.TOUCH_DEFAULT_ID; - if (dx === 0 && dy === 0 && event.type === 'touchmove') return false; // don't send these if nothing happened + if (!dx && !dy && event.type === 'touchmove') return false; // don't send these if nothing happened {{{ makeSetValue('ptr', C_STRUCTS.SDL_TouchFingerEvent.type, 'SDL.DOMEventToSDLEvent[event.type]', 'i32') }}}; {{{ makeSetValue('ptr', C_STRUCTS.SDL_TouchFingerEvent.timestamp, '_SDL_GetTicks()', 'i32') }}}; {{{ makeSetValue('ptr', C_STRUCTS.SDL_TouchFingerEvent.touchId, 'touch.deviceID', 'i64') }}}; @@ -1965,7 +1965,7 @@ var LibrarySDL = { rotozoomSurface__deps: ['zoomSurface'], rotozoomSurface: (src, angle, zoom, smooth) => { - if (angle % 360 === 0) { + if (!(angle % 360)) { return _zoomSurface(src, zoom, zoom, smooth); } var srcData = SDL.surfaces[src]; diff --git a/src/lib/libsockfs_node.js b/src/lib/libsockfs_node.js index 5a85245343a99..f939744f41bf5 100644 --- a/src/lib/libsockfs_node.js +++ b/src/lib/libsockfs_node.js @@ -263,7 +263,7 @@ var NodeSockFSLibrary = { sock.udp.recvStart(); if (sock.sport === undefined) { var name = {}; - if (sock.udp.getsockname(name) === 0) { + if (!sock.udp.getsockname(name)) { sock.saddr = name.address; sock.sport = name.port; } @@ -438,7 +438,7 @@ var NodeSockFSLibrary = { if (sock.connection) { var conn = sock.connection; var linger = sock.opts?.linger; - if (linger?.onoff && linger.linger === 0 && conn.resetAndDestroy) { + if (linger?.onoff && !linger.linger && conn.resetAndDestroy) { // SO_LINGER with a zero timeout: abortive close - send RST and // discard any unsent data. conn.resetAndDestroy(); @@ -464,7 +464,7 @@ var NodeSockFSLibrary = { // how: SHUT_RD 0, SHUT_WR 1, SHUT_RDWR 2 (musl sys/socket.h). shutdown(sock, how) { if (!sock.connection) throw new FS.ErrnoError({{{ cDefs.ENOTCONN }}}); - if (how === 0 || how === 2) { + if (!how || how === 2) { // No more reads: subsequent recv returns EOF. sock.readClosed = true; } diff --git a/src/lib/libsyscall.js b/src/lib/libsyscall.js index bb257a45da280..57e6652b81238 100644 --- a/src/lib/libsyscall.js +++ b/src/lib/libsyscall.js @@ -727,7 +727,7 @@ var SyscallsLibrary = { __syscall_epoll_pwait: (epfd, ev, maxevents, timeout, sigmask, sigsetsize) => -{{{ cDefs.ENOSYS }}}, __syscall_getcwd__deps: ['$lengthBytesUTF8', '$stringToUTF8'], __syscall_getcwd: (buf, size) => { - if (size === 0) return -{{{ cDefs.EINVAL }}}; + if (!size) return -{{{ cDefs.EINVAL }}}; var cwd = FS.cwd(); var cwdLengthInBytes = lengthBytesUTF8(cwd) + 1; if (size < cwdLengthInBytes) return -{{{ cDefs.ERANGE }}}; diff --git a/src/lib/libtty.js b/src/lib/libtty.js index ba392b12c32ff..010cdad2d9a62 100644 --- a/src/lib/libtty.js +++ b/src/lib/libtty.js @@ -71,7 +71,7 @@ addToLibrary({ } catch (e) { throw new FS.ErrnoError({{{ cDefs.EIO }}}); } - if (result === undefined && bytesRead === 0) { + if (result === undefined && !bytesRead) { throw new FS.ErrnoError({{{ cDefs.EAGAIN }}}); } if (result === null || result === undefined) break; diff --git a/src/lib/libwasi.js b/src/lib/libwasi.js index a7c06fcc113cb..85717a996d51a 100644 --- a/src/lib/libwasi.js +++ b/src/lib/libwasi.js @@ -258,7 +258,7 @@ var WasiLibrary = { #if ASSERTIONS assert(buffer); #endif - if (curr === 0 || curr === {{{ charCode('\n') }}}) { + if (!curr || curr === {{{ charCode('\n') }}}) { (stream === 1 ? out : err)(UTF8ArrayToString(buffer)); buffer.length = 0; } else { @@ -383,7 +383,7 @@ var WasiLibrary = { var stream = SYSCALLS.getStreamFromFD(fd); FS.llseek(stream, offset, whence); {{{ makeSetValue('newOffset', '0', 'stream.position', 'i64') }}}; - if (stream.getdents && offset === 0 && whence === {{{ cDefs.SEEK_SET }}}) stream.getdents = null; // reset readdir state + if (stream.getdents && !offset && whence === {{{ cDefs.SEEK_SET }}}) stream.getdents = null; // reset readdir state return 0; #else return {{{ cDefs.ESPIPE }}}; diff --git a/src/lib/libwasmfs.js b/src/lib/libwasmfs.js index 944d495fc440c..ebe5d87869ed8 100644 --- a/src/lib/libwasmfs.js +++ b/src/lib/libwasmfs.js @@ -229,7 +229,7 @@ addToLibrary({ // offset is passed to msync to maintain backwards compatibility with the legacy JS API but is not used by WasmFS. msync: (stream, bufferPtr, offset, length, mmapFlags) => { #if ASSERTIONS - assert(offset === 0); + assert(!offset); #endif // TODO: assert that stream has the fd corresponding to the mapped buffer (bufferPtr). return FS.handleError(__wasmfs_msync(bufferPtr, length, mmapFlags)); @@ -409,7 +409,7 @@ addToLibrary({ } catch (e) { throw new FS.ErrnoError({{{ cDefs.EIO }}}); } - if (result === undefined && bytesRead === 0) { + if (result === undefined && !bytesRead) { throw new FS.ErrnoError({{{ cDefs.EAGAIN }}}); } if (result === null || result === undefined) break; diff --git a/src/lib/libwebgl.js b/src/lib/libwebgl.js index c20f871325bc6..069e6ae4996d2 100644 --- a/src/lib/libwebgl.js +++ b/src/lib/libwebgl.js @@ -406,7 +406,7 @@ for (/**@suppress{duplicate}*/var i = 0; i <= {{{ GL_POOL_TEMP_BUFFERS_SIZE }}}; // bits are needed to represent x, or, if x was rounded up to next pow2, // which index is the single '1' bit at? // Then log2ceilLookup[x] returns ceil(log2(x)). - log2ceilLookup: (i) => 32 - Math.clz32(i === 0 ? 0 : i - 1), + log2ceilLookup: (i) => 32 - Math.clz32(i ? i - 1 : 0), generateTempBuffers: (quads, context) => { var largestIndex = GL.log2ceilLookup(GL.MAX_TEMP_BUFFER_SIZE); From a836c3527fdd8ce9d5460eadf7002327b7efc6d2 Mon Sep 17 00:00:00 2001 From: Sam Clegg Date: Thu, 30 Jul 2026 10:06:38 -0700 Subject: [PATCH 2/2] feedback --- src/lib/libcore.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/test_codesize_cxx_except_wasm.json | 8 ++++---- .../test_codesize_cxx_except_wasm_legacy.json | 4 ++-- 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_file_preload.expected.js | 10 +++++----- test/codesize/test_codesize_file_preload.json | 8 ++++---- test/codesize/test_codesize_files_js_fs.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/test_codesize_hello_dylink_all.json | 4 ++-- .../test_codesize_hello_esm_integration.json | 4 ++-- test/codesize/test_codesize_hello_single_file.json | 4 ++-- test/codesize/test_codesize_hello_wasmfs.json | 8 ++++---- test/codesize/test_codesize_minimal_pthreads.json | 8 ++++---- .../test_codesize_minimal_pthreads_memgrowth.json | 8 ++++---- ...nimal_runtime_code_size_random_printf_wasm.json | 4 ++-- ...al_runtime_code_size_random_printf_wasm2js.json | 2 +- test/codesize/test_small_js_flags.expected.js | 2 +- test/codesize/test_small_js_flags.json | 8 ++++---- test/codesize/test_unoptimized_code_size.json | 14 +++++++------- 30 files changed, 105 insertions(+), 105 deletions(-) diff --git a/src/lib/libcore.js b/src/lib/libcore.js index 16b653de01de3..234ba5be7d482 100644 --- a/src/lib/libcore.js +++ b/src/lib/libcore.js @@ -1740,7 +1740,7 @@ addToLibrary({ _Unwind_Backtrace: (func, arg) => { var trace = getCallstack(); var parts = trace.split('\n'); - for (var _ of parts) { + for (var i = 0; i < parts.length; i++) { var ret = {{{ makeDynCall('iii', 'func') }}}(0, arg); if (ret) return; } diff --git a/test/codesize/test_codesize_cxx_ctors1.json b/test/codesize/test_codesize_cxx_ctors1.json index b687919ea97de..08fdd4cd24810 100644 --- a/test/codesize/test_codesize_cxx_ctors1.json +++ b/test/codesize/test_codesize_cxx_ctors1.json @@ -1,10 +1,10 @@ { - "a.out.js": 19228, - "a.out.js.gz": 8122, + "a.out.js": 19208, + "a.out.js.gz": 8121, "a.out.nodebug.wasm": 134745, "a.out.nodebug.wasm.gz": 51530, - "total": 153973, - "total_gz": 59652, + "total": 153953, + "total_gz": 59651, "sent": [ "__cxa_throw", "_abort_js", diff --git a/test/codesize/test_codesize_cxx_ctors2.json b/test/codesize/test_codesize_cxx_ctors2.json index 13ac12fa9a3f9..612d8c48db362 100644 --- a/test/codesize/test_codesize_cxx_ctors2.json +++ b/test/codesize/test_codesize_cxx_ctors2.json @@ -1,10 +1,10 @@ { - "a.out.js": 19205, - "a.out.js.gz": 8105, + "a.out.js": 19185, + "a.out.js.gz": 8104, "a.out.nodebug.wasm": 134174, "a.out.nodebug.wasm.gz": 51195, - "total": 153379, - "total_gz": 59300, + "total": 153359, + "total_gz": 59299, "sent": [ "__cxa_throw", "_abort_js", diff --git a/test/codesize/test_codesize_cxx_except.json b/test/codesize/test_codesize_cxx_except.json index 1f2d5290e2976..f08a026f3b703 100644 --- a/test/codesize/test_codesize_cxx_except.json +++ b/test/codesize/test_codesize_cxx_except.json @@ -1,10 +1,10 @@ { - "a.out.js": 22918, - "a.out.js.gz": 9082, + "a.out.js": 22895, + "a.out.js.gz": 9075, "a.out.nodebug.wasm": 177211, "a.out.nodebug.wasm.gz": 59121, - "total": 200129, - "total_gz": 68203, + "total": 200106, + "total_gz": 68196, "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 1f3dc9718c8eb..862734efc2716 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": 8035, + "a.out.js": 19007, + "a.out.js.gz": 8036, "a.out.nodebug.wasm": 150474, "a.out.nodebug.wasm.gz": 56590, - "total": 169501, - "total_gz": 64625, + "total": 169481, + "total_gz": 64626, "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 66fd9326a8437..b53fbe141a152 100644 --- a/test/codesize/test_codesize_cxx_except_wasm_legacy.json +++ b/test/codesize/test_codesize_cxx_except_wasm_legacy.json @@ -1,9 +1,9 @@ { - "a.out.js": 19105, + "a.out.js": 19085, "a.out.js.gz": 8060, "a.out.nodebug.wasm": 148256, "a.out.nodebug.wasm.gz": 56290, - "total": 167361, + "total": 167341, "total_gz": 64350, "sent": [ "_abort_js", diff --git a/test/codesize/test_codesize_cxx_lto.json b/test/codesize/test_codesize_cxx_lto.json index 70a152084c0ff..89b45a2de14fc 100644 --- a/test/codesize/test_codesize_cxx_lto.json +++ b/test/codesize/test_codesize_cxx_lto.json @@ -1,10 +1,10 @@ { - "a.out.js": 18572, - "a.out.js.gz": 7817, + "a.out.js": 18552, + "a.out.js.gz": 7814, "a.out.nodebug.wasm": 101014, "a.out.nodebug.wasm.gz": 38222, - "total": 119586, - "total_gz": 46039, + "total": 119566, + "total_gz": 46036, "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 990f7d83d3368..ee416adedea5b 100644 --- a/test/codesize/test_codesize_cxx_mangle.json +++ b/test/codesize/test_codesize_cxx_mangle.json @@ -1,10 +1,10 @@ { - "a.out.js": 22968, - "a.out.js.gz": 9103, + "a.out.js": 22945, + "a.out.js.gz": 9095, "a.out.nodebug.wasm": 243491, "a.out.nodebug.wasm.gz": 81314, - "total": 266459, - "total_gz": 90417, + "total": 266436, + "total_gz": 90409, "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 80cd75b938115..dbe25ddf18295 100644 --- a/test/codesize/test_codesize_cxx_noexcept.json +++ b/test/codesize/test_codesize_cxx_noexcept.json @@ -1,10 +1,10 @@ { - "a.out.js": 19228, - "a.out.js.gz": 8122, + "a.out.js": 19208, + "a.out.js.gz": 8121, "a.out.nodebug.wasm": 136655, "a.out.nodebug.wasm.gz": 52145, - "total": 155883, - "total_gz": 60267, + "total": 155863, + "total_gz": 60266, "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 04a321132d71e..024496f7d7701 100644 --- a/test/codesize/test_codesize_file_preload.expected.js +++ b/test/codesize/test_codesize_file_preload.expected.js @@ -859,7 +859,7 @@ var TTY = { } catch (e) { throw new FS.ErrnoError(29); } - if (result === undefined && bytesRead === 0) { + if (result === undefined && !bytesRead) { throw new FS.ErrnoError(6); } if (result === null || result === undefined) break; @@ -1176,7 +1176,7 @@ var MEMFS = { if (canOwn) { node.contents = buffer.subarray(offset, offset + length); node.usedBytes = length; - } else if (node.usedBytes === 0 && position === 0) { + } else if (!node.usedBytes && !position) { // If this is a simple first write to an empty file, do a fast set since we don't need to care about old data. node.contents = buffer.slice(offset, offset + length); node.usedBytes = length; @@ -2517,7 +2517,7 @@ var FS = { // to write to file opened in read-only mode with MAP_PRIVATE flag, // as all modifications will be visible only in the memory of // the current process. - if ((prot & 2) !== 0 && (flags & 2) === 0 && (stream.flags & 2097155) !== 2) { + if ((prot & 2) && !(flags & 2) && (stream.flags & 2097155) !== 2) { throw new FS.ErrnoError(2); } if ((stream.flags & 2097155) === 1) { @@ -2610,7 +2610,7 @@ var FS = { // use a buffer to avoid overhead of individual crypto calls per byte var randomBuffer = new Uint8Array(1024), randomLeft = 0; var randomByte = () => { - if (randomLeft === 0) { + if (!randomLeft) { randomFill(randomBuffer); randomLeft = randomBuffer.byteLength; } @@ -2826,7 +2826,7 @@ var FS = { } catch (e) { throw new FS.ErrnoError(29); } - if (result === undefined && bytesRead === 0) { + if (result === undefined && !bytesRead) { throw new FS.ErrnoError(6); } if (result === null || result === undefined) break; diff --git a/test/codesize/test_codesize_file_preload.json b/test/codesize/test_codesize_file_preload.json index 43aefe571dd8a..b953023499e05 100644 --- a/test/codesize/test_codesize_file_preload.json +++ b/test/codesize/test_codesize_file_preload.json @@ -1,10 +1,10 @@ { - "a.out.js": 22204, - "a.out.js.gz": 9264, + "a.out.js": 22187, + "a.out.js.gz": 9259, "a.out.nodebug.wasm": 1666, "a.out.nodebug.wasm.gz": 945, - "total": 23870, - "total_gz": 10209, + "total": 23853, + "total_gz": 10204, "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 51305d3167d94..b60d8b6a54be8 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": 17872, - "a.out.js.gz": 7464, + "a.out.js": 17855, + "a.out.js.gz": 7462, "a.out.nodebug.wasm": 381, "a.out.nodebug.wasm.gz": 258, - "total": 18253, - "total_gz": 7722, + "total": 18236, + "total_gz": 7720, "sent": [ "a (fd_write)", "b (fd_read)", diff --git a/test/codesize/test_codesize_hello_O0.json b/test/codesize/test_codesize_hello_O0.json index c734588a0e6e0..8ad48f5be16de 100644 --- a/test/codesize/test_codesize_hello_O0.json +++ b/test/codesize/test_codesize_hello_O0.json @@ -1,10 +1,10 @@ { - "a.out.js": 23477, - "a.out.js.gz": 8557, + "a.out.js": 23471, + "a.out.js.gz": 8555, "a.out.nodebug.wasm": 15115, "a.out.nodebug.wasm.gz": 7464, - "total": 38592, - "total_gz": 16021, + "total": 38586, + "total_gz": 16019, "sent": [ "fd_write" ], diff --git a/test/codesize/test_codesize_hello_O1.json b/test/codesize/test_codesize_hello_O1.json index be7c4fe9daa15..b6cbfdd357df5 100644 --- a/test/codesize/test_codesize_hello_O1.json +++ b/test/codesize/test_codesize_hello_O1.json @@ -1,10 +1,10 @@ { - "a.out.js": 5522, - "a.out.js.gz": 2239, + "a.out.js": 5516, + "a.out.js.gz": 2242, "a.out.nodebug.wasm": 2544, "a.out.nodebug.wasm.gz": 1436, - "total": 8066, - "total_gz": 3675, + "total": 8060, + "total_gz": 3678, "sent": [ "fd_write" ], diff --git a/test/codesize/test_codesize_hello_O2.json b/test/codesize/test_codesize_hello_O2.json index ba874758500df..ffa925f61aa27 100644 --- a/test/codesize/test_codesize_hello_O2.json +++ b/test/codesize/test_codesize_hello_O2.json @@ -1,10 +1,10 @@ { - "a.out.js": 3859, - "a.out.js.gz": 1970, + "a.out.js": 3855, + "a.out.js.gz": 1966, "a.out.nodebug.wasm": 1912, "a.out.nodebug.wasm.gz": 1129, - "total": 5771, - "total_gz": 3099, + "total": 5767, + "total_gz": 3095, "sent": [ "fd_write" ], diff --git a/test/codesize/test_codesize_hello_O3.json b/test/codesize/test_codesize_hello_O3.json index be2ba272d7006..e5e1dd06d3f4a 100644 --- a/test/codesize/test_codesize_hello_O3.json +++ b/test/codesize/test_codesize_hello_O3.json @@ -1,10 +1,10 @@ { - "a.out.js": 3801, - "a.out.js.gz": 1928, + "a.out.js": 3797, + "a.out.js.gz": 1925, "a.out.nodebug.wasm": 1666, "a.out.nodebug.wasm.gz": 945, - "total": 5467, - "total_gz": 2873, + "total": 5463, + "total_gz": 2870, "sent": [ "a (fd_write)" ], diff --git a/test/codesize/test_codesize_hello_Os.json b/test/codesize/test_codesize_hello_Os.json index 71749bb323745..989b872d675a7 100644 --- a/test/codesize/test_codesize_hello_Os.json +++ b/test/codesize/test_codesize_hello_Os.json @@ -1,10 +1,10 @@ { - "a.out.js": 3801, - "a.out.js.gz": 1928, + "a.out.js": 3797, + "a.out.js.gz": 1925, "a.out.nodebug.wasm": 1654, "a.out.nodebug.wasm.gz": 953, - "total": 5455, - "total_gz": 2881, + "total": 5451, + "total_gz": 2878, "sent": [ "a (fd_write)" ], diff --git a/test/codesize/test_codesize_hello_Oz.json b/test/codesize/test_codesize_hello_Oz.json index 85d5d192a160a..96405ea5ca1ba 100644 --- a/test/codesize/test_codesize_hello_Oz.json +++ b/test/codesize/test_codesize_hello_Oz.json @@ -1,10 +1,10 @@ { - "a.out.js": 3438, - "a.out.js.gz": 1732, + "a.out.js": 3434, + "a.out.js.gz": 1729, "a.out.nodebug.wasm": 1188, "a.out.nodebug.wasm.gz": 731, - "total": 4626, - "total_gz": 2463, + "total": 4622, + "total_gz": 2460, "sent": [ "a (fd_write)" ], diff --git a/test/codesize/test_codesize_hello_dylink.json b/test/codesize/test_codesize_hello_dylink.json index d8bc7497928dd..474140fcbddb5 100644 --- a/test/codesize/test_codesize_hello_dylink.json +++ b/test/codesize/test_codesize_hello_dylink.json @@ -1,10 +1,10 @@ { - "a.out.js": 26265, - "a.out.js.gz": 11212, + "a.out.js": 26242, + "a.out.js.gz": 11203, "a.out.nodebug.wasm": 17861, "a.out.nodebug.wasm.gz": 9019, - "total": 44126, - "total_gz": 20231, + "total": 44103, + "total_gz": 20222, "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 bd69a6cbe1e04..d46140ae65d47 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": 267933, + "a.out.js": 267788, "a.out.nodebug.wasm": 588309, - "total": 856242, + "total": 856097, "sent": [ "IMG_Init", "IMG_Load", diff --git a/test/codesize/test_codesize_hello_esm_integration.json b/test/codesize/test_codesize_hello_esm_integration.json index 597fc662d5b7c..49aa34bab2902 100644 --- a/test/codesize/test_codesize_hello_esm_integration.json +++ b/test/codesize/test_codesize_hello_esm_integration.json @@ -1,11 +1,11 @@ { "a.out.mjs": 671, "a.out.mjs.gz": 401, - "a.out.support.mjs": 6092, + "a.out.support.mjs": 6089, "a.out.support.mjs.gz": 2388, "a.out.nodebug.wasm": 1688, "a.out.nodebug.wasm.gz": 973, - "total": 8451, + "total": 8448, "total_gz": 3762, "sent": [ "a (fd_write)" diff --git a/test/codesize/test_codesize_hello_single_file.json b/test/codesize/test_codesize_hello_single_file.json index 5903fc859d0f6..15ee0660be1dc 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": 4853, - "a.out.js.gz": 2750, + "a.out.js": 4849, + "a.out.js.gz": 2748, "sent": [ "a (fd_write)" ] diff --git a/test/codesize/test_codesize_hello_wasmfs.json b/test/codesize/test_codesize_hello_wasmfs.json index be2ba272d7006..e5e1dd06d3f4a 100644 --- a/test/codesize/test_codesize_hello_wasmfs.json +++ b/test/codesize/test_codesize_hello_wasmfs.json @@ -1,10 +1,10 @@ { - "a.out.js": 3801, - "a.out.js.gz": 1928, + "a.out.js": 3797, + "a.out.js.gz": 1925, "a.out.nodebug.wasm": 1666, "a.out.nodebug.wasm.gz": 945, - "total": 5467, - "total_gz": 2873, + "total": 5463, + "total_gz": 2870, "sent": [ "a (fd_write)" ], diff --git a/test/codesize/test_codesize_minimal_pthreads.json b/test/codesize/test_codesize_minimal_pthreads.json index d15dcdb7e370b..43f744cf97b4f 100644 --- a/test/codesize/test_codesize_minimal_pthreads.json +++ b/test/codesize/test_codesize_minimal_pthreads.json @@ -1,10 +1,10 @@ { - "a.out.js": 6859, - "a.out.js.gz": 3409, + "a.out.js": 6856, + "a.out.js.gz": 3406, "a.out.nodebug.wasm": 19108, "a.out.nodebug.wasm.gz": 8823, - "total": 25967, - "total_gz": 12232, + "total": 25964, + "total_gz": 12229, "sent": [ "a (memory)", "b (exit)", diff --git a/test/codesize/test_codesize_minimal_pthreads_memgrowth.json b/test/codesize/test_codesize_minimal_pthreads_memgrowth.json index f87b8f974fa98..c7d20dad4ac1b 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": 7310, - "a.out.js.gz": 3625, + "a.out.js": 7307, + "a.out.js.gz": 3624, "a.out.nodebug.wasm": 19109, "a.out.nodebug.wasm.gz": 8826, - "total": 26419, - "total_gz": 12451, + "total": 26416, + "total_gz": 12450, "sent": [ "a (memory)", "b (exit)", diff --git a/test/codesize/test_minimal_runtime_code_size_random_printf_wasm.json b/test/codesize/test_minimal_runtime_code_size_random_printf_wasm.json index 98f3f3999840a..e9244d9f3e1e0 100644 --- a/test/codesize/test_minimal_runtime_code_size_random_printf_wasm.json +++ b/test/codesize/test_minimal_runtime_code_size_random_printf_wasm.json @@ -1,4 +1,4 @@ { - "a.html": 11054, - "a.html.gz": 5752 + "a.html": 11050, + "a.html.gz": 5753 } diff --git a/test/codesize/test_minimal_runtime_code_size_random_printf_wasm2js.json b/test/codesize/test_minimal_runtime_code_size_random_printf_wasm2js.json index 269bfba988fe7..b0ccdc99b411d 100644 --- a/test/codesize/test_minimal_runtime_code_size_random_printf_wasm2js.json +++ b/test/codesize/test_minimal_runtime_code_size_random_printf_wasm2js.json @@ -1,4 +1,4 @@ { - "a.html": 17417, + "a.html": 17413, "a.html.gz": 7659 } diff --git a/test/codesize/test_small_js_flags.expected.js b/test/codesize/test_small_js_flags.expected.js index a97e03c35e819..1b5aa349a4476 100644 --- a/test/codesize/test_small_js_flags.expected.js +++ b/test/codesize/test_small_js_flags.expected.js @@ -322,7 +322,7 @@ var UTF8Decoder = globalThis.TextDecoder && new TextDecoder; var printChar = (stream, curr) => { var buffer = printCharBuffers[stream]; - if (curr === 0 || curr === 10) { + if (!curr || curr === 10) { (stream === 1 ? out : err)(UTF8ArrayToString(buffer)); buffer.length = 0; } else { diff --git a/test/codesize/test_small_js_flags.json b/test/codesize/test_small_js_flags.json index fca4a53fc1243..bdf5486448901 100644 --- a/test/codesize/test_small_js_flags.json +++ b/test/codesize/test_small_js_flags.json @@ -1,10 +1,10 @@ { - "a.out.js": 2066, - "a.out.js.gz": 1187, + "a.out.js": 2062, + "a.out.js.gz": 1182, "a.out.nodebug.wasm": 1666, "a.out.nodebug.wasm.gz": 945, - "total": 3732, - "total_gz": 2132, + "total": 3728, + "total_gz": 2127, "sent": [ "a (fd_write)" ], diff --git a/test/codesize/test_unoptimized_code_size.json b/test/codesize/test_unoptimized_code_size.json index 87bbc644c9d2f..76798f8761f3a 100644 --- a/test/codesize/test_unoptimized_code_size.json +++ b/test/codesize/test_unoptimized_code_size.json @@ -1,16 +1,16 @@ { - "hello_world.js": 54555, - "hello_world.js.gz": 17327, + "hello_world.js": 54550, + "hello_world.js.gz": 17328, "hello_world.wasm": 15115, "hello_world.wasm.gz": 7464, - "no_asserts.js": 23634, + "no_asserts.js": 23629, "no_asserts.js.gz": 8288, "no_asserts.wasm": 12229, "no_asserts.wasm.gz": 6004, - "strict.js": 51706, - "strict.js.gz": 16337, + "strict.js": 51701, + "strict.js.gz": 16338, "strict.wasm": 15115, "strict.wasm.gz": 7461, - "total": 172354, - "total_gz": 62881 + "total": 172339, + "total_gz": 62883 }