Rewrite defineShape() in asmjs