Simple speedup for is_dir

Summary: is_dir was calling realpath before calling stat. The only time
it needed that was so that prefix-matching on the AllowedDirectories
would work. Skip it unless we're in SafeFileMode (we could probably
be smarter here; have a version of File::TranslatePath that checks the
path against the allowed directories, then calls realpath and tries
again if it fails).

It also tried to lookup the directory in the StaticContentsCache; but
that only contains files, so pass false for useFileCache.

Reviewed By: @bertmaher

Differential Revision: D1743945