If you're "mashing" up a hill, you're probably swinging the bike from side to side. If timed just wrong, the chain will swing to the side of the chainring just as the next tooth is moving into contact. Once one tooth is outside the chain, the rest will follow. This is probably exacerbated by the frame flexing. Try to get the chain a little tighter, and make sure your chainline is ok. The further out of line the chainring is, the more likely it is to happen.