Not possible for any compiled language. Now if you're building a clock or whatever, counting instructions can be a difficult way to write code more than a few lines. You can't add or remove lines without affecting the timing, and loops of variable length and/or conditional branching won't use constant timing.
You can time simple bus protocols (like serial comm, i2c, SPI) by number of instructions. But for many applications you want to set up a timer and use interrupts.