Problem
Compiler.tdzRefsPending iterates every not-yet-declared lexical spelling and runs a complete nameRefInClosure AST walk for each one. An attacker-sized function with many lexical declarations and a large expression before them can therefore multiply pending-binding count by expression size during bytecode admission, even when the expression references none of those bindings.
This is a compiler-classification cost, not an execution shortcut: TDZ detection must remain conservative and exact.
Scope
- Add an owned parse-plus-plain-function-compile growth witness at 1K/2K/4K widths, including no-reference, forward-reference, self-reference, nested-function/class deferred-reference, and declare-before-use controls.
- Record exact admission/chunk/checksum, allocations/bytes, instructions/cycles, wall diagnostics, and complete raw commands through the exact-parent A/B pipeline.
- Replace per-pending-binding whole-subtree walks with one exhaustive identifier traversal using exact pending-lexical membership lookups.
- Preserve the exhaustive AST-node contract so a new node kind cannot silently create a TDZ false negative.
- Keep ordinary functions on unchecked hot opcodes when proven hazard-free; do not broaden runtime TDZ checks as a performance workaround.
Acceptance
- Growth evidence demonstrates bounded near-linear classifier work as binding and expression width scale together.
- All witness variants preserve exact admission, chunk shape/checksum, allocation accounting, and TDZ behavior.
- Self/forward and hoisted/nested-function references retain checked lexical loads; field initializers and static fields retain exact hazardous classification and conservative frame-capture rejection.
- Declare-before-use and unrelated-identifier controls remain bytecode-eligible without checked lexical opcodes.
- Focused compiler/frontend tests, forced tree-walker/required-bytecode differentials, full units, and relevant test262 lexical/function/class subtrees pass with zero flips.
- Exact-parent evidence and documentation name exact revisions and do not convert noisy wall observations into claims.