Featured image of post 试玩 deno2

试玩 deno2

前言

ry 近期把 deno 的第二版原型从 deno2 文件夹中转移到 src 上了,并初步完成之前定下针对 unprivileged 部分的改造目标:

  • Use the gn build system for fast builds, sane configuration, and easy linking into Chrome.
  • Use V8 snapshots to improve startup time.
  • Remove Golang. Although it has been working nicely, I am concerned the double GC will become a problem sometime down the road.
  • Distribute a C++ library called libdeno, containing the snapshotted typescript runtime.
  • Test the message passing and other functionality at that layer before involving higher level languages. 翻译:
  • 使用 GN 这个构建工具,这是 chromium 团队使用的构建工具
  • 使用 V8 Snapshots 提升启动速度(已完成)
  • **移除 Golang,**因为不想同时存在两个 GC(Go 和 TS)
  • 弄了一个 C++ 库叫 libdeno,负责 TS 的运行时环境

试玩

克隆 Depot Tools

1
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git

配置环境变量

这里我是把配置到 .zshrc 文件中

1
export PATH=$PATH:/path/to/depot_tools

克隆仓库

1
git clone [email protected]:ry/deno.git

进入到 src 文件夹

1
cd deno/src

获取包和 v8

1
gclient sync --no-history

然后你就会在 src 下看到一堆三方包和 v8 被下载下来

安装 js 依赖

1
2
3
cd js
yarn install
gn gen out/Debug --args='cc_wrapper="ccache" is_debug=true '

使用 ninja 编译

mac 上得先安装 ccache 不然会报 subcommand failed 错误

1
brew install ccache

src 下进行编译

1
ninja -C out/Debug/ deno

试着执行

这样 deno 的执行文件就产生了

接着运行看看

打印出了 v8 的版本 V8 6.8.275.14

Licensed under CC BY-NC-SA 4.0
Built with Hugo
主题 StackJimmy 设计