build V8 on mac

Tags
v8
Created
May 25, 2018 2:11 PM

// v8 的 builtin 部分由编译中间产物 mksnapshot 程序生成 // 源代码是 js ? 跟 firefox 一样

代码只在V8的编译阶段mksnapshot程序执行,执行后会产出机器码(JIT),然后mksnapshot程序把生成的机器码dump下来放到汇编文件embedded.S里,编译进V8运行时(相当于用JIT编译器去AOT)。

https://gist.github.com/kevincennis/0cd2138c78a07412ef21

https://github.com/v8/v8/wiki/Building-from-Source

Prerequisites

  • Install Xcode (Avaliable on the Mac App Store)
  • Install Xcode Command Line Tools (Preferences > Downloads)
  • Install depot_tools

Build V8

I'd also recommend adding these to your .bash_profile:

  • sudo nano ~/.bash_profile
  • Add alias d8=/path/to/v8/repo/out.gn/x64.optdebug/d8
  • Add alias tick-processor=/path/to/v8/repo/tools/mac-tick-processor
  • Add export D8_PATH="/path/to/v8/repo/out.gn/x64.optdebug"
  • source ~/.bash_profile
SuperMade with Super