[js] optimize DynamicAccess.set (see #3517)