We exploit recently developed topology-optimization techniques to design complex, wavelength-scale resonators for enhancing various nonlinear χ(2) and χ(3) frequency conversion processes. In particular, we demonstrate aperiodic, multi-track ring resonators and two-dimensional slab microcavities exhibiting long lifetimes Q≳104, small modal volumes V≳(λ/2n)3<...