JägerMonkey & Nitro Components
After our recent blogs about JägerMonkey, some articles out there gave the impression that we were removing nanojit, throwing everything away, or doing all sorts of other radical things that we are not in fact doing. I don’t have a huge problem with that–this is complicated stuff and it’s hard to get right. So Chris Blizzard made a post correcting some of the misconceptions. I thought it might also be easier to see what we’re doing in a picture of the major system compoents of SpiderMonkey, TraceMonkey, JägerMonkey, and Nitro:
The size of each box is proportional to the number of lines of code in that component. (I just measured the file size, including comments and whitespace. LOC is a rough measure of complexity anyway, so it doesn’t matter much.)
(By the way, I might have the JSC/Nitro terminology wrong; I’m not sure exactly what they call the different parts. I’m using “Nitro” to refer to the method JIT, and JSC to refer to the other parts of the engine, but Nitro might actually be a name for the whole engine that includes the method JIT. There is a similar ambiguity in the use of SpiderMonkey/TraceMonkey in Mozilla.)
The key point is that the only piece of WebKit that we are importing is the assembler, which we are using beneath our method JIT. We need our own method JIT because the method JIT’s job is to translate bytecode to cross-platform assembly, and SpiderMonkey and WebKit each have their own bytecode. Also, the generated code interfaces heavily with the giant green box (which implements strings, arrays, regular expressions, dates, etc), which is different for each system.
Note also that we are definitely keeping TraceMonkey, because it has excellent performance on the right kind of code. There is no simple description of the “right kind of code”; one of the main reasons we are doing JägerMonkey is to provide more predictable high performance. JägerMonkey and TraceMonkey are going to work together, TraceMonkey running when it can and JägerMonkey when it must. We’re working on that right now–they work together for basic cases already, and we should have even advanced tracing, such as recursion, working with JägerMonkey soon.