Optimize tail calls to avoid findMember calls

Cache the member symbols for `Boolean.{||, &&}` per-run, rather
than look them up repeatedly.

Based on profiling the tail calls phase in the program below, which
was distilled by @rmacleod2 from the code generated by macros in
https://github.com/paytronix/utils-open/tree/release/2014/ernststavrosgrouper

Wall clock time went from 12s to 6.5s.

```scala
object Test {
    def a(): Option[String] = Some("a")

    def main(args: Array[String]) {
        a() match {
            case Some(b1) =>
        a() match {
            case Some(b2) =>
        a() match {
            case Some(b3) =>
        a() match {
            case Some(b4) =>
        a() match {
            case Some(b5) =>
        a() match {
            case Some(b6) =>
        a() match {
            case Some(b7) =>
        a() match {
            case Some(b8) =>
        a() match {
            case Some(b9) =>
        a() match {
            case Some(b10) =>
        a() match {
            case Some(b11) =>
        a() match {
            case Some(b12) =>
        a() match {
            case Some(b13) =>
        a() match {
            case Some(b14) =>
        a() match {
            case Some(b15) =>
        a() match {
            case Some(b16) =>
        a() match {
            case Some(b17) =>
        a() match {
            case Some(b18) =>
        a() match {
            case Some(b19) =>
        a() match {
            case Some(b20) =>
                println("yay")
            case None => None
        }
            case None => None
        }
            case None => None
        }
            case None => None
        }
            case None => None
        }
            case None => None
        }
            case None => None
        }
            case None => None
        }
            case None => None
        }
            case None => None
        }
            case None => None
        }
            case None => None
        }
            case None => None
        }
            case None => None
        }
            case None => None
        }
            case None => None
        }
            case None => None
        }
            case None => None
        }
            case None => None
        }
            case None => None
        }
    }
}
```
Avoid needlessly deep chains of ClonedTailContext

I believe ClonedTailContext was added to avoid the need to
mutate the Boolean `ctx.tailPos`. All other calls are forwarded
to a delegate context.

This commit tries to find a delegate context with the right
value of `tailPos` to reuse that, rather than creating a
wrapper each time we need to flip that bit.
Wider use of mapConserve and the like in TailCalls

Save the Trees!

When a subtransform is an identity, we must
strive to return the identical tree to enable the lazy part of
LazyTreeCopier. If we get this wrong in a leaf, all parents are
wastefully copied.
SI-8893 Restore linear perf in TailCalls with nested matches

Compilation perfomance of the enclosed test regressed when the
new pattern matcher was introduced, specifically when the tail
call elimination phase was made aware of its tree shapes in cd3d34203.

The code added in that commit detects an application to a tail label
in order to treat recursive calls in the argument as in tail position.

If the transform of that argument makes no change, it falls
back to `rewriteApply`, which transforms the argument again
(although this time on a non-tail-position context.)

This commit avoids the second transform by introducing a flag
to `rewriteApply` to mark the arguments are pre-transformed.

I don't yet see how that fixes the exponential performance, as
on the surface it seems like a constant factor improvement.
But the numbers don't lie, and we can now compile the test
case in seconds, rather than before when it was running for
> 10 minutes.

This test case was based on a code pattern generated by the Avro
serializer macro in:

  https://github.com/paytronix/utils-open/tree/release/2014/ernststavrosgrouper

The exponential performance in that context is visualed here:

  https://twitter.com/dridus/status/519544110173007872

Thanks for @rmacleod2 for minimizing the problem.
Avoid wasteful array creation in backend

The iteration is only needed to side effect on `instructionList`
and `code.touched`. This commit uses an iterator and `foreach`,
rather than creating throwaway Arrays.

    % time (for f in {1..200}; do echo test/files/pos/t8893.scala; done | qscalac -Xresident)

    Before: 30s
    After : 21s
SI-8910 BitSet sometimes uses exponential memory.

Because of an off-by-one error in scala.collection.mutable.BitSet, where a
function (ensureCapacity) is passed a list length instead of an index, when
^=, &=, |=, or &~= are passed BitSets with the same internal capacity as the
set the method is being invoked on, the size of the first BitSet is needlessly
doubled.

This patch simply changes the ensureCapacity calls to pass the last index of
the list, instead of the raw length. In addition, add documentation to
ensureCapacity to try and stop something similar from happening in the future.
fix typo. s/represenation/representation
SI-4950 Add tests, looks like it has been fixed earlier
SI-8875 showCode should print all class constructor modifiers.

showCode used to print nothing when the only modifier was a change in
visibility scope (i.e. no flags but privateWithin is set).
Make global-showdef a DirectTest

The test test/files/run/global-showdef.scala was outputting
to the cwd instead of the test output dir.

Good behavior is now inherited from DirectTest.

Test frameworks, of any ilk or capability, rock.
Reduce compiles for global-showdef test

You can only show one class or object at a time,
but we can show one of each to reduce the compilations
for this test.

It seems the original issue happened because the test
started to create class files after SI-8217.

So, also stop compile after typer, because why stress the kitteh.
SI-8893 Test case to show that tailrec continues to work

As suggested during code review, this test checks that
the tailcalls phase recurses appropriately below a method
that doesn and does not itself tail call. The test case is
based on the pattern of code that to trigger super-linear
performance in this transform.
SI-8893 Test tailcall transform for mix of tail/non-tail recursion

Another excellent test suggestion by Dear Reviewer.

After tail calls, the transform results in:

```
def tick(i: Int): Unit = {
      <synthetic> val _$this: Test.type = Test.this;
      _tick(_$this: Test.type, i: Int){
        if (i.==(0))
  ()
else
  if (i.==(42))
    {
      Test.this.tick(0);
      _tick(Test.this, i.-(1).asInstanceOf[Int]())
    }
  else
    _tick(Test.this, i.-(1).asInstanceOf[Int]()).asInstanceOf[Unit]()
      }
    };
```

We test this by mostly exercising the tail-recursive code path with
a level of recursion that would overflow the stack if we weren't
using jumps.
IntelliJ IDEA files for version 14

The latest version of the Scala plugin for IntelliJ IDEA introduces
a new project structure

http://blog.jetbrains.com/scala/2014/10/30/scala-plugin-update-for-intellij-idea-14-rc-is-out/

Due to a bug (https://youtrack.jetbrains.com/issue/SCL-7753), you
currently need to install the latest nightly build from here:
http://confluence.jetbrains.com/display/SCA/Scala+Plugin+Nightly+Builds+for+Cassiopeia

The new format doesn't allow scala compiler options per-module, so
the `-sourcepath src/libarary` is used for all modules.
Merge pull request #4072 from soc/SI-4950

SI-4950 Add tests, looks like it has been fixed earlier
Merge pull request #4064 from xuwei-k/typo-representation

fix typo. s/represenation/representation
Merge pull request #4063 from som-snytt/issue/direct-showdef-test

Make global-showdef a DirectTest
Merge pull request #4045 from gourlaysama/wip/t8875-show-code

SI-8875 showCode should print all class constructor modifiers.
Merge pull request #4087 from lrytz/intellij

IntelliJ IDEA files for version 14
Merge pull request #4052 from Lymia/issue/8910

SI-8910 BitSet sometimes uses exponential memory.