private void splay(Node toTop) {
    assert toTop != null;

    if (toTop == sentinel) {
      return;
    }

    while (toTop.parent() != sentinel) {
      Node parent      = toTop.parent();
      Node grandparent = parent.parent();

      if (grandparent == sentinel) {
        rotateUp(toTop);
      } else {
        if (grandparent.left()  == parent && parent.left()  == toTop
              ||
            grandparent.right() == parent && parent.right() == toTop) {
          rotateUp(parent);
          rotateUp(toTop);
        } else {
          rotateUp(toTop);
          rotateUp(toTop);
        }
      }
    }
  }