Remove old outputs from build log and deps log during recompaction.

At the moment, entries for old files – files that were once part of the build, but then got deleted for renamed – are never removed from the build log or the deps log, which means if a file is continuously renamed the logs will grow without bounds. And if such an old file is added back to the build it will be dirty due to its timestamp anyway, so there's no point in keeping these old entries around.

In practice, this problem used to slow down log loading about 20% and deps loading 26% in some cases.

Fixes #661.