The prohibition of tochen does not only apply when using a special grinding tool like a millstone or a mortar and pestle – it is even forbidden to use a knife to cut finely. Therefore, one may not cut vegetables into small pieces for a salad – this is a Torah prohibition of tochen. In the opinion of most Rishonim the only prohibition to cut vegetables finely is when they can not be eaten without cutting them – such as when cutting them before they are cooked. However, if one could eat these vegetables without cutting them then it is permitted to cut them finely.
Even in a case when it is generally prohibited to cut vegetables finely, such as when they are inedible without cutting them, it is still permitted to cut them finely if this is done right before the meal. This is because cutting them right before the meal is a normal act in food preparation, not a melacha. Indeed, one may eat vegetables on Shabbos even if they are finely chopped. Even when one is chopping vegetables finely just before the meal ideally one should chop them slightly less fine than normal.
Even though Chazal allowed chopping vegetables finely prior to consumption, it is forbidden to use a fork to mash an avocado or a banana, even if it is just before the meal. Nor may one subsequently spread these mashed fruits on bread. Some argue and permit this, as long as one does not use a tool specifically designed for grinding. On the other hand, if one uses a spoon or the handle of a knife to do this all opinions agree that is permitted, because to do so is to use a shinui(alteration).
One may mash fruits or vegetables which have already become mashed up due to their cooking process. For example, potatoes or zucchini become soft when boiled – if as a result of the boiling they are now very easy to mash, there is no prohibition to mash them.
The Torah only prohibits grinding things which grow from the ground, but Chazal added a prohibition to things which do not grow from the ground. However, in this rabbinic category the prohibition only stands if one uses a tool specifically designed for grinding, such as a grater. Therefore, meat, fish and cheese – which do not grow from the ground – may be cut finely with a knife, even if one intends to eat them some time later. On the other hand, it would be forbidden to use a grater to grate the cheese.
(Regarding the preparation of egg and onion, even though it is permitted to grind eggs up finely, even for later consumption, there is a separate prohibition of borer when one removes the peels of the eggs for later – it would only be permitted to peel them just prior to consumption. Further, there is a potential prohibition of losh (kneading) if one mixes the egg and onion with oil or mayonnaise and makes a fine mixture. Of course, it would also be prohibited to grind the onions, even with a knife, unless it was done just before the meal, and even then they would need to be cut up slightly larger than normal.)
Notes and Sources
 Shulcan Aruch 321:12
 The R’id, the Ritva, the Re’ah, the Ramban and the Ran. The Rambam’s opinion is similar to these.
 This heiter is similar to that found in borer, where again one is allowed to sort food (by hand and taking the ochel from the psoles) if it is done for immediate consumption. Rashba, Beis Yosef, Rema 321:12.
 Beis Yosef, Mishnah Berurah 321:45, since there are several opinions who do not allow cutting vegetables finely for immediate consumption.
 Chazon Ish Orach Chaim 57, Shemiras Shabbos 6:1. Shemiras Shabbos adds that if these fruits are so soft that if one would hold part of it that part would come away in the hand without pulling the rest of the fruit with it, it would be permitted to mash it – it is effectively already mashed.
 Yechave Daas 5:27. The Igros Moshe also allows it in Orach Chaim IV:74, although he writes that ideally one should be stringent like the Chazon Ish.
 Shemiras Shabbos 6:9, Chazon Ish Orach Chaim 58:9
 Shulchan Aruch 321:9-10