To understand how JavaScript runs and its operating mechanism, first of all, we need to understand the kernel of the browser: Browser kernelThose who have learned about it know that different browsers are composed of different kernels. So what kernels are there and what kernels are used by our commonly used browsers:
The so-called browser kernel refers to the browser's typesetting engine, that is, the browser engine. The engine's work execution process is as follows: But during this execution process, what should we do if we encounter JavaScript tags when parsing HTML? Of course, why not just load and execute the JavaScript code asynchronously instead of stopping here? Therefore, the browser wants to put the DOM parsed by HTML and the DOM after JavaScript operations together to generate the final DOM tree, rather than frequently generating new DOM trees; So, who executes the JavaScript code? JavaScript EngineWhy do we need a JavaScript engine?
What are the common JavaScript engines?
V8 Engine
The principle of V8 engine executing JavaScript code: The Parse module converts JavaScript code into AST (Abstract Syntax Tree) because the interpreter does not directly understand JavaScript code;
Ignition is an interpreter that converts AST into ByteCode
TurboFan is a compiler that compiles bytecode into machine code that the CPU can directly execute;
The above is the execution process of JavaScript code Learn, record, and encourage each other! This is the end of this article about how JavaScript works. For more information about how JavaScript works, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: Detailed explanation of Nginx status monitoring and log analysis
This article shares with you the specific method ...
Table of contents 1. Why NanoID is replacing UUID...
This article will introduce how to use radial-gra...
Table of contents What is a skeleton screen How t...
Install crontab yum install crontabs CentOS 7 com...
In the previous article, I introduced the detaile...
The default varchar type in MySQL is case insensi...
This article mainly introduces the detailed proce...
Preface As we all know, the nginx configuration f...
Table of contents Background 1. What is dns-prefe...
PSD to div css web page cutting example Step 1: F...
Not only does it reduce the cost of website develo...
Preface MySQL is the most popular relational data...
<br />Now let's take a look at how to cl...
Table of contents Overview definition Instance Me...