wiki:JavaScriptCore

Version 2 (modified by Thomas Guy Cornyn, 13 years ago) ( diff )

Typo, 3rd paragraph - "JavaScriptCode"

JavaScriptCore

JavaScriptCore is the built-in JavaScript engine for WebKit. It currently implements ECMAScript as in ECMA-262 specification.

JavaScriptCore is often referred with different names, such as SquirrelFish and SquirrelFish Extreme. Within the context of Safari, Nitro and Nitro Extreme (the marketing terms from Apple) are also commonly used. However, the name of the project and the library is always JavaScriptCore.

JavaScriptCore source code resides in WebKit source tree, it's under Source/JavaScriptCore directory.

Note that while Chromium uses WebKit as the rendering engine, it does not use JavaScriptCore as the JavaScript engine. Rather, Chromium uses V8 (which is not a WebKit project).

Core Engine

Like a typical scripting engine, JavaScriptCore consists of the following building blocks: lexer, parser, and interpreter.

Lexer is responsible for the lexical analysis, i.e. breaking down the script source into a series of tokens. JavaScriptCore lexer is hand-written, it is mostly in parser/Lexer.h and parser/Lexer.cpp.

Parser carries out the syntactic analysis, i.e. consuming the tokens from the lexer and building the corresponding syntax tree. JavaScriptCore uses a hand-written recursive descent parser, the code is in parser/JSParser.h and parser/JSParser.cpp.

Interpreter executes the bytecodes produced by the parser. JavaScriptCore has two types of interpreter: bytecode-based and JIT-based. The former runs the bytecodes in a virtual machine, the latter uses JIT (Just-in-time) compiling approach to produce native machine codes in order to have a faster execution. The bulk of the interpreter code is in interpreter/ subdirectory with the JIT compiler in jit/ subdirectory.

(More to be written)

Runtime

(To be written)

Binding

(To be written)

Attachments (2)

Download all attachments as: .zip

Note: See TracWiki for help on using the wiki.