Masturbating is something anyone going through puberty does, my advice would be to keep her busy. By keeping her busy her mind will be concentrating on doing that, but if she has a lot of free time and spends time by herself then thats when her mind tries to occupy itself by thinking of things that please the body. Try to introduce new hobbies to her for example music! it's entertaining and fun, time flies by when your doing something your interested in. If you don't help her masturbating will just become a habit.
It sounds like your daughter might be starting puberty early. 8 seems young, but I started when i was 6 and it was called precocious puberty.
now that I have two daughters 9 and 10, I've been reading up on puberty and body odour is the first sign!
Also, the bad mood swings...we can all attest to the emotional roller coaster puberty sends us on. And dont worry, all children investigate their bodies and will masturbate whether we know it or not, it's a fact of life. You should take her for a check-up, mention the body odour and mood swings, I'm sure you'll find out thats all it is.
Please, for her sake, do not make a big deal about the masturbating. If she's doing it in the privacy of her own room, and it's a stress relief, just leave it alone. You want her to have a healthy attitude towards her body and her sexuality. Yes, I said sexuality, we all are sexual beings. Educate and inform her about her body and how it works and why.If you start now, in age appropriate terms, answer her questions and dont judge her, you will build a strong and honest relationship with your daughter, where she will come to you to have her questions answered.