fix another stack overflow case on large inputs in js*