From 47e7cd4506216c275f0d15056710b6dc37633443 Mon Sep 17 00:00:00 2001 From: qiuyu Date: Sun, 24 Jul 2022 00:49:00 +0800 Subject: [PATCH] Enable bytecode optimizer by default Enable bytecode optimizer by default Disable log by default Issue: I5HYBL Signed-off-by: qiuyu Change-Id: I6f71a1d081bede6e1496e4329c555cf7468e346c --- test262/config.py | 2 +- ts2panda/src/cmdOptions.ts | 2 +- ts2panda/ts2abc/ts2abc.cpp | 12 +++++++----- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/test262/config.py b/test262/config.py index 4ea7d7cefe..f2a1d8836e 100755 --- a/test262/config.py +++ b/test262/config.py @@ -96,5 +96,5 @@ ARK_ARCH_LIST = [ ] DEFAULT_ARK_ARCH = ARK_ARCH_LIST[0] -DEFAULT_OPT_LEVEL = 0 +DEFAULT_OPT_LEVEL = 2 DEFAULT_ES2ABC_THREAD_COUNT = 0 diff --git a/ts2panda/src/cmdOptions.ts b/ts2panda/src/cmdOptions.ts index 980ec2c5d7..bd302d1ea3 100644 --- a/ts2panda/src/cmdOptions.ts +++ b/ts2panda/src/cmdOptions.ts @@ -34,7 +34,7 @@ const ts2pandaOptions = [ { name: 'timeout', alias: 't', type: Number, defaultValue: 0, description: "js to abc timeout threshold(unit: seconds)." }, { name: 'opt-log-level', type: String, defaultValue: "error", description: "specifie optimizer log level. Possible values: ['debug', 'info', 'error', 'fatal']" }, { - name: 'opt-level', type: Number, defaultValue: 0, description: "Optimization level. Possible values: [0, 1, 2]. Default: 0\n 0: no optimizations\n \ + name: 'opt-level', type: Number, defaultValue: 2, description: "Optimization level. Possible values: [0, 1, 2]. Default: 0\n 0: no optimizations\n \ 1: basic bytecode optimizations, including valueNumber, lowering, constantResolver, regAccAllocator\n \ 2: other bytecode optimizations, unimplemented yet"}, { name: 'help', alias: 'h', type: Boolean, description: "Show usage guide." }, diff --git a/ts2panda/ts2abc/ts2abc.cpp b/ts2panda/ts2abc/ts2abc.cpp index 7226eea918..5f79472eaa 100644 --- a/ts2panda/ts2abc/ts2abc.cpp +++ b/ts2panda/ts2abc/ts2abc.cpp @@ -1316,11 +1316,13 @@ bool GenerateProgram([[maybe_unused]] const std::string &data, const std::string if (g_optLevel != static_cast(OptLevel::O_LEVEL0) || optLevel != static_cast(OptLevel::O_LEVEL0)) { optLogLevel = (optLogLevel != "error") ? optLogLevel : g_optLogLevel; - panda::Logger::ComponentMask mask; - mask.set(panda::Logger::Component::ASSEMBLER); - mask.set(panda::Logger::Component::BYTECODE_OPTIMIZER); - mask.set(panda::Logger::Component::COMPILER); - panda::Logger::InitializeStdLogging(panda::Logger::LevelFromString(optLogLevel), mask); + if (g_optLogLevel != "error") { + panda::Logger::ComponentMask mask; + mask.set(panda::Logger::Component::ASSEMBLER); + mask.set(panda::Logger::Component::BYTECODE_OPTIMIZER); + mask.set(panda::Logger::Component::COMPILER); + panda::Logger::InitializeStdLogging(panda::Logger::LevelFromString(optLogLevel), mask); + } bool emitDebugInfo = true; std::map stat; -- Gitee