Use bitflag based has_flag() in a few places that need the speed.

A few places were calling has_flag() with a string argument and bubbled to the top of the profiling list, so switch them over to the bitflag version and it seems to make a significant difference.