diff --git a/core/modules/comment/comment.module b/core/modules/comment/comment.module
index b09bfa8..a9e24f3 100644
--- a/core/modules/comment/comment.module
+++ b/core/modules/comment/comment.module
@@ -1061,9 +1061,12 @@ function comment_user_predelete($account) {
 /**
  * Loads comment entities from the database.
  *
+<<<<<<< HEAD
  * @deprecated in Drupal 8.x, will be removed before Drupal 9.0.
  *   Use \Drupal\comment\Entity\Comment::loadMultiple().
  *
+=======
+>>>>>>> Initial.
  * @param array $cids
  *   (optional) An array of entity IDs. If omitted, all entities are loaded.
  * @param bool $reset
@@ -1072,6 +1075,9 @@ function comment_user_predelete($account) {
  * @return array
  *   An array of comment objects, indexed by comment ID.
  *
+ * @deprecated in Drupal 8.x-dev, will be removed before Drupal 8.0.
+ *   Use entity_load_multiple('comment', $cids).
+ *
  * @see entity_load()
  * @see \Drupal\Core\Entity\Query\QueryInterface
  */
@@ -1172,35 +1178,17 @@ function comment_num_new($entity_id, $entity_type, $field_name = NULL, $timestam
  *   Field definition of the comments.
  *
  * @return int
- *   The display ordinal for the comment.
+ *   The display ordinal for the comment, or 0 if the comment is not found.
  *
- * @see comment_get_display_page()
+ * @deprecated Deprecated since Drupal 8.x-dev, to be removed in Drupal 8.0.
+ *   Use \Drupal\comment\CommentStorageInterface::getDisplayOrdinal().
  */
 function comment_get_display_ordinal($cid, FieldDefinitionInterface $field_definition) {
-  // Count how many comments (c1) are before $cid (c2) in display order. This is
-  // the 0-based display ordinal.
-  $query = db_select('comment', 'c1');
-  $query->innerJoin('comment', 'c2', 'c2.entity_id = c1.entity_id AND c2.entity_type = c1.entity_type AND c2.field_id = c1.field_id');
-  $query->addExpression('COUNT(*)', 'count');
-  $query->condition('c2.cid', $cid);
-  if (!user_access('administer comments')) {
-    $query->condition('c1.status', CommentInterface::PUBLISHED);
-  }
-
-  if ($field_definition->getSetting('default_mode') == COMMENT_MODE_FLAT) {
-    // For flat comments, cid is used for ordering comments due to
-    // unpredictable behavior with timestamp, so we make the same assumption
-    // here.
-    $query->condition('c1.cid', $cid, '<');
-  }
-  else {
-    // For threaded comments, the c.thread column is used for ordering. We can
-    // use the sorting code for comparison, but must remove the trailing slash.
-    // See CommentViewBuilder.
-    $query->where('SUBSTRING(c1.thread, 1, (LENGTH(c1.thread) -1)) < SUBSTRING(c2.thread, 1, (LENGTH(c2.thread) -1))');
-  }
-
-  return $query->execute()->fetchField();
+  $comment = \Drupal::entityManager()->getStorage('comment')->load($cid);
+  return $comment ?
+    \Drupal::entityManager()->getStorage('comment')
+      ->getDisplayOrdinal($comment, $field_definition->getSetting('default_mode'))
+    : 0;
 }
 
 /**
@@ -1215,12 +1203,17 @@ function comment_get_display_ordinal($cid, FieldDefinitionInterface $field_defin
  *   Field definition of the comments.
  *
  * @return int
- *   The page number.
+ *   The page number, or 0 if the comment is not found.
+ *
+ * @deprecated Deprecated since Drupal 8.x-dev, to be removed in Drupal 8.0.
+ *   Use \Drupal\comment\CommentStorageInterface::getDisplayOrdinal().
  */
 function comment_get_display_page($cid, FieldDefinitionInterface $field_definition) {
-  $ordinal = comment_get_display_ordinal($cid, $field_definition);
-  $comments_per_page = $field_definition->getSetting('per_page');
-  return floor($ordinal / $comments_per_page);
+  $comment = \Drupal::entityManager()->getStorage('comment')->load($cid);
+  return $comment ?
+    \Drupal::entityManager()->getStorage('comment')
+      ->getDisplayOrdinal($comment, $field_definition->getSetting('default_mode'), $field_definition->getSetting('per_page'))
+    : 0;
 }
 
 /**
diff --git a/core/modules/comment/src/CommentForm.php b/core/modules/comment/src/CommentForm.php
index 01af9bb..a9f7b4b 100644
--- a/core/modules/comment/src/CommentForm.php
+++ b/core/modules/comment/src/CommentForm.php
@@ -393,7 +393,7 @@ public function save(array $form, array &$form_state) {
       $query = array();
       // Find the current display page for this comment.
       $field_definition = $this->entityManager->getFieldDefinitions($entity->getEntityTypeId(), $entity->bundle())[$field_name];
-      $page = comment_get_display_page($comment->id(), $field_definition);
+      $page = $this->entityManager->getStorage('comment')->getDisplayOrdinal($comment, $field_definition->getSetting('default_mode'), $field_definition->getSetting('per_page'));
       if ($page > 0) {
         $query['page'] = $page;
       }
diff --git a/core/modules/comment/src/CommentStorage.php b/core/modules/comment/src/CommentStorage.php
index 5526d2b..cad6942 100644
--- a/core/modules/comment/src/CommentStorage.php
+++ b/core/modules/comment/src/CommentStorage.php
@@ -119,6 +119,38 @@ public function getMaxThreadPerThread(EntityInterface $comment) {
   /**
    * {@inheritdoc}
    */
+  public function getDisplayOrdinal(CommentInterface $comment, $comment_mode, $divisor = 1) {
+    // Count how many comments (c1) are before $comment (c2) in display order. This
+    // is the 0-based display ordinal.
+    $query = $this->database->select('comment', 'c1');
+    $query->innerJoin('comment', 'c2', 'c2.entity_id = c1.entity_id AND c2.entity_type = c1.entity_type AND c2.field_id = c1.field_id');
+    $query->addExpression('COUNT(*)', 'count');
+    $query->condition('c2.cid', $comment->id());
+    if (!user_access('administer comments')) {
+      $query->condition('c1.status', CommentInterface::PUBLISHED);
+    }
+
+    if ($comment_mode == COMMENT_MODE_FLAT) {
+      // For rendering flat comments, cid is used for ordering comments due to
+      // unpredictable behavior with timestamp, so we make the same assumption
+      // here.
+      $query->condition('c1.cid', $comment->id(), '<');
+    }
+    else {
+      // For threaded comments, the c.thread column is used for ordering. We can
+      // use the sorting code for comparison, but must remove the trailing
+      // slash.
+      $query->where('SUBSTRING(c1.thread, 1, (LENGTH(c1.thread) - 1)) < SUBSTRING(c2.thread, 1, (LENGTH(c2.thread) - 1))');
+    }
+
+    $ordinal = $query->execute()->fetchField();
+
+    return ($divisor > 1) ? floor($ordinal / $divisor) : $ordinal;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
   public function getChildCids(array $comments) {
     return $this->database->select('comment', 'c')
       ->fields('c', array('cid'))
diff --git a/core/modules/comment/src/CommentStorageInterface.php b/core/modules/comment/src/CommentStorageInterface.php
index c1587a5..cc1579d 100644
--- a/core/modules/comment/src/CommentStorageInterface.php
+++ b/core/modules/comment/src/CommentStorageInterface.php
@@ -39,6 +39,24 @@ public function getMaxThread(EntityInterface $comment);
   public function getMaxThreadPerThread(EntityInterface $comment);
 
   /**
+   * Gets the display ordinal or page number for a comment.
+   *
+   * @param \Drupal\comment\CommentInterface $comment
+   *   The comment to use as a reference point.
+   * @param int $comment_mode
+   *   Comment mode (COMMENT_MODE_FLAT or COMMENT_MODE_THREADED).
+   * @param int $divisor
+   *   Defaults to 1, which returns the display ordinal for a comment. If the
+   *   number of comments per page is provided, the returned value will be the
+   *   page number. (The return value will be divided by $divisor.)
+   *
+   * @return int
+   *   The display ordinal or page number for the comment. It is 0-based, so
+   *   will represent the number of items before the given comment/page.
+   */
+  public function getDisplayOrdinal(CommentInterface $comment, $comment_mode, $divisor = 1);
+
+  /**
    * Gets the comment ids of the passed comment entities' children.
    *
    * @param array $comments
diff --git a/core/modules/comment/src/Controller/CommentController.php b/core/modules/comment/src/Controller/CommentController.php
index 1e73008..497ea21 100644
--- a/core/modules/comment/src/Controller/CommentController.php
+++ b/core/modules/comment/src/Controller/CommentController.php
@@ -114,7 +114,7 @@ public function commentPermalink(Request $request, CommentInterface $comment) {
       $field_definition = $this->entityManager()->getFieldDefinitions($entity->getEntityTypeId(), $entity->bundle())[$comment->getFieldName()];
 
       // Find the current display page for this comment.
-      $page = comment_get_display_page($comment->id(), $field_definition);
+      $page = $this->entityManager()->getStorage('comment')->getDisplayOrdinal($comment, $field_definition->getSetting('default_mode'), $field_definition->getSetting('per_page'));
       // @todo: Cleaner sub request handling.
       $redirect_request = Request::create($entity->getSystemPath(), 'GET', $request->query->all(), $request->cookies->all(), array(), $request->server->all());
       $redirect_request->query->set('page', $page);
