Improve performance of Weak.add (#13737)
* Improve performance of Weak.add
Replace a recursive function by a while loop.
The recursive function was allocated for each element when resizing, contributing significantly
to the memory footprint of code using weak tables.
* More idiomatic code
* Changes
* nitpick from Gabriel
authored by