From dd3776e30d82cc7e84d32150d3a4bbb896b03ab2 Mon Sep 17 00:00:00 2001 From: g00416891 Date: Thu, 17 Nov 2022 15:12:11 +0800 Subject: [PATCH] support es2abc_gen_abc generate patch Signed-off-by: g00416891 Change-Id: I193dbe03f52cae3c93e7df0e63a7b6bc8792432d --- es2panda/es2abc_config.gni | 13 +++++++++++++ es2panda/scripts/generate_js_bytecode.py | 13 +++++++++++++ 2 files changed, 26 insertions(+) diff --git a/es2panda/es2abc_config.gni b/es2panda/es2abc_config.gni index c46973d596..6a14c16732 100644 --- a/es2panda/es2abc_config.gni +++ b/es2panda/es2abc_config.gni @@ -71,6 +71,19 @@ template("es2abc_gen_abc") { rebase_path("${es2abc_build_path}"), ] + if (defined(invoker.dump_symbol_table)) { + args += [ + "--dump-symbol-table", + invoker.dump_symbol_table, + ] + } + if (defined(invoker.input_symbol_table)) { + args += [ + "--input-symbol-table", + invoker.input_symbol_table, + ] + } + if (defined(invoker.extra_args)) { args += invoker.extra_args } diff --git a/es2panda/scripts/generate_js_bytecode.py b/es2panda/scripts/generate_js_bytecode.py index 0371d9239b..60b2054722 100755 --- a/es2panda/scripts/generate_js_bytecode.py +++ b/es2panda/scripts/generate_js_bytecode.py @@ -40,6 +40,12 @@ def parse_args(): help='whether is commonjs') parser.add_argument("--merge-abc", action='store_true', help='whether is merge abc') + parser.add_argument("--generate-patch", action='store_false', + help='generate patch abc') + parser.add_argument("--dump-symbol-table", + help='dump symbol table of base abc') + parser.add_argument("--input-symbol-table", + help='input symbol table for patch abc') arguments = parser.parse_args() return arguments @@ -58,6 +64,10 @@ def gen_abc_info(input_arguments): '--output', input_arguments.dst_file, input_arguments.src_js] + if input_arguments.dump_symbol_table: + cmd += ['--dump-symbol-table', input_arguments.dump_symbol_table] + if input_arguments.input_symbol_table: + cmd += ['--input-symbol-table', input_arguments.input_symbol_table] if input_arguments.debug: src_index = cmd.index(input_arguments.src_js) cmd.insert(src_index, '--debug-info') @@ -70,6 +80,9 @@ def gen_abc_info(input_arguments): if input_arguments.merge_abc: src_index = cmd.index(input_arguments.src_js) cmd.insert(src_index, '--merge-abc') + if input_arguments.generate_patch: + src_index = cmd.index(input_arguments.src_js) + cmd.insert(src_index, '--generate-patch') # insert d.ts option to cmd later run_command(cmd, path) -- Gitee