Faster dumping with and without Harmony

Replace an O(n^2) algorithm (indexOf + insert) * n with a much faster
algorithm, depending on what is supported by the JS engine.

I prefer the Set version as it is similar in spirit to the original
code and does not need to change the walked tree, but the flag setting
approach has the advantage that it works with current Node versions
without needing commandline flags.
Merge pull request #633 from joerixaop/master

Faster dumping with and without Harmony