File: Fix fs.resolve when child == "/"

While we're here, rewrite the awkward and inefficient normalize
implementation in terms of a straightforward for loop.

BEFORE:
-------

Experiment {instrument=runtime, benchmarkMethod=timeFileCreationWithEmptyChild, vm=default, parameters={}}
    runtime(ns): min=1038.95, 1st qu.=1073.66, median=1126.43, mean=1114.45, 3rd qu.=1146.79, max=1167.06
Experiment {instrument=runtime, benchmarkMethod=timeFileCreationWithNormalizationNecessary, vm=default, parameters={}}
    runtime(ns): min=4689.34, 1st qu.=4824.58, median=5154.13, mean=5070.34, 3rd qu.=5246.19, max=5365.60

AFTER:
------

Experiment {instrument=runtime, benchmarkMethod=timeFileCreationWithEmptyChild, vm=default, parameters={}}
    runtime(ns): min=903.75, 1st qu.=915.69, median=928.18, mean=960.25, 3rd qu.=955.40, max=1202.22
Experiment {instrument=runtime, benchmarkMethod=timeFileCreationWithNormalizationNecessary, vm=default, parameters={}}
    runtime(ns): min=3198.08, 1st qu.=3219.68, median=3368.74, mean=3445.71, 3rd qu.=3520.65, max=4113.64

bug: 27731686

Change-Id: Ie1eba4449aad010a18d87f3d03bcc99836505051
3 files changed