Open In App

What happens inside JavaScript Engine ?

JavaScript is a multi-paradigm prototype-based language, which uses JavaScript Engine such as Chrome’s V8 engine Firefox SpiderMonkey engine and etc. They convert the high level code into machine-readable code which lets computer to perform some specific tasks. We will understand this using an image.
 



Google chrome’s JavaScript V8 engine: Firstly, raw JavaScript file goes into the Parser




// Arrow function
const multiply = (a, b)=> a*b;
 
for(let i=0;i<1000;i++){
    console.log(multiply(4, 3));
}

Mozilla’s SpiderMonkey JavaScript Engine: SpiderMonkey is the first Engine created by Brendan Eich, Creator of JavaScript. He created this Engine at Netscape Communication in 1995 and now it is maintained by Mozilla Foundation. We will understand this using an image. 



The Spider Monkey converts the main JS code into the byte code through the compiler, after that the byte code goes into two section Interpreter and JIT Compiler.
Mozilla’s SpiderMonkey Engine three things are important which are as follows: 

Difference between Chrome V8 vs Mozilla’s Spider Monkey: The main difference between chrome’s V8 Engine and Mozilla’s SpiderMonkey lies in ECMAScript conformance Test262 which is used to check how closely JavaScript implementation follows the ECMAScript 5th edition specification standards, created by ECMA International. This test consists of thousands of individual tests, which checks the requirement of the specification.
Conformance test: 

Chrome’s V8 Engine -> 98%

Mozilla’s SpiderMonkey -> 87%

Article Tags :