Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 28350b6

Browse files
Restyled by prettier-markdown
1 parent 9f1d924 commit 28350b6

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

‎Notes/17-JSEngine-ChromeV8.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,31 @@
33
#### JS runs literally everywhere from smart watch to robots to browsers because of Javascript Runtime Environment (JRE)
44

55
- JRE consists of a JS Engine (❤️ of JRE), set of APIs to connect with outside environment, event loop, Callback queue, Microtask queue etc.
6-
- JRE is a container that can run JS code.
6+
- JRE is a container that can run JS code.
77

88
- ECMAScript is a governing body of JS. It has set of rules followed by all JS engines like Chakra(Edge), Spidermonkey(Firefox), v8(Chrome)
9-
- JS Engine is **not a machine**. Its software written in low level languages (eg. C++) that takes in hi-level code in JS and spits out low level machine
10-
code
9+
- JS Engine is **not a machine**. Its software written in low level languages (eg. C++) that takes in hi-level code in JS and spits out low level machine
10+
code
1111

1212
In all languages, code is compiled either with **interpreter** or with **compiler**. JS used to have only interpreter in old times, but now has **both**
13-
to compile JS code.
13+
to compile JS code.
1414

1515
Interpreter : Takes code and executes line by line. Has no idea what will happen in next line. Very fast.
1616
Compiler : Code is compiled and an optimized version of same code is formed, and then executed. More efficient
1717

1818
- Code inside JRE passes through 3 steps : **Parsing, Compilation and Execution**
1919

2020
1. **Parsing** - Code is broken down into tokens. In "let a = 7" -> let, a, =, 7 are all tokens. Also we have a **syntax parser** that takes code and converts it
21-
into an **AST (Abstract Syntax Tree)** which is a JSON with all key values like type, start, end, body etc (looks like package.json but for a line of code in JS. Kinda
22-
unimportant)(Check out astexplorer.net -> converts line of code into AST)
21+
into an **AST (Abstract Syntax Tree)** which is a JSON with all key values like type, start, end, body etc (looks like package.json but for a line of code in JS. Kinda
22+
unimportant)(Check out astexplorer.net -> converts line of code into AST)
2323

24-
2. **Compilation** - JS has something called **Just-in-time(JIT) Compilation - uses both interpreter & compiler**. Also compilation and execution both go hand in hand.
25-
The AST from previous step goes to interpreter which converts hi-level code to byte code and moves to execeution. While interpreting, compiler also works hand in hand
26-
to compile and form optimized code during runtime.
24+
2. **Compilation** - JS has something called **Just-in-time(JIT) Compilation - uses both interpreter & compiler**. Also compilation and execution both go hand in hand.
25+
The AST from previous step goes to interpreter which converts hi-level code to byte code and moves to execeution. While interpreting, compiler also works hand in hand
26+
to compile and form optimized code during runtime.
2727

28-
3. **Execution** - Needs 2 components ie. Memory heap(place where all memory is stored) and Call Stack(same call stack from prev episodes). There is also a *garbage collector.*
29-
It uses an algo called **Mark and Sweep**.
28+
3. **Execution** - Needs 2 components ie. Memory heap(place where all memory is stored) and Call Stack(same call stack from prev episodes). There is also a _garbage collector._
29+
It uses an algo called **Mark and Sweep**.
3030

31-
Companies use different JS engines and each try to make theirs the best.
31+
Companies use different JS engines and each try to make theirs the best.
3232

33-
- v8 of Google has Interpreter called *Ignition*, a compiler called *Turbo Fan* and garbage collector called *Orinoco*
33+
- v8 of Google has Interpreter called _Ignition_, a compiler called _Turbo Fan_ and garbage collector called _Orinoco_

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /