[SPARK-695] In DAGScheduler's getPreferredLocs, track set of visited partitions.

What do you think of a method like this for avoiding exponential path exploration in DAGScheduler's getPreferredLocs, per SPARK-695?

Some minor cleanups are also included.  The comment I removed in Dependency.scala seemed incorrect to me, per my commit comment:

    Remove apparently incorrect comment describing NarrowDependency.
  
    Each of a CartesianRDD's dependencies, for example, is a NarrowDependency, but child partitions of
    these dependencies may depend on shared parent partitions.  For example, the cartesian product of
    RDDs a and b containing partitions [ a_0 ] and [ b_0, b_1 ] respectively will be partitioned as
    [ ( a_0, b_0 ), ( a_0, b_1 ) ].  Each child partition depends on parent partition a_0.

I'm new to spark, scala (and even java) so a careful review may be in order.

Thanks,
Aaron
@mateiz It looks to me that this is what was always intended, but has actually been missing the `visitedStages` check for the past couple of years:
```scala
if (!mapStage.isAvailable && !visitedStages(mapStage)) {
  visitedStages += mapStage
  visit(mapStage.rdd)
}  // Otherwise there's no need to follow the dependency back
```
Making that change works for me in the sense that all of the test suites continue to pass, but I haven't yet got any relative performance numbers.

Proabably needs to go in a separate JIRA & PR.