[core][js] gc engine: code rewriting