On the regularity of the solution of the Dirichlet problem for Hamilton-Jacobi equations