Problem
The forced tree walker and required bytecode disagree on 13 positive test262 expression cases, all in the proper-tail-call family:
- logical
&&/||and nullish??right operands - conditional branches
- the final comma operand
- ordinary identifier/member calls, including an identifier resolved through
with - tagged-template calls
Current-main evidence (136178ae):
# test/language/expressions: 13 diverge, 11025 agreeEvery mismatch is fail_runtime->pass: the tree walker reaches its native stack guard while required bytecode completes.
The tree walker already owns a frame-reusing tail-call trampoline, but tree_tail_allowed is enabled only when a strict function's source contains the bytes eval, and prepareTreeTailCall recognizes only a non-direct call through an identifier literally named eval. Ordinary tail calls and the other HasCallInTailPosition expression forms therefore never enter it.
Executed oracle
A minimized strict conditional-tail recursion at depth 100 returns 41 exactly once in Node, JavaScriptCore, forced tree, and required VM. At depth 100,000:
- JavaScriptCore:
41:1 - required VM:
41:1 - forced tree:
RangeError, terminal call count0 - Node:
RangeErrorbecause Node does not implement the optional proper-tail-call feature; it is useful here only for the bounded semantic/order control
Scope
- Extend the existing tree-walker trampoline across the exact strict-mode tail-position expression grammar used by the compiler: call, final sequence operand, logical right operand, conditional branches, nullish right operand, and tagged templates.
- Preserve call-reference semantics: computed/member/super/
withreceivers, evaluation order, direct-eval handling, spread arguments, optional short circuit, and call-site diagnostics. - Do not reuse a frame while a
try/finallyor constructor obligation must remain live. - Add deterministic forced-tree versus required-bytecode tests, including receiver/order and GC-rooting coverage.
Acceptance
- The 13 current expression divergences become 0 without reducing the denominator.
- Minimized deep strict recursion completes with bounded native stack in forced-tree and required-bytecode modes.
- Sloppy recursion still grows the logical/native stack and throws rather than being silently optimized.
- Receiver, argument, tagged-template,
with, abrupt completion, and moving-GC observations agree across tiers. - Focused normal and unsuppressed TSan tests pass; affected test262 subtrees have zero failures.
No source-name recognition, test-specific depth exception, or forced-tree fallback to bytecode.