The Minecraft Wiki says carpet doesn't prevent mob spawning. But does it affect mob spawning on blocks mobs normally don't spawn on? If I put carpet on glass or slabs, can mobs spawn there?
Carpet both does not prevent and does not facilitate mob spawning, but it does help in a way.
Carpet is an invisible block, so, in terms of algorithm, mobs do not spawn on carpets, but ranter in. Basically, you can replace all carpets with signs for the same, but more obvious, situation.
Mob spawning alrotihm, simplified, is the following:
What it means regarding carpets: if you have a level floor in a room, and room is surrounded by solid stone, no mobs will spawn even in the dark, as there are no air blocks on floor level. If you have a building surrounded by air, though, mobs will be able to start spawning outside and "leak" onto your carpet floors.
So, glass floors are as safe as they ever were.
Detailed algorithm is on the wiki.
No carpets are basically an invisible block. All mobs can spawn on carpet. However there is an exception. Slimes cannot spawn on carpets even in the swamp biome because the "biome floor is covered"