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