Tamarin is Adobe's ActionScript engine aimed at executing the now-not-happening ECMAScript 4, which Adobe contributed to Mozilla. Tamarin uses just in time (JIT) compilation to increase performance; as a function or method is being interpreted for the first time, the system compiles that code and executes the compiled version. The drawback of this approach, as with early Java JIT implementations, is that compilation takes time. In a recent branch of Tamarin, Abobe looked at how to optimise the compilation of code by a process called tracing, where the path of code execution is traced and, where it is valuable to compile code, that code is then compiled. This project was called Tamarin-Tracing.
Throwing out SpiderMonkey to replace it with Tamarin was regarded as problematic, so some Mozilla developers took a different approach – adding tracing to SpiderMonkey. They used the back-end of Tamarin-Tracing, called nanojit, and incorporated it into the existing SpiderMonkey framework to create TraceMonkey. TraceMonkey watches the bytecode, looking specifically at loops in the code, and when appropriate it can trigger compilation of the code in that loop. Unlike SquirrelFish, the code is compiled to the machine code of the underlying processor. What this means in practice is huge wins on code where there are a lot of intensive calculations within loops. Less so, though where there is code that does not repeat. In a comparison between SquirrelFish and TraceMonkey, TraceMonkey was twelve times faster than SquirrelFish on some tests, yet was approaching half the speed of SquirrelFish in others. The other issue with TraceMonkey is portability between processors; nanojit has to be able to generate machine code for the CPU it is running on, and currently supports only x86 and ARM architectures; this provides good coverage for the current deployed processors inside machines today so doesn't provide an immediate worry.