SERVER-12949 Restore intermediate in-memory reduces, which are used to
keep the memory occupied by map/reduce small and spill extra large results
to disk.

Also adds a JS unit test to ensure this behaviour doesn't change
accidentally.