Add counters to File#{exists, isFile, isDirectory}.

Due to limitations in the Statistics machinery, these are only
reported if this patch is applied.

        --- a/src/reflect/scala/reflect/internal/util/Statistics.scala
        +++ b/src/reflect/scala/reflect/internal/util/Statistics.scala
        @@ -109,7 +109,7 @@ quant)
            *  Quantities with non-empty prefix are printed in the statistics info.
            */
           trait Quantity {
        -    if (enabled && prefix.nonEmpty) {
        +    if (prefix.nonEmpty) {
               val key = s"${if (underlying != this) underlying.prefix else ""}/$prefix"
               qs(key) = this
             }
        @@ -243,7 +243,7 @@ quant)
            *
            *  to remove all Statistics code from build
            */
        -  final val canEnable = _enabled
        +  final val canEnable = true // _enabled
Optimization: avoid isDirectory call in DirectoryClassPath traversal

If we just established that the given path is a File or a Directory,
we don't need to go straight back to disk to re-check.

Background: When profiling an application that was using the interpreter
to compile a script, a lot of time was reported in exists / isDirectory
/ isFile. For the record, I happened to be profiling on Windows.

Turns out some of these calls are redundant, this commit and the
subsequent eliminate two sources thereof.

Here's an example of how it helps:

Taking a Hello, Akka! application, and compiling it with the compiler
and library on a directory classpath (ie, using build/quick):

    class HelloActor extends Actor {
      def receive = {
        case "hello" => println("hello back at you")
        case _       => println("huh?")
      }
    }

    object Main extends App {
      val system = ActorSystem("HelloSystem")
      // default Actor constructor
      val helloActor = system.actorOf(Props[HelloActor], name = "helloactor")
      helloActor ! "hello"
      helloActor ! "buenos dias"
    }

    % qbin/scalac -Ystatistics -classpath ~/.ivy2/cache/com.typesafe.akka/akka-actor_2.10/jars/akka-actor_2.10-2.1.1.jar:/Users/jason/.ivy2/cache/com.typesafe/config/bundles/config-1.0.0.jar sandbox/test.scala 2>&1 | grep File

Before
----------------------------------
File.isFile calls           : 7620
File.isDirectory calls      : 8348
File.exists calls           : 5770

After
----------------------------------
File.isFile calls           : 7620
File.isDirectory calls      : 2319
File.exists calls           : 5770
Optimization: avoid call to exists in PlainFile#iterator

If we just established that the given path is a File or a Directory,
we can assume it continues to exist.

Before
----------------------------------
File.isFile calls           : 7620
File.isDirectory calls      : 2319
File.exists calls           : 5770

After
----------------------------------
File.isFile calls           : 7620
File.isDirectory calls      : 2319
File.exists calls           : 345
Merge pull request #2335 from retronym/topic/opt-file-access

Optimize file metadata access