JavaScript:TraceMonkey
Contents
About TraceMonkey
TraceMonkey adds native‐code compilation to Mozilla’s JavaScript® engine (known as “SpiderMonkey”). It is based on a technique developed at UC Irvine called “trace trees”, and building on code and ideas shared with the Tamarin Tracing project. The net result is a massive speed increase both in the browser chrome and Web‐page content.
Playing with TraceMonkey
TraceMonkey is currently available and enabled by default in stable 32-bit Firefox 3.5+ and nightly builds. If you want to modify the types of JavaScript that are executed using TraceMonkey:
- open a new tab;
- type “about:config” and hit enter;
- read the warning and heed its wisdom;
- enter “jit” in the filter field;
- change the value of “javascript.options.jit.content” to enable (true) and disable (false) TraceMonkey for JavaScript in Web content;
- change the value of “javascript.options.jit.chrome” to enable (true) and disable (false) TraceMonkey for JavaScript in XUL/chrome.
If you experience instability, please file a bug and reference any crash report ID that might be relevant. As of 2009, of the stable builds only the 32-bit versions of Firefox have TraceMonkey available (use nightly builds for 64-bit support).
Hacking on TraceMonkey
The TM tree is located at http://hg.mozilla.org/tracemonkey.
We are currently still in rapid‐development mode. Our commit policy is as follows: if you are confident you know what you are doing, push now and prepare to answer questions later if you break the tree. If you have commit access to hg.mozilla.org, feel free to commit any patch you feel is sensible. Even white‐space clean‐up, additional comments or general code clean‐up/naming‐consistency changes are welcome.
Run trace-test.js and all benchmarks in t/* before you commit. Commits that break any of these tests are allowed if sensible, but please let everyone know why you break what and what has to happen to fix it.
The main channel to discuss TM is #jsapi on irc.mozilla.org.
TraceMonkey Tasks
Beta 1
- fuzzer bugs fixed
- slow script dialog
- perf matches a2
- test suites passing
- gcov
- content_jit
- nanojit x86 (this works, but it must remain so)
- OOM nanojit/tracer testing
- disable tracer in the presence of debugger
Beta 2
- tracing recursion
- trace over DOM fast stubs (not into)
- event handler tracing
- ARM nanojit
Future Features
- SSE opts
- PPC nanojit
- built‐in reg usage
- Nanojit Verifier
Security Review
Javascript is a trademark or registered trademark of Sun Microsystems, Inc. in
the U.S. and other countries.