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
Table of contents 1. Introduction 2. Simple epoll...
Table of contents 01 What is Kubernetes? 02 The d...
Preface The mv command is the abbreviation of mov...
Table of contents 1. Usage of keep-alive Example ...
Preface When we were writing the horse, I guess e...
Table of contents Primary key index Create indexe...
binlog is a binary log file that records all DML ...
Table of contents 1. Test experiment 2. Performan...
<br />This is not only an era of information...
This article shares the specific code of jQuery t...
binlog is a binary log file, which records all my...
01. Command Overview The whatis command searches ...
1. Add the following code to http{} in nginx.conf...
<br />The frame structure allows several web...
1. Download 1. MySQL official website download ad...