How to choose between paying down equity line of credit, mortgage, and long term investing?

Are there any useful heuristics in choosing how to prioritize between these three for best overall value long term?