To test programmatically if the current page is the home page of the site on a Drupal 8 site, you can use the following code:
\Drupal::service('path.matcher')->isFrontPage()
The method will return TRUE if the current path is the home page, and FALSE otherwise.