Improve positions of some class definitions.
Fix #496: conversions from JS prims to Scala types are unsafe.

* js.prim.Number  -> Double: makePrimitiveUnbox to `Double`
  (null becomes 0, numbers become themselves, everything else throws)
* js.prim.Boolean -> Boolean: makePrimitiveUnbox to `Boolean`
  (null becomes false, booleans become themselves, everything else throws)
* js.prim.String  -> String: `.asInstanceOf[String]`
  (null and strings become themselves, everything else throws)
Merge pull request #502 from sjrd/before-new-ir

Small fixes
New intermediate representation (IR).

This new IR is meant to be an interchange format between the
compiler and the packager and optimizers (instead of raw
JavaScript code), so that inlining will eventually be possible.
In this commit, though, it simply replaces the JS Trees as an
intermediate representation in the compiler: the compiler
emits the IR and immediately desugars it in the JavaScript
subset, which is emitted as source code as before.

Some highlights of the IR compared to JS trees:
* It represents Scala.js classes independent of an encoding
  (so the variable `ScalaJS` and its fields are never in the IR)
* It is statically typed, with an additional `dyn` type.
  (note: I said it is *statically typed*; I did not say it was
  *typechecked*!)
Merge pull request #493 from sjrd/smart-optimizer-1st-review

New intermediate representation (IR)
Unify partest filter to reuse code when using files and CLI arguments
Fix #500: Avoid removal of duplicate percentage signs by Node.js
Fix #501: Never eliminate ClassData of hijacked classes
Fix #503: Never eliminate RuntimeLong.fromDouble
Fix #504: Fix typo in java.lang.Class (getSuperClass -> getSuperclass)
Fix #505: Implement StringBuilder(Buffer).setCharAt
Fix #508: Ignore irrelevant DCE warnings in partest
Fix #492: Classify last partests. Partests fully work with --fastOpt