Adds support for JS Map serialization.

As in the SVN revisions r15770 and r15773, but with the required changes for the different internal structure of iterator objects in ESR 31.