From ac133e4eef7bc39f8c96ecca91ca5b22cf6a01e9 Mon Sep 17 00:00:00 2001 From: lixiaoyan Date: Fri, 24 May 2024 14:32:24 +0800 Subject: [PATCH] Add --run-jit switch for test262 Signed-off-by: lixiaoyan Change-Id: I9bd43fa476bb04f21e34d02ea7386c9de0c28c73 --- test262/config.py | 3 +++ test262/run_sunspider.py | 19 +++++++++++++++++++ test262/run_test262.py | 22 ++++++++++++++++++---- 3 files changed, 40 insertions(+), 4 deletions(-) diff --git a/test262/config.py b/test262/config.py index 066c633679..b9b18eca36 100755 --- a/test262/config.py +++ b/test262/config.py @@ -92,6 +92,9 @@ TEST262_GIT_URL = "https://gitee.com/hufeng20/test262.git" ESHOST_GIT_URL = "https://gitee.com/hufeng20/eshost.git" HARNESS_GIT_URL = "https://gitee.com/hufeng20/test262-harness.git" +TEST262_JIT_GIT_URL = "https://gitee.com/lxy0115/test262.git" +TEST262_JIT_GIT_HASH = "41cf77eb3ab4babdf8662c2a60cb63439c61740a" + SKIP_LIST_FILE = os.path.join("test262", "skip_tests.json") ES2ABC_SKIP_LIST_FILE = os.path.join("test262", "es2abc_skip_tests.json") TS2ABC_SKIP_LIST_FILE = os.path.join("test262", "ts2abc_skip_tests.json") diff --git a/test262/run_sunspider.py b/test262/run_sunspider.py index b43945f185..ef738546ea 100755 --- a/test262/run_sunspider.py +++ b/test262/run_sunspider.py @@ -93,6 +93,9 @@ def parse_args(): parser.add_argument('--run-pgo', action='store_true', required=False, help="Run test262 with aot pgo") + parser.add_argument('--run-jit', action='store_true', + required=False, + help="Run test262 with JIT") parser.add_argument('--abc2program', action='store_true', help="Use abc2prog to generate abc, aot or pgo is not supported yet under this option") arguments = parser.parse_args() @@ -117,6 +120,7 @@ class ArkProgram(): self.ark_tool = ARK_TOOL self.ark_aot = False self.run_pgo = False + self.run_jit = False self.ark_aot_tool = ARK_AOT_TOOL self.libs_dir = LIBS_DIR self.ark_frontend = ARK_FRONTEND @@ -146,6 +150,9 @@ class ArkProgram(): if self.args.run_pgo: self.run_pgo = self.args.run_pgo + if self.args.run_jit: + self.run_jit = self.args.run_jit + if self.args.ark_aot_tool: self.ark_aot_tool = self.args.ark_aot_tool @@ -608,6 +615,10 @@ class ArkProgram(): cmd_args = [qemu_tool, qemu_arg1, qemu_arg2, self.ark_tool, ICU_PATH, f'{file_name_pre}.abc'] + if self.run_jit: + cmd_args = [qemu_tool, qemu_arg1, qemu_arg2, self.ark_tool, f'--compiler-enable-litecg=true', + f'--compiler-enable-jit=true --log-debug=jit', ICU_PATH, + f'{file_name_pre}.abc'] elif self.arch == ARK_ARCH_LIST[2]: qemu_tool = "qemu-arm" qemu_arg1 = "-L" @@ -615,6 +626,10 @@ class ArkProgram(): cmd_args = [qemu_tool, qemu_arg1, qemu_arg2, self.ark_tool, ICU_PATH, f'{file_name_pre}.abc'] + if self.run_jit: + cmd_args = [qemu_tool, qemu_arg1, qemu_arg2, self.ark_tool, f'--compiler-enable-litecg=true', + f'--compiler-enable-jit=true --log-debug=jit', ICU_PATH, + f'{file_name_pre}.abc'] elif self.arch == ARK_ARCH_LIST[0]: if file_name_pre in FORCE_GC_SKIP_TESTS: unforce_gc = True @@ -623,6 +638,10 @@ class ArkProgram(): asm_arg1 = "--enable-force-gc=false" cmd_args = [self.ark_tool, ICU_PATH, asm_arg1, f'{file_name_pre}.abc'] + if self.run_jit: + cmd_args = [self.ark_tool, f'--compiler-enable-litecg=true', + f'--compiler-enable-jit=true --log-debug=jit',ICU_PATH, asm_arg1, + f'{file_name_pre}.abc'] record_name = os.path.splitext(os.path.split(self.js_file)[1])[0] cmd_args.insert(-1, f'--entry-point={record_name}') diff --git a/test262/run_test262.py b/test262/run_test262.py index 91a7f34a0a..b630f1ba04 100755 --- a/test262/run_test262.py +++ b/test262/run_test262.py @@ -120,6 +120,8 @@ def parse_args(): help="ark's product name") parser.add_argument('--run-pgo', action='store_true', help="Run test262 with aot pgo") + parser.add_argument('--run-jit', action='store_true', + help="Run test262 with JIT") parser.add_argument('--abc2program', action='store_true', help="Use abc2prog to generate abc, aot or pgo is not supported yet under this option") @@ -234,8 +236,12 @@ class TestPrepare(): def prepare_test262_code(self): if not os.path.isdir(os.path.join(DATA_DIR, '.git')): - git_clone(TEST262_GIT_URL, DATA_DIR) - git_checkout(TEST262_GIT_HASH, DATA_DIR) + if self.args.run_jit: + git_clone(TEST262_JIT_GIT_URL, DATA_DIR) + git_checkout(TEST262_JIT_GIT_HASH, DATA_DIR) + else: + git_clone(TEST262_GIT_URL, DATA_DIR) + git_checkout(TEST262_GIT_HASH, DATA_DIR) if not os.path.isdir(os.path.join(ESHOST_DIR, '.git')): git_clone(ESHOST_GIT_URL, ESHOST_DIR) @@ -253,7 +259,10 @@ class TestPrepare(): def prepare_clean_data(self): git_clean(DATA_DIR) - git_checkout(TEST262_GIT_HASH, DATA_DIR) + if self.args.run_jit: + git_checkout(TEST262_JIT_GIT_HASH, DATA_DIR) + else: + git_checkout(TEST262_GIT_HASH, DATA_DIR) def patching_the_plugin(self): remove_file(os.path.join(ESHOST_DIR, "lib/agents/panda.js")) @@ -487,7 +496,10 @@ class TestPrepare(): elif self.args.esnext: git_checkout(ESNEXT_GIT_HASH, DATA_DIR) else: - git_checkout(TEST262_GIT_HASH, DATA_DIR) + if self.args.run_jit: + git_checkout(TEST262_JIT_GIT_HASH, DATA_DIR) + else: + git_checkout(TEST262_GIT_HASH, DATA_DIR) if self.args.file: mkdstdir(self.args.file, src_dir, self.out_dir) @@ -585,6 +597,8 @@ def get_host_args_of_host_type(args, host_type, ark_tool, ark_aot_tool, libs_dir host_args += f"--ark-aot " if args.run_pgo: host_args += f"--run-pgo " + if args.run_jit: + host_args += f"--run-jit " host_args += f"--ark-aot-tool={ark_aot_tool} " host_args += f"--libs-dir={libs_dir} " host_args += f"--ark-frontend={ark_frontend} " -- Gitee