[libc++abi] Add a rate limiter when logging dynamic_cast errors

This upstreams a fix that Howard made a long time ago, where so many
errors would be logged that applications were becoming sluggish. With
this patch, the first three errors will be printed, and after that the
printing frequency decreases exponentially.

_LIBCXX_DYNAMIC_FALLBACK is only enabled on Apple platforms, so this
should be NFC for other platforms.

rdar://14996273

Differential Revision: https://reviews.llvm.org/D78330

GitOrigin-RevId: 58f32435e8bf8e32c4e2fbe7ffa866ffc52fab13
1 file changed