refactor use of asm in js optimizer