Optimize tree walking in markAliveBlocks.