Nonlinear optics of two-dimensional heterostructures