Details on JavaScriptCore's new B3 JIT, replacing their LLVM JIT

A great blog post has just gone up about JavascriptCore's new B3 JIT.
https://webkit.org/blog/5852/introducing-the-b3-jit-compiler/

This replaces LLVM as the low-level optimisation layer of the FTL JIT.
They currently achieve roughly 5x faster compile time than LLVM while
achieving roughly the same generated code quality for their workloads.

I'm sharing as I thought some parts of the design may be interesting
to other LLVM devs, including the use of Check opcodes ("like a
marriage between a Branch and a Patchpoint") and the backwards greedy
pattern matching for lowering from B3 to Air.

Alex

This part, at least, is isomorphic to the greedy matching algorithms used by SelectionDAG and FastISel.

—Owen

FYI, Sanjoy just started a discussion on what a "check"-like construct might look like in LLVM over in the thread "RFC: Add guard intrinsics to LLVM". To avoid confusion, it's worth calling out that the predicate is reversed in Sanjoy's proposal from how it's described in the b3 post.

Philip