Deprecated CircularReferenceError in AS::JSON::Encoding

As discussed with @jeremy on campfire, this is considered programmer
error and protecting against these kind of errors is out of scope for
the JSON encoder. A StackError will be raised instead, which is
aliased as AS::JSON::Encoding::CircularReferenceError with a
deprecation warning for Rails 4.1.

Removing this responsibility allowed me to remove a lot of complexity
from the encoder while still passing all existing tests.

This reuses ideas and code from @sergiocampama's #11728.

Also, "fixes" #11460.