Fix #573: Add an IR checker.

The IR checker can be enabled with the setting
  checkScalaJSIR := true
It will perform a complete sanity check of the IR and typecheck it
during fast-optimizations.

Note that it will not even run if fast-opt reports at least one
"linking" error.

The IR checker is disabled by default in the sbt plugin, but we
enable it for all the examples and the test suite in the Scala.js
build. It is also enabled for the partest suite.