Backport of changes in #4472
This PR is a backport of the issues referenced in #4472 (closed). The original commits weren't applying cleanly for two reasons.
- Normal churn on master, where all commits aren't backported to LTS caused conflicts.
- Each referenced PR was mapped to a single commit in #4472 (closed). However, a few of the PRs actually had multiple commits.
With this branch, I was able to get all tests passing on my local machine. R= @TheAlphaNerd @bnoordhuis @jasnell Closes #4472 (closed)