For reasons uknown, I haven't really dealt with defragging my drives in ...many years. Anyway, I just decided to run it for one of my external drives. I got this window, part of it I am showing. I was surprised to see it says it runs automatically on my C and D drives, both of which are ssds. I am pretty sure I never enabled that. Does Windows 8.1 actually defrag the SSDs? Or does it perform some other type of optimization?
I think that it performs trim and maybe something else SSD specific and not actual defragmentation. At least I believe that I've read that in some discussion. And if memory serves me well, if you try to run defrag on an SSD manually, it should finish almost immediately (much faster than it could defragment a drive, SSD or not).
It detects it as solidstate, even windows 7 since SP1... should implement a Solid state detection provided the performance metric is run within it at least once after an SSD is installed or if the ssd was installed and windows was installed to it clean. It'll perform general trim commands as IvanV stated, and with newer versions of windows, there are additional garbage collection codes that can be ran if the drive supports it.