sivagao / blog

blog of sivagao,每天一篇好文章~
https://sivagao.github.io/blog
611 stars 49 forks source link

2016/05/04 Node.js 是怎么工作? #39

Open sivagao opened 8 years ago

sivagao commented 8 years ago

翻译自How does NodeJS work?

Browser

Virtual Machine

V8

V8 Templates

Function Template

Object Template

By now, we learned how to expose C++ methods\structures to JavaScript. We will now learn how to run JavaScript code in those modified contexts. It’s simple. Just compile and run principle.

V8 Compile && Run JavaScript

C++ -> V8 Templates -> Run JavaScript -> ?

Modularity

C++ Module Loader

JavaScript Module Loader

Let’s start with NativeModule first.

Another thing is Module loader implementation.

NodeJS Runtime Library?

Event Loop