Fix #1017: Fast MethodDef comparison through hashes

By hashing the method defs the compiler emits, we can calculate more
accurate diffs in the incremental optimizer. This allows us to truly
only re-optimize methods that have changed (and their dependees).

Pseudo-benchmarks have shown that the speed-loss is acceptable:
~7% additional compile time for the whole scalajs library.

The changes to MethodDef made the pattern matcher (or typer) choke,
hence the seemingly unrelated changes to the patterns.