Backport Optimize varargs by using js.WrappedArray instead of scm.WrappedArray.

Backport: Adapt checksizes

(cherry picked from commit af3653d43cfcf5f63fcc566eaa09d4eedd50814f)

Conflicts:

	ci/checksizes.sh
Backport Fix #1157: Negative number literals should be printed with parentheses.

Backport: No change to javascript printer, since it does not exist in
0.5.x.

(cherry picked from commit acf05682c90a3d543054316eced890698031adef)

Conflicts:

	tools/shared/src/main/scala/scala/scalajs/tools/javascript/Printers.scala
Backport Fix #1155: Int unary -.

Backport: Remove all `js.` prefixes.

(cherry picked from commit 8736e6ba6c9294fa0d87c0e8674443a7ef9cebe1)

Conflicts:

	ir/src/main/scala/scala/scalajs/ir/JSDesugaring.scala
Backport Constant-fold Matches.

(cherry picked from commit b60914286d05b0f01307637c64c90c9bca5721c4)

Conflicts:

	tools/shared/src/main/scala/scala/scalajs/tools/optimizer/OptimizerCore.scala
Backport Fix {ir,js}.Block.toString().

Backport: There is no js.Block in 0.5.x.

(cherry picked from commit 2100f8d5ff08232d1d0d8797aae3a790b276a0e7)

Conflicts:

	tools/shared/src/main/scala/scala/scalajs/tools/javascript/Trees.scala
Backport More constant folding with operands disappearing.

Their side-effects must be preserved.

(cherry picked from commit 4bf3c58462fea7d171dd5402f2331e6aef7e7efd)

Conflicts:

	tools/shared/src/main/scala/scala/scalajs/tools/optimizer/OptimizerCore.scala
Backport Fix #1162: Implement java.lang.Arrays.equals

(cherry picked from commit cb3712895d0ba4e55c1e6a806581e8024199cc0a)
Backport Fix #1154: Add @JSExportDescendentClasses (exports subclass ctors)

Backport: Had to fix stub project specifically for 0.5.x. Also had to
add method `decodedFullName` originally introduced in
698d69814eb250656f076eda494397e649bb0f78.

(cherry picked from commit b128e480ec8adc6bf1b095de37da725aeebe1c62)

Conflicts:

	stubs/src/main/scala/scala/scalajs/js/annotation/ExportAnnotations.scala
Backport js.Dynamic.newInstance returns Object with Dynamic.

Instead of just Dynamic.

(cherry picked from commit dad0941befaf0663cdcfdf520a9ba1eed19d551e)
Backport Mark js.WrappedDict as inlineable, and override its keys method.

(cherry picked from commit cee83a8e13d5f99d61370335d9a5f0d8556eea6d)
Backport Improve the implementation of Long.to{Binary,Hex,Octal}String.

It does not use Formatter anymore, and does not require to drop
the leading 0's after the fact.

(cherry picked from commit 9e43ed89ea3c33e4ecdb9753879b25605a42ebd3)

Conflicts:

	javalanglib/src/main/scala/java/lang/Long.scala
Backport Fix unit test for DataInputStream.readLong().

It's not good to give Longs to Jasmine for comparisons, because
they are converted to Doubles.

(cherry picked from commit b692d0be4bcbbb9704e11a84c0f2393f6684dc9f)
Backport Fix #1169: Make IR printer print cases of match tree nicely

It now looks like this:

    match (x1) {
      case 1 | 2 | 3:
        mod:s_Predef$.println__O__V("low");
      case 4:
        mod:s_Predef$.println__O__V("four");
      default:
        mod:s_Predef$.println__O__V("other");
    }

(cherry picked from commit 0d6504b872d191e600ebf638e5fad0fae6db23ce)

Conflicts:

	ir/src/main/scala/scala/scalajs/ir/Printers.scala
Backport Avoid crashing for classpath elements that do not exists on the file system.

Added DummyVersion constant value, exists() to detect file that does not exists and getDummyVersion to provide a string version for a dummy file.
Implemented DummyVersion and isDummy in physical and node file systems.
Added simple ClasspathElementsTraverser tests using the PhysicalFileSystem.

(cherry picked from commit 76df98df86465cf7d1663226b3d6d1c20c33d006)

Conflicts:

	tools/shared/src/main/scala/scala/scalajs/tools/classpath/builder/ClasspathElementsTraverser.scala
Backport Fix a few typos in scala.scalajs.js package object docs

(cherry picked from commit 6689fef40aa84062bcb37da652cca88f07e04404)
Backport Fix #1191: Reset caseaccessor flag on export forwarders

(cherry picked from commit 2310223109bf2c81c255c82b32b94ac435c9acb2)
Backport Fix #1171: Split: Sometimes remove leading empty match

The conditions were determined experimentally since the JavaDoc is
note precise enough.

(cherry picked from commit cba58ff2c58ce916ebd4df942612f8538ea6bb70)
Backport Fix #364 for good: remove magical Rhino top-level package objects.

Instead of hard-coding a list of known problematic top-level
package names, we detect what needs to be removed by listing
the properties in the Packages object.

Backport: In 0.5.x, the LiveConnect classes were removed before
loading env.js (unlike 0.6.x). The backport leaves these steps in the
order they were in 0.5.x.

(cherry picked from commit 856029644aa01c16b2df0c7e696615e956b55eec)

Conflicts:

	sbt-plugin/src/main/scala/scala/scalajs/sbtplugin/env/rhino/RhinoJSEnv.scala
Backport Add replace and deleteCharAt methods to StringBuilder and StringBuffer

(cherry picked from commit 20973bc986ccaf78082e00dd0fd7380a9c630cac)
Backport Use a Traverser in JSASTTest instead of a Transformer.

(cherry picked from commit 4752db29e17d5960b18b4aab73c34f83b01a486d)