[js] compiler: better stack allocation function
[js] compiler: better coding of tstr_dup() call