mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-28 10:37:17 +02:00
The scope collector uses HashMaps for identifier groups and variables, which means their iteration order is non-deterministic. This causes local variable indices and function declaration instantiation (FDI) bytecode to vary between runs. Fix this by sorting identifier group keys alphabetically before assigning local variable indices, and sorting vars_to_initialize by name before emitting FDI bytecode. Also make register allocation deterministic by always picking the lowest-numbered free register instead of whichever one happens to be at the end of the free list. This is preparation for bringing in a new source->bytecode pipeline written in Rust. Checking for regressions is significantly easier if we can expect identical output from both pipelines.
84 KiB
84 KiB