How do I dig into under the hood of Google V8 JavaScript engine

来源:互联网 发布:视频特效软件手机版 编辑:程序博客网 时间:2024/06/06 18:58

1.  Firstly, you should prepare some knowledge of dynamic compilation.  If you have the knowledge of Java Virtual Machine, you are in good position but you need to prepare some new knowledge of compiler.  Especially the concept of "Sea of Nodes"  IR.   You can start from googling "combining Analyses, Combining optimizations - Summary", and then read Cliff Clicks thesis.

2. And then you should read the V8 design docs. Of course the best ones are from Google V8 engineering team.

3. The third step is of course to download V8 source code and try to play with it, like building, testing etc.

4. After playing with it,  you are commended to scan through the source code.  I did it by setting up the Eclipse environment and scan all the source codes under v8/src directory. At this stage, you are only expected to get a rough idea of those key classes, and try to remember their names and their roles.

5. Now,  try to understand the general execution sequence of running a simple JS file. I did it by generating a callgraph by using valgrind tool and get the visual call graph by kCachegrind.

1 0
原创粉丝点击