What is it and what it does?
Well, before mastering any new programming language, it is important to find out what it is and how it would function. It is useful in weighing about what you would really like to specialize in.
In essence, these essentials create everything that is visual when you visit a webpage like browsing, using emails, reading news, online shopping and more.
Is it still relevant today?
No doubt the world of web development is dynamic and changing. It is difficult to tell what lies ahead in this field and as an aspiring web developer its quite challenging to where you should focus and invest your time.
There’s no doubt that this is a language worth knowing!
Once you have mastered it, the possibilities are endless! So cool right?
For instance, the most popular one is the V8 Engine developed by Google that is used in Chrome and Node.js.
V8 — open source, developed by Google, written in C++
Rhino — managed by the Mozilla Foundation, open source, developed entirely in Java
KJS — KDE’s engine originally developed by Harri Porten for the KDE project’s Konqueror web browser
Chakra (JScript9) — Internet Explorer
Nashorn, open source as part of OpenJDK, written by Oracle Java Languages and Tool Group
JerryScript — is a lightweight engine for the Internet of Things.
An excerpt from the blog that I really found informative:
Excerpt starts here:
The main processes are Parser, Ignition, and TurboFan. Let’s go a little on each process to see how it works.
The first step is to convert into AST (Abstract Syntax Tree). The V8’s parser does that job, it takes the code and parses it into AST.
Abstract Syntax Tree is a tree representation of the source code.
There are two steps in this phase,
• Lexical Analysis
• Syntactical Analysis
Before we parse the code into an Abstract syntax tree, we first convert it into Tokens. This conversion to tokens happens in Lexical Analysis.
A Scanner consumes a stream of Unicode characters, combine it into tokens, and remove all the whitespace, newlines and comments, etc.
These tokens are keywords, operators, etc.
Once the engine converts your code into tokens, it’s time to convert it into Abstract Syntax Tree. This phase is called Syntax Analysis.
The tokens are converted into Abstract Syntax Tree using V8’s Parser and the language syntax validation also happens during this phase.
The heart of the V8 engine is Ignition and TurboFan.
Ignition is the component that helps to interpret your bytecode.
Once the engine has AST, it sends this tree to Ignition which converts it into bytecode. Then this bytecode is interpreted by a high-performance interpreter.
Ignition has a swift startup time, and the bytecode it produces is very small, so V8 uses it to execute the code on page load. Ignition is used for the infrequent code because the performance comes at a cost and V8 doesn’t want to consume a lot of memory.
TurboFan is an optimizing Compiler, which compiles your code to an optimized Machine language. It generates an extremely fast Machine Code. It does this with the help of assumptions (we will get into this in a while).
Since the TurboFan generates an optimized Machine Code, the V8 uses TurboFan to produce an optimized version of frequently used code.