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_THERMAL_LEVEL,
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_LAST,
201     OPTION_COMPILER_OPT_INDUCTION_VARIABLE,
202     OPTION_COMPILER_TRACE_INDUCTION_VARIABLE,
203     OPTION_COMPILER_ENABLE_BASELINEJIT,
204     OPTION_COMPILER_BASELINEJIT_HOTNESS_THRESHOLD,
205     OPTION_COMPILER_FORCE_BASELINEJIT_COMPILE_MAIN,
206     OPTION_ENABLE_AOT_CRASH_ESCAPE,
207     OPTION_COMPILER_ENABLE_JIT_FAST_COMPILE,
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_COMPILER_ENABLE_CONCURRENT,
215     OPTION_COMPILER_OPT_STRING,
216     OPTION_OPEN_ARK_TOOLS,
217     OPTION_COMPILER_OPT_FRAME_STATE_ELIMINATION,
218     OPTION_ENABLE_FORCE_IC,
219     OPTION_COMPILER_ENABLE_PGO_SPACE,
220 };
221 static_assert(OPTION_SPLIT_ONE == 64); // add new option at the bottom, DO NOT modify this value
222 static_assert(OPTION_SPLIT_TWO == 128); // add new option at the bottom, DO NOT modify this value
223 
224 class PUBLIC_API JSRuntimeOptions {
225 public:
JSRuntimeOptions()226     JSRuntimeOptions() {}
227     ~JSRuntimeOptions() = default;
228     DEFAULT_COPY_SEMANTIC(JSRuntimeOptions);
229     DEFAULT_MOVE_SEMANTIC(JSRuntimeOptions);
230 
231     bool ParseCommand(const int argc, const char** argv);
232     bool SetDefaultValue(char* argv);
233 
EnableArkTools() const234     bool EnableArkTools() const
235     {
236         return (enableArkTools_) || ((static_cast<uint32_t>(arkProperties_) & ArkProperties::ENABLE_ARKTOOLS) != 0);
237     }
238 
SetEnableArkTools(bool value)239     void SetEnableArkTools(bool value)
240     {
241         enableArkTools_ = value;
242     }
243 
WasSetEnableArkTools() const244     bool WasSetEnableArkTools() const
245     {
246         return WasOptionSet(OPTION_ENABLE_ARK_TOOLS);
247     }
248 
IsOpenArkTools() const249     bool IsOpenArkTools() const
250     {
251         return openArkTools_;
252     }
253 
SetOpenArkTools(bool value)254     void SetOpenArkTools(bool value)
255     {
256         openArkTools_ = value;
257     }
258 
WasSetOpenArkTools() const259     bool WasSetOpenArkTools() const
260     {
261         return WasOptionSet(OPTION_OPEN_ARK_TOOLS);
262     }
263 
IsEnableRuntimeStat() const264     bool IsEnableRuntimeStat() const
265     {
266         return enableRuntimeStat_;
267     }
268 
SetEnableRuntimeStat(bool value)269     void SetEnableRuntimeStat(bool value)
270     {
271         enableRuntimeStat_ = value;
272     }
273 
WasSetEnableRuntimeStat() const274     bool WasSetEnableRuntimeStat() const
275     {
276         return WasOptionSet(OPTION_ENABLE_RUNTIME_STAT);
277     }
278 
GetStubFile() const279     std::string GetStubFile() const
280     {
281         return stubFile_;
282     }
283 
SetStubFile(std::string value)284     void SetStubFile(std::string value)
285     {
286         stubFile_ = std::move(value);
287     }
288 
SetCompilerPkgJsonInfo(std::string pkgJsonInfo)289     void SetCompilerPkgJsonInfo(std::string pkgJsonInfo)
290     {
291         compilerPkgInfo_ = std::move(pkgJsonInfo);
292     }
293 
GetCompilerPkgJsonInfo() const294     const std::string& GetCompilerPkgJsonInfo() const
295     {
296         return compilerPkgInfo_;
297     }
298 
SetCompilerExternalPkgJsonInfo(std::string pkgJsonInfo)299     void SetCompilerExternalPkgJsonInfo(std::string pkgJsonInfo)
300     {
301         compilerExternalPkgInfo_ = std::move(pkgJsonInfo);
302     }
303 
GetCompilerExternalPkgJsonInfo() const304     const std::string& GetCompilerExternalPkgJsonInfo() const
305     {
306         return compilerExternalPkgInfo_;
307     }
308 
SetCompilerEnableExternalPkg(bool compilerEnableExternalPkg)309     void SetCompilerEnableExternalPkg(bool compilerEnableExternalPkg)
310     {
311         compilerEnableExternalPkg_ = compilerEnableExternalPkg;
312     }
313 
GetCompilerEnableExternalPkg() const314     bool GetCompilerEnableExternalPkg() const
315     {
316         return compilerEnableExternalPkg_;
317     }
318 
WasStubFileSet() const319     bool WasStubFileSet() const
320     {
321         return WasOptionSet(OPTION_STUB_FILE);
322     }
323 
SetEnableAOT(bool value)324     void SetEnableAOT(bool value)
325     {
326         enableAOT_ = value;
327     }
328 
GetEnableAOT() const329     bool GetEnableAOT() const
330     {
331         return enableAOT_;
332     }
333 
GetAOTOutputFile() const334     std::string GetAOTOutputFile() const
335     {
336         return aotOutputFile_;
337     }
338 
SetAOTOutputFile(const std::string& value)339     void SetAOTOutputFile(const std::string& value)
340     {
341         aotOutputFile_ = panda::os::file::File::GetExtendedFilePath(value);
342     }
343 
WasAOTOutputFileSet() const344     bool WasAOTOutputFileSet() const
345     {
346         return WasOptionSet(OPTION_AOT_FILE);
347     }
348 
GetTargetTriple() const349     std::string GetTargetTriple() const
350     {
351         return targetTriple_;
352     }
353 
SetTargetTriple(std::string value)354     void SetTargetTriple(std::string value)
355     {
356         targetTriple_ = std::move(value);
357     }
358 
GetOptLevel() const359     size_t GetOptLevel() const
360     {
361         return asmOptLevel_;
362     }
363 
SetOptLevel(size_t value)364     void SetOptLevel(size_t value)
365     {
366         asmOptLevel_ = value;
367     }
368 
GetRelocMode() const369     size_t GetRelocMode() const
370     {
371         return relocationMode_;
372     }
373 
SetRelocMode(size_t value)374     void SetRelocMode(size_t value)
375     {
376         relocationMode_ = value;
377     }
378 
EnableForceGC() const379     bool EnableForceGC() const
380     {
381         return enableForceGc_;
382     }
383 
SetEnableForceGC(bool value)384     void SetEnableForceGC(bool value)
385     {
386         enableForceGc_ = value;
387     }
388 
EnableEdenGC() const389     bool EnableEdenGC() const
390     {
391         return enableEdenGC_;
392     }
393 
SetEnableEdenGC(bool value)394     void SetEnableEdenGC(bool value)
395     {
396         enableEdenGC_ = value;
397     }
398 
ForceFullGC() const399     bool ForceFullGC() const
400     {
401         return forceFullGc_;
402     }
403 
SetForceFullGC(bool value)404     void SetForceFullGC(bool value)
405     {
406         forceFullGc_ = value;
407     }
408 
SetForceSharedGCFrequency(size_t frequency)409     void SetForceSharedGCFrequency(size_t frequency)
410     {
411         forceSharedGc_ = frequency;
412     }
413 
GetForceSharedGCFrequency() const414     uint32_t GetForceSharedGCFrequency() const
415     {
416         return forceSharedGc_;
417     }
418 
SetGcThreadNum(size_t num)419     void SetGcThreadNum(size_t num)
420     {
421         gcThreadNum_ = num;
422     }
423 
GetGcThreadNum() const424     size_t GetGcThreadNum() const
425     {
426         return gcThreadNum_;
427     }
428 
SetLongPauseTime(size_t time)429     void SetLongPauseTime(size_t time)
430     {
431         longPauseTime_ = time;
432     }
433 
GetLongPauseTime() const434     size_t GetLongPauseTime() const
435     {
436         return longPauseTime_;
437     }
438 
SetArkProperties(int prop)439     void SetArkProperties(int prop)
440     {
441         if (prop != ArkProperties::DEFAULT) {
442             arkProperties_ = prop;
443         }
444     }
445 
SetArkBundleName(std::string bundleName)446     void SetArkBundleName(std::string bundleName)
447     {
448         if (bundleName != "") {
449             arkBundleName_ = bundleName;
450         }
451     }
452 
SetMemConfigProperty(std::string configProperty)453     void SetMemConfigProperty(std::string configProperty)
454     {
455         if (configProperty != "") {
456             std::string key;
457             std::string value;
458             for (char c: configProperty) {
459                 if (isdigit(c)) {
460                     value += c;
461                 } else {
462                     key += c;
463                 }
464             }
465             if (key == "jsHeap") {
466                 heapSize_ = static_cast<size_t>(stoi(value)) * 1_MB;
467             }
468             if (key == "openArkTools") {
469                 openArkTools_ = true;
470             }
471         }
472     }
473 
GetHeapSize() const474     size_t GetHeapSize() const
475     {
476         return heapSize_;
477     }
478 
GetDefaultProperties()479     int GetDefaultProperties()
480     {
481         return ArkProperties::PARALLEL_GC | ArkProperties::CONCURRENT_MARK | ArkProperties::CONCURRENT_SWEEP |
482                ArkProperties::ENABLE_ARKTOOLS | ArkProperties::ENABLE_IDLE_GC;
483     }
484 
GetArkProperties()485     int GetArkProperties()
486     {
487         return arkProperties_;
488     }
489 
GetArkBundleName() const490     std::string GetArkBundleName() const
491     {
492         return arkBundleName_;
493     }
494 
EnableOptionalLog() const495     bool EnableOptionalLog() const
496     {
497         return (static_cast<uint32_t>(arkProperties_) & ArkProperties::OPTIONAL_LOG) != 0;
498     }
499 
EnableGCStatsPrint() const500     bool EnableGCStatsPrint() const
501     {
502         return (static_cast<uint32_t>(arkProperties_) & ArkProperties::GC_STATS_PRINT) != 0;
503     }
504 
EnableParallelGC() const505     bool EnableParallelGC() const
506     {
507         return (static_cast<uint32_t>(arkProperties_) & ArkProperties::PARALLEL_GC) != 0;
508     }
509 
EnableConcurrentMark() const510     bool EnableConcurrentMark() const
511     {
512         return (static_cast<uint32_t>(arkProperties_) & ArkProperties::CONCURRENT_MARK) != 0;
513     }
514 
EnableSharedConcurrentMark() const515     bool EnableSharedConcurrentMark() const
516     {
517         // Use DISABLE to adapt to the exsiting ArkProperties in testing scripts.
518         return (static_cast<uint32_t>(arkProperties_) & ArkProperties::DISABLE_SHARED_CONCURRENT_MARK) == 0;
519     }
520 
EnableExceptionBacktrace() const521     bool EnableExceptionBacktrace() const
522     {
523         return (static_cast<uint32_t>(arkProperties_) & ArkProperties::EXCEPTION_BACKTRACE) != 0;
524     }
525 
EnableConcurrentSweep() const526     bool EnableConcurrentSweep() const
527     {
528         return (static_cast<uint32_t>(arkProperties_) & ArkProperties::CONCURRENT_SWEEP) != 0;
529     }
530 
EnableThreadCheck() const531     bool EnableThreadCheck() const
532     {
533         return (static_cast<uint32_t>(arkProperties_) & ArkProperties::THREAD_CHECK) != 0;
534     }
535 
EnableIdleGC() const536     bool EnableIdleGC() const
537     {
538         return false;
539     }
540 
EnableGCTracer() const541     bool EnableGCTracer() const
542     {
543         return (static_cast<uint32_t>(arkProperties_) & ArkProperties::ENABLE_GC_TRACER) != 0;
544     }
545 
EnableGlobalObjectLeakCheck() const546     bool EnableGlobalObjectLeakCheck() const
547     {
548         return (static_cast<uint32_t>(arkProperties_) & ArkProperties::GLOBAL_OBJECT_LEAK_CHECK) != 0;
549     }
550 
EnableGlobalPrimitiveLeakCheck() const551     bool EnableGlobalPrimitiveLeakCheck() const
552     {
553         return (static_cast<uint32_t>(arkProperties_) & ArkProperties::GLOBAL_PRIMITIVE_LEAK_CHECK) != 0;
554     }
555 
EnableGlobalLeakCheck() const556     bool EnableGlobalLeakCheck() const
557     {
558         return EnableGlobalObjectLeakCheck() || EnableGlobalPrimitiveLeakCheck();
559     }
560 
EnableCpuProfilerColdStartMainThread() const561     bool EnableCpuProfilerColdStartMainThread() const
562     {
563         return (static_cast<uint32_t>(arkProperties_) & ArkProperties::CPU_PROFILER_COLD_START_MAIN_THREAD) != 0;
564     }
565 
EnableCpuProfilerColdStartWorkerThread() const566     bool EnableCpuProfilerColdStartWorkerThread() const
567     {
568         return (static_cast<uint32_t>(arkProperties_) & ArkProperties::CPU_PROFILER_COLD_START_WORKER_THREAD) != 0;
569     }
570 
EnableCpuProfilerAnyTimeMainThread() const571     bool EnableCpuProfilerAnyTimeMainThread() const
572     {
573         return (static_cast<uint32_t>(arkProperties_) & ArkProperties::CPU_PROFILER_ANY_TIME_MAIN_THREAD) != 0;
574     }
575 
EnableCpuProfilerAnyTimeWorkerThread() const576     bool EnableCpuProfilerAnyTimeWorkerThread() const
577     {
578         return (static_cast<uint32_t>(arkProperties_) & ArkProperties::CPU_PROFILER_ANY_TIME_WORKER_THREAD) != 0;
579     }
580 
EnableCpuProfilerVMTag() const581     bool EnableCpuProfilerVMTag() const
582     {
583         return (static_cast<uint32_t>(arkProperties_) & ArkProperties::ENABLE_CPU_PROFILER_VM_TAG) != 0;
584     }
585 
IsStartGlobalLeakCheck() const586     bool IsStartGlobalLeakCheck() const
587     {
588         return startGlobalLeakCheck_;
589     }
590 
SwitchStartGlobalLeakCheck()591     void SwitchStartGlobalLeakCheck()
592     {
593         startGlobalLeakCheck_ = !startGlobalLeakCheck_;
594     }
595 
EnableSnapshotSerialize() const596     bool EnableSnapshotSerialize() const
597     {
598         return (static_cast<uint32_t>(arkProperties_) & ArkProperties::ENABLE_SNAPSHOT_SERIALIZE) != 0;
599     }
600 
EnableSnapshotDeserialize() const601     bool EnableSnapshotDeserialize() const
602     {
603         if (WIN_OR_MAC_OR_IOS_PLATFORM) {
604             return false;
605         }
606 
607         return (static_cast<uint32_t>(arkProperties_) & ArkProperties::ENABLE_SNAPSHOT_DESERIALIZE) != 0;
608     }
609 
EnableHeapVerify() const610     bool EnableHeapVerify() const
611     {
612         return (static_cast<uint32_t>(arkProperties_) & ArkProperties::ENABLE_HEAP_VERIFY) != 0;
613     }
614 
EnableMicroJobTrace() const615     bool EnableMicroJobTrace() const
616     {
617         return (static_cast<uint32_t>(arkProperties_) & ArkProperties::ENABLE_MICROJOB_TRACE) != 0;
618     }
619 
EnableESMTrace() const620     bool EnableESMTrace() const
621     {
622         return (static_cast<uint32_t>(arkProperties_) & ArkProperties::ENABLE_ESM_TRACE) != 0;
623     }
624 
EnableModuleLog() const625     bool EnableModuleLog() const
626     {
627         return (static_cast<uint32_t>(arkProperties_) & ArkProperties::ENABLE_MODULE_LOG) != 0;
628     }
629 
EnableSerializationTimeoutCheck() const630     bool EnableSerializationTimeoutCheck() const
631     {
632         return (static_cast<uint32_t>(arkProperties_) & ArkProperties::ENABLE_SERIALIZATION_TIMEOUT_CHECK) != 0;
633     }
634 
WasSetMaxNonmovableSpaceCapacity() const635     bool WasSetMaxNonmovableSpaceCapacity() const
636     {
637         return WasOptionSet(OPTION_MAX_UNMOVABLE_SPACE);
638     }
639 
MaxNonmovableSpaceCapacity() const640     size_t MaxNonmovableSpaceCapacity() const
641     {
642         return maxNonmovableSpaceCapacity_;
643     }
644 
SetMaxNonmovableSpaceCapacity(uint32_t value)645     void SetMaxNonmovableSpaceCapacity(uint32_t value)
646     {
647         maxNonmovableSpaceCapacity_ = value;
648     }
649 
SetEnableAsmInterpreter(bool value)650     void SetEnableAsmInterpreter(bool value)
651     {
652         enableAsmInterpreter_ = value;
653     }
654 
GetEnableAsmInterpreter() const655     bool GetEnableAsmInterpreter() const
656     {
657         return enableAsmInterpreter_;
658     }
659 
SetEnableBuiltinsLazy(bool value)660     void SetEnableBuiltinsLazy(bool value)
661     {
662         enableBuiltinsLazy_ = value;
663     }
664 
GetEnableBuiltinsLazy() const665     bool GetEnableBuiltinsLazy() const
666     {
667         return enableBuiltinsLazy_;
668     }
669 
SetAsmOpcodeDisableRange(std::string value)670     void SetAsmOpcodeDisableRange(std::string value)
671     {
672         asmOpcodeDisableRange_ = std::move(value);
673     }
674 
SetDisableCodeSign(bool value)675     void SetDisableCodeSign(bool value)
676     {
677         disableCodeSign_ = value;
678     }
679 
GetDisableCodeSign() const680     bool GetDisableCodeSign() const
681     {
682         return disableCodeSign_;
683     }
684 
SetEnableJitFort(bool value)685     void SetEnableJitFort(bool value)
686     {
687         enableJitFort_ = value;
688     }
689 
GetEnableJitFort() const690     bool GetEnableJitFort() const
691     {
692         return enableJitFort_;
693     }
694 
SetEnableAsyncCopyToFort(bool value)695     void SetEnableAsyncCopyToFort(bool value)
696     {
697         enableAsyncCopyToFort_ = value;
698     }
699 
GetEnableAsyncCopyToFort() const700     bool GetEnableAsyncCopyToFort() const
701     {
702         return enableAsyncCopyToFort_;
703     }
704 
ParseAsmInterOption()705     void ParseAsmInterOption()
706     {
707         asmInterParsedOption_.enableAsm = enableAsmInterpreter_;
708         std::string strAsmOpcodeDisableRange = asmOpcodeDisableRange_;
709         if (strAsmOpcodeDisableRange.empty()) {
710             return;
711         }
712 
713         // asm interpreter handle disable range
714         size_t pos = strAsmOpcodeDisableRange.find(",");
715         if (pos != std::string::npos) {
716             std::string strStart = strAsmOpcodeDisableRange.substr(0, pos);
717             std::string strEnd = strAsmOpcodeDisableRange.substr(pos + 1);
718             int64_t inputStart;
719             int64_t inputEnd;
720             if (!base::NumberHelper::StringToInt64(strStart, inputStart)) {
721                 inputStart = 0;
722                 LOG_ECMA_IF(!strStart.empty(), INFO) << "when get start, strStart is " << strStart;
723             }
724             if (!base::NumberHelper::StringToInt64(strEnd, inputEnd)) {
725                 inputEnd = kungfu::BYTECODE_STUB_END_ID;
726                 LOG_ECMA_IF(!strEnd.empty(), INFO) << "when get end, strEnd is " << strEnd;
727             }
728             int start = static_cast<int>(inputStart);
729             int end = static_cast<int>(inputEnd);
730             if (start >= 0 && start < kungfu::BytecodeStubCSigns::NUM_OF_ALL_NORMAL_STUBS && end >= 0 &&
731                 end < kungfu::BytecodeStubCSigns::NUM_OF_ALL_NORMAL_STUBS && start <= end) {
732                 asmInterParsedOption_.handleStart = start;
733                 asmInterParsedOption_.handleEnd = end;
734             }
735         }
736     }
737 
GetAsmInterParsedOption() const738     AsmInterParsedOption GetAsmInterParsedOption() const
739     {
740         return asmInterParsedOption_;
741     }
742 
GetCompilerLogOption() const743     std::string GetCompilerLogOption() const
744     {
745         return compilerLogOpt_;
746     }
747 
SetCompilerLogOption(std::string value)748     void SetCompilerLogOption(std::string value)
749     {
750         compilerLogOpt_ = std::move(value);
751     }
752 
WasSetCompilerLogOption() const753     bool WasSetCompilerLogOption() const
754     {
755         return WasOptionSet(OPTION_COMPILER_LOG_OPT) && GetCompilerLogOption().find("none") == std::string::npos;
756     }
757 
GetMethodsListForLog() const758     std::string GetMethodsListForLog() const
759     {
760         return compilerLogMethods_;
761     }
762 
SetMethodsListForLog(std::string value)763     void SetMethodsListForLog(std::string value)
764     {
765         compilerLogMethods_ = std::move(value);
766     }
767 
WasSetMethodsListForLog() const768     bool WasSetMethodsListForLog() const
769     {
770         return WasOptionSet(OPTION_COMPILER_LOG_METHODS) && GetCompilerLogOption().find("none") == std::string::npos &&
771                GetCompilerLogOption().find("all") == std::string::npos;
772     }
773 
SetCompilerLogSnapshot(bool value)774     void SetCompilerLogSnapshot(bool value)
775     {
776         compilerLogSnapshot_ = value;
777     }
778 
IsEnableCompilerLogSnapshot() const779     bool IsEnableCompilerLogSnapshot() const
780     {
781         return compilerLogSnapshot_;
782     }
783 
WasSetCompilerLogSnapshot() const784     bool WasSetCompilerLogSnapshot() const
785     {
786         return WasOptionSet(OPTION_COMPILER_LOG_SNAPSHOT);
787     }
788 
SetCompilerLogTime(bool value)789     void SetCompilerLogTime(bool value)
790     {
791         compilerLogTime_ = value;
792     }
793 
IsEnableCompilerLogTime() const794     bool IsEnableCompilerLogTime() const
795     {
796         return compilerLogTime_;
797     }
798 
WasSetCompilerLogTime() const799     bool WasSetCompilerLogTime() const
800     {
801         return WasOptionSet(OPTION_COMPILER_LOG_TIME);
802     }
803 
GetSerializerBufferSizeLimit() const804     uint64_t GetSerializerBufferSizeLimit() const
805     {
806         return serializerBufferSizeLimit_;
807     }
808 
SetSerializerBufferSizeLimit(uint64_t value)809     void SetSerializerBufferSizeLimit(uint64_t value)
810     {
811         serializerBufferSizeLimit_ = value;
812     }
813 
GetHeapSizeLimit() const814     uint32_t GetHeapSizeLimit() const
815     {
816         return heapSizeLimit_;
817     }
818 
SetHeapSizeLimit(uint32_t value)819     void SetHeapSizeLimit(uint32_t value)
820     {
821         heapSizeLimit_ = value;
822     }
823 
WasSetHeapSizeLimit() const824     bool WasSetHeapSizeLimit() const
825     {
826         return WasOptionSet(OPTION_HEAP_SIZE_LIMIT);
827     }
828 
SetIsWorker(bool isWorker)829     void SetIsWorker(bool isWorker)
830     {
831         isWorker_ = isWorker;
832     }
833 
SetIsRestrictedWorker(bool isRestrictedWorker)834     void SetIsRestrictedWorker(bool isRestrictedWorker)
835     {
836         isRestrictedWorker_ = isRestrictedWorker;
837     }
838 
IsWorker() const839     bool IsWorker() const
840     {
841         return isWorker_;
842     }
843 
IsRestrictedWorker() const844     bool IsRestrictedWorker() const
845     {
846         return isRestrictedWorker_;
847     }
848 
EnableIC() const849     bool EnableIC() const
850     {
851         return enableIC_;
852     }
853 
SetEnableIC(bool value)854     void SetEnableIC(bool value)
855     {
856         enableIC_ = value;
857     }
858 
WasSetEnableIC() const859     bool WasSetEnableIC() const
860     {
861         return WasOptionSet(OPTION_ENABLE_IC);
862     }
863 
GetIcuDataPath() const864     std::string GetIcuDataPath() const
865     {
866         return icuDataPath_;
867     }
868 
SetIcuDataPath(std::string value)869     void SetIcuDataPath(std::string value)
870     {
871         icuDataPath_ = std::move(value);
872     }
873 
WasSetIcuDataPath() const874     bool WasSetIcuDataPath() const
875     {
876         return WasOptionSet(OPTION_ICU_DATA_PATH);
877     }
878 
IsStartupTime() const879     bool IsStartupTime() const
880     {
881         return startupTime_;
882     }
883 
SetStartupTime(bool value)884     void SetStartupTime(bool value)
885     {
886         startupTime_ = value;
887     }
888 
WasSetStartupTime() const889     bool WasSetStartupTime() const
890     {
891         return WasOptionSet(OPTION_STARTUP_TIME);
892     }
893 
SetTraceBc(bool value)894     void SetTraceBc(bool value)
895     {
896         traceBc_ = value;
897     }
898 
IsTraceBC() const899     bool IsTraceBC() const
900     {
901         return traceBc_;
902     }
903 
WasSetTraceBc() const904     bool WasSetTraceBc() const
905     {
906         return WasOptionSet(OPTION_COMPILER_TRACE_BC);
907     }
908 
GetLogLevel() const909     std::string GetLogLevel() const
910     {
911         return logLevel_;
912     }
913 
SetLogLevel(std::string value)914     void SetLogLevel(std::string value)
915     {
916         logLevel_ = std::move(value);
917     }
918 
WasSetLogLevel() const919     bool WasSetLogLevel() const
920     {
921         return WasOptionSet(OPTION_LOG_LEVEL);
922     }
923 
GetLogComponents() const924     arg_list_t GetLogComponents() const
925     {
926         return logComponents_;
927     }
928 
SetLogComponents(arg_list_t value)929     void SetLogComponents(arg_list_t value)
930     {
931         logComponents_ = std::move(value);
932     }
933 
WasSetLogComponents() const934     bool WasSetLogComponents() const
935     {
936         return WasOptionSet(OPTION_LOG_COMPONENTS);
937     }
938 
GetLogDebug() const939     arg_list_t GetLogDebug() const
940     {
941         return logDebug_;
942     }
943 
SetLogDebug(arg_list_t value)944     void SetLogDebug(arg_list_t value)
945     {
946         logDebug_ = std::move(value);
947     }
948 
WasSetLogDebug() const949     bool WasSetLogDebug() const
950     {
951         return WasOptionSet(OPTION_LOG_DEBUG);
952     }
953 
GetLogInfo() const954     arg_list_t GetLogInfo() const
955     {
956         return logInfo_;
957     }
958 
SetLogInfo(arg_list_t value)959     void SetLogInfo(arg_list_t value)
960     {
961         logInfo_ = std::move(value);
962     }
963 
WasSetLogInfo() const964     bool WasSetLogInfo() const
965     {
966         return WasOptionSet(OPTION_LOG_INFO);
967     }
968 
GetLogWarning() const969     arg_list_t GetLogWarning() const
970     {
971         return logWarning_;
972     }
973 
SetLogWarning(arg_list_t value)974     void SetLogWarning(arg_list_t value)
975     {
976         logWarning_ = std::move(value);
977     }
978 
WasSetLogWarning() const979     bool WasSetLogWarning() const
980     {
981         return WasOptionSet(OPTION_LOG_WARNING);
982     }
983 
GetLogError() const984     arg_list_t GetLogError() const
985     {
986         return logError_;
987     }
988 
SetLogError(arg_list_t value)989     void SetLogError(arg_list_t value)
990     {
991         logError_ = std::move(value);
992     }
993 
WasSetLogError() const994     bool WasSetLogError() const
995     {
996         return WasOptionSet(OPTION_LOG_ERROR);
997     }
998 
GetLogFatal() const999     arg_list_t GetLogFatal() const
1000     {
1001         return logFatal_;
1002     }
1003 
SetLogFatal(arg_list_t value)1004     void SetLogFatal(arg_list_t value)
1005     {
1006         logFatal_ = std::move(value);
1007     }
1008 
WasSetLogFatal() const1009     bool WasSetLogFatal() const
1010     {
1011         return WasOptionSet(OPTION_LOG_FATAL);
1012     }
1013 
GetMaxAotMethodSize() const1014     size_t GetMaxAotMethodSize() const
1015     {
1016         return maxAotMethodSize_;
1017     }
1018 
SetMaxAotMethodSize(uint32_t value)1019     void SetMaxAotMethodSize(uint32_t value)
1020     {
1021         maxAotMethodSize_ = value;
1022     }
1023 
GetTypeThreshold() const1024     double GetTypeThreshold() const
1025     {
1026         return typeThreshold_;
1027     }
1028 
SetTypeThreshold(double threshold)1029     void SetTypeThreshold(double threshold)
1030     {
1031         typeThreshold_ = threshold;
1032     }
1033 
GetEntryPoint() const1034     std::string GetEntryPoint() const
1035     {
1036         return entryPoint_;
1037     }
1038 
SetEntryPoint(std::string value)1039     void SetEntryPoint(std::string value)
1040     {
1041         entryPoint_ = std::move(value);
1042     }
1043 
WasSetEntryPoint() const1044     bool WasSetEntryPoint() const
1045     {
1046         return WasOptionSet(OPTION_ENTRY_POINT);
1047     }
1048 
GetMergeAbc() const1049     bool GetMergeAbc() const
1050     {
1051         return mergeAbc_;
1052     }
1053 
SetMergeAbc(bool value)1054     void SetMergeAbc(bool value)
1055     {
1056         mergeAbc_ = value;
1057     }
1058 
SetEnableContext(bool value)1059     void SetEnableContext(bool value)
1060     {
1061         enableContext_ = value;
1062     }
1063 
IsEnableContext() const1064     bool IsEnableContext() const
1065     {
1066         return enableContext_;
1067     }
1068 
SetEnablePrintExecuteTime(bool value)1069     void SetEnablePrintExecuteTime(bool value)
1070     {
1071         enablePrintExecuteTime_ = value;
1072     }
1073 
IsEnablePrintExecuteTime() const1074     bool IsEnablePrintExecuteTime() const
1075     {
1076         return enablePrintExecuteTime_;
1077     }
1078 
SetEnableElementsKind(bool value)1079     void SetEnableElementsKind(bool value)
1080     {
1081         enableElementsKind_ = value;
1082     }
1083 
IsEnableElementsKind() const1084     bool IsEnableElementsKind() const
1085     {
1086         return enableElementsKind_;
1087     }
1088 
SetEnableForceIC(bool value)1089     void SetEnableForceIC(bool value)
1090     {
1091         enableForceIC_ = value;
1092     }
1093 
IsEnableForceIC() const1094     bool IsEnableForceIC() const
1095     {
1096         return enableForceIC_;
1097     }
1098 
SetEnablePGOProfiler(bool value)1099     void SetEnablePGOProfiler(bool value)
1100     {
1101         enablePGOProfiler_ = value;
1102     }
1103 
IsEnablePGOProfiler() const1104     bool IsEnablePGOProfiler() const
1105     {
1106         return enablePGOProfiler_;
1107     }
1108 
GetPGOHotnessThreshold() const1109     uint32_t GetPGOHotnessThreshold() const
1110     {
1111         return pgoHotnessThreshold_;
1112     }
1113 
SetPGOHotnessThreshold(uint32_t threshold)1114     void SetPGOHotnessThreshold(uint32_t threshold)
1115     {
1116         pgoHotnessThreshold_ = threshold;
1117     }
1118 
GetPGOSaveMinInterval() const1119     uint32_t GetPGOSaveMinInterval() const
1120     {
1121         return pgoSaveMinInterval_;
1122     }
1123 
SetPGOSaveMinInterval(uint32_t value)1124     void SetPGOSaveMinInterval(uint32_t value)
1125     {
1126         pgoSaveMinInterval_ = value;
1127     }
1128 
GetPGOProfilerPath() const1129     std::string GetPGOProfilerPath() const
1130     {
1131         return pgoProfilerPath_;
1132     }
1133 
SetEnableBaselinePgo(bool value)1134     void SetEnableBaselinePgo(bool value)
1135     {
1136         enableBaselinePgo_ = value;
1137     }
1138 
IsEnableBaselinePgo() const1139     bool IsEnableBaselinePgo() const
1140     {
1141         return enableBaselinePgo_;
1142     }
1143 
SetPGOProfilerPath(const std::string& value)1144     void SetPGOProfilerPath(const std::string& value)
1145     {
1146         pgoProfilerPath_ = panda::os::file::File::GetExtendedFilePath(value);
1147     }
1148 
IsPGOProfilerPathEmpty() const1149     bool IsPGOProfilerPathEmpty() const
1150     {
1151         return pgoProfilerPath_.empty();
1152     }
1153 
SetEnableTypeLowering(bool value)1154     void SetEnableTypeLowering(bool value)
1155     {
1156         enableTypeLowering_ = value;
1157     }
1158 
IsEnableArrayBoundsCheckElimination() const1159     bool IsEnableArrayBoundsCheckElimination() const
1160     {
1161         return enableArrayBoundsCheckElimination_;
1162     }
1163 
SetEnableArrayBoundsCheckElimination(bool value)1164     void SetEnableArrayBoundsCheckElimination(bool value)
1165     {
1166         enableArrayBoundsCheckElimination_ = value;
1167     }
1168 
IsEnableFrameStateElimination() const1169     bool IsEnableFrameStateElimination() const
1170     {
1171         return enableFrameStateElimination_;
1172     }
1173 
SetEnableFrameStateElimination(bool value)1174     void SetEnableFrameStateElimination(bool value)
1175     {
1176         enableFrameStateElimination_ = value;
1177     }
1178 
IsEnableTypeLowering() const1179     bool IsEnableTypeLowering() const
1180     {
1181         return enableTypeLowering_;
1182     }
1183 
SetEnableEarlyElimination(bool value)1184     void SetEnableEarlyElimination(bool value)
1185     {
1186         enableEarlyElimination_ = value;
1187     }
1188 
IsEnableEarlyElimination() const1189     bool IsEnableEarlyElimination() const
1190     {
1191         return enableEarlyElimination_;
1192     }
1193 
SetEnableLaterElimination(bool value)1194     void SetEnableLaterElimination(bool value)
1195     {
1196         enableLaterElimination_ = value;
1197     }
1198 
IsEnableLaterElimination() const1199     bool IsEnableLaterElimination() const
1200     {
1201         return enableLaterElimination_;
1202     }
1203 
SetEnableInstrcutionCombine(bool value)1204     void SetEnableInstrcutionCombine(bool value)
1205     {
1206         enableInstrcutionCombine = value;
1207     }
1208 
IsEnableInstrcutionCombine() const1209     bool IsEnableInstrcutionCombine() const
1210     {
1211         return enableInstrcutionCombine;
1212     }
1213 
SetEnableValueNumbering(bool value)1214     void SetEnableValueNumbering(bool value)
1215     {
1216         enableValueNumbering_ = value;
1217     }
1218 
IsEnableValueNumbering() const1219     bool IsEnableValueNumbering() const
1220     {
1221         return enableValueNumbering_;
1222     }
1223 
SetEnableJIT(bool value)1224     void SetEnableJIT(bool value)
1225     {
1226         enableFastJIT_ = value;
1227     }
1228 
IsEnableJIT() const1229     bool IsEnableJIT() const
1230     {
1231         return enableFastJIT_;
1232     }
1233 
SetEnableAPPJIT(bool value)1234     void SetEnableAPPJIT(bool value)
1235     {
1236         enableAPPJIT_ = value;
1237     }
1238 
IsEnableAPPJIT() const1239     bool IsEnableAPPJIT() const
1240     {
1241         return enableAPPJIT_;
1242     }
1243 
SetEnableJitFrame(bool value)1244     void SetEnableJitFrame(bool value)
1245     {
1246         enableJitFrame_ = value;
1247     }
1248 
IsEnableJitFrame() const1249     bool IsEnableJitFrame() const
1250     {
1251         return enableJitFrame_;
1252     }
1253 
IsEnableJitDfxDump() const1254     bool IsEnableJitDfxDump() const
1255     {
1256         return isEnableJitDfxDump_;
1257     }
1258 
SetEnableJitDfxDump(bool value)1259     void SetEnableJitDfxDump(bool value)
1260     {
1261         isEnableJitDfxDump_ = value;
1262     }
1263 
SetEnableOSR(bool value)1264     void SetEnableOSR(bool value)
1265     {
1266         enableOSR_ = value;
1267     }
1268 
IsEnableOSR() const1269     bool IsEnableOSR() const
1270     {
1271         return enableOSR_;
1272     }
1273 
SetJitHotnessThreshold(uint16_t value)1274     void SetJitHotnessThreshold(uint16_t value)
1275     {
1276         jitHotnessThreshold_ = value;
1277     }
1278 
GetJitHotnessThreshold() const1279     uint16_t GetJitHotnessThreshold() const
1280     {
1281         return jitHotnessThreshold_;
1282     }
1283 
SetJitCallThreshold(uint8_t value)1284     void SetJitCallThreshold(uint8_t value)
1285     {
1286         jitCallThreshold_ = value;
1287     }
1288 
GetJitCallThreshold() const1289     uint8_t GetJitCallThreshold() const
1290     {
1291         return jitCallThreshold_;
1292     }
1293 
SetOsrHotnessThreshold(uint16_t value)1294     void SetOsrHotnessThreshold(uint16_t value)
1295     {
1296         osrHotnessThreshold_ = value;
1297     }
1298 
GetOsrHotnessThreshold() const1299     uint16_t GetOsrHotnessThreshold() const
1300     {
1301         return osrHotnessThreshold_;
1302     }
1303 
SetForceJitCompileMain(bool value)1304     void SetForceJitCompileMain(bool value)
1305     {
1306         forceJitCompileMain_ = value;
1307     }
1308 
IsEnableForceJitCompileMain() const1309     bool IsEnableForceJitCompileMain() const
1310     {
1311         return forceJitCompileMain_;
1312     }
1313 
SetEnableBaselineJIT(bool value)1314     void SetEnableBaselineJIT(bool value)
1315     {
1316         enableBaselineJIT_ = value;
1317     }
1318 
IsEnableBaselineJIT() const1319     bool IsEnableBaselineJIT() const
1320     {
1321         return enableBaselineJIT_;
1322     }
1323 
SetBaselineJitHotnessThreshold(uint16_t value)1324     void SetBaselineJitHotnessThreshold(uint16_t value)
1325     {
1326         baselineJitHotnessThreshold_ = value;
1327     }
1328 
GetBaselineJitHotnessThreshold() const1329     uint16_t GetBaselineJitHotnessThreshold() const
1330     {
1331         return baselineJitHotnessThreshold_;
1332     }
1333 
SetForceBaselineCompileMain(bool value)1334     void SetForceBaselineCompileMain(bool value)
1335     {
1336         forceBaselineCompileMain_ = value;
1337     }
1338 
IsEnableForceBaselineCompileMain() const1339     bool IsEnableForceBaselineCompileMain() const
1340     {
1341         return forceBaselineCompileMain_;
1342     }
1343 
SetEnableNewValueNumbering(bool value)1344     void SetEnableNewValueNumbering(bool value)
1345     {
1346         enableNewValueNumbering_ = value;
1347     }
1348 
IsEnableNewValueNumbering() const1349     bool IsEnableNewValueNumbering() const
1350     {
1351         return enableNewValueNumbering_;
1352     }
1353 
SetEnableOptString(bool value)1354     void SetEnableOptString(bool value)
1355     {
1356         enableOptString_ = value;
1357     }
1358 
IsEnableOptString() const1359     bool IsEnableOptString() const
1360     {
1361         return enableOptString_;
1362     }
1363 
SetEnableOptInlining(bool value)1364     void SetEnableOptInlining(bool value)
1365     {
1366         enableOptInlining_ = value;
1367     }
1368 
IsEnableOptInlining() const1369     bool IsEnableOptInlining() const
1370     {
1371         return enableOptInlining_;
1372     }
1373 
SetEnableOptPGOType(bool value)1374     void SetEnableOptPGOType(bool value)
1375     {
1376         enableOptPGOType_ = value;
1377     }
1378 
IsEnableOptPGOType() const1379     bool IsEnableOptPGOType() const
1380     {
1381         return enableOptPGOType_;
1382     }
1383 
SetEnableOptTrackField(bool value)1384     void SetEnableOptTrackField(bool value)
1385     {
1386         enableOptTrackField_ = value;
1387     }
1388 
IsEnableOptTrackField() const1389     bool IsEnableOptTrackField() const
1390     {
1391         return enableOptTrackField_;
1392     }
1393 
GetCompilerModuleMethods() const1394     uint32_t GetCompilerModuleMethods() const
1395     {
1396         return compilerModuleMethods_;
1397     }
1398 
SetCompilerModuleMethods(uint32_t compilerModuleMethods)1399     void SetCompilerModuleMethods(uint32_t compilerModuleMethods)
1400     {
1401         compilerModuleMethods_ = compilerModuleMethods;
1402     }
1403 
SetTraceDeopt(bool value)1404     void SetTraceDeopt(bool value)
1405     {
1406         traceDeopt_ = value;
1407     }
1408 
GetTraceDeopt() const1409     bool GetTraceDeopt() const
1410     {
1411         return traceDeopt_;
1412     }
1413 
SetDeoptThreshold(uint8_t value)1414     void SetDeoptThreshold(uint8_t value)
1415     {
1416         deoptThreshold_ = value;
1417     }
1418 
GetDeoptThreshold() const1419     uint32_t GetDeoptThreshold() const
1420     {
1421         return deoptThreshold_;
1422     }
1423 
SetStressDeopt(bool value)1424     void SetStressDeopt(bool value)
1425     {
1426         stressDeopt_ = value;
1427     }
1428 
GetStressDeopt() const1429     bool GetStressDeopt() const
1430     {
1431         return stressDeopt_;
1432     }
1433 
SetDeviceState(bool value)1434     void SetDeviceState(bool value)
1435     {
1436         deviceIsScreenOff_ = value;
1437     }
1438 
GetDeviceState() const1439     bool GetDeviceState() const
1440     {
1441         return deviceIsScreenOff_;
1442     }
1443 
WasSetDeviceState() const1444     bool WasSetDeviceState() const
1445     {
1446         return WasOptionSet(OPTION_COMPILER_DEVICE_STATE);
1447     }
1448 
SetThermalLevel(int32_t level)1449     void SetThermalLevel(int32_t level)
1450     {
1451         deviceThermalLevel_ = level;
1452     }
1453 
GetThermalLevel() const1454     int32_t GetThermalLevel() const
1455     {
1456         return deviceThermalLevel_;
1457     }
1458 
WasSetThermalLevel() const1459     bool WasSetThermalLevel() const
1460     {
1461         return WasOptionSet(OPTION_COMPILER_THERMAL_LEVEL);
1462     }
1463 
SetOptCodeProfiler(bool value)1464     void SetOptCodeProfiler(bool value)
1465     {
1466         optCodeProfiler_ = value;
1467     }
1468 
GetOptCodeProfiler() const1469     bool GetOptCodeProfiler() const
1470     {
1471         return optCodeProfiler_;
1472     }
1473 
SetVerifyVTable(bool value)1474     void SetVerifyVTable(bool value)
1475     {
1476         verifyVTable_ = value;
1477     }
1478 
GetVerifyVTable() const1479     bool GetVerifyVTable() const
1480     {
1481         return verifyVTable_;
1482     }
1483 
GetCompilerSelectMethods() const1484     std::string GetCompilerSelectMethods() const
1485     {
1486         return compilerSelectMethods_;
1487     }
1488 
SetCompilerSelectMethods(std::string value)1489     void SetCompilerSelectMethods(std::string value)
1490     {
1491         compilerSelectMethods_ = std::move(value);
1492     }
1493 
GetCompilerSkipMethods() const1494     std::string GetCompilerSkipMethods() const
1495     {
1496         return compilerSkipMethods_;
1497     }
1498 
SetCompilerSkipMethods(std::string value)1499     void SetCompilerSkipMethods(std::string value)
1500     {
1501         compilerSkipMethods_ = std::move(value);
1502     }
1503 
SetPGOTrace(bool value)1504     void SetPGOTrace(bool value)
1505     {
1506         pgoTrace_ = value;
1507     }
1508 
GetPGOTrace() const1509     bool GetPGOTrace() const
1510     {
1511         return pgoTrace_;
1512     }
1513 
SetTraceInline(bool value)1514     void SetTraceInline(bool value)
1515     {
1516         traceInline_ = value;
1517     }
1518 
GetTraceInline() const1519     bool GetTraceInline() const
1520     {
1521         return traceInline_;
1522     }
1523 
SetTraceValueNumbering(bool value)1524     void SetTraceValueNumbering(bool value)
1525     {
1526         traceValueNumbering_ = value;
1527     }
1528 
GetTraceValueNumbering() const1529     bool GetTraceValueNumbering() const
1530     {
1531         return traceValueNumbering_;
1532     }
1533 
SetTraceJIT(bool value)1534     void SetTraceJIT(bool value)
1535     {
1536         traceJIT_ = value;
1537     }
1538 
GetTraceJIT() const1539     bool GetTraceJIT() const
1540     {
1541         return traceJIT_;
1542     }
1543 
SetTraceInstructionCombine(bool value)1544     void SetTraceInstructionCombine(bool value)
1545     {
1546         traceInstructionCombine_ = value;
1547     }
1548 
GetTraceInstructionCombine() const1549     bool GetTraceInstructionCombine() const
1550     {
1551         return traceInstructionCombine_;
1552     }
1553 
SetMaxInlineBytecodes(size_t value)1554     void SetMaxInlineBytecodes(size_t value)
1555     {
1556         maxInlineBytecodes_ = value;
1557     }
1558 
GetMaxInlineBytecodes()1559     size_t GetMaxInlineBytecodes()
1560     {
1561         return maxInlineBytecodes_;
1562     }
1563 
SetCompilerFrameworkAbcPath(std::string frameworkAbcPath)1564     void SetCompilerFrameworkAbcPath(std::string frameworkAbcPath)
1565     {
1566         frameworkAbcPath_ = std::move(frameworkAbcPath);
1567     }
1568 
GetCompilerFrameworkAbcPath() const1569     std::string GetCompilerFrameworkAbcPath() const
1570     {
1571         return frameworkAbcPath_;
1572     }
1573 
WasSetCompilerFrameworkAbcPath() const1574     bool WasSetCompilerFrameworkAbcPath() const
1575     {
1576         return WasOptionSet(OPTION_COMPILER_FRAMEWORK_ABC_PATH);
1577     }
1578 
SetTargetCompilerMode(std::string mode)1579     void SetTargetCompilerMode(std::string mode)
1580     {
1581         targetCompilerMode_ = std::move(mode);
1582     }
1583 
GetTargetCompilerMode() const1584     std::string GetTargetCompilerMode() const
1585     {
1586         return targetCompilerMode_;
1587     }
1588 
IsTargetCompilerMode() const1589     bool IsTargetCompilerMode() const
1590     {
1591         return IsPartialCompilerMode() || IsFullCompilerMode();
1592     }
1593 
IsPartialCompilerMode() const1594     bool IsPartialCompilerMode() const
1595     {
1596         return targetCompilerMode_ == "partial";
1597     }
1598 
IsFullCompilerMode() const1599     bool IsFullCompilerMode() const
1600     {
1601         return targetCompilerMode_ == "full";
1602     }
1603 
SetHapPath(std::string path)1604     void SetHapPath(std::string path)
1605     {
1606         hapPath_ = std::move(path);
1607     }
1608 
GetHapPath() const1609     std::string GetHapPath() const
1610     {
1611         return hapPath_;
1612     }
1613 
SetHapAbcOffset(uint32_t offset)1614     void SetHapAbcOffset(uint32_t offset)
1615     {
1616         hapAbcOffset_ = offset;
1617     }
1618 
GetHapAbcOffset() const1619     uint32_t GetHapAbcOffset() const
1620     {
1621         return hapAbcOffset_;
1622     }
1623 
SetHapAbcSize(uint32_t size)1624     void SetHapAbcSize(uint32_t size)
1625     {
1626         hapAbcSize_ = size;
1627     }
1628 
GetHapAbcSize() const1629     uint32_t GetHapAbcSize() const
1630     {
1631         return hapAbcSize_;
1632     }
1633 
SetCompilerNoCheck(bool value)1634     void SetCompilerNoCheck(bool value)
1635     {
1636         compilerNoCheck_ = value;
1637     }
1638 
IsCompilerNoCheck() const1639     bool IsCompilerNoCheck() const
1640     {
1641         return compilerNoCheck_;
1642     }
1643 
1644     void SetOptionsForTargetCompilation();
1645 
1646     void BindCPUCoreForTargetCompilation();
1647 
SetCompilerPipelineHostAOT(bool value)1648     void SetCompilerPipelineHostAOT(bool value)
1649     {
1650         compilerPipelineHostAOT_ = value;
1651     }
1652 
IsCompilerPipelineHostAOT() const1653     bool IsCompilerPipelineHostAOT() const
1654     {
1655         return compilerPipelineHostAOT_;
1656     }
1657 
SetFastAOTCompileMode(bool value)1658     void SetFastAOTCompileMode(bool value)
1659     {
1660         fastAOTCompileMode_ = value;
1661     }
1662 
GetFastAOTCompileMode() const1663     bool GetFastAOTCompileMode() const
1664     {
1665         return fastAOTCompileMode_;
1666     }
1667 
SetEnableOptLoopPeeling(bool value)1668     void SetEnableOptLoopPeeling(bool value)
1669     {
1670         enableOptLoopPeeling_ = value;
1671     }
1672 
IsEnableOptLoopPeeling() const1673     bool IsEnableOptLoopPeeling() const
1674     {
1675         return enableOptLoopPeeling_;
1676     }
1677 
SetEnableOptLoopInvariantCodeMotion(bool value)1678     void SetEnableOptLoopInvariantCodeMotion(bool value)
1679     {
1680         enableOptLoopInvariantCodeMotion_ = value;
1681     }
1682 
IsEnableOptLoopInvariantCodeMotion() const1683     bool IsEnableOptLoopInvariantCodeMotion() const
1684     {
1685         return enableOptLoopInvariantCodeMotion_;
1686     }
1687 
IsEnableOptConstantFolding() const1688     bool IsEnableOptConstantFolding() const
1689     {
1690         return enableOptConstantFolding_;
1691     }
1692 
SetEnableOptConstantFolding(bool value)1693     void SetEnableOptConstantFolding(bool value)
1694     {
1695         enableOptConstantFolding_ = value;
1696     }
1697 
SetEnableOptOnHeapCheck(bool value)1698     void SetEnableOptOnHeapCheck(bool value)
1699     {
1700         enableOptOnHeapCheck_ = value;
1701     }
1702 
IsEnableOptOnHeapCheck() const1703     bool IsEnableOptOnHeapCheck() const
1704     {
1705         return enableOptOnHeapCheck_;
1706     }
1707 
IsEnableLexenvSpecialization() const1708     bool IsEnableLexenvSpecialization() const
1709     {
1710         return enableLexenvSpecialization_;
1711     }
1712 
SetEnableLexenvSpecialization(bool value)1713     void SetEnableLexenvSpecialization(bool value)
1714     {
1715         enableLexenvSpecialization_ = value;
1716     }
1717 
IsEnableNativeInline() const1718     bool IsEnableNativeInline() const
1719     {
1720         return enableNativeInline_;
1721     }
1722 
SetEnableNativeInline(bool value)1723     void SetEnableNativeInline(bool value)
1724     {
1725         enableNativeInline_ = value;
1726     }
1727 
IsEnableLoweringBuiltin() const1728     bool IsEnableLoweringBuiltin() const
1729     {
1730         return enableLoweringBuiltin_;
1731     }
1732 
SetEnableLoweringBuiltin(bool value)1733     void SetEnableLoweringBuiltin(bool value)
1734     {
1735         enableLoweringBuiltin_ = value;
1736     }
1737 
SetCompilerEnableLiteCG(bool value)1738     void SetCompilerEnableLiteCG(bool value)
1739     {
1740         enableLiteCG_ = value;
1741     }
1742 
IsCompilerEnableLiteCG() const1743     bool IsCompilerEnableLiteCG() const
1744     {
1745         return enableLiteCG_;
1746     }
1747 
SetTypedOpProfiler(bool value)1748     void SetTypedOpProfiler(bool value)
1749     {
1750         enableTypedOpProfiler_ = value;
1751     }
1752 
GetTypedOpProfiler() const1753     bool GetTypedOpProfiler() const
1754     {
1755         return enableTypedOpProfiler_;
1756     }
1757 
IsEnableBranchProfiling() const1758     bool IsEnableBranchProfiling() const
1759     {
1760         return enableBranchProfiling_;
1761     }
1762 
SetEnableBranchProfiling(bool value)1763     void SetEnableBranchProfiling(bool value)
1764     {
1765         enableBranchProfiling_ = value;
1766     }
1767 
SetTestAssert(bool value)1768     void SetTestAssert(bool value)
1769     {
1770         testAssert_ = value;
1771     }
1772 
GetTestAssert() const1773     bool GetTestAssert() const
1774     {
1775         return testAssert_;
1776     }
1777 
SetCompilerMethodsRange(arg_list_t* argListStr)1778     void SetCompilerMethodsRange(arg_list_t* argListStr)
1779     {
1780         compileMethodsRange_.first = std::stoull((*argListStr)[0]);
1781         compileMethodsRange_.second = std::stoull((*argListStr)[1]);
1782     }
1783 
GetCompilerMethodsRange() const1784     const std::pair<uint32_t, uint32_t>& GetCompilerMethodsRange() const
1785     {
1786         return compileMethodsRange_;
1787     }
1788 
SetCompilerCodegenOptions(arg_list_t argListStr)1789     void SetCompilerCodegenOptions(arg_list_t argListStr)
1790     {
1791         compileCodegenOption_ = std::move(argListStr);
1792     }
1793 
GetCompilerCodegenOptions() const1794     const arg_list_t& GetCompilerCodegenOptions() const
1795     {
1796         return compileCodegenOption_;
1797     }
1798 
SetOptCodeRange(std::string value)1799     void SetOptCodeRange(std::string value)
1800     {
1801         optBCRange_ = std::move(value);
1802     }
1803 
GetOptCodeRange() const1804     std::string GetOptCodeRange() const
1805     {
1806         return optBCRange_;
1807     }
1808 
SetEnableEscapeAnalysis(bool value)1809     void SetEnableEscapeAnalysis(bool value)
1810     {
1811         enableEscapeAnalysis_ = value;
1812     }
1813 
IsEnableEscapeAnalysis() const1814     bool IsEnableEscapeAnalysis() const
1815     {
1816         return enableEscapeAnalysis_;
1817     }
1818 
SetEnableTraceEscapeAnalysis(bool value)1819     void SetEnableTraceEscapeAnalysis(bool value)
1820     {
1821         traceEscapeAnalysis_ = value;
1822     }
1823 
GetTraceEscapeAnalysis() const1824     bool GetTraceEscapeAnalysis() const
1825     {
1826         return traceEscapeAnalysis_;
1827     }
1828 
SetEnableInductionVariableAnalysis(bool value)1829     void SetEnableInductionVariableAnalysis(bool value)
1830     {
1831         enableInductionVariableAnalysis_ = value;
1832     }
1833 
IsEnableInductionVariableAnalysis() const1834     bool IsEnableInductionVariableAnalysis() const
1835     {
1836         return enableInductionVariableAnalysis_;
1837     }
1838 
SetEnableTraceInductionVariableAnalysis(bool value)1839     void SetEnableTraceInductionVariableAnalysis(bool value)
1840     {
1841         traceInductionVariableAnalysis_ = value;
1842     }
1843 
GetTraceInductionVariableAnalysis() const1844     bool GetTraceInductionVariableAnalysis() const
1845     {
1846         return traceInductionVariableAnalysis_;
1847     }
1848 
SetEnableMemoryAnalysis(bool value)1849     void SetEnableMemoryAnalysis(bool value)
1850     {
1851         enableMemoryAnalysis_ = value;
1852     }
1853 
IsEnableMemoryAnalysis() const1854     bool IsEnableMemoryAnalysis() const
1855     {
1856         return enableMemoryAnalysis_;
1857     }
1858 
SetCheckPgoVersion(bool value)1859     void SetCheckPgoVersion(bool value)
1860     {
1861         checkPgoVersion_ = value;
1862     }
1863 
IsCheckPgoVersion() const1864     bool IsCheckPgoVersion() const
1865     {
1866         return checkPgoVersion_;
1867     }
1868 
SetEnableJITPGO(bool value)1869     void SetEnableJITPGO(bool value)
1870     {
1871         enableJITPGO_ = value;
1872     }
1873 
IsEnableJITPGO() const1874     bool IsEnableJITPGO() const
1875     {
1876         return enableJITPGO_;
1877     }
1878 
SetEnableProfileDump(bool value)1879     void SetEnableProfileDump(bool value)
1880     {
1881         enableProfileDump_ = value;
1882     }
1883 
IsEnableProfileDump() const1884     bool IsEnableProfileDump() const
1885     {
1886         return enableProfileDump_;
1887     }
1888 
SetEnableAOTPGO(bool value)1889     void SetEnableAOTPGO(bool value)
1890     {
1891         enableAOTPGO_ = value;
1892     }
1893 
IsEnableAOTPGO() const1894     bool IsEnableAOTPGO() const
1895     {
1896         return enableAOTPGO_;
1897     }
1898 
SetEnableJitFastCompile(bool value)1899     void SetEnableJitFastCompile(bool value)
1900     {
1901         enableJitFastCompile_ = value;
1902     }
1903 
IsEnableJitFastCompile() const1904     bool IsEnableJitFastCompile() const
1905     {
1906         return enableJitFastCompile_;
1907     }
1908 
SetEnableFrameworkAOT(bool value)1909     void SetEnableFrameworkAOT(bool value)
1910     {
1911         enableFrameworkAOT_ = value;
1912     }
1913 
IsEnableFrameworkAOT() const1914     bool IsEnableFrameworkAOT() const
1915     {
1916         return enableFrameworkAOT_;
1917     }
1918 
SetAsyncLoadAbc(bool value)1919     void SetAsyncLoadAbc(bool value)
1920     {
1921         asyncLoadAbc_ = value;
1922     }
1923 
IsAsyncLoadAbc() const1924     bool IsAsyncLoadAbc() const
1925     {
1926         return asyncLoadAbc_;
1927     }
1928 
SetAsyncLoadAbcTest(bool value)1929     void SetAsyncLoadAbcTest(bool value)
1930     {
1931         asyncLoadAbcTest_ = value;
1932     }
1933 
IsAsyncLoadAbcTest() const1934     bool IsAsyncLoadAbcTest() const
1935     {
1936         return asyncLoadAbcTest_;
1937     }
1938 
IsPgoForceDump() const1939     bool IsPgoForceDump() const
1940     {
1941         return forceDump_;
1942     }
1943 
SetPgoForceDump(bool value)1944     void SetPgoForceDump(bool value)
1945     {
1946         forceDump_ = value;
1947     }
1948 
SetConcurrentCompile(bool value)1949     void SetConcurrentCompile(bool value)
1950     {
1951         concurrentCompile = value;
1952     }
1953 
IsConcurrentCompile() const1954     bool IsConcurrentCompile() const
1955     {
1956         return concurrentCompile;
1957     }
1958 
SetAOTHasException(bool value)1959     void SetAOTHasException(bool value)
1960     {
1961         aotHasException_ = value;
1962     }
1963 
GetAOTHasException() const1964     bool GetAOTHasException() const
1965     {
1966         return aotHasException_;
1967     }
1968 
SetCompilerEnablePgoSpace(bool value)1969     void SetCompilerEnablePgoSpace(bool value)
1970     {
1971         enablePgoSpace_ = value;
1972     }
1973 
IsCompilerEnablePgoSpace() const1974     bool IsCompilerEnablePgoSpace() const
1975     {
1976         return enablePgoSpace_;
1977     }
1978 
1979 public:
1980     static constexpr int32_t MAX_APP_COMPILE_METHOD_SIZE = 4_KB;
1981 
1982 private:
1983 
StartsWith(const std::string& haystack, const std::string& needle)1984     static bool StartsWith(const std::string& haystack, const std::string& needle)
1985     {
1986         return std::equal(needle.begin(), needle.end(), haystack.begin());
1987     }
1988 
WasSet(int option)1989     void WasSet(int option)
1990     {
1991         if (option < OPTION_SPLIT_ONE) {
1992             wasSetPartOne_ |= (1ULL << static_cast<uint64_t>(option));
1993         } else if (option < OPTION_SPLIT_TWO) {
1994             wasSetPartTwo_ |= (1ULL << static_cast<uint64_t>(option - OPTION_SPLIT_ONE));
1995         } else {
1996             wasSetPartThree_ |= (1ULL << static_cast<uint64_t>(option - OPTION_SPLIT_TWO));
1997         }
1998     }
1999 
WasOptionSet(int option) const2000     bool WasOptionSet(int option) const
2001     {
2002         if (option < OPTION_SPLIT_ONE) {
2003             return ((1ULL << static_cast<uint64_t>(option)) & wasSetPartOne_) != 0;
2004         } else if (option < OPTION_SPLIT_TWO) {
2005             return ((1ULL << static_cast<uint64_t>(option - OPTION_SPLIT_ONE)) & wasSetPartTwo_) != 0;
2006         }
2007         return ((1ULL << static_cast<uint64_t>(option - OPTION_SPLIT_TWO)) & wasSetPartThree_) != 0;
2008     }
2009 
2010     bool ParseBoolParam(bool* argBool);
2011     bool ParseDoubleParam(const std::string& option, double* argDouble);
2012     bool ParseIntParam(const std::string& option, int* argInt);
2013     bool ParseUint32Param(const std::string& option, uint32_t* argUInt32);
2014     bool ParseUint64Param(const std::string& option, uint64_t* argUInt64);
2015     void ParseListArgParam(const std::string& option, arg_list_t* argListStr, std::string delimiter);
2016 
2017     bool enableArkTools_ {true};
2018     bool openArkTools_ {false};
2019     std::string stubFile_ {"stub.an"};
2020     std::string compilerPkgInfo_ {};
2021     std::string compilerExternalPkgInfo_ {};
2022     bool compilerEnableExternalPkg_ {true};
2023     bool enableForceGc_ {true};
2024     bool enableEdenGC_ {false};
2025     bool forceFullGc_ {true};
2026     uint32_t forceSharedGc_ {1};
2027     int32_t deviceThermalLevel_ {0};
2028     int arkProperties_ = GetDefaultProperties();
2029     std::string arkBundleName_ = {""};
2030     size_t heapSize_ = {0};
2031     uint32_t gcThreadNum_ {7}; // 7: default thread num
2032     uint32_t longPauseTime_ {40}; // 40: default pause time
2033     std::string aotOutputFile_ {""};
2034     std::string targetTriple_ {TARGET_X64};
2035     uint32_t asmOptLevel_ {2};
2036     uint32_t relocationMode_ {2}; // 2: default relocation mode
2037     uint32_t maxNonmovableSpaceCapacity_ {4_MB};
2038     bool enableAsmInterpreter_ {true};
2039     bool enableBuiltinsLazy_ {true};
2040     std::string asmOpcodeDisableRange_ {""};
2041     AsmInterParsedOption asmInterParsedOption_;
2042     uint64_t serializerBufferSizeLimit_ {2_GB};
2043     uint32_t heapSizeLimit_ {512_MB};
2044     bool enableIC_ {true};
2045     std::string icuDataPath_ {"default"};
2046     bool startupTime_ {false};
2047     std::string compilerLogOpt_ {"none"};
2048     std::string compilerLogMethods_ {"none"};
2049     bool compilerLogSnapshot_ {false};
2050     bool compilerLogTime_ {false};
2051     bool enableRuntimeStat_ {false};
2052     bool isWorker_ {false};
2053     bool isRestrictedWorker_ {false};
2054     bool traceBc_ {false};
2055     std::string logLevel_ {"error"};
2056     arg_list_t logDebug_ {{"all"}};
2057     arg_list_t logInfo_ {{"all"}};
2058     arg_list_t logWarning_ {{"all"}};
2059     arg_list_t logError_ {{"all"}};
2060     arg_list_t logFatal_ {{"all"}};
2061     arg_list_t logComponents_ {{"all"}};
2062     bool enableAOT_ {false};
2063     uint32_t maxAotMethodSize_ {32_KB};
2064     double typeThreshold_ {-1};
2065     std::string entryPoint_ {"_GLOBAL::func_main_0"};
2066     bool mergeAbc_ {false};
2067     bool enableArrayBoundsCheckElimination_ {false};
2068     bool enableFrameStateElimination_ {true};
2069     bool enableTypeLowering_ {true};
2070     bool enableEarlyElimination_ {true};
2071     bool enableLaterElimination_ {true};
2072     bool enableValueNumbering_ {true};
2073     bool enableOptString_ {true};
2074     bool enableElementsKind_ {false};
2075     bool enableForceIC_ {true};
2076     bool enableInstrcutionCombine {true};
2077     bool enableNewValueNumbering_ {true};
2078     bool enableOptInlining_ {true};
2079     bool enableOptPGOType_ {true};
2080     bool enableFastJIT_ {false};
2081     bool enableAPPJIT_ {false};
2082     bool isEnableJitDfxDump_ {false};
2083     bool enableOSR_ {false};
2084     uint16_t jitHotnessThreshold_ {2};
2085     uint8_t jitCallThreshold_ {0};
2086     uint16_t osrHotnessThreshold_ {2};
2087     bool forceJitCompileMain_ {false};
2088     bool enableBaselineJIT_ {false};
2089     uint16_t baselineJitHotnessThreshold_ {1};
2090     bool forceBaselineCompileMain_ {false};
2091     bool enableOptTrackField_ {true};
2092     uint32_t compilerModuleMethods_ {100};
2093     uint64_t wasSetPartOne_ {0};
2094     uint64_t wasSetPartTwo_ {0};
2095     uint64_t wasSetPartThree_ {0};
2096     bool enableContext_ {false};
2097     bool enablePrintExecuteTime_ {false};
2098     bool enablePGOProfiler_ {false};
2099     bool enableJITPGO_ {true};
2100     bool enableAOTPGO_ {true};
2101     bool enableProfileDump_ {true};
2102     bool enableFrameworkAOT_ {false};
2103     uint32_t pgoHotnessThreshold_ {1};
2104     std::string pgoProfilerPath_ {""};
2105     uint32_t pgoSaveMinInterval_ {30};
2106     bool traceDeopt_ {false};
2107     uint8_t deoptThreshold_ {10};
2108     bool stressDeopt_ {false};
2109     bool deviceIsScreenOff_ {true};
2110     bool optCodeProfiler_ {false};
2111     bool startGlobalLeakCheck_ {false};
2112     bool verifyVTable_ {false};
2113     std::string compilerSelectMethods_ {""};
2114     std::string compilerSkipMethods_ {""};
2115     bool pgoTrace_ {false};
2116     bool traceInline_ {false};
2117     bool traceJIT_ {false};
2118     bool traceValueNumbering_ {false};
2119     bool traceInstructionCombine_ {false};
2120     bool compilerPipelineHostAOT_ {false};
2121     size_t maxInlineBytecodes_ {45};
2122     std::string targetCompilerMode_ {""};
2123     std::string frameworkAbcPath_ {""};
2124     std::string hapPath_ {""};
2125     uint32_t hapAbcOffset_ {0};
2126     uint32_t hapAbcSize_ {0};
2127     std::string optBCRange_ {""};
2128     bool compilerNoCheck_ {false};
2129     bool fastAOTCompileMode_ {false};
2130     bool enableOptLoopPeeling_ {true};
2131     bool enableOptConstantFolding_ {true};
2132     bool enableOptOnHeapCheck_ {true};
2133     bool enableOptLoopInvariantCodeMotion_ {false};
2134     bool enableLexenvSpecialization_ {false};
2135     bool enableNativeInline_ {true};
2136     bool enableLoweringBuiltin_ {true};
2137     bool enableLiteCG_ {false};
2138     bool enableTypedOpProfiler_ {false};
2139     bool enableBranchProfiling_ {true};
2140     bool enablePgoSpace_ {false};
2141     bool testAssert_ {false};
2142     std::pair<uint32_t, uint32_t> compileMethodsRange_ {0, UINT32_MAX};
2143     arg_list_t compileCodegenOption_ {{""}};
2144     bool enableEscapeAnalysis_ {false};
2145     bool traceEscapeAnalysis_ {false};
2146     bool enableInductionVariableAnalysis_ {false};
2147     bool traceInductionVariableAnalysis_ {false};
2148     bool enableMemoryAnalysis_ {true};
2149     bool checkPgoVersion_ {false};
2150     bool enableJitFastCompile_ {false};
2151     bool enableJitFrame_ {false};
2152     bool disableCodeSign_ {true};
2153     bool enableJitFort_ {true};
2154     bool enableAsyncCopyToFort_ {true};
2155     bool enableBaselinePgo_ {false};
2156     bool asyncLoadAbc_ {true};
2157     bool asyncLoadAbcTest_ {false};
2158     bool forceDump_ {true};
2159     bool concurrentCompile {true};
2160     bool aotHasException_ {false};
2161 };
2162 } // namespace panda::ecmascript
2163 
2164 #endif // ECMASCRIPT_JS_RUNTIME_OPTIONS_H_
2165