fix JS compiler segfault errors for various platforms

Closes: #708331