Skip to main content

join_stack_push

Function join_stack_push 

Source
pub fn join_stack_push(v: &Value) -> bool
Expand description

V8’s JoinStackPush: record that v is being joined, or report false if it already is.

Array.prototype.join (and toString/toLocaleString, which route through it) is the one place the language walks an object graph with no depth bound, so every engine cuts re-entrance here: a receiver already on the stack contributes the EMPTY STRING rather than recursing. Measured on node v26.7.0, const a=[1]; a.push(a); a.push(2); a.join('-') is "1--2", and String(a)/`${a}` on a=[a] are both "". node-js had no such cut and recursed until the native stack overflowed, ABORTING the process (exit 134) — uncatchable, where node returns a string.

Only re-entrance is cut, not repetition: [a,a].join('|') still renders a twice, because the first render pops before the second pushes.

A true return MUST be paired with join_stack_pop.