JS AST rewriter for tail call elimination