You seem to be looking for an MCU that has a power failover built in as a peripheral of sorts. There may be a rare MCU available that has this, but from my memory there aren't many in a general way. For instance, I know that Atmel CortexM3s have the ability to run their internal RTC off of battery power. However, that is about as much that you can do.
Instead of looking for a single chip solution, it may be easier to look at designing a low power system out of a few different pieces, which would be easier to do.
For a microcontroller, pick something that's specifically designed to be low power. Having fine grained power control on the peripherals and the availability of low power sleep states is a plus. I've seen TI's MSP430 line qualify well in those parameters. Olin, in his comment, suggests the PIC16F1xxx series. Neither is an 8051 based solution, though. There may well be 8051 based controllers which qualify. I don't know how amenable the 8051 core is to low power states, though to be fair a lot of these other cores also do most of their sleeping by slowing down system clocks and turning off peripherals, which doesn't really need a specialized core.
In order to switchover power, you could use an IC designed for doing that, depending on the sort of battery and topology you have in mind. For a non-rechargeable coin battery sort of thing, you could look at one of the many RTC and Watchdog and Reset controller ICs, a large number of which include some way to switch over to a battery. For a rechargeable battery, assuming its voltage to high enough to be close to the supply voltage you intend to use with mains power, you're better off using a battery tied bus topology. This means that the battery is always connected to the circuit. Imagine the battery and mcu being connected in parallel. When there is mains power, the battery is charged also (using appropriate charging circuits depending on the chemistry of the battery) and when its absent, the current through the battery reverses and powers the circuit.