{"id":18356516,"url":"https://github.com/lbwa/v8-reference","last_synced_at":"2025-04-10T01:48:56.628Z","repository":{"id":96822362,"uuid":"254082071","full_name":"lbwa/v8-reference","owner":"lbwa","description":"Based on header files from source code","archived":false,"fork":false,"pushed_at":"2020-05-14T02:37:39.000Z","size":1059,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-15T00:09:09.779Z","etag":null,"topics":["api-reference","v8"],"latest_commit_sha":null,"homepage":"https://lbwa.github.io/v8-reference","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lbwa.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-04-08T12:31:25.000Z","updated_at":"2020-05-26T15:03:35.000Z","dependencies_parsed_at":"2023-03-21T01:33:13.837Z","dependency_job_id":null,"html_url":"https://github.com/lbwa/v8-reference","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lbwa%2Fv8-reference","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lbwa%2Fv8-reference/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lbwa%2Fv8-reference/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lbwa%2Fv8-reference/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lbwa","download_url":"https://codeload.github.com/lbwa/v8-reference/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248142696,"owners_count":21054666,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api-reference","v8"],"created_at":"2024-11-05T22:10:33.072Z","updated_at":"2025-04-10T01:48:56.607Z","avatar_url":"https://github.com/lbwa.png","language":"Shell","readme":"\u003ch1 align=\"center\"\u003eV8 Reference\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\u003ca href=\"https://lbwa.github.io/v8-reference\"\u003eOnline\u003c/a\u003e\u003c/p\u003e\n\nThis project is an API reference for Google's open-source [v8](https://github.com/v8/v8) `JavaScript` engine.\n\n\u003c!-- TOC --\u003e\n\n- [Install](#install)\n- [Core components](#core-components)\n  - [Mental model](#mental-model)\n  - [Compiler pipeline](#compiler-pipeline)\n- [Further readings](#further-readings)\n  - [Articles](#articles)\n  - [Videos](#videos)\n\n\u003c!-- /TOC --\u003e\n\n## Install\n\n1. Fetch the latest version `v8` source code:\n\n   ```bash\n   $ git submodule init\n   $ git submodule foreach git pull\n   ```\n\n1. Download [doxygen](https://github.com/doxygen/doxygen) binaries into `doxygen` directory.\n\n1. Run command for generating documentations:\n\n   ```bash\n   $ ./doxygen/doxygen.exe\n   ```\n\n1. Done. All output `HTML` files are in the `docs` directory.\n\n## Core components\n\n### Mental model\n\n\u003e Recommend: [You don't know JS yet - compiling code](https://github.com/getify/You-Dont-Know-JS/blob/2nd-ed/scope-closures/ch1.md)\n\nJavaScript is in fact parsed/compiled in a separate phase before execution begins. Scope is primarily determined during compilation.\n\nIn class compiler theory, a program is processed by a compiler in three basic stages:\n\n1. **Tokenizing/Lexing**: breaking up a string of characters into meaningful (to the language) chunks, called **tokens**.\n\n1. **Parsing**: taking a stream(array) of tokens and turning it init a tree of nested elements. This is called an **`abstract syntax tree(abbr, AST)`**.\n\n1. **Code generation**: taking an AST and turning it into **executable code**.\n\n### Compiler pipeline\n\n\u003e [related](https://youtu.be/p-iiEDtpy6I?t=726)\n\n- baseline compiler(as an interpreter) is called [Ignition](https://v8.dev/docs/ignition)\n\n- optimizing compiler is called [TurboFan](https://v8.dev/docs/turbofan).\n\n## Further readings\n\n### Articles\n\n- [You don't known JS yet - Compiled vs. Interpreted](https://github.com/getify/You-Dont-Know-JS/blob/2nd-ed/scope-closures/ch1.md#compiled-vs-interpreted)\n\n### Videos\n\n- [JavaScript engines - how do they even?](https://youtu.be/p-iiEDtpy6I)\n\n  - [Just in time compilation](https://youtu.be/p-iiEDtpy6I?t=510), abbr as `JIT`, 即时编译, just compiling the source code just in time as we need it\n\n  - re-compile **`hot`** functions with **type information** from previous execution, de-optimize if the type has changed\u003csup\u003e[#](https://youtu.be/p-iiEDtpy6I?t=588)\u003c/sup\u003e\n\n    \u003e 虽然 JS 是动态类型，但 `v8` 内部仍然是根据类型信息来优化代码实现 JIT 优化。\u003csup\u003e[#](https://youtu.be/p-iiEDtpy6I?t=787)\u003c/sup\u003e\n\n    [How to optimize JS code with a concrete example](https://youtu.be/p-iiEDtpy6I?t=810)\n\n  - As a **engine-level performance** tip, always construct the same type of objects.\u003csup\u003e[#](https://youtu.be/p-iiEDtpy6I?t=1190)\u003c/sup\u003e\n\n    ```ts\n    function load(obj: { x: number, a: number, b: number}) {\n      return obj.x\n    }\n\n    load(x: undefined, a: 3, b: 9)\n    load(x: 3, a: undefined, b: 9)\n    load(x: 4, a: 7, b: undefined)\n    ```\n\n  - Write code that looks like statically typed.\n\n    \u003e Because JIT optimization depends on type information.\n\n- [JavaScript Engine Internals for JavaScript Developers](https://youtu.be/-lt6a9kbc_k)\n- [JavaScript engine fundamentals: optimizing prototypes](https://mathiasbynens.be/notes/prototypes)\n- [JavaScript engine fundamentals: Shapes and Inline Caches](https://mathiasbynens.be/notes/shapes-ics)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flbwa%2Fv8-reference","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flbwa%2Fv8-reference","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flbwa%2Fv8-reference/lists"}