Skip to main content

JS EngineProgram to execute JS Source Code, consists of Call Stack, Heap, Callback Queue & Event Loop

aka JavaScript-Engine

Browser Vendor Engines

Call Stack

where code executed via EC, to track execution order

Heap

unstructured memory pool to store all Objects for app

Value

immutable data saved at Memory Address

JS Compiler

Program to transform JS Code, consists of Baseline Compiler, Optimization Compiler & Monitor

JIT

Mix of Interpretation & Compiled Language, used by modern JS Engine, all code compiled & executed immediately

Interpretation

Programming Language with Interpreter to parse & execute Source Code line by line

Compiler

Program to translate Source Code to Machine Code (or IR)

Compilation vs Interpretation

References

  1. Browser RuntimeJS Runtime Environ with JS Engine, Web API, Callback Queue & Event Loop

  2. JavaScript RuntimeEnviron (container) to run JS, consists of JS Engine, JS Library & Platform-specific API

  3. Node.js RuntimeJS Runtime Environ to execute JS outside Browser via JS Engine with C++ Bindings & Thread Pool

  4. Concurrency Model ↔ (mechanism) to achieve Concurrency for JS Engine via Event Loop, Callback Queue & Callback Function

  5. ASTtree data struct to rep Source Code by organize JS Keywords for JS Engine

  6. JS InterpreterJS Engine Component to check AST for SyntaxError, handles ASI

  7. JIT ↔ Mix of Interpretation & Compiled Language, used by modern JS Engine, all code compiled & executed immediately

  8. Garbage-Collection ↔ 🧹Algorithm (in JS Engine) to remove old unused Object from Heap Memory

  9. InternalErrorException when exceed Call Stack size in JS Engine - when something too large || Infinite Loop

  10. Lexical Environment ↔ current Scope environ where JS Engine read Code

  11. getHeapStatistics()v8 Static Method to print stats for JS Engine

  12. V8JS Engine of Google Chrome & Node.js

  13. SpidermonkeyJS Engine to power Firefox, built in C++

  14. Safari ↔ default Apple OS Browser, Webkit JS Engine

  15. v8Node API for V8 JS Engine