From what I remember it varies between oxygen and battery. Here's an example from STS-127 where the answer was oxygen.
Both spacesuits are working well today. Mission Control projects the
EVA-limiting consumable is oxygen that should last a total duration of
seven hours and 30 minutes. The spacewalk just passed the
four-and-a-half hour mark. If the crew needs more time to finish the
battery task, they could return to the airlock for a quick recharge of
the suits' oxygen supply.
ISTR that battery life limited some EVAs, but perhaps battery upgrades have made that obsolete.
For your case of a stranded EVA crewmember, it might depend on what they did. If they just lay quietly, battery would probably be the limit. If they thrashed about in panic, probably O2 or cooling water.