private Object tryConvertToHash(
      VirtualFrame frame, final int argumentCount, final Object lastArgument) {
    if (respondsToToHashProfile.profile(respondToToHash(frame, lastArgument))) {
      final Object converted = callToHash(frame, lastArgument);

      if (convertedIsHashProfile.profile(RubyGuards.isRubyHash(converted))) {
        RubyArguments.setArgument(frame, argumentCount - 1, converted);
        return converted;
      }
    }

    return null;
  }