The calls on b are static - the compiler knows for sure at compilation time what the type of b will be at runtime (obviously a Bar) so it will directly use the addresses of the methods that will be invoked.
Virtual only matters when you make a call via pointer/reference as the call could have different targets at runtime. This would matter if, for example, you called function1 on a pointer and during runtime changed the actual type that the pointer pointed to.
Now the situation here, where you call function2 on f is tricky for two reasons: the function is never overridden, and you use a reference which cannot be reassigned. Therefore, a really smart compiler that sees all input files could conceivably figure out what the target of the call really will be with 100% confidence (since you're not going to add new classes to the already compiled code). However, AFAIK, the compilers does not have to do it so you would pay the cost.
Generally speaking, if you don't plan to override a function ever, don't make it virtual.