There are also other compilers from C++ to Javascript, Mandreel
and Cheerp.
Cheerp claims to support the builtin Javascript garbage collector:
«Dynamic memory management. C++ objects are translated directly
to JS objects, without the proxy of an emulated, flat memory
space. Allow your applications to exploit the JavaScript VM
garbage collector and co-exist with fair, on-demand memory
allocation.»
http://www.leaningtech.com/cheerp/blog/
So if Cheerp is ready for production (I don't know if it is), it
might be a better fit for D.