The engine consists of two main elements:
The Call stack is a data structure that functions on the Last In First Out (LIFO) principle. The call stack stores the execution context or code for each function. It is defined as an object which stores local variables, functions, and objects of the codes and how would they appear on the screen. Primitive values like int, bool, etc are stored inside the call stack. While function definitions and objects are not stored inside the call stack, they are stored inside the memory heap. The call stack just has the reference or memory address of where these function definitions and objects are stored and would appear on the search engine.
Later, the interpreter takes this byte code and makes the conversion into machine code, which will further run this code on the hardware of the machine to generate the results. The assignment of a baseline compiler is to perform the compilation of the code as fast as possible and to generate less-optimized byte codes.
3. Spider Monkey
Let's take an example of Loop Unrolling, a 'for' loop to increment an integer can be inlined using '+' operations 'n' number of times to optimize the script. Similar optimizations can be achieved using functions in-line.
For the reason that code execution is done sequentially, any code that takes a long time to execute will block anything that needs to be executed after that and will extend the processing time. Hence, sometimes you will be observing a small bar showing the progress below the screen while using Google Chrome.