Long reference "chain" can overflow the stack during GC trace
Very long "reference chains" (i.e. very deeply nested objects) can overflow the stack because, afaict, each object trace during GC cycles is its own function call. It seems like there's basically no guards against stack overflows (for example even simple cases like #809 can abort the process) so this is probably lower priority, but this sounds a little trickier to guard against.
To Reproduce
let old = {};
for (let i = 0; i < 100000000; i++) {
old = { old };
}
After 10 iterations, old would be { old: { old: { old: { old: { old: { old: { old: { old: { old: { old: {} } } } } } } } } } }.
After 1e8 iterations, this would be nested very deeply, so anything that makes the engine recursively visit each property will end in a stack overflow (which is what happens during a GC trace as it needs to mark everything as visited)
Expected behavior Not a stack overflow. The process shouldn't abort.
Build environment:
- OS: Ubuntu
- Version: 20.04
- Target triple: x86_64-unknown-linux-gnu
- Rustc version: rustc 1.60.0-nightly (75d9a0ae2 2022-02-16)