The coffee-script gem (https://github.com/josh/ruby-coffee-script) uses ExecJS (https://github.com/sstephenson/execjs) to invoke the CS compiler. Rails 3.1's asset pipelining system will use these gems by way of Sprockets 2 (https://github.com/sstephenson/sprockets) to compile and serve CoffeeScript to the browser.
If you're on Windows or Mac OS, ExecJS will use the JS runtime already installed on your system (Windows Script Host or Apple JavaScriptCore). You can also install a gem like therubyracer (V8 for MRI, available on Heroku) or therubyrhino (Rhino for JRuby) for faster compilation. And ExecJS can use Node.js or Spidermonkey if they're installed too.