Emscripten, an LLVM-to-JavaScript compiler
github.com
github.com
Update: For OS X you need GHC 7.2 to use the LLVM backend. Otherwise GHC just ignores the -fllvm flag. The Haskell Platform only uses version 7.0.4.
For instance, the simplest source-to-source transformation for operator overloading is to use function calls for all operators. But this degrades performance for the Number type. Presumably a tracing JIT could switch to native Javascript operators after observing hotspots that only use Numbers.
https://github.com/jashkenas/coffee-script/issues/846
But the question is whether a tracing JIT could largely eliminate this bottleneck by noticing if inner loops are really Numeric types. I was wondering if there were any LLVM examples that show potential performance of a JIT on a JIT.
One thing I would like to see done is to take PyPy or LuaJIT, and get their tracing JITs to generate JS, either directly or more likely indirectly by emitting LLVM which Emscripten then compiles to JS. In theory that could let PyPy and LuaJIT run on the web with speed similar to what they have natively.
If anyone familiar with PyPy or LuaJIT wants to work on this with me (I wrote Emscripten), let me know! :)
JITs compile to native machine code, but this is transforming LLVM IR, a typed assembly language.
It might be possible with http://bellard.org/jslinux/ , but I wouldn't expect great performance.