In this paper, we propose a general correspondence which associates a non-perturbative quantum-mechanical operator to a toric Calabi-Yau manifold, and we conjecture an explicit formula for its spectral determinant in terms of an M-theoretic version of the topological string free energy. As a consequence, we derive an exact quantization condition for the operator spectrum, in terms of the vanishing of a generalized theta function.