Compile for Emscripten in asm.js mode

This patch resolves previously undefined symbols such that it can be compiled to asm.js code, resulting in a huge speedup of hot code paths when running on a Firefox Nightly build (should be in release versions in June). Also adds libwebp and libjpeg as well.