Hi Sebastian
To make it simple: fundamentally, JavaScript is interpreted. However,
JavaScript engine apply a set of optimizations that tend to make it looks
like JavaScript is a compiled language.
A JavaScript engine first parse a JavaScript file then interpreted it.
However, while it is interpreted there some cases than can be optimized:
for example, function that are called several times with a predictable
results can be transformed into some specific bitcode that that will be run
faster as it allows the JS engine to run it as if it where native binary
code (this is a bit over simplified but you get the idea) This is technique
is called Just In Time compilation (a.k.a JIT) as this compilation occured
on demand when it's necessary to have a faster executed code.
Modern JS engine also know a specific subset of JavaScript named ASM.js
this special way of writing JavaScript allow the engine to skip the
interpretation of JavaScript by turning immediately the JS code into an
executable bitcode. Again that looks very much like a compiled language.
This is so true that the best way to get some ASM.js JavaScript is to write
C++ code then transform it to ASM.js using transitional compiler tools
(LLVM + emscripten to be precise)
So as you can see it's a bit blurry but let's be clear: In essence,
JavaScript is an interpreted language. After that it's mostly JS engine
doing some voodoo magic to optimize that interpretation by using an
intermediate binary code representation with different optimization to get
such binary code as fast as possible.
Hope this help to understand
Best,
Jeremie
> _______________________________________________
> dev-mdc mailing list
>
dev...@lists.mozilla.org
>
https://lists.mozilla.org/listinfo/dev-mdc
> MDN contributor guide:
http://bit.ly/ContributorGuide
>
--
Jeremie
.............................
Web :
http://jeremie.patonnier.net
Twitter : @JeremiePat <
http://twitter.com/JeremiePat>