GoogleChromeLabs/jsvu

V8 commit: "Remove JS natives support, step 1" broke JSVU's V8 installation

rwaldron opened this issue · 6 comments

This commit: v8/v8@28a9dc2#diff-da88faf5ecb7458b02cfbdfab426c3c1 removed the --natives_blob flag. That flag is used in both v8 and v8-debug:

The result is:

$ echo "print(1+1);" >> add.js && v8 ./add.js
Warning: unknown flag --natives_blob=/Users/rwaldron/.jsvu/engines/v8/natives_blob.bin.
Try --help for options
2

Thanks for the report!

We should change jsvu to use --natives_blob only for V8 versions prior to v7.9.

Instead of doing it based on the version, we can detect if the natives_blob.bin file in the download exists and is larger than 1 byte.

const nativesBlob = './natives_blob.bin';
const useNativesBlob = fs.existsSync(nativesBlob) && fs.statSync(nativesBlob).size > 1;

Ideally we’d be able to just check for the existence of the file, but the latest download at https://storage.googleapis.com/chromium-v8/official/canary/v8-mac64-rel-7.9.212.zip contains a 1-byte natives_blob.bin (consisting of a single 0x00 byte). 🤷🏼‍♂️

Fix landed and published. npm i -g jsvu@latest

That was quick ❤️

It doesn't look like the problem is fully fixed:

📦 jsvu v1.9.2 — the JavaScript engine Version Updater 📦
✔ Read OS from config: linux64
✔ Read engine + version from CLI argument: v8 v7.8
✔ Found specific V8 version: v7.8.279.
✔ URL: https://storage.googleapis.com/chromium-v8/official/canary/v8-linux64-rel-7.8.279.zip
✔ Download completed.
❯ Extracting…
Installing library to ~/.jsvu/engines/v8-7.8.279/icudtl.dat…
Installing library to ~/.jsvu/engines/v8-7.8.279/natives_blob.bin…
Installing library to ~/.jsvu/engines/v8-7.8.279/snapshot_blob.bin…
Installing binary to ~/.jsvu/engines/v8-7.8.279/v8-7.8.279…
Installing wrapper script to ~/.jsvu/v8-7.8.279…
✔ Extraction completed.
❯ Testing…
✖ Error: Command failed with exit code 132 (Unknown system error -132): /home/node/.jsvu/v8-7.8.279 /tmp/d323790f0794855e8e0bfa7d888ffe42.
$ ~/.jsvu/v8-7.8.279 


#
# Fatal error in , line 0
# Check failed: blob_file.
#
#
#
#FailureMessage Object: 0x7ffe76c1fbf0
==== C stack trace ===============================

    /home/node/.jsvu/engines/v8-7.8.279/v8-7.8.279(+0xc9ddb3) [0x564135b9fdb3]
    /home/node/.jsvu/engines/v8-7.8.279/v8-7.8.279(+0xc9d3bb) [0x564135b9f3bb]
    /home/node/.jsvu/engines/v8-7.8.279/v8-7.8.279(+0xc98825) [0x564135b9a825]
    /home/node/.jsvu/engines/v8-7.8.279/v8-7.8.279(+0x4dbe6e) [0x5641353dde6e]
    /home/node/.jsvu/engines/v8-7.8.279/v8-7.8.279(+0x2ceda1) [0x5641351d0da1]
    /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf1) [0x7992bd6102e1]
    /home/node/.jsvu/engines/v8-7.8.279/v8-7.8.279(_start+0x2a) [0x5641351bf02a]
Received signal 4 ILL_ILLOPN 564135b9d532
/home/node/.jsvu/v8-7.8.279: line 2: 32046 Illegal instruction     (core dumped) "/home/node/.jsvu/engines/v8-7.8.279/v8-7.8.279" --snapshot_blob="/home/node/.jsvu/engines/v8-7.8.279/snapshot_blob.bin" "$@"

That's what I get for pushing hotfixes on a Friday :) @mhofman This should be resolved in jsvu@latest.