fix(timers): global setImmediate/clearImmediate calls + timer typeof === 'function' (#1454)#1455
Merged
Merged
Conversation
…=== 'function' (#1454) setImmediate/clearImmediate weren't recognized as builtin globals, so bare calls lowered to GlobalGet → 'value is not a function'. Add them to is_builtin_function (setImmediate already had a codegen call arm; add a clearImmediate arm routing to js_clear_timeout_value — immediates share the timer pool). And typeof of the global timer builtins read 'boolean' (they lower to ExternFuncRef); fold typeof of setTimeout/setInterval/setImmediate/ clearTimeout/clearInterval/clearImmediate (+fetch) to 'function' — gc excluded (undefined in Node without --expose-gc). Flips node-suite/timers/object/dispose (the setImmediate half, on top of #1453's Symbol.dispose) and adds timers/global-functions. Verified typeof fetch + setTimeout call unaffected.
2a0b3ad to
2dc3241
Compare
4 tasks
proggeramlug
added a commit
that referenced
this pull request
May 23, 2026
…es (#1458) Rolls up 22 PRs that merged to main post-v0.5.1025 without per-PR version bumps. - node:timers epic (#1213, 6 PRs #1449-#1455): node:timers/promises setTimeout/setImmediate, numeric-id clear*, namespace import, ref() typeof, Symbol.dispose, global setImmediate/clearImmediate. - node:perf_hooks fan-out (10 PRs across #1320 #1327 #1337-#1340 #1388-#1390 #1403): typeof methods, performance singleton identity, nodeTiming, toJSON, clearResourceTimings, structured-clone detail, observer arg + buffered + throw cases. - node:json lazy-tape closes #1424 (#1447) — JSON.parse reviver on lazy-tape arrays no longer SIGSEGVs (test un-skip-listed). - #1448 console.log/util.inspect on lazy-tape arrays materialises before formatting. - #1429 GC unsafe-zone guards for fastify/hyper handlers. - #1341 codegen: Any-typed .includes()/.indexOf() dynamic dispatch. - #1370 perry/ui web driver debug noise dropped. #1423 (AsyncLocalStorage .enterWith/.exit) remains skip-listed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two related global-timer gaps (#1454):
setImmediate/clearImmediatebare calls threwvalue is not a function— they weren't inis_builtin_function, so they lowered to aGlobalGetcall instead of anExternFuncRef(which hits the codegen fast path). Added both;setImmediatealready had a codegen call arm, added aclearImmediatearm routing tojs_clear_timeout_value(immediates share the timer pool).typeof setTimeout(etc.) read"boolean"— bare timer builtins lower to anExternFuncRefwhosetypeofis wrong. FoldtypeofofsetTimeout/setInterval/setImmediate/clearTimeout/clearInterval/clearImmediate(+fetch) to"function".gcis excluded (it'sundefinedin Node without--expose-gc).Test
node-suite/timers/object/disposeto PASS (thesetImmediatehalf, on top of feat(timers): Symbol.dispose on Timeout/Immediate handles (#1213) #1453'sSymbol.dispose).node-suite/timers/global-functions—typeofof all six +setImmediate/clearImmediatecall/clear — matches Node.typeof fetch === "function",setTimeout(...)calls, andtest_parity_timers/test_parity_timers_promisesall still pass.Closes #1454.