mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-12 18:08:15 +02:00
Replace per-AST-node Rc<Identifier> with a Copy IdentifierId index into a Vec<Identifier> arena, plumbed through Parser, scope_collector, codegen, ast_dump, and the FFI. The arena lives on the parser during parse, ships out via Arc<AstArena> on ParsedProgram, and is shared by each child Generator and FunctionPayload through Arc clones. Eliminates the per-occurrence Rc::new in the parser: every identifier reference, parameter binding, function name, class name, and binding-pattern target lands in the arena's Vec instead of getting its own malloc plus Rc control block. Identifier field reads in codegen become direct array indexing. Identifier still carries Cell<>-wrapped scope-analysis state, so AstArena is not yet Send + Sync; the existing unsafe-impl-Send wrapper on ParsedProgram covers cross-thread handoff. Removing the Cells is the next step.