Spectral Methods for Time-dependent Studies of Accretion Flows. II. Two-dimensional Hydrodynamic Disks with Self-Gravity