It might be possible. But you'd have to solve the following problems:

- OSR exits at the rate of roughly one per opcode. I'm not sure if LLVM 
supports them at all and if it does, I'm not sure that it can efficiently 
support as many of them as our backend. We can provide meta-data for how to 
reify baseline state at almost any point, which allows us to do aggressive 
profile driven speculations. I don't know if LLVM would allow us to speculate 
quite so aggressively. And remember, LLVM's main source languages are all 
strongly typed, so speculation and OSR exit may be underexplored territory. 

- Idiom tuning. How you tune a compiler that mainly sees C style code is very 
different from how you would tune a compiler for JS. This is due to (1) what 
idioms a programmer is likely to use and (2) what idioms are likely to be 
introduced by the frontend. If you wanted to get LLVM to compete with our 
backend you'd have to probably do some tuning. 

- Code patching. We rely heavily on self modifying code. I'm not sure if LLVM 
would give you quite enough flexibility to do that. If you removed code 
patching, btw, you'd get destroyed on every benchmark. 

- Speed of compilation. We optimize for this with great zeal. Often we avoid 
certain otherwise popular optimization strategies because we don't want to hurt 
page load times. That said, you could avoid this with the right combo of 
concurrent JIT and tiering. 

In my experience the first two points can kill you if you try to use an 
optimized-for-C compiler since C code requires only minimal code patching 
(often it's just an idiom that the linker and the C compiler agree on) and 
usually only supports side exits for exceptions, which are a lot simpler than 
OSR. 

-Filip

On Feb 17, 2012, at 10:28 PM, "Michael.Kang" <[email protected]> wrote:

> Hello WebKitten:
> 
>         I am a newbie here. Now I am investigating if we can use LLVM
> as our JIT system of Javascript engine to get a faster Javascript
> engine? I had
> searched webkit-dev maillist (probably I missed some previous related
> discussion ), and it seems there is only some discussions about
> translating
> llvm IR to javascript.
>        I know the speed of javascript engine is a fight among V8, SFX
> etc. Several famous companies have already done a lot of thing on it.
> But I will
> think that why we can not translate the javascript to the IR of llvm
> since LLVM have a good support for JIT system.  Is it feasible? Could
> we get a
> faster JIT engine based on LLVM? I like to get your suggestion or
> advice about that. Is there some special considerations or obstacle
> for such way.
>        Any discussion about my stupid thinking is very appreciate.
> 
> Thanks
> MK
> 
> -- 
> www.skyeye.org
> _______________________________________________
> webkit-dev mailing list
> [email protected]
> http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
_______________________________________________
webkit-dev mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev

Reply via email to