Backport Aggressively inline methods when arguments are "likely" optimizable.

If at least one of the receiver and arguments to a method call
is "likely optimizable", then we force inlining of the method,
even if it is not inlineable.

An argument is likely optimizable if it is a LocalDef for a
tentative anon fun replacement, or for an inlined class instance
(i.e., a record var ref).

At the same time, we removed ad-hoc @inline's on methods, because
they were targeted at the use case now better covered by this
improvement.

Together, these changes perform less inlinings that serve no
purpose, and more inlinings that do bring improvements.

Backport: Adapt checksizes

(cherry picked from commit 490cc0bbe5ac8cbddfeb3bb0c9f798ed63d9b437)
Backport Add insert methods to java.lang StringBuilder and StringBuffer

(cherry picked from commit 28fc5cf03d1309a9e616bf81f68e2f2e2ff374b6)
Backport Add Cast() case in OptimizerCore.pretransformExpr().

This is necessary for a Cast(expr) not to force expr if the
result of the Cast is not used.

(cherry picked from commit 12a2509a67485d4db9c9db1c027ca268e43bfd1d)
Backport Fix js.ArrayOps.repr.

Its default implementation is to return
  this.asInstanceOf[Repr]
but we have to override it to return `array`.

(cherry picked from commit 5d17c1bfe9bc5bde855804f747eee9dfc4c5a869)
Backport Fix #1110: Correct toMatch(re: RegExp) in Jasmine typing

(cherry picked from commit 5cef5ee4a2d53df516b2386e5c719989db81ec0a)

Conflicts:

	jasmine-test-framework/src/main/scala/org/scalajs/jasmine/JasmineExpectation.scala
Backport Fix #1114: Verify contents of interop annotations

Backport: Only verifies @JSExport annotations unlike original commit,
since the PrepJSInterop phase does not have the facilities to easily
add the check for @JSName in 0.5.x.

(cherry picked from commit 842b0d39c416f1a074eae004717ae00870eaca2d)

Conflicts:

	compiler/src/main/scala/scala/scalajs/compiler/JSGlobalAddons.scala
	compiler/src/main/scala/scala/scalajs/compiler/PrepJSInterop.scala
	compiler/src/test/scala/scala/scalajs/compiler/test/JSInteropTest.scala
Backport Add a setter for js.Array.length.

Backport: Changed body of method from `native` to `???`
w.r.t. original commit.

(cherry picked from commit 2d4058a14ce01a74fde6dd4f5fcf4ee18e3310ab)
Backport Fix #1121: Desugar of a Match does not transformExpr its selector.

(cherry picked from commit 3494b99aae983fc7f2214775e1d22ea7474c35a9)
Backport Fix #1123: IR checker should allow Apply/Select on {Null,Nothing}Type.

(cherry picked from commit 4cf00838432942fa4e4f65138c9b1cbe00e88985)
Backport Add case IsInstanceOf(inner, _) in inlineable methods.

This mostly gets rid of the canEqual() methods that are part of
the equals() methods generated for case classes.

(cherry picked from commit 8c77c36d76e65137114f57eece9fd565ca2e4724)
Backport Fix #1132: RuntimeLong.intValue() not preserved by numberIntValue(x: jl.Long).

(cherry picked from commit a0e52d6a9da955846a73fc5357e970e300036fa0)
Backport Optimize BoxesRunTime with the numeric semantics in mind.

(cherry picked from commit db49957d496e40ac2cdf0bfa168a21bf0fbcd9d1)

Conflicts:

	ci/checksizes.sh
Backport Better implementations of unbox helpers.

Use primitive operators that convey more meaning to the VM
as the expected result type.

(cherry picked from commit a8f76d706cf27ef7c153b889702b4db2a15a7a66)
Backport More constant folding.

(cherry picked from commit b8cdbcaca569f1e14e1b05e1e9494fd97412473f)
Backport Fix #1130: Add RuntimeLong.hashCode().

It implements the spec of java.lang.Long.hashCode(), which is
*not* the same as x.## for a Long x.

(cherry picked from commit ce1d5d62d3073c0312f67ef2b884e7cd2d0973cc)

Conflicts:

	ci/checksizes.sh
Backport Fix #1133: AtomicReference should compare with reference equality.

Fixed a few signatures in Atomic classes in the process.

(cherry picked from commit b0068c7a31e2007064d39bad9b07cc54b1dbf406)

Conflicts:

	test-suite/src/test/scala/scala/scalajs/test/javalib/AtomicTest.scala
Backport Handle the parameters of a tail-rec LabelDef in a more principled way.

In particular, we do not patch them as mutable by default, only to
re-patch them as immutable if they are not mutated. Instead, we keep
their original isMutable flag as the default, and we patch immutable
locals as mutable if they are mutated.

(cherry picked from commit 8886e2d45fbc494c0d06c131ba389777a2becc62)
Backport Fix #1148: generalize our tail-call transform to more LabelDefs.

The translation of the LabelDef and Apply of tail-recursive calls
is generalized to support arbitrary LabelDefs, as long as all
label-applies to it are performed from within its body.

In addition to being a nice generalization, this fixes #1148,
because label-defs for while loops transformed in weird ways by
scoverage now fall under this generalized transformation.

(cherry picked from commit c13350fcc589ba1056a425d009e250321442e1c5)
Backport PreTransRecordTrees are likely optimizable.

(cherry picked from commit c2ba014735dc36c9f0fe1ee7782a9c55bc67a460)
Backport Fix #1153: Inlineable classes break with dependent fields.

(cherry picked from commit 95c4a60cb6522be353425d98754d5e1af229b728)