The quirks are called at the appropriate places, and can be inlined using LTO. The same places would need to hash the current context and check if it's in the hash map (is it one global hash map, or a specialized one for each quirk, with an optimised hashing function?). And on a match, you need to do the full check anyway, due to likely collisions.
The conditionals in the full check seem to use symbolised strings where possible, so they're quite fast. Probably faster than producing a suitable hash.