看看 mozilla 的开源js引擎以下网页较为详细地介绍了如何使用Javascript Engine http://developer.mozilla.org/en/docs/SpiderMonkey SpiderMonkey SpiderMonkey is Gecko's JavaScript engine written in C. It is used in various Mozilla products, including Firefox, and is available under MPL/GPL/LGPL tri-license. Documentation JSAPI Reference SpiderMonkey API reference. JSDBGAPI Reference SpiderMonkey debugging API reference. JavaScript C Engine Embedder's Guide This guide provides an overview of SpiderMonkey and describes how you can embed engine calls in your applications to make them JavaScript-aware. How to embed the JavaScript engine A bare-bones tutorial about embedding SpiderMonkey. SpiderMonkey Garbage Collection Tips Tips on avoiding garbage collector pitfalls. Introduction to the JavaScript shell How to get, build, and use the JavaScript shell. SpiderMonkey Internals: Thread Safety How SpiderMonkey's request model works inside. SpiderMonkey Build Documentation How to build SpiderMonkey and run the test suite.