factorized non-specific parts out of the asm.js plugin, for later re-use