• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2024 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef ECMASCRIPT_JS_RUNTIME_OPTIONS_H_
17 #define ECMASCRIPT_JS_RUNTIME_OPTIONS_H_
18 
19 #include <optional>
20 #include <string>
21 #include <string_view>
22 #include <vector>
23 
24 #include "ecmascript/compiler/assembler/assembler.h"
25 #include "ecmascript/compiler/bc_call_signature.h"
26 #include "ecmascript/mem/mem_common.h"
27 #include "libpandabase/os/file.h"
28 #include "ecmascript/base/number_helper.h"
29 
30 namespace {
31 constexpr size_t DEFAULT_OPT_LEVEL = 3;  // 3: default opt level
32 constexpr size_t DEFAULT_REL_MODE = 2;
33 }  // namespace
34 
35 // namespace panda {
36 namespace panda::ecmascript {
37 using arg_list_t = std::vector<std::string>;
38 enum ArkProperties {
39     DEFAULT = -1, // default value 000'0000'0001'0000'0101'1100 -> 0x105c
40     OPTIONAL_LOG = 1,
41     GC_STATS_PRINT = 1 << 1,
42     PARALLEL_GC = 1 << 2, // default enable
43     CONCURRENT_MARK = 1 << 3, // default enable
44     CONCURRENT_SWEEP = 1 << 4, // default enable
45     THREAD_CHECK = 1 << 5,
46     ENABLE_ARKTOOLS = 1 << 6, // default enable
47     ENABLE_SNAPSHOT_SERIALIZE = 1 << 7,
48     ENABLE_SNAPSHOT_DESERIALIZE = 1 << 8,
49     EXCEPTION_BACKTRACE = 1 << 9,
50     GLOBAL_OBJECT_LEAK_CHECK = 1 << 10,
51     GLOBAL_PRIMITIVE_LEAK_CHECK = 1 << 11,
52     ENABLE_IDLE_GC = 1 << 12, // default enable
53     CPU_PROFILER_COLD_START_MAIN_THREAD = 1 << 13,
54     ENABLE_CPU_PROFILER_VM_TAG = 1 << 14,
55     ENABLE_GC_TRACER = 1 << 15,
56     CPU_PROFILER_COLD_START_WORKER_THREAD = 1 << 16,
57     CPU_PROFILER_ANY_TIME_MAIN_THREAD = 1 << 17,
58     CPU_PROFILER_ANY_TIME_WORKER_THREAD = 1 << 18,
59     ENABLE_HEAP_VERIFY = 1 << 19,
60     ENABLE_MICROJOB_TRACE = 1 << 20,
61     // Use DISABLE to adapt to the exsiting ArkProperties in testing scripts.
62     DISABLE_SHARED_CONCURRENT_MARK = 1 << 22,
63     ENABLE_ESM_TRACE = 1 << 24,
64     ENABLE_MODULE_LOG = 1 << 25,
65     ENABLE_SERIALIZATION_TIMEOUT_CHECK = 1 << 26
66 };
67 
68 // asm interpreter control parsed option
69 struct AsmInterParsedOption {
70     int handleStart {-1};
71     int handleEnd {-1};
72     bool enableAsm {false};
73 };
74 
75 extern const std::string PUBLIC_API COMMON_HELP_HEAD_MSG;
76 extern const std::string PUBLIC_API STUB_HELP_HEAD_MSG;
77 extern const std::string PUBLIC_API COMPILER_HELP_HEAD_MSG;
78 extern const std::string PUBLIC_API HELP_OPTION_MSG;
79 
80 enum CommandValues {
81     OPTION_DEFAULT,
82     OPTION_HELP,
83     OPTION_ENABLE_ARK_TOOLS,
84     OPTION_STUB_FILE,
85     OPTION_ENABLE_FORCE_GC,
86     OPTION_FORCE_FULL_GC,
87     OPTION_ENABLE_FORCE_SHARED_GC_FREQUENCY,
88     OPTION_ARK_PROPERTIES,
89     OPTION_ARK_BUNDLENAME,
90     OPTION_GC_THREADNUM,
91     OPTION_GC_LONG_PAUSED_TIME,
92     OPTION_AOT_FILE,
93     OPTION_COMPILER_TARGET_TRIPLE,
94     OPTION_ASM_OPT_LEVEL,
95     OPTION_RELOCATION_MODE,
96     OPTION_MAX_UNMOVABLE_SPACE,
97     OPTION_ENABLE_ASM_INTERPRETER,
98     OPTION_ENABLE_BUILTINS_LAZY,
99     OPTION_ASM_OPCODE_DISABLE_RANGE,
100     OPTION_SERIALIZER_BUFFER_SIZE_LIMIT,
101     OPTION_HEAP_SIZE_LIMIT,
102     OPTION_ENABLE_IC,
103     OPTION_ICU_DATA_PATH,
104     OPTION_STARTUP_TIME,
105     OPTION_COMPILER_LOG_OPT,
106     OPTION_COMPILER_LOG_METHODS,
107     OPTION_COMPILER_TYPE_THRESHOLD,
108     OPTION_ENABLE_RUNTIME_STAT,
109     OPTION_COMPILER_LOG_SNAPSHOT,
110     OPTION_COMPILER_LOG_TIME,
111     OPTION_ENABLE_WORKER,
112     OPTION_COMPILER_TRACE_BC,
113     OPTION_COMPILER_TRACE_DEOPT,
114     OPTION_COMPILER_TRACE_INLINE,
115     OPTION_COMPILER_MAX_INLINE_BYTECODES,
116     OPTION_COMPILER_DEOPT_THRESHOLD,
117     OPTION_COMPILER_STRESS_DEOPT,
118     OPTION_COMPILER_OPT_CODE_PROFILER,
119     OPTION_COMPILER_OPT_BC_RANGE,
120     OPTION_LOG_LEVEL,
121     OPTION_LOG_DEBUG,
122     OPTION_LOG_INFO,
123     OPTION_LOG_WARNING,
124     OPTION_LOG_ERROR,
125     OPTION_LOG_FATAL,
126     OPTION_LOG_COMPONENTS,
127     OPTION_COMPILER_OPT_MAX_METHOD,
128     OPTION_COMPILER_MODULE_METHODS,
129     OPTION_ENTRY_POINT,
130     OPTION_MERGE_ABC,
131     OPTION_ENABLE_CONTEXT,
132     OPTION_COMPILER_OPT_TYPE_LOWERING,
133     OPTION_COMPILER_OPT_EARLY_ELIMINATION,
134     OPTION_COMPILER_OPT_LATER_ELIMINATION,
135     OPTION_COMPILER_OPT_STRING,
136     OPTION_COMPILER_OPT_VALUE_NUMBERING,
137     OPTION_COMPILER_OPT_INLINING,
138     OPTION_COMPILER_OPT_PGOTYPE,
139     OPTION_COMPILER_OPT_TRACK_FIELD,
140     OPTION_COMPILER_PGO_PROFILER_PATH,
141     OPTION_COMPILER_PGO_HOTNESS_THRESHOLD,
142     OPTION_COMPILER_PGO_SAVE_MIN_INTERVAL,
143     OPTION_ENABLE_PGO_PROFILER,
144     OPTION_PRINT_EXECUTE_TIME,
145     OPTION_SPLIT_ONE,
146     OPTION_ENABLE_EDEN_GC,
147     OPTION_COMPILER_DEVICE_STATE,
148     OPTION_COMPILER_VERIFY_VTABLE,
149     OPTION_COMPILER_SELECT_METHODS,
150     OPTION_COMPILER_SKIP_METHODS,
151     OPTION_TARGET_COMPILER_MODE,
152     OPTION_HAP_PATH,
153     OPTION_HAP_ABC_OFFSET,
154     OPTION_HAP_ABC_SIZE,
155     OPTION_COMPILER_NOCHECK,
156     OPTION_COMPILER_PIPELINE_HOST_AOT,
157     OPTION_FAST_AOT_COMPILE_MODE,
158     OPTION_COMPILER_OPT_LOOP_PEELING,
159     OPTION_COMPILER_OPT_ON_HEAP_CHECK,
160     OPTION_COMPILER_PKG_INFO,
161     OPTION_COMPILER_EXTERNAL_PKG_INFO,
162     OPTION_COMPILER_ENABLE_EXTERNAL_PKG,
163     OPTION_COMPILER_FRAMEWORK_ABC_PATH,
164     OPTION_COMPILER_OPT_ARRAY_BOUNDS_CHECK_ELIMINATION,
165     OPTION_COMPILER_OPT_LOOP_INVARIANT_CODE_MOTION,
166     OPTION_COMPILER_OPT_CONSTANT_FOLDING,
167     OPTION_COMPILER_ENABLE_LEXENV_SPECIALIZATION,
168     OPTION_COMPILER_TRACE_INSTRUCTION_COMBINE,
169     OPTION_COMPILER_TRACE_VALUE_NUMBERING,
170     OPTION_COMPILER_OPT_INSTRUCTIONE_COMBINE,
171     OPTION_COMPILER_OPT_NEW_VALUE_NUMBERING,
172     OPTION_COMPILER_ENABLE_NATIVE_INLINE,
173     OPTION_COMPILER_ENABLE_LOWERING_BUILTIN,
174     OPTION_COMPILER_ENABLE_LITECG,
175     OPTION_COMPILER_ENABLE_JIT,
176     OPTION_COMPILER_ENABLE_OSR,
177     OPTION_COMPILER_JIT_HOTNESS_THRESHOLD,
178     OPTION_COMPILER_JIT_CALL_THRESHOLD,
179     OPTION_COMPILER_OSR_HOTNESS_THRESHOLD,
180     OPTION_COMPILER_FORCE_JIT_COMPILE_MAIN,
181     OPTION_COMPILER_TRACE_JIT,
182     OPTION_COMPILER_ENABLE_JIT_PGO,
183     OPTION_COMPILER_ENABLE_AOT_PGO,
184     OPTION_COMPILER_ENABLE_FRAMEWORK_AOT,
185     OPTION_COMPILER_ENABLE_PROPFILE_DUMP,
186     OPTION_ENABLE_ELEMENTSKIND,
187     OPTION_COMPILER_TYPED_OP_PROFILER,
188     OPTION_COMPILER_OPT_BRANCH_PROFILING,
189     OPTION_TEST_ASSERT,
190     OPTION_COMPILER_METHODS_RANGE,
191     OPTION_COMPILER_CODEGEN_OPT,
192     OPTION_COMPILER_OPT_BC_RANGE_HELP,
193     OPTION_COMPILER_MEMORY_ANALYSIS,
194     OPTION_COMPILER_CHECK_PGO_VERSION,
195     OPTION_COMPILER_OPT_ESCAPE_ANALYSIS,
196     OPTION_COMPILER_TRACE_ESCAPE_ANALYSIS,
197     OPTION_ENABLE_JITFORT,
198     OPTION_CODESIGN_DISABLE,
199     OPTION_ENABLE_ASYNC_COPYTOFORT,
200     OPTION_COMPILER_OPT_INDUCTION_VARIABLE,
201     OPTION_COMPILER_TRACE_INDUCTION_VARIABLE,
202     OPTION_ENABLE_AOT_CRASH_ESCAPE,
203     OPTION_COMPILER_ENABLE_BASELINEJIT,
204     OPTION_COMPILER_BASELINEJIT_HOTNESS_THRESHOLD,
205     OPTION_COMPILER_FORCE_BASELINEJIT_COMPILE_MAIN,
206     OPTION_COMPILER_ENABLE_JIT_FAST_COMPILE,
207     OPTION_LAST,
208     OPTION_COMPILER_BASELINE_PGO,
209     OPTION_SPLIT_TWO,
210     OPTION_ASYNC_LOAD_ABC,
211     OPTION_ASYNC_LOAD_ABC_TEST,
212     OPTION_PGO_TRACE,
213     OPTION_COMPILER_PGO_FORCE_DUMP,
214     OPTION_OPEN_ARK_TOOLS,
215     OPTION_COMPILER_ENABLE_CONCURRENT,
216     OPTION_COMPILER_OPT_FRAME_STATE_ELIMINATION,
217     OPTION_COMPILER_EMPTY_CATCH_FUNCTION,
218 };
219 static_assert(OPTION_SPLIT_ONE == 64);
220 static_assert(OPTION_SPLIT_TWO == 128); // add new option at the bottom, DO NOT modify this value
221 
222 class PUBLIC_API JSRuntimeOptions {
223 public:
JSRuntimeOptions()224     JSRuntimeOptions() {}
225     ~JSRuntimeOptions() = default;
226     DEFAULT_COPY_SEMANTIC(JSRuntimeOptions);
227     DEFAULT_MOVE_SEMANTIC(JSRuntimeOptions);
228 
229     bool ParseCommand(const int argc, const char** argv);
230     bool SetDefaultValue(char* argv);
231 
EnableArkTools()232     bool EnableArkTools() const
233     {
234         return (enableArkTools_) || ((static_cast<uint32_t>(arkProperties_) & ArkProperties::ENABLE_ARKTOOLS) != 0);
235     }
236 
SetEnableArkTools(bool value)237     void SetEnableArkTools(bool value)
238     {
239         enableArkTools_ = value;
240     }
241 
WasSetEnableArkTools()242     bool WasSetEnableArkTools() const
243     {
244         return WasOptionSet(OPTION_ENABLE_ARK_TOOLS);
245     }
246 
IsOpenArkTools()247     bool IsOpenArkTools() const
248     {
249         return openArkTools_;
250     }
251 
SetOpenArkTools(bool value)252     void SetOpenArkTools(bool value)
253     {
254         openArkTools_ = value;
255     }
256 
WasSetOpenArkTools()257     bool WasSetOpenArkTools() const
258     {
259         return WasOptionSet(OPTION_OPEN_ARK_TOOLS);
260     }
261 
IsEnableRuntimeStat()262     bool IsEnableRuntimeStat() const
263     {
264         return enableRuntimeStat_;
265     }
266 
SetEnableRuntimeStat(bool value)267     void SetEnableRuntimeStat(bool value)
268     {
269         enableRuntimeStat_ = value;
270     }
271 
WasSetEnableRuntimeStat()272     bool WasSetEnableRuntimeStat() const
273     {
274         return WasOptionSet(OPTION_ENABLE_RUNTIME_STAT);
275     }
276 
GetStubFile()277     std::string GetStubFile() const
278     {
279         return stubFile_;
280     }
281 
SetStubFile(std::string value)282     void SetStubFile(std::string value)
283     {
284         stubFile_ = std::move(value);
285     }
286 
SetCompilerPkgJsonInfo(std::string pkgJsonInfo)287     void SetCompilerPkgJsonInfo(std::string pkgJsonInfo)
288     {
289         compilerPkgInfo_ = std::move(pkgJsonInfo);
290     }
291 
GetCompilerPkgJsonInfo()292     const std::string& GetCompilerPkgJsonInfo() const
293     {
294         return compilerPkgInfo_;
295     }
296 
SetCompilerExternalPkgJsonInfo(std::string pkgJsonInfo)297     void SetCompilerExternalPkgJsonInfo(std::string pkgJsonInfo)
298     {
299         compilerExternalPkgInfo_ = std::move(pkgJsonInfo);
300     }
301 
GetCompilerExternalPkgJsonInfo()302     const std::string& GetCompilerExternalPkgJsonInfo() const
303     {
304         return compilerExternalPkgInfo_;
305     }
306 
SetCompilerEnableExternalPkg(bool compilerEnableExternalPkg)307     void SetCompilerEnableExternalPkg(bool compilerEnableExternalPkg)
308     {
309         compilerEnableExternalPkg_ = compilerEnableExternalPkg;
310     }
311 
GetCompilerEnableExternalPkg()312     bool GetCompilerEnableExternalPkg() const
313     {
314         return compilerEnableExternalPkg_;
315     }
316 
WasStubFileSet()317     bool WasStubFileSet() const
318     {
319         return WasOptionSet(OPTION_STUB_FILE);
320     }
321 
SetEnableAOT(bool value)322     void SetEnableAOT(bool value)
323     {
324         enableAOT_ = value;
325     }
326 
GetEnableAOT()327     bool GetEnableAOT() const
328     {
329         return enableAOT_;
330     }
331 
GetAOTOutputFile()332     std::string GetAOTOutputFile() const
333     {
334         return aotOutputFile_;
335     }
336 
SetAOTOutputFile(const std::string & value)337     void SetAOTOutputFile(const std::string& value)
338     {
339         aotOutputFile_ = panda::os::file::File::GetExtendedFilePath(value);
340     }
341 
WasAOTOutputFileSet()342     bool WasAOTOutputFileSet() const
343     {
344         return WasOptionSet(OPTION_AOT_FILE);
345     }
346 
GetTargetTriple()347     std::string GetTargetTriple() const
348     {
349         return targetTriple_;
350     }
351 
SetTargetTriple(std::string value)352     void SetTargetTriple(std::string value)
353     {
354         targetTriple_ = std::move(value);
355     }
356 
GetOptLevel()357     size_t GetOptLevel() const
358     {
359         return asmOptLevel_;
360     }
361 
SetOptLevel(size_t value)362     void SetOptLevel(size_t value)
363     {
364         asmOptLevel_ = value;
365     }
366 
GetRelocMode()367     size_t GetRelocMode() const
368     {
369         return relocationMode_;
370     }
371 
SetRelocMode(size_t value)372     void SetRelocMode(size_t value)
373     {
374         relocationMode_ = value;
375     }
376 
EnableForceGC()377     bool EnableForceGC() const
378     {
379         return enableForceGc_;
380     }
381 
SetEnableForceGC(bool value)382     void SetEnableForceGC(bool value)
383     {
384         enableForceGc_ = value;
385     }
386 
EnableEdenGC()387     bool EnableEdenGC() const
388     {
389         return enableEdenGC_;
390     }
391 
SetEnableEdenGC(bool value)392     void SetEnableEdenGC(bool value)
393     {
394         enableEdenGC_ = value;
395     }
396 
ForceFullGC()397     bool ForceFullGC() const
398     {
399         return forceFullGc_;
400     }
401 
SetForceFullGC(bool value)402     void SetForceFullGC(bool value)
403     {
404         forceFullGc_ = value;
405     }
406 
SetForceSharedGCFrequency(size_t frequency)407     void SetForceSharedGCFrequency(size_t frequency)
408     {
409         forceSharedGc_ = frequency;
410     }
411 
GetForceSharedGCFrequency()412     uint32_t GetForceSharedGCFrequency() const
413     {
414         return forceSharedGc_;
415     }
416 
SetGcThreadNum(size_t num)417     void SetGcThreadNum(size_t num)
418     {
419         gcThreadNum_ = num;
420     }
421 
GetGcThreadNum()422     size_t GetGcThreadNum() const
423     {
424         return gcThreadNum_;
425     }
426 
SetLongPauseTime(size_t time)427     void SetLongPauseTime(size_t time)
428     {
429         longPauseTime_ = time;
430     }
431 
GetLongPauseTime()432     size_t GetLongPauseTime() const
433     {
434         return longPauseTime_;
435     }
436 
SetArkProperties(int prop)437     void SetArkProperties(int prop)
438     {
439         if (prop != ArkProperties::DEFAULT) {
440             arkProperties_ = prop;
441         }
442     }
443 
SetArkBundleName(std::string bundleName)444     void SetArkBundleName(std::string bundleName)
445     {
446         if (bundleName != "") {
447             arkBundleName_ = bundleName;
448         }
449     }
450 
SetMemConfigProperty(std::string configProperty)451     void SetMemConfigProperty(std::string configProperty)
452     {
453         if (configProperty != "") {
454             std::string key;
455             std::string value;
456             for (char c: configProperty) {
457                 if (isdigit(c)) {
458                     value += c;
459                 } else {
460                     key += c;
461                 }
462             }
463             if (key == "jsHeap") {
464                 heapSize_ = static_cast<size_t>(stoi(value)) * 1_MB;
465             }
466             if (key == "openArkTools") {
467                 openArkTools_ = true;
468             }
469         }
470     }
471 
GetHeapSize()472     size_t GetHeapSize() const
473     {
474         return heapSize_;
475     }
476 
GetDefaultProperties()477     int GetDefaultProperties()
478     {
479         return ArkProperties::PARALLEL_GC | ArkProperties::CONCURRENT_MARK | ArkProperties::CONCURRENT_SWEEP |
480                ArkProperties::ENABLE_ARKTOOLS | ArkProperties::ENABLE_IDLE_GC;
481     }
482 
GetArkProperties()483     int GetArkProperties()
484     {
485         return arkProperties_;
486     }
487 
GetArkBundleName()488     std::string GetArkBundleName() const
489     {
490         return arkBundleName_;
491     }
492 
EnableOptionalLog()493     bool EnableOptionalLog() const
494     {
495         return (static_cast<uint32_t>(arkProperties_) & ArkProperties::OPTIONAL_LOG) != 0;
496     }
497 
EnableGCStatsPrint()498     bool EnableGCStatsPrint() const
499     {
500         return (static_cast<uint32_t>(arkProperties_) & ArkProperties::GC_STATS_PRINT) != 0;
501     }
502 
EnableParallelGC()503     bool EnableParallelGC() const
504     {
505         return (static_cast<uint32_t>(arkProperties_) & ArkProperties::PARALLEL_GC) != 0;
506     }
507 
EnableConcurrentMark()508     bool EnableConcurrentMark() const
509     {
510         return (static_cast<uint32_t>(arkProperties_) & ArkProperties::CONCURRENT_MARK) != 0;
511     }
512 
EnableSharedConcurrentMark()513     bool EnableSharedConcurrentMark() const
514     {
515         // Use DISABLE to adapt to the exsiting ArkProperties in testing scripts.
516         return (static_cast<uint32_t>(arkProperties_) & ArkProperties::DISABLE_SHARED_CONCURRENT_MARK) == 0;
517     }
518 
EnableExceptionBacktrace()519     bool EnableExceptionBacktrace() const
520     {
521         return (static_cast<uint32_t>(arkProperties_) & ArkProperties::EXCEPTION_BACKTRACE) != 0;
522     }
523 
EnableConcurrentSweep()524     bool EnableConcurrentSweep() const
525     {
526         return (static_cast<uint32_t>(arkProperties_) & ArkProperties::CONCURRENT_SWEEP) != 0;
527     }
528 
EnableThreadCheck()529     bool EnableThreadCheck() const
530     {
531         return (static_cast<uint32_t>(arkProperties_) & ArkProperties::THREAD_CHECK) != 0;
532     }
533 
EnableIdleGC()534     bool EnableIdleGC() const
535     {
536         return false;
537     }
538 
EnableGCTracer()539     bool EnableGCTracer() const
540     {
541         return (static_cast<uint32_t>(arkProperties_) & ArkProperties::ENABLE_GC_TRACER) != 0;
542     }
543 
EnableGlobalObjectLeakCheck()544     bool EnableGlobalObjectLeakCheck() const
545     {
546         return (static_cast<uint32_t>(arkProperties_) & ArkProperties::GLOBAL_OBJECT_LEAK_CHECK) != 0;
547     }
548 
EnableGlobalPrimitiveLeakCheck()549     bool EnableGlobalPrimitiveLeakCheck() const
550     {
551         return (static_cast<uint32_t>(arkProperties_) & ArkProperties::GLOBAL_PRIMITIVE_LEAK_CHECK) != 0;
552     }
553 
EnableGlobalLeakCheck()554     bool EnableGlobalLeakCheck() const
555     {
556         return EnableGlobalObjectLeakCheck() || EnableGlobalPrimitiveLeakCheck();
557     }
558 
EnableCpuProfilerColdStartMainThread()559     bool EnableCpuProfilerColdStartMainThread() const
560     {
561         return (static_cast<uint32_t>(arkProperties_) & ArkProperties::CPU_PROFILER_COLD_START_MAIN_THREAD) != 0;
562     }
563 
EnableCpuProfilerColdStartWorkerThread()564     bool EnableCpuProfilerColdStartWorkerThread() const
565     {
566         return (static_cast<uint32_t>(arkProperties_) & ArkProperties::CPU_PROFILER_COLD_START_WORKER_THREAD) != 0;
567     }
568 
EnableCpuProfilerAnyTimeMainThread()569     bool EnableCpuProfilerAnyTimeMainThread() const
570     {
571         return (static_cast<uint32_t>(arkProperties_) & ArkProperties::CPU_PROFILER_ANY_TIME_MAIN_THREAD) != 0;
572     }
573 
EnableCpuProfilerAnyTimeWorkerThread()574     bool EnableCpuProfilerAnyTimeWorkerThread() const
575     {
576         return (static_cast<uint32_t>(arkProperties_) & ArkProperties::CPU_PROFILER_ANY_TIME_WORKER_THREAD) != 0;
577     }
578 
EnableCpuProfilerVMTag()579     bool EnableCpuProfilerVMTag() const
580     {
581         return (static_cast<uint32_t>(arkProperties_) & ArkProperties::ENABLE_CPU_PROFILER_VM_TAG) != 0;
582     }
583 
IsStartGlobalLeakCheck()584     bool IsStartGlobalLeakCheck() const
585     {
586         return startGlobalLeakCheck_;
587     }
588 
SwitchStartGlobalLeakCheck()589     void SwitchStartGlobalLeakCheck()
590     {
591         startGlobalLeakCheck_ = !startGlobalLeakCheck_;
592     }
593 
EnableSnapshotSerialize()594     bool EnableSnapshotSerialize() const
595     {
596         return (static_cast<uint32_t>(arkProperties_) & ArkProperties::ENABLE_SNAPSHOT_SERIALIZE) != 0;
597     }
598 
EnableSnapshotDeserialize()599     bool EnableSnapshotDeserialize() const
600     {
601         if (WIN_OR_MAC_OR_IOS_PLATFORM) {
602             return false;
603         }
604 
605         return (static_cast<uint32_t>(arkProperties_) & ArkProperties::ENABLE_SNAPSHOT_DESERIALIZE) != 0;
606     }
607 
EnableHeapVerify()608     bool EnableHeapVerify() const
609     {
610         return (static_cast<uint32_t>(arkProperties_) & ArkProperties::ENABLE_HEAP_VERIFY) != 0;
611     }
612 
EnableMicroJobTrace()613     bool EnableMicroJobTrace() const
614     {
615         return (static_cast<uint32_t>(arkProperties_) & ArkProperties::ENABLE_MICROJOB_TRACE) != 0;
616     }
617 
EnableESMTrace()618     bool EnableESMTrace() const
619     {
620         return (static_cast<uint32_t>(arkProperties_) & ArkProperties::ENABLE_ESM_TRACE) != 0;
621     }
622 
EnableModuleLog()623     bool EnableModuleLog() const
624     {
625         return (static_cast<uint32_t>(arkProperties_) & ArkProperties::ENABLE_MODULE_LOG) != 0;
626     }
627 
EnableSerializationTimeoutCheck()628     bool EnableSerializationTimeoutCheck() const
629     {
630         return (static_cast<uint32_t>(arkProperties_) & ArkProperties::ENABLE_SERIALIZATION_TIMEOUT_CHECK) != 0;
631     }
632 
WasSetMaxNonmovableSpaceCapacity()633     bool WasSetMaxNonmovableSpaceCapacity() const
634     {
635         return WasOptionSet(OPTION_MAX_UNMOVABLE_SPACE);
636     }
637 
MaxNonmovableSpaceCapacity()638     size_t MaxNonmovableSpaceCapacity() const
639     {
640         return maxNonmovableSpaceCapacity_;
641     }
642 
SetMaxNonmovableSpaceCapacity(uint32_t value)643     void SetMaxNonmovableSpaceCapacity(uint32_t value)
644     {
645         maxNonmovableSpaceCapacity_ = value;
646     }
647 
SetEnableAsmInterpreter(bool value)648     void SetEnableAsmInterpreter(bool value)
649     {
650         enableAsmInterpreter_ = value;
651     }
652 
GetEnableAsmInterpreter()653     bool GetEnableAsmInterpreter() const
654     {
655         return enableAsmInterpreter_;
656     }
657 
SetEnableBuiltinsLazy(bool value)658     void SetEnableBuiltinsLazy(bool value)
659     {
660         enableBuiltinsLazy_ = value;
661     }
662 
GetEnableBuiltinsLazy()663     bool GetEnableBuiltinsLazy() const
664     {
665         return enableBuiltinsLazy_;
666     }
667 
SetAsmOpcodeDisableRange(std::string value)668     void SetAsmOpcodeDisableRange(std::string value)
669     {
670         asmOpcodeDisableRange_ = std::move(value);
671     }
672 
SetDisableCodeSign(bool value)673     void SetDisableCodeSign(bool value)
674     {
675         disableCodeSign_ = value;
676     }
677 
GetDisableCodeSign()678     bool GetDisableCodeSign() const
679     {
680         return disableCodeSign_;
681     }
682 
SetEnableJitFort(bool value)683     void SetEnableJitFort(bool value)
684     {
685         enableJitFort_ = value;
686     }
687 
GetEnableJitFort()688     bool GetEnableJitFort() const
689     {
690         return enableJitFort_;
691     }
692 
SetEnableAsyncCopyToFort(bool value)693     void SetEnableAsyncCopyToFort(bool value)
694     {
695         enableAsyncCopyToFort_ = value;
696     }
697 
GetEnableAsyncCopyToFort()698     bool GetEnableAsyncCopyToFort() const
699     {
700         return enableAsyncCopyToFort_;
701     }
702 
ParseAsmInterOption()703     void ParseAsmInterOption()
704     {
705         asmInterParsedOption_.enableAsm = enableAsmInterpreter_;
706         std::string strAsmOpcodeDisableRange = asmOpcodeDisableRange_;
707         if (strAsmOpcodeDisableRange.empty()) {
708             return;
709         }
710 
711         // asm interpreter handle disable range
712         size_t pos = strAsmOpcodeDisableRange.find(",");
713         if (pos != std::string::npos) {
714             std::string strStart = strAsmOpcodeDisableRange.substr(0, pos);
715             std::string strEnd = strAsmOpcodeDisableRange.substr(pos + 1);
716             int64_t inputStart;
717             int64_t inputEnd;
718             if (!base::NumberHelper::StringToInt64(strStart, inputStart)) {
719                 inputStart = 0;
720                 LOG_ECMA_IF(!strStart.empty(), INFO) << "when get start, strStart is " << strStart;
721             }
722             if (!base::NumberHelper::StringToInt64(strEnd, inputEnd)) {
723                 inputEnd = kungfu::BYTECODE_STUB_END_ID;
724                 LOG_ECMA_IF(!strEnd.empty(), INFO) << "when get end, strEnd is " << strEnd;
725             }
726             int start = static_cast<int>(inputStart);
727             int end = static_cast<int>(inputEnd);
728             if (start >= 0 && start < kungfu::BytecodeStubCSigns::NUM_OF_ALL_NORMAL_STUBS && end >= 0 &&
729                 end < kungfu::BytecodeStubCSigns::NUM_OF_ALL_NORMAL_STUBS && start <= end) {
730                 asmInterParsedOption_.handleStart = start;
731                 asmInterParsedOption_.handleEnd = end;
732             }
733         }
734     }
735 
GetAsmInterParsedOption()736     AsmInterParsedOption GetAsmInterParsedOption() const
737     {
738         return asmInterParsedOption_;
739     }
740 
GetCompilerLogOption()741     std::string GetCompilerLogOption() const
742     {
743         return compilerLogOpt_;
744     }
745 
SetCompilerLogOption(std::string value)746     void SetCompilerLogOption(std::string value)
747     {
748         compilerLogOpt_ = std::move(value);
749     }
750 
WasSetCompilerLogOption()751     bool WasSetCompilerLogOption() const
752     {
753         return WasOptionSet(OPTION_COMPILER_LOG_OPT) && GetCompilerLogOption().find("none") == std::string::npos;
754     }
755 
GetMethodsListForLog()756     std::string GetMethodsListForLog() const
757     {
758         return compilerLogMethods_;
759     }
760 
SetMethodsListForLog(std::string value)761     void SetMethodsListForLog(std::string value)
762     {
763         compilerLogMethods_ = std::move(value);
764     }
765 
WasSetMethodsListForLog()766     bool WasSetMethodsListForLog() const
767     {
768         return WasOptionSet(OPTION_COMPILER_LOG_METHODS) && GetCompilerLogOption().find("none") == std::string::npos &&
769                GetCompilerLogOption().find("all") == std::string::npos;
770     }
771 
SetCompilerLogSnapshot(bool value)772     void SetCompilerLogSnapshot(bool value)
773     {
774         compilerLogSnapshot_ = value;
775     }
776 
IsEnableCompilerLogSnapshot()777     bool IsEnableCompilerLogSnapshot() const
778     {
779         return compilerLogSnapshot_;
780     }
781 
WasSetCompilerLogSnapshot()782     bool WasSetCompilerLogSnapshot() const
783     {
784         return WasOptionSet(OPTION_COMPILER_LOG_SNAPSHOT);
785     }
786 
SetCompilerLogTime(bool value)787     void SetCompilerLogTime(bool value)
788     {
789         compilerLogTime_ = value;
790     }
791 
IsEnableCompilerLogTime()792     bool IsEnableCompilerLogTime() const
793     {
794         return compilerLogTime_;
795     }
796 
WasSetCompilerLogTime()797     bool WasSetCompilerLogTime() const
798     {
799         return WasOptionSet(OPTION_COMPILER_LOG_TIME);
800     }
801 
GetSerializerBufferSizeLimit()802     uint64_t GetSerializerBufferSizeLimit() const
803     {
804         return serializerBufferSizeLimit_;
805     }
806 
SetSerializerBufferSizeLimit(uint64_t value)807     void SetSerializerBufferSizeLimit(uint64_t value)
808     {
809         serializerBufferSizeLimit_ = value;
810     }
811 
GetHeapSizeLimit()812     uint32_t GetHeapSizeLimit() const
813     {
814         return heapSizeLimit_;
815     }
816 
SetHeapSizeLimit(uint32_t value)817     void SetHeapSizeLimit(uint32_t value)
818     {
819         heapSizeLimit_ = value;
820     }
821 
WasSetHeapSizeLimit()822     bool WasSetHeapSizeLimit() const
823     {
824         return WasOptionSet(OPTION_HEAP_SIZE_LIMIT);
825     }
826 
SetIsWorker(bool isWorker)827     void SetIsWorker(bool isWorker)
828     {
829         isWorker_ = isWorker;
830     }
831 
SetIsRestrictedWorker(bool isRestrictedWorker)832     inline void SetIsRestrictedWorker(bool isRestrictedWorker)
833     {
834         isRestrictedWorker_ = isRestrictedWorker;
835     }
836 
IsWorker()837     bool IsWorker() const
838     {
839         return isWorker_;
840     }
841 
IsRestrictedWorker()842     bool IsRestrictedWorker() const
843     {
844         return isRestrictedWorker_;
845     }
846 
EnableIC()847     bool EnableIC() const
848     {
849         return enableIC_;
850     }
851 
SetEnableIC(bool value)852     void SetEnableIC(bool value)
853     {
854         enableIC_ = value;
855     }
856 
WasSetEnableIC()857     bool WasSetEnableIC() const
858     {
859         return WasOptionSet(OPTION_ENABLE_IC);
860     }
861 
GetIcuDataPath()862     std::string GetIcuDataPath() const
863     {
864         return icuDataPath_;
865     }
866 
SetIcuDataPath(std::string value)867     void SetIcuDataPath(std::string value)
868     {
869         icuDataPath_ = std::move(value);
870     }
871 
WasSetIcuDataPath()872     bool WasSetIcuDataPath() const
873     {
874         return WasOptionSet(OPTION_ICU_DATA_PATH);
875     }
876 
IsStartupTime()877     bool IsStartupTime() const
878     {
879         return startupTime_;
880     }
881 
SetStartupTime(bool value)882     void SetStartupTime(bool value)
883     {
884         startupTime_ = value;
885     }
886 
WasSetStartupTime()887     bool WasSetStartupTime() const
888     {
889         return WasOptionSet(OPTION_STARTUP_TIME);
890     }
891 
SetTraceBc(bool value)892     void SetTraceBc(bool value)
893     {
894         traceBc_ = value;
895     }
896 
IsTraceBC()897     bool IsTraceBC() const
898     {
899         return traceBc_;
900     }
901 
WasSetTraceBc()902     bool WasSetTraceBc() const
903     {
904         return WasOptionSet(OPTION_COMPILER_TRACE_BC);
905     }
906 
GetLogLevel()907     std::string GetLogLevel() const
908     {
909         return logLevel_;
910     }
911 
SetLogLevel(std::string value)912     void SetLogLevel(std::string value)
913     {
914         logLevel_ = std::move(value);
915     }
916 
WasSetLogLevel()917     bool WasSetLogLevel() const
918     {
919         return WasOptionSet(OPTION_LOG_LEVEL);
920     }
921 
GetLogComponents()922     arg_list_t GetLogComponents() const
923     {
924         return logComponents_;
925     }
926 
SetLogComponents(arg_list_t value)927     void SetLogComponents(arg_list_t value)
928     {
929         logComponents_ = std::move(value);
930     }
931 
WasSetLogComponents()932     bool WasSetLogComponents() const
933     {
934         return WasOptionSet(OPTION_LOG_COMPONENTS);
935     }
936 
GetLogDebug()937     arg_list_t GetLogDebug() const
938     {
939         return logDebug_;
940     }
941 
SetLogDebug(arg_list_t value)942     void SetLogDebug(arg_list_t value)
943     {
944         logDebug_ = std::move(value);
945     }
946 
WasSetLogDebug()947     bool WasSetLogDebug() const
948     {
949         return WasOptionSet(OPTION_LOG_DEBUG);
950     }
951 
GetLogInfo()952     arg_list_t GetLogInfo() const
953     {
954         return logInfo_;
955     }
956 
SetLogInfo(arg_list_t value)957     void SetLogInfo(arg_list_t value)
958     {
959         logInfo_ = std::move(value);
960     }
961 
WasSetLogInfo()962     bool WasSetLogInfo() const
963     {
964         return WasOptionSet(OPTION_LOG_INFO);
965     }
966 
GetLogWarning()967     arg_list_t GetLogWarning() const
968     {
969         return logWarning_;
970     }
971 
SetLogWarning(arg_list_t value)972     void SetLogWarning(arg_list_t value)
973     {
974         logWarning_ = std::move(value);
975     }
976 
WasSetLogWarning()977     bool WasSetLogWarning() const
978     {
979         return WasOptionSet(OPTION_LOG_WARNING);
980     }
981 
GetLogError()982     arg_list_t GetLogError() const
983     {
984         return logError_;
985     }
986 
SetLogError(arg_list_t value)987     void SetLogError(arg_list_t value)
988     {
989         logError_ = std::move(value);
990     }
991 
WasSetLogError()992     bool WasSetLogError() const
993     {
994         return WasOptionSet(OPTION_LOG_ERROR);
995     }
996 
GetLogFatal()997     arg_list_t GetLogFatal() const
998     {
999         return logFatal_;
1000     }
1001 
SetLogFatal(arg_list_t value)1002     void SetLogFatal(arg_list_t value)
1003     {
1004         logFatal_ = std::move(value);
1005     }
1006 
WasSetLogFatal()1007     bool WasSetLogFatal() const
1008     {
1009         return WasOptionSet(OPTION_LOG_FATAL);
1010     }
1011 
GetMaxAotMethodSize()1012     size_t GetMaxAotMethodSize() const
1013     {
1014         return maxAotMethodSize_;
1015     }
1016 
SetMaxAotMethodSize(uint32_t value)1017     void SetMaxAotMethodSize(uint32_t value)
1018     {
1019         maxAotMethodSize_ = value;
1020     }
1021 
GetTypeThreshold()1022     double GetTypeThreshold() const
1023     {
1024         return typeThreshold_;
1025     }
1026 
SetTypeThreshold(double threshold)1027     void SetTypeThreshold(double threshold)
1028     {
1029         typeThreshold_ = threshold;
1030     }
1031 
GetEntryPoint()1032     std::string GetEntryPoint() const
1033     {
1034         return entryPoint_;
1035     }
1036 
SetEntryPoint(std::string value)1037     void SetEntryPoint(std::string value)
1038     {
1039         entryPoint_ = std::move(value);
1040     }
1041 
WasSetEntryPoint()1042     bool WasSetEntryPoint() const
1043     {
1044         return WasOptionSet(OPTION_ENTRY_POINT);
1045     }
1046 
GetMergeAbc()1047     bool GetMergeAbc() const
1048     {
1049         return mergeAbc_;
1050     }
1051 
SetMergeAbc(bool value)1052     void SetMergeAbc(bool value)
1053     {
1054         mergeAbc_ = value;
1055     }
1056 
SetEnableContext(bool value)1057     void SetEnableContext(bool value)
1058     {
1059         enableContext_ = value;
1060     }
1061 
IsEnableContext()1062     bool IsEnableContext() const
1063     {
1064         return enableContext_;
1065     }
1066 
SetEnablePrintExecuteTime(bool value)1067     void SetEnablePrintExecuteTime(bool value)
1068     {
1069         enablePrintExecuteTime_ = value;
1070     }
1071 
IsEnablePrintExecuteTime()1072     bool IsEnablePrintExecuteTime() const
1073     {
1074         return enablePrintExecuteTime_;
1075     }
1076 
SetEnableElementsKind(bool value)1077     void SetEnableElementsKind(bool value)
1078     {
1079         enableElementsKind_ = value;
1080     }
1081 
IsEnableElementsKind()1082     bool IsEnableElementsKind() const
1083     {
1084         return enableElementsKind_;
1085     }
1086 
SetEnablePGOProfiler(bool value)1087     void SetEnablePGOProfiler(bool value)
1088     {
1089         enablePGOProfiler_ = value;
1090     }
1091 
IsEnablePGOProfiler()1092     bool IsEnablePGOProfiler() const
1093     {
1094         return enablePGOProfiler_;
1095     }
1096 
GetPGOHotnessThreshold()1097     uint32_t GetPGOHotnessThreshold() const
1098     {
1099         return pgoHotnessThreshold_;
1100     }
1101 
SetPGOHotnessThreshold(uint32_t threshold)1102     void SetPGOHotnessThreshold(uint32_t threshold)
1103     {
1104         pgoHotnessThreshold_ = threshold;
1105     }
1106 
GetPGOSaveMinInterval()1107     uint32_t GetPGOSaveMinInterval() const
1108     {
1109         return pgoSaveMinInterval_;
1110     }
1111 
SetPGOSaveMinInterval(uint32_t value)1112     void SetPGOSaveMinInterval(uint32_t value)
1113     {
1114         pgoSaveMinInterval_ = value;
1115     }
1116 
GetPGOProfilerPath()1117     std::string GetPGOProfilerPath() const
1118     {
1119         return pgoProfilerPath_;
1120     }
1121 
SetEnableBaselinePgo(bool value)1122     void SetEnableBaselinePgo(bool value)
1123     {
1124         enableBaselinePgo_ = value;
1125     }
1126 
IsEnableBaselinePgo()1127     bool IsEnableBaselinePgo() const
1128     {
1129         return enableBaselinePgo_;
1130     }
1131 
SetPGOProfilerPath(const std::string & value)1132     void SetPGOProfilerPath(const std::string& value)
1133     {
1134         pgoProfilerPath_ = panda::os::file::File::GetExtendedFilePath(value);
1135     }
1136 
IsPGOProfilerPathEmpty()1137     bool IsPGOProfilerPathEmpty() const
1138     {
1139         return pgoProfilerPath_.empty();
1140     }
1141 
SetEnableTypeLowering(bool value)1142     void SetEnableTypeLowering(bool value)
1143     {
1144         enableTypeLowering_ = value;
1145     }
1146 
IsEnableArrayBoundsCheckElimination()1147     bool IsEnableArrayBoundsCheckElimination() const
1148     {
1149         return enableArrayBoundsCheckElimination_;
1150     }
1151 
SetEnableArrayBoundsCheckElimination(bool value)1152     void SetEnableArrayBoundsCheckElimination(bool value)
1153     {
1154         enableArrayBoundsCheckElimination_ = value;
1155     }
1156 
IsEnableFrameStateElimination()1157     bool IsEnableFrameStateElimination() const
1158     {
1159         return enableFrameStateElimination_;
1160     }
1161 
SetEnableFrameStateElimination(bool value)1162     void SetEnableFrameStateElimination(bool value)
1163     {
1164         enableFrameStateElimination_ = value;
1165     }
1166 
IsEnableTypeLowering()1167     bool IsEnableTypeLowering() const
1168     {
1169         return enableTypeLowering_;
1170     }
1171 
SetEnableEarlyElimination(bool value)1172     void SetEnableEarlyElimination(bool value)
1173     {
1174         enableEarlyElimination_ = value;
1175     }
1176 
IsEnableEarlyElimination()1177     bool IsEnableEarlyElimination() const
1178     {
1179         return enableEarlyElimination_;
1180     }
1181 
SetEnableLaterElimination(bool value)1182     void SetEnableLaterElimination(bool value)
1183     {
1184         enableLaterElimination_ = value;
1185     }
1186 
IsEnableLaterElimination()1187     bool IsEnableLaterElimination() const
1188     {
1189         return enableLaterElimination_;
1190     }
1191 
SetEnableInstrcutionCombine(bool value)1192     void SetEnableInstrcutionCombine(bool value)
1193     {
1194         enableInstrcutionCombine = value;
1195     }
1196 
IsEnableInstrcutionCombine()1197     bool IsEnableInstrcutionCombine() const
1198     {
1199         return enableInstrcutionCombine;
1200     }
1201 
SetEnableValueNumbering(bool value)1202     void SetEnableValueNumbering(bool value)
1203     {
1204         enableValueNumbering_ = value;
1205     }
1206 
IsEnableValueNumbering()1207     bool IsEnableValueNumbering() const
1208     {
1209         return enableValueNumbering_;
1210     }
1211 
SetEnableJIT(bool value)1212     void SetEnableJIT(bool value)
1213     {
1214         enableFastJIT_ = value;
1215     }
1216 
IsEnableJIT()1217     bool IsEnableJIT() const
1218     {
1219         return enableFastJIT_;
1220     }
1221 
SetEnableAPPJIT(bool value)1222     void SetEnableAPPJIT(bool value)
1223     {
1224         enableAPPJIT_ = value;
1225     }
1226 
IsEnableAPPJIT()1227     bool IsEnableAPPJIT() const
1228     {
1229         return enableAPPJIT_;
1230     }
1231 
SetEnableJitFrame(bool value)1232     void SetEnableJitFrame(bool value)
1233     {
1234         enableJitFrame_ = value;
1235     }
1236 
IsEnableJitFrame()1237     bool IsEnableJitFrame() const
1238     {
1239         return enableJitFrame_;
1240     }
1241 
IsEnableJitDfxDump()1242     bool IsEnableJitDfxDump() const
1243     {
1244         return isEnableJitDfxDump_;
1245     }
1246 
SetEnableJitDfxDump(bool value)1247     void SetEnableJitDfxDump(bool value)
1248     {
1249         isEnableJitDfxDump_ = value;
1250     }
1251 
SetEnableOSR(bool value)1252     void SetEnableOSR(bool value)
1253     {
1254         enableOSR_ = value;
1255     }
1256 
IsEnableOSR()1257     bool IsEnableOSR() const
1258     {
1259         return enableOSR_;
1260     }
1261 
SetJitHotnessThreshold(uint16_t value)1262     void SetJitHotnessThreshold(uint16_t value)
1263     {
1264         jitHotnessThreshold_ = value;
1265     }
1266 
GetJitHotnessThreshold()1267     uint16_t GetJitHotnessThreshold() const
1268     {
1269         return jitHotnessThreshold_;
1270     }
1271 
SetJitCallThreshold(uint8_t value)1272     void SetJitCallThreshold(uint8_t value)
1273     {
1274         jitCallThreshold_ = value;
1275     }
1276 
GetJitCallThreshold()1277     uint8_t GetJitCallThreshold() const
1278     {
1279         return jitCallThreshold_;
1280     }
1281 
SetOsrHotnessThreshold(uint16_t value)1282     void SetOsrHotnessThreshold(uint16_t value)
1283     {
1284         osrHotnessThreshold_ = value;
1285     }
1286 
GetOsrHotnessThreshold()1287     uint16_t GetOsrHotnessThreshold() const
1288     {
1289         return osrHotnessThreshold_;
1290     }
1291 
SetForceJitCompileMain(bool value)1292     void SetForceJitCompileMain(bool value)
1293     {
1294         forceJitCompileMain_ = value;
1295     }
1296 
IsEnableForceJitCompileMain()1297     bool IsEnableForceJitCompileMain() const
1298     {
1299         return forceJitCompileMain_;
1300     }
1301 
SetEnableBaselineJIT(bool value)1302     void SetEnableBaselineJIT(bool value)
1303     {
1304         enableBaselineJIT_ = value;
1305     }
1306 
IsEnableBaselineJIT()1307     bool IsEnableBaselineJIT() const
1308     {
1309         return enableBaselineJIT_;
1310     }
1311 
SetBaselineJitHotnessThreshold(uint16_t value)1312     void SetBaselineJitHotnessThreshold(uint16_t value)
1313     {
1314         baselineJitHotnessThreshold_ = value;
1315     }
1316 
GetBaselineJitHotnessThreshold()1317     uint16_t GetBaselineJitHotnessThreshold() const
1318     {
1319         return baselineJitHotnessThreshold_;
1320     }
1321 
SetForceBaselineCompileMain(bool value)1322     void SetForceBaselineCompileMain(bool value)
1323     {
1324         forceBaselineCompileMain_ = value;
1325     }
1326 
IsEnableForceBaselineCompileMain()1327     bool IsEnableForceBaselineCompileMain() const
1328     {
1329         return forceBaselineCompileMain_;
1330     }
1331 
SetEnableNewValueNumbering(bool value)1332     void SetEnableNewValueNumbering(bool value)
1333     {
1334         enableNewValueNumbering_ = value;
1335     }
1336 
IsEnableNewValueNumbering()1337     bool IsEnableNewValueNumbering() const
1338     {
1339         return enableNewValueNumbering_;
1340     }
1341 
SetEnableOptString(bool value)1342     void SetEnableOptString(bool value)
1343     {
1344         enableOptString_ = value;
1345     }
1346 
IsEnableOptString()1347     bool IsEnableOptString() const
1348     {
1349         return enableOptString_;
1350     }
1351 
SetEnableOptInlining(bool value)1352     void SetEnableOptInlining(bool value)
1353     {
1354         enableOptInlining_ = value;
1355     }
1356 
SetEnableEmptyCatchFunction(bool value)1357     void SetEnableEmptyCatchFunction(bool value)
1358     {
1359         enableEmptyCatchFunction_ = value;
1360     }
1361 
IsEnableEmptyCatchFunction()1362     bool IsEnableEmptyCatchFunction() const
1363     {
1364         return enableEmptyCatchFunction_;
1365     }
1366 
IsEnableOptInlining()1367     bool IsEnableOptInlining() const
1368     {
1369         return enableOptInlining_;
1370     }
1371 
SetEnableOptPGOType(bool value)1372     void SetEnableOptPGOType(bool value)
1373     {
1374         enableOptPGOType_ = value;
1375     }
1376 
IsEnableOptPGOType()1377     bool IsEnableOptPGOType() const
1378     {
1379         return enableOptPGOType_;
1380     }
1381 
SetEnableOptTrackField(bool value)1382     void SetEnableOptTrackField(bool value)
1383     {
1384         enableOptTrackField_ = value;
1385     }
1386 
IsEnableOptTrackField()1387     bool IsEnableOptTrackField() const
1388     {
1389         return enableOptTrackField_;
1390     }
1391 
GetCompilerModuleMethods()1392     uint32_t GetCompilerModuleMethods() const
1393     {
1394         return compilerModuleMethods_;
1395     }
1396 
SetCompilerModuleMethods(uint32_t compilerModuleMethods)1397     void SetCompilerModuleMethods(uint32_t compilerModuleMethods)
1398     {
1399         compilerModuleMethods_ = compilerModuleMethods;
1400     }
1401 
SetTraceDeopt(bool value)1402     void SetTraceDeopt(bool value)
1403     {
1404         traceDeopt_ = value;
1405     }
1406 
GetTraceDeopt()1407     bool GetTraceDeopt() const
1408     {
1409         return traceDeopt_;
1410     }
1411 
SetDeoptThreshold(uint8_t value)1412     void SetDeoptThreshold(uint8_t value)
1413     {
1414         deoptThreshold_ = value;
1415     }
1416 
GetDeoptThreshold()1417     uint32_t GetDeoptThreshold() const
1418     {
1419         return deoptThreshold_;
1420     }
1421 
SetStressDeopt(bool value)1422     void SetStressDeopt(bool value)
1423     {
1424         stressDeopt_ = value;
1425     }
1426 
GetStressDeopt()1427     bool GetStressDeopt() const
1428     {
1429         return stressDeopt_;
1430     }
1431 
SetDeviceState(bool value)1432     void SetDeviceState(bool value)
1433     {
1434         deviceIsScreenOff_ = value;
1435     }
1436 
GetDeviceState()1437     bool GetDeviceState() const
1438     {
1439         return deviceIsScreenOff_;
1440     }
1441 
WasSetDeviceState()1442     bool WasSetDeviceState() const
1443     {
1444         return WasOptionSet(OPTION_COMPILER_DEVICE_STATE);
1445     }
1446 
SetOptCodeProfiler(bool value)1447     void SetOptCodeProfiler(bool value)
1448     {
1449         optCodeProfiler_ = value;
1450     }
1451 
GetOptCodeProfiler()1452     bool GetOptCodeProfiler() const
1453     {
1454         return optCodeProfiler_;
1455     }
1456 
SetVerifyVTable(bool value)1457     void SetVerifyVTable(bool value)
1458     {
1459         verifyVTable_ = value;
1460     }
1461 
GetVerifyVTable()1462     bool GetVerifyVTable() const
1463     {
1464         return verifyVTable_;
1465     }
1466 
GetCompilerSelectMethods()1467     std::string GetCompilerSelectMethods() const
1468     {
1469         return compilerSelectMethods_;
1470     }
1471 
SetCompilerSelectMethods(std::string value)1472     void SetCompilerSelectMethods(std::string value)
1473     {
1474         compilerSelectMethods_ = std::move(value);
1475     }
1476 
GetCompilerSkipMethods()1477     std::string GetCompilerSkipMethods() const
1478     {
1479         return compilerSkipMethods_;
1480     }
1481 
SetCompilerSkipMethods(std::string value)1482     void SetCompilerSkipMethods(std::string value)
1483     {
1484         compilerSkipMethods_ = std::move(value);
1485     }
1486 
SetPGOTrace(bool value)1487     void SetPGOTrace(bool value)
1488     {
1489         pgoTrace_ = value;
1490     }
1491 
GetPGOTrace()1492     bool GetPGOTrace() const
1493     {
1494         return pgoTrace_;
1495     }
1496 
SetTraceInline(bool value)1497     void SetTraceInline(bool value)
1498     {
1499         traceInline_ = value;
1500     }
1501 
GetTraceInline()1502     bool GetTraceInline() const
1503     {
1504         return traceInline_;
1505     }
1506 
SetTraceValueNumbering(bool value)1507     void SetTraceValueNumbering(bool value)
1508     {
1509         traceValueNumbering_ = value;
1510     }
1511 
GetTraceValueNumbering()1512     bool GetTraceValueNumbering() const
1513     {
1514         return traceValueNumbering_;
1515     }
1516 
SetTraceJIT(bool value)1517     void SetTraceJIT(bool value)
1518     {
1519         traceJIT_ = value;
1520     }
1521 
GetTraceJIT()1522     bool GetTraceJIT() const
1523     {
1524         return traceJIT_;
1525     }
1526 
SetTraceInstructionCombine(bool value)1527     void SetTraceInstructionCombine(bool value)
1528     {
1529         traceInstructionCombine_ = value;
1530     }
1531 
GetTraceInstructionCombine()1532     bool GetTraceInstructionCombine() const
1533     {
1534         return traceInstructionCombine_;
1535     }
1536 
SetMaxInlineBytecodes(size_t value)1537     void SetMaxInlineBytecodes(size_t value)
1538     {
1539         maxInlineBytecodes_ = value;
1540     }
1541 
GetMaxInlineBytecodes()1542     size_t GetMaxInlineBytecodes()
1543     {
1544         return maxInlineBytecodes_;
1545     }
1546 
SetCompilerFrameworkAbcPath(std::string frameworkAbcPath)1547     void SetCompilerFrameworkAbcPath(std::string frameworkAbcPath)
1548     {
1549         frameworkAbcPath_ = std::move(frameworkAbcPath);
1550     }
1551 
GetCompilerFrameworkAbcPath()1552     std::string GetCompilerFrameworkAbcPath() const
1553     {
1554         return frameworkAbcPath_;
1555     }
1556 
WasSetCompilerFrameworkAbcPath()1557     bool WasSetCompilerFrameworkAbcPath() const
1558     {
1559         return WasOptionSet(OPTION_COMPILER_FRAMEWORK_ABC_PATH);
1560     }
1561 
SetTargetCompilerMode(std::string mode)1562     void SetTargetCompilerMode(std::string mode)
1563     {
1564         targetCompilerMode_ = std::move(mode);
1565     }
1566 
GetTargetCompilerMode()1567     std::string GetTargetCompilerMode() const
1568     {
1569         return targetCompilerMode_;
1570     }
1571 
IsTargetCompilerMode()1572     bool IsTargetCompilerMode() const
1573     {
1574         return IsPartialCompilerMode() || IsFullCompilerMode();
1575     }
1576 
IsPartialCompilerMode()1577     bool IsPartialCompilerMode() const
1578     {
1579         return targetCompilerMode_ == "partial";
1580     }
1581 
IsFullCompilerMode()1582     bool IsFullCompilerMode() const
1583     {
1584         return targetCompilerMode_ == "full";
1585     }
1586 
SetHapPath(std::string path)1587     void SetHapPath(std::string path)
1588     {
1589         hapPath_ = std::move(path);
1590     }
1591 
GetHapPath()1592     std::string GetHapPath() const
1593     {
1594         return hapPath_;
1595     }
1596 
SetHapAbcOffset(uint32_t offset)1597     void SetHapAbcOffset(uint32_t offset)
1598     {
1599         hapAbcOffset_ = offset;
1600     }
1601 
GetHapAbcOffset()1602     uint32_t GetHapAbcOffset() const
1603     {
1604         return hapAbcOffset_;
1605     }
1606 
SetHapAbcSize(uint32_t size)1607     void SetHapAbcSize(uint32_t size)
1608     {
1609         hapAbcSize_ = size;
1610     }
1611 
GetHapAbcSize()1612     uint32_t GetHapAbcSize() const
1613     {
1614         return hapAbcSize_;
1615     }
1616 
SetCompilerNoCheck(bool value)1617     void SetCompilerNoCheck(bool value)
1618     {
1619         compilerNoCheck_ = value;
1620     }
1621 
IsCompilerNoCheck()1622     bool IsCompilerNoCheck() const
1623     {
1624         return compilerNoCheck_;
1625     }
1626 
1627     void SetOptionsForTargetCompilation();
1628 
SetCompilerPipelineHostAOT(bool value)1629     void SetCompilerPipelineHostAOT(bool value)
1630     {
1631         compilerPipelineHostAOT_ = value;
1632     }
1633 
IsCompilerPipelineHostAOT()1634     bool IsCompilerPipelineHostAOT() const
1635     {
1636         return compilerPipelineHostAOT_;
1637     }
1638 
SetFastAOTCompileMode(bool value)1639     void SetFastAOTCompileMode(bool value)
1640     {
1641         fastAOTCompileMode_ = value;
1642     }
1643 
GetFastAOTCompileMode()1644     bool GetFastAOTCompileMode() const
1645     {
1646         return fastAOTCompileMode_;
1647     }
1648 
SetEnableOptLoopPeeling(bool value)1649     void SetEnableOptLoopPeeling(bool value)
1650     {
1651         enableOptLoopPeeling_ = value;
1652     }
1653 
IsEnableOptLoopPeeling()1654     bool IsEnableOptLoopPeeling() const
1655     {
1656         return enableOptLoopPeeling_;
1657     }
1658 
SetEnableOptLoopInvariantCodeMotion(bool value)1659     void SetEnableOptLoopInvariantCodeMotion(bool value)
1660     {
1661         enableOptLoopInvariantCodeMotion_ = value;
1662     }
1663 
IsEnableOptLoopInvariantCodeMotion()1664     bool IsEnableOptLoopInvariantCodeMotion() const
1665     {
1666         return enableOptLoopInvariantCodeMotion_;
1667     }
1668 
IsEnableOptConstantFolding()1669     bool IsEnableOptConstantFolding() const
1670     {
1671         return enableOptConstantFolding_;
1672     }
1673 
SetEnableOptConstantFolding(bool value)1674     void SetEnableOptConstantFolding(bool value)
1675     {
1676         enableOptConstantFolding_ = value;
1677     }
1678 
SetEnableOptOnHeapCheck(bool value)1679     void SetEnableOptOnHeapCheck(bool value)
1680     {
1681         enableOptOnHeapCheck_ = value;
1682     }
1683 
IsEnableOptOnHeapCheck()1684     bool IsEnableOptOnHeapCheck() const
1685     {
1686         return enableOptOnHeapCheck_;
1687     }
1688 
IsEnableLexenvSpecialization()1689     bool IsEnableLexenvSpecialization() const
1690     {
1691         return enableLexenvSpecialization_;
1692     }
1693 
SetEnableLexenvSpecialization(bool value)1694     void SetEnableLexenvSpecialization(bool value)
1695     {
1696         enableLexenvSpecialization_ = value;
1697     }
1698 
IsEnableNativeInline()1699     bool IsEnableNativeInline() const
1700     {
1701         return enableNativeInline_;
1702     }
1703 
SetEnableNativeInline(bool value)1704     void SetEnableNativeInline(bool value)
1705     {
1706         enableNativeInline_ = value;
1707     }
1708 
IsEnableLoweringBuiltin()1709     bool IsEnableLoweringBuiltin() const
1710     {
1711         return enableLoweringBuiltin_;
1712     }
1713 
SetEnableLoweringBuiltin(bool value)1714     void SetEnableLoweringBuiltin(bool value)
1715     {
1716         enableLoweringBuiltin_ = value;
1717     }
1718 
SetCompilerEnableLiteCG(bool value)1719     void SetCompilerEnableLiteCG(bool value)
1720     {
1721         enableLiteCG_ = value;
1722     }
1723 
IsCompilerEnableLiteCG()1724     bool IsCompilerEnableLiteCG() const
1725     {
1726         return enableLiteCG_;
1727     }
1728 
SetTypedOpProfiler(bool value)1729     void SetTypedOpProfiler(bool value)
1730     {
1731         enableTypedOpProfiler_ = value;
1732     }
1733 
GetTypedOpProfiler()1734     bool GetTypedOpProfiler() const
1735     {
1736         return enableTypedOpProfiler_;
1737     }
1738 
IsEnableBranchProfiling()1739     bool IsEnableBranchProfiling() const
1740     {
1741         return enableBranchProfiling_;
1742     }
1743 
SetEnableBranchProfiling(bool value)1744     void SetEnableBranchProfiling(bool value)
1745     {
1746         enableBranchProfiling_ = value;
1747     }
1748 
SetCompilerMethodsRange(arg_list_t * argListStr)1749     void SetCompilerMethodsRange(arg_list_t* argListStr)
1750     {
1751         compileMethodsRange_.first = std::stoull((*argListStr)[0]);
1752         compileMethodsRange_.second = std::stoull((*argListStr)[1]);
1753     }
1754 
GetCompilerMethodsRange()1755     const std::pair<uint32_t, uint32_t>& GetCompilerMethodsRange() const
1756     {
1757         return compileMethodsRange_;
1758     }
1759 
SetCompilerCodegenOptions(arg_list_t argListStr)1760     void SetCompilerCodegenOptions(arg_list_t argListStr)
1761     {
1762         compileCodegenOption_ = std::move(argListStr);
1763     }
1764 
GetCompilerCodegenOptions()1765     const arg_list_t& GetCompilerCodegenOptions() const
1766     {
1767         return compileCodegenOption_;
1768     }
SetOptCodeRange(std::string value)1769     void SetOptCodeRange(std::string value)
1770     {
1771         optBCRange_ = std::move(value);
1772     }
1773 
GetOptCodeRange()1774     std::string GetOptCodeRange() const
1775     {
1776         return optBCRange_;
1777     }
1778 
SetTestAssert(bool value)1779     void SetTestAssert(bool value)
1780     {
1781         testAssert_ = value;
1782     }
1783 
GetTestAssert()1784     bool GetTestAssert() const
1785     {
1786         return testAssert_;
1787     }
1788 
SetEnableEscapeAnalysis(bool value)1789     void SetEnableEscapeAnalysis(bool value)
1790     {
1791         enableEscapeAnalysis_ = value;
1792     }
1793 
IsEnableEscapeAnalysis()1794     bool IsEnableEscapeAnalysis() const
1795     {
1796         return enableEscapeAnalysis_;
1797     }
1798 
SetEnableTraceEscapeAnalysis(bool value)1799     void SetEnableTraceEscapeAnalysis(bool value)
1800     {
1801         traceEscapeAnalysis_ = value;
1802     }
1803 
GetTraceEscapeAnalysis()1804     bool GetTraceEscapeAnalysis() const
1805     {
1806         return traceEscapeAnalysis_;
1807     }
1808 
SetEnableInductionVariableAnalysis(bool value)1809     void SetEnableInductionVariableAnalysis(bool value)
1810     {
1811         enableInductionVariableAnalysis_ = value;
1812     }
1813 
IsEnableInductionVariableAnalysis()1814     bool IsEnableInductionVariableAnalysis() const
1815     {
1816         return enableInductionVariableAnalysis_;
1817     }
1818 
SetEnableTraceInductionVariableAnalysis(bool value)1819     void SetEnableTraceInductionVariableAnalysis(bool value)
1820     {
1821         traceInductionVariableAnalysis_ = value;
1822     }
1823 
GetTraceInductionVariableAnalysis()1824     bool GetTraceInductionVariableAnalysis() const
1825     {
1826         return traceInductionVariableAnalysis_;
1827     }
1828 
SetEnableMemoryAnalysis(bool value)1829     void SetEnableMemoryAnalysis(bool value)
1830     {
1831         enableMemoryAnalysis_ = value;
1832     }
1833 
IsEnableMemoryAnalysis()1834     bool IsEnableMemoryAnalysis() const
1835     {
1836         return enableMemoryAnalysis_;
1837     }
1838 
SetCheckPgoVersion(bool value)1839     void SetCheckPgoVersion(bool value)
1840     {
1841         checkPgoVersion_ = value;
1842     }
1843 
IsCheckPgoVersion()1844     bool IsCheckPgoVersion() const
1845     {
1846         return checkPgoVersion_;
1847     }
1848 
SetEnableJITPGO(bool value)1849     void SetEnableJITPGO(bool value)
1850     {
1851         enableJITPGO_ = value;
1852     }
1853 
IsEnableJITPGO()1854     bool IsEnableJITPGO() const
1855     {
1856         return enableJITPGO_;
1857     }
1858 
SetEnableProfileDump(bool value)1859     void SetEnableProfileDump(bool value)
1860     {
1861         enableProfileDump_ = value;
1862     }
1863 
IsEnableProfileDump()1864     bool IsEnableProfileDump() const
1865     {
1866         return enableProfileDump_;
1867     }
1868 
SetEnableAOTPGO(bool value)1869     void SetEnableAOTPGO(bool value)
1870     {
1871         enableAOTPGO_ = value;
1872     }
1873 
IsEnableAOTPGO()1874     bool IsEnableAOTPGO() const
1875     {
1876         return enableAOTPGO_;
1877     }
1878 
SetEnableJitFastCompile(bool value)1879     void SetEnableJitFastCompile(bool value)
1880     {
1881         enableJitFastCompile_ = value;
1882     }
1883 
IsEnableJitFastCompile()1884     bool IsEnableJitFastCompile() const
1885     {
1886         return enableJitFastCompile_;
1887     }
1888 
SetEnableFrameworkAOT(bool value)1889     void SetEnableFrameworkAOT(bool value)
1890     {
1891         enableFrameworkAOT_ = value;
1892     }
1893 
IsEnableFrameworkAOT()1894     bool IsEnableFrameworkAOT() const
1895     {
1896         return enableFrameworkAOT_;
1897     }
1898 
SetAsyncLoadAbc(bool value)1899     void SetAsyncLoadAbc(bool value)
1900     {
1901         asyncLoadAbc_ = value;
1902     }
1903 
IsAsyncLoadAbc()1904     bool IsAsyncLoadAbc() const
1905     {
1906         return asyncLoadAbc_;
1907     }
1908 
SetAsyncLoadAbcTest(bool value)1909     void SetAsyncLoadAbcTest(bool value)
1910     {
1911         asyncLoadAbcTest_ = value;
1912     }
1913 
IsAsyncLoadAbcTest()1914     bool IsAsyncLoadAbcTest() const
1915     {
1916         return asyncLoadAbcTest_;
1917     }
1918 
IsPgoForceDump()1919     bool IsPgoForceDump() const
1920     {
1921         return forceDump_;
1922     }
1923 
SetPgoForceDump(bool value)1924     void SetPgoForceDump(bool value)
1925     {
1926         forceDump_ = value;
1927     }
1928 
SetConcurrentCompile(bool value)1929     void SetConcurrentCompile(bool value)
1930     {
1931         concurrentCompile = value;
1932     }
1933 
IsConcurrentCompile()1934     bool IsConcurrentCompile() const
1935     {
1936         return concurrentCompile;
1937     }
1938 
SetAOTHasException(bool value)1939     void SetAOTHasException(bool value)
1940     {
1941         aotHasException_ = value;
1942     }
1943 
GetAOTHasException()1944     bool GetAOTHasException() const
1945     {
1946         return aotHasException_;
1947     }
1948 public:
1949     static constexpr int32_t MAX_APP_COMPILE_METHOD_SIZE = 4_KB;
1950 
1951 private:
1952 
StartsWith(const std::string & haystack,const std::string & needle)1953     static bool StartsWith(const std::string& haystack, const std::string& needle)
1954     {
1955         return std::equal(needle.begin(), needle.end(), haystack.begin());
1956     }
1957 
WasSet(int option)1958     void WasSet(int option)
1959     {
1960         if (option < OPTION_SPLIT_ONE) {
1961             wasSetPartOne_ |= (1ULL << static_cast<uint64_t>(option));
1962         } else if (option < OPTION_SPLIT_TWO) {
1963             wasSetPartTwo_ |= (1ULL << static_cast<uint64_t>(option - OPTION_SPLIT_ONE));
1964         } else {
1965             wasSetPartThree_ |= (1ULL << static_cast<uint64_t>(option - OPTION_SPLIT_TWO));
1966         }
1967     }
1968 
WasOptionSet(int option)1969     bool WasOptionSet(int option) const
1970     {
1971         if (option < OPTION_SPLIT_ONE) {
1972             return ((1ULL << static_cast<uint64_t>(option)) & wasSetPartOne_) != 0;
1973         } else if (option < OPTION_SPLIT_TWO) {
1974             return ((1ULL << static_cast<uint64_t>(option - OPTION_SPLIT_ONE)) & wasSetPartTwo_) != 0;
1975         }
1976         return ((1ULL << static_cast<uint64_t>(option - OPTION_SPLIT_TWO)) & wasSetPartThree_) != 0;
1977     }
1978 
1979     bool ParseBoolParam(bool* argBool);
1980     bool ParseDoubleParam(const std::string& option, double* argDouble);
1981     bool ParseIntParam(const std::string& option, int* argInt);
1982     bool ParseUint32Param(const std::string& option, uint32_t* argUInt32);
1983     bool ParseUint64Param(const std::string& option, uint64_t* argUInt64);
1984     void ParseListArgParam(const std::string& option, arg_list_t* argListStr, std::string delimiter);
1985 
1986     bool enableArkTools_ {true};
1987     bool openArkTools_ {false};
1988     std::string stubFile_ {"stub.an"};
1989     std::string compilerPkgInfo_ {};
1990     std::string compilerExternalPkgInfo_ {};
1991     bool compilerEnableExternalPkg_ {true};
1992     bool enableForceGc_ {true};
1993     bool enableEdenGC_ {false};
1994     bool forceFullGc_ {true};
1995     uint32_t forceSharedGc_ {1};
1996     int arkProperties_ = GetDefaultProperties();
1997     std::string arkBundleName_ = {""};
1998     size_t heapSize_ = {0};
1999     uint32_t gcThreadNum_ {7}; // 7: default thread num
2000     uint32_t longPauseTime_ {40}; // 40: default pause time
2001     std::string aotOutputFile_ {""};
2002     std::string targetTriple_ {TARGET_X64};
2003     uint32_t asmOptLevel_ {2};
2004     uint32_t relocationMode_ {2}; // 2: default relocation mode
2005     uint32_t maxNonmovableSpaceCapacity_ {4_MB};
2006     bool enableAsmInterpreter_ {true};
2007     bool enableBuiltinsLazy_ {true};
2008     std::string asmOpcodeDisableRange_ {""};
2009     AsmInterParsedOption asmInterParsedOption_;
2010     uint64_t serializerBufferSizeLimit_ {2_GB};
2011     uint32_t heapSizeLimit_ {512_MB};
2012     bool enableIC_ {true};
2013     std::string icuDataPath_ {"default"};
2014     bool startupTime_ {false};
2015     std::string compilerLogOpt_ {"none"};
2016     std::string compilerLogMethods_ {"none"};
2017     bool compilerLogSnapshot_ {false};
2018     bool compilerLogTime_ {false};
2019     bool enableRuntimeStat_ {false};
2020     bool isWorker_ {false};
2021     bool isRestrictedWorker_ {false};
2022     bool traceBc_ {false};
2023     std::string logLevel_ {"error"};
2024     arg_list_t logDebug_ {{"all"}};
2025     arg_list_t logInfo_ {{"all"}};
2026     arg_list_t logWarning_ {{"all"}};
2027     arg_list_t logError_ {{"all"}};
2028     arg_list_t logFatal_ {{"all"}};
2029     arg_list_t logComponents_ {{"all"}};
2030     bool enableAOT_ {false};
2031     uint32_t maxAotMethodSize_ {32_KB};
2032     double typeThreshold_ {-1};
2033     std::string entryPoint_ {"_GLOBAL::func_main_0"};
2034     bool mergeAbc_ {false};
2035     bool enableArrayBoundsCheckElimination_ {false};
2036     bool enableFrameStateElimination_ {true};
2037     bool enableTypeLowering_ {true};
2038     bool enableEarlyElimination_ {true};
2039     bool enableLaterElimination_ {true};
2040     bool enableValueNumbering_ {true};
2041     bool enableOptString_ {true};
2042     bool enableElementsKind_ {false};
2043     bool enableInstrcutionCombine {true};
2044     bool enableNewValueNumbering_ {true};
2045     bool enableOptInlining_ {true};
2046     bool enableEmptyCatchFunction_ {false};
2047     bool enableOptPGOType_ {true};
2048     bool enableFastJIT_ {false};
2049     bool enableAPPJIT_ {false};
2050     bool isEnableJitDfxDump_ {false};
2051     bool enableOSR_ {false};
2052     uint16_t jitHotnessThreshold_ {2};
2053     uint8_t jitCallThreshold_ {0};
2054     uint16_t osrHotnessThreshold_ {2};
2055     bool forceJitCompileMain_ {false};
2056     bool enableBaselineJIT_ {false};
2057     uint16_t baselineJitHotnessThreshold_ {1};
2058     bool forceBaselineCompileMain_ {false};
2059     bool enableOptTrackField_ {true};
2060     uint32_t compilerModuleMethods_ {100};
2061     uint64_t wasSetPartOne_ {0};
2062     uint64_t wasSetPartTwo_ {0};
2063     uint64_t wasSetPartThree_ {0};
2064     bool enableContext_ {false};
2065     bool enablePrintExecuteTime_ {false};
2066     bool enablePGOProfiler_ {false};
2067     bool enableJITPGO_ {true};
2068     bool enableAOTPGO_ {true};
2069     bool enableProfileDump_ {true};
2070     bool enableFrameworkAOT_ {false};
2071     uint32_t pgoHotnessThreshold_ {1};
2072     std::string pgoProfilerPath_ {""};
2073     uint32_t pgoSaveMinInterval_ {30};
2074     bool traceDeopt_ {false};
2075     uint8_t deoptThreshold_ {10};
2076     bool stressDeopt_ {false};
2077     bool deviceIsScreenOff_ {true};
2078     bool optCodeProfiler_ {false};
2079     bool startGlobalLeakCheck_ {false};
2080     bool verifyVTable_ {false};
2081     std::string compilerSelectMethods_ {""};
2082     std::string compilerSkipMethods_ {""};
2083     bool pgoTrace_ {false};
2084     bool traceInline_ {false};
2085     bool traceJIT_ {false};
2086     bool traceValueNumbering_ {false};
2087     bool traceInstructionCombine_ {false};
2088     bool compilerPipelineHostAOT_ {false};
2089     size_t maxInlineBytecodes_ {45};
2090     std::string targetCompilerMode_ {""};
2091     std::string frameworkAbcPath_ {""};
2092     std::string hapPath_ {""};
2093     uint32_t hapAbcOffset_ {0};
2094     uint32_t hapAbcSize_ {0};
2095     std::string optBCRange_ {""};
2096     bool compilerNoCheck_ {false};
2097     bool fastAOTCompileMode_ {false};
2098     bool enableOptLoopPeeling_ {true};
2099     bool enableOptConstantFolding_ {true};
2100     bool enableOptOnHeapCheck_ {true};
2101     bool enableOptLoopInvariantCodeMotion_ {false};
2102     bool enableLexenvSpecialization_ {false};
2103     bool enableNativeInline_ {true};
2104     bool enableLoweringBuiltin_ {true};
2105     bool enableLiteCG_ {false};
2106     bool enableTypedOpProfiler_ {false};
2107     bool enableBranchProfiling_ {true};
2108     bool testAssert_ {false};
2109     std::pair<uint32_t, uint32_t> compileMethodsRange_ {0, UINT32_MAX};
2110     arg_list_t compileCodegenOption_ {{""}};
2111     bool enableEscapeAnalysis_ {false};
2112     bool traceEscapeAnalysis_ {false};
2113     bool enableInductionVariableAnalysis_ {false};
2114     bool traceInductionVariableAnalysis_ {false};
2115     bool enableMemoryAnalysis_ {true};
2116     bool checkPgoVersion_ {false};
2117     bool enableJitFastCompile_ {false};
2118     bool enableJitFrame_ {false};
2119     bool disableCodeSign_ {true};
2120     bool enableJitFort_ {true};
2121     bool enableAsyncCopyToFort_ {true};
2122     bool enableBaselinePgo_ {false};
2123     bool asyncLoadAbc_ {true};
2124     bool asyncLoadAbcTest_ {false};
2125     bool forceDump_ {true};
2126     bool concurrentCompile {true};
2127     bool aotHasException_ {false};
2128 };
2129 } // namespace panda::ecmascript
2130 
2131 #endif // ECMASCRIPT_JS_RUNTIME_OPTIONS_H_
2132