8. Given the function
$$
f(x)=\mathrm{e}^{x}(x+a)(a \in \mathbf{R}) \text {. }
$$

Then the number of zeros of the function $g(x)=f(x-a)-x^{2}$ is $\qquad$ .
8. When $a>1$, $g(x)$ has 3 zeros.
Notice,
$$
\begin{array}{l}
g(x)=f(x-a)-x^{2}=x \mathrm{e}^{x-a}-x^{2} \\
=x\left(\mathrm{e}^{x-a}-x\right) .
\end{array}
$$

From $g(x)=0$, we get
$x=0$ or $\mathrm{e}^{x-a}-x=0$.
Let $h(x)=\mathrm{e}^{x-a}-x$.
Also, $h(0)=\mathrm{e}^{-a} \neq 0$, which means $x=0$ is not a zero of $h(x)$, so we only need to discuss the number of zeros of the function $h(x)$.
By $h^{\prime}(x)=\mathrm{e}^{x-a}-1$, we know
when $x \in(-\infty, a)$, $h^{\prime}(x)<0$, $h(x)$ is monotonically decreasing;
when $x \in(a, +\infty)$, $h^{\prime}(x)>0$, $h(x)$ is monotonically increasing.
Then, when $x=a$, $h(x)$ reaches its minimum value
$$
h(a)=1-a \text{. }
$$

Thus, when $h(a)>0$, i.e., $a<1$, by
$$
h(0)=\mathrm{e}^{-a}>0,
$$

we know $h(x)$ has exactly 1 zero in the interval $(-\infty, a)$.
Let $x=2a$, then $h(2a)=\mathrm{e}^{a}-2a$.
Let $\varphi(a)=h(2a)=\mathrm{e}^{a}-2a$.
Then $\varphi^{\prime}(a)=\mathrm{e}^{a}-2>0$ holds true in the interval $(1,+\infty)$. Therefore, $\varphi(a)$ is monotonically increasing in the interval $(1,+\infty)$.
Thus, for any $a \in(1,+\infty)$, we have $\varphi(a)>\varphi(1)=\mathrm{e}-2>0$.
Hence, $h(2a)=\varphi(a)=\mathrm{e}^{a}-2a>0$.
Therefore, $h(x)$ has exactly 1 zero in the interval $(a,+\infty)$.
In conclusion, when $a>1$, $h(x)$ has 2 zeros.
Overall, when $a>1$, $g(x)$ has 3 zeros.