Move the call to hv_clear_placeholders() from hsplit() to hv_common().

The relevant code calls Perl_hv_clear_placeholders() at split time, if there
are still placeholders left over from a (previously) restricted hash.
There are two callers to S_hsplit(), one from the regular HV code, and one
from the shared string table code. As the shared string table can't contain
placeholders, only the other call site could trigger this condition, so move
the code there. This simplifies S_hsplit(), and will make splitting the
shared string table marginally faster.
Refactor the loop logic in S_hsplit() and Perl_hv_ksplit() to converge.

Making the code as similar as possible will make it simpler to merge the two.
Move the code handling allocating a new buffer earlier in Perl_hv_ksplit().

This makes the rest of the code of Perl_hv_ksplit() closer to that of
S_hsplit().
Pass the current and desired hash sizes to S_hsplit().

Whilst this is slightly more work for its existing two callers, it will
permit Perl_hv_ksplit() to also call it.

Use STRLEN for the parameters, and change a local variable from I32 to
STRLEN to match.
Tweak S_hsplit() to return early if there are no keys to process.

This mimics the behaviour in Perl_hv_ksplit().

Also remove a vestigial comment. The code it relates to was removed in
commit 7dc8663964c66a69 in Nov 2012.
Replace the bulk of Perl_hv_ksplit() with a call to S_hsplit().

The code duplication that introduced hv_ksplit() as a fork of hsplit() back
with commit 72940dca186befa0 in Sept 1996 is finally healed.
In S_hsplit(), replace a for with a do/while, as the loop runs at least once.

Seems pointless to check the exit condition before any iterations, when we
know that it will always be false the first time.
Clarify why hv_common() tries to clear placeholders before calling hsplit().

Which makes me realise that if we clear placeholders, we may be able to
avoid the need to split at all.

(In fact, as hv_common() only adds one key to the hash, under the current
definition of DO_HSPLIT() which only considers total number of keys,
clearing any placeholder is going to be enough to drop the total number of
keys, and so no longer trigger the split. But we'll leave the code making a
second check, to avoid a tight coupling with the internals of DO_HSPLIT().)
In Perl_hv_common(), call S_clear_placeholders() directly.

This saves one call to HvPLACEHOLDERS_get().
Merge the refactored S_hsplit() and Perl_hv_ksplit() and related cleanups.

Perl_hv_ksplit() now calls S_hsplit(), avoiding duplicating the code to
split hashes when they grow.