Hi Steve,
You should check out the Rhino documentation. The Java Scripting implementation of it into the JRE might get in the way of some stuff, but you should be able to access a lot of stuff directly within your javascript code. (I have not tested this to any great extent, but in theory it is possible.)
Also, Rhino does in fact compile scripts to Java for fast execution when the optimization level is properly set. This works in Mango Automation which uses Rhino directly, but M2M uses the Java Scripting impl via which there doesn't appear to be a public way to set the optimization level. Maybe a future version of M2M will use Rhino directly.