Prevent leak of StackContexts in repeated gen.engine functions.

Internally, StackContexts now return a deactivation callback,
which can be used to prevent that StackContext from propagating
further.  This is used in gen.engine because the decorator doesn't know
which arguments are callbacks that need to be wrapped outside of its
ExceptionStackContext.  This is deliberately undocumented for now.

Closes #507.

Conflicts:

	tornado/gen.py
	tornado/stack_context.py
Improve isolation of stack contexts.

Previously, a chain of callbacks started without any contexts could
accidentally pick up other contexts based on where the callbacks
were run.  This was due to a mistaken optimization in the no-context
case; now the behavior is the same whether the initial context was empty
or not.

Conflicts:

	tornado/stack_context.py
	tornado/test/stack_context_test.py
Simplify StackContext logic and behavior.

Previously, there was an optimization to avoid recreating contexts
that were already on the stack.  This optimization rarely mattered
(especially given the movement to run all callbacks through
IOLoop.add_callback), and sometimes caused surprising behavior as
other exception handlers could be inserted between stack contexts that
expected to be adjacent to each other or to the wrapped function.  Now
each wrapped function recreates its full stack of contexts, even if
some of those contexts were already on the stack.

This change allows a use of NullContext in testing.py to be
removed.

Conflicts:

	tornado/testing.py
Fix a memory leak in stack_context.

The old_contexts reference in StackContexts could maintain a chain of
old irrelevant contexts, so clear it once it's no longer needed.
This was mainly a problem in gen.engine, where additional contexts
would accumulate in memory (but not on the stack) for each asynchronous
operation.

Also clear the deactivate_stack_context in gen.Runner to allow
the StackContext to be garbage-collected sooner.
Revert "More IOLoop scheduler changes"

This reverts commit b8dba60b0cd2d8115667d951eb6d5f123f5147d1.
Revert "Set default priority in iostream too"

This reverts commit 655eade078e9308ebefc550895306b95ff451be1.
Revert "Default to priority 0"

This reverts commit 12c228dd965adaa495ef61a1929b8d85dcb974c5.
Revert "Optimized IOLoop for async mongo"

This reverts commit e3f5658bc2a29ed1c20c6c8f00996e67ae22c01b.