Introduction

Generate a discrepancy report on the number of bytecode instructions generated by ES2ABC and V8.

Prepare V8

1. Install depot_tools

git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
export PATH=/path/to/depot_tools:$PATH

2. fetch v8 code

Create a V8 source code directory in any directory and switch to it:

mkdir ~/v8
cd ~/v8

Get the V8 source code and all its branches and dependencies using the fetch command

fetch v8
cd v8

3. Installing dependencies

Execute the following commands in the V8 source directory to pull the latest changes and install any new generated dependencies.

git pull
gclient sync

Next, install the other build dependencies:

./build/install-build-deps.sh

4. compile V8

Use the gm tool for V8 build.

tools/dev/gm.py x64.release

The path of the compiled V8 executable program d8 is as follows:

out/x64.release/d8

Running the Script

Usage

python3 parse_command.py -es2abc ES2ABC_PATH -v8 D8_PATH [arguments]

Tail arguments

  • -es2abc: path to the executable program es2abc.
  • -v8: path to the V8 executable d8.

Optional arguments

  • --add_case: Add the file path of a single test case to be executed.
  • --add_case_dir: Add the directory where the test cases are to be executed and the script will automatically search for all cases in that directory (By default it filters cases with .js extension).
  • --timeout: Time limits for use case execution (In seconds).

Test Result

Instruction number discrepancy report: ./discrepancy_report.html