Ah! I remember reading something about self-optimizing interpreters, which is pretty cool. I think it's related to what they call "adaptive interpreter".
The interpreter starts out with a generic/slow approach and as it gets more datatype info it uses more specialized and faster implementations.