• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 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/bc_call_signature.h"
25 #include "ecmascript/mem/mem_common.h"
26 
27 // namespace panda {
28 namespace panda::ecmascript {
29 using arg_list_t = std::vector<std::string>;
30 enum ArkProperties {
31     DEFAULT = -1,  // default value 1000001011100 -> 0x105c
32     OPTIONAL_LOG = 1,
33     GC_STATS_PRINT = 1 << 1,
34     PARALLEL_GC = 1 << 2,  // default enable
35     CONCURRENT_MARK = 1 << 3,  // default enable
36     CONCURRENT_SWEEP = 1 << 4,  // default enable
37     THREAD_CHECK = 1 << 5,
38     ENABLE_ARKTOOLS = 1 << 6,  // default enable
39     ENABLE_SNAPSHOT_SERIALIZE = 1 << 7,
40     ENABLE_SNAPSHOT_DESERIALIZE = 1 << 8,
41     EXCEPTION_BACKTRACE = 1 << 9,
42     GLOBAL_OBJECT_LEAK_CHECK = 1 << 10,
43     GLOBAL_PRIMITIVE_LEAK_CHECK = 1 << 11,
44     ENABLE_IDLE_GC = 1 << 12,  // default enable
45     CPU_PROFILER_COLD_START_MAIN_THREAD = 1 << 13,
46     ENABLE_CPU_PROFILER_VM_TAG = 1 << 14,
47     ENABLE_GC_TRACER = 1 << 15,
48     CPU_PROFILER_COLD_START_WORKER_THREAD = 1 << 16,
49     CPU_PROFILER_ANY_TIME_MAIN_THREAD = 1 << 17,
50     CPU_PROFILER_ANY_TIME_WORKER_THREAD = 1 << 18,
51     ENABLE_HEAP_VERIFY = 1 << 19
52 };
53 
54 // asm interpreter control parsed option
55 struct AsmInterParsedOption {
56     int handleStart {-1};
57     int handleEnd {-1};
58     bool enableAsm {false};
59 };
60 
61 extern const std::string PUBLIC_API COMMON_HELP_HEAD_MSG;
62 extern const std::string PUBLIC_API STUB_HELP_HEAD_MSG;
63 extern const std::string PUBLIC_API COMPILER_HELP_HEAD_MSG;
64 extern const std::string PUBLIC_API HELP_OPTION_MSG;
65 
66 enum CommandValues {
67     OPTION_DEFAULT,
68     OPTION_ENABLE_ARK_TOOLS,
69     OPTION_STUB_FILE,
70     OPTION_ENABLE_FORCE_GC,
71     OPTION_FORCE_FULL_GC,
72     OPTION_ARK_PROPERTIES,
73     OPTION_ARK_BUNDLENAME,
74     OPTION_GC_THREADNUM,
75     OPTION_GC_LONG_PAUSED_TIME,
76     OPTION_AOT_FILE,
77     OPTION_COMPILER_TARGET_TRIPLE,
78     OPTION_ASM_OPT_LEVEL,
79     OPTION_RELOCATION_MODE,
80     OPTION_MAX_UNMOVABLE_SPACE,
81     OPTION_ENABLE_ASM_INTERPRETER,
82     OPTION_ENABLE_BUILTINS_LAZY,
83     OPTION_ASM_OPCODE_DISABLE_RANGE,
84     OPTION_SERIALIZER_BUFFER_SIZE_LIMIT,
85     OPTION_HEAP_SIZE_LIMIT,
86     OPTION_ENABLE_IC,
87     OPTION_ICU_DATA_PATH,
88     OPTION_STARTUP_TIME,
89     OPTION_COMPILER_LOG_OPT,
90     OPTION_COMPILER_LOG_METHODS,
91     OPTION_COMPILER_TYPE_THRESHOLD,
92     OPTION_ENABLE_RUNTIME_STAT,
93     OPTION_COMPILER_ASSERT_TYPES,
94     OPTION_COMPILER_PRINT_TYPE_INFO,
95     OPTION_COMPILER_LOG_SNAPSHOT,
96     OPTION_COMPILER_LOG_TIME,
97     OPTION_ENABLE_WORKER,
98     OPTION_BUILTINS_DTS,
99     OPTION_COMPILER_TRACE_BC,
100     OPTION_COMPILER_TRACE_DEOPT,
101     OPTION_COMPILER_TRACE_INLINE,
102     OPTION_COMPILER_MAX_INLINE_BYTECODES,
103     OPTION_COMPILER_DEOPT_THRESHOLD,
104     OPTION_COMPILER_STRESS_DEOPT,
105     OPTION_COMPILER_OPT_CODE_PROFILER,
106     OPTION_LOG_LEVEL,
107     OPTION_LOG_DEBUG,
108     OPTION_LOG_INFO,
109     OPTION_LOG_WARNING,
110     OPTION_LOG_ERROR,
111     OPTION_LOG_FATAL,
112     OPTION_LOG_COMPONENTS,
113     OPTION_COMPILER_OPT_MAX_METHOD,
114     OPTION_COMPILER_MODULE_METHODS,
115     OPTION_ENTRY_POINT,
116     OPTION_MERGE_ABC,
117     OPTION_ENABLE_CONTEXT,
118     OPTION_COMPILER_OPT_TYPE_LOWERING,
119     OPTION_COMPILER_OPT_EARLY_ELIMINATION,
120     OPTION_COMPILER_OPT_LATER_ELIMINATION,
121     OPTION_COMPILER_OPT_STRING,
122     OPTION_COMPILER_OPT_VALUE_NUMBERING,
123     OPTION_COMPILER_OPT_INLINING,
124     OPTION_COMPILER_OPT_PGOTYPE,
125     OPTION_COMPILER_OPT_TRACK_FIELD,
126     OPTION_COMPILER_OPT_GLOBAL_TYPEINFER,
127     OPTION_HELP,
128     OPTION_COMPILER_PGO_PROFILER_PATH,
129     OPTION_COMPILER_PGO_HOTNESS_THRESHOLD,
130     OPTION_COMPILER_PGO_SAVE_MIN_INTERVAL,
131     OPTION_ENABLE_PGO_PROFILER,
132     OPTION_OPTIONS,
133     OPTION_PRINT_EXECUTE_TIME,
134     OPTION_COMPILER_VERIFY_VTABLE,
135     OPTION_COMPILER_SELECT_METHODS,
136     OPTION_COMPILER_SKIP_METHODS,
137     OPTION_TARGET_COMPILER_MODE,
138     OPTION_HAP_PATH,
139     OPTION_HAP_ABC_OFFSET,
140     OPTION_HAP_ABC_SIZE,
141     OPTION_COMPILER_NOCHECK,
142     OPTION_FAST_AOT_COMPILE_MODE,
143     OPTION_COMPILER_OPT_LOOP_PEELING,
144     OPTION_COMPILER_OPT_ON_HEAP_CHECK,
145     OPTION_COMPILER_PKG_INFO,
146     OPTION_COMPILER_EXTERNAL_PKG_INFO,
147     OPTION_COMPILER_ENABLE_EXTERNAL_PKG,
148     OPTION_COMPILER_OPT_ARRAY_BOUNDS_CHECK_ELIMINATION,
149     OPTION_COMPILER_OPT_LOOP_INVARIANT_CODE_MOTION,
150     OPTION_COMPILER_OPT_CONSTANT_FOLDING,
151     OPTION_COMPILER_ENABLE_LEXENV_SPECIALIZATION,
152     OPTION_COMPILER_TRACE_INSTRUCTION_COMBINE,
153     OPTION_COMPILER_TRACE_VALUE_NUMBERING,
154     OPTION_COMPILER_OPT_INSTRUCTIONE_COMBINE,
155     OPTION_COMPILER_OPT_NEW_VALUE_NUMBERING,
156     OPTION_COMPILER_ENABLE_NATIVE_INLINE,
157     OPTION_COMPILER_ENABLE_LOWERING_BUILTIN,
158     OPTION_COMPILER_ENABLE_LITECG,
159     OPTION_COMPILER_ENABLE_JIT,
160     OPTION_COMPILER_JIT_HOTNESS_THRESHOLD,
161     OPTION_COMPILER_FORCE_JIT_COMPILE_MAIN,
162     OPTION_COMPILER_TRACE_JIT,
163     OPTION_ENABLE_ELEMENTSKIND,
164     OPTION_COMPILER_TYPED_OP_PROFILER,
165     OPTION_COMPILER_OPT_BRANCH_PROFILING,
166 };
167 
168 class PUBLIC_API JSRuntimeOptions {
169 public:
JSRuntimeOptions()170     JSRuntimeOptions() {}
171     ~JSRuntimeOptions() = default;
172     DEFAULT_COPY_SEMANTIC(JSRuntimeOptions);
173     DEFAULT_MOVE_SEMANTIC(JSRuntimeOptions);
174 
175     bool ParseCommand(const int argc, const char **argv);
176     bool SetDefaultValue(char* argv);
177 
EnableArkTools()178     bool EnableArkTools() const
179     {
180         return (enableArkTools_) ||
181             ((static_cast<uint32_t>(arkProperties_) & ArkProperties::ENABLE_ARKTOOLS) != 0);
182     }
183 
SetEnableArkTools(bool value)184     void SetEnableArkTools(bool value) {
185         enableArkTools_ = value;
186     }
187 
WasSetEnableArkTools()188     bool WasSetEnableArkTools() const
189     {
190         return WasOptionSet(OPTION_ENABLE_ARK_TOOLS);
191     }
192 
IsEnableRuntimeStat()193     bool IsEnableRuntimeStat() const
194     {
195         return enableRuntimeStat_;
196     }
197 
SetEnableRuntimeStat(bool value)198     void SetEnableRuntimeStat(bool value)
199     {
200         enableRuntimeStat_ = value;
201     }
202 
WasSetEnableRuntimeStat()203     bool WasSetEnableRuntimeStat() const
204     {
205         return WasOptionSet(OPTION_ENABLE_RUNTIME_STAT);
206     }
207 
GetStubFile()208     std::string GetStubFile() const
209     {
210         return stubFile_;
211     }
212 
SetStubFile(std::string value)213     void SetStubFile(std::string value)
214     {
215         stubFile_ = std::move(value);
216     }
217 
SetCompilerPkgJsonInfo(std::string pkgJsonInfo)218     void SetCompilerPkgJsonInfo(std::string pkgJsonInfo)
219     {
220         compilerPkgInfo_ = std::move(pkgJsonInfo);
221     }
222 
GetCompilerPkgJsonInfo()223     const std::string &GetCompilerPkgJsonInfo() const
224     {
225         return compilerPkgInfo_;
226     }
227 
SetCompilerExternalPkgJsonInfo(std::string pkgJsonInfo)228     void SetCompilerExternalPkgJsonInfo(std::string pkgJsonInfo)
229     {
230         compilerExternalPkgInfo_ = std::move(pkgJsonInfo);
231     }
232 
GetCompilerExternalPkgJsonInfo()233     const std::string &GetCompilerExternalPkgJsonInfo() const
234     {
235         return compilerExternalPkgInfo_;
236     }
237 
SetCompilerEnableExternalPkg(bool compilerEnableExternalPkg)238     void SetCompilerEnableExternalPkg(bool compilerEnableExternalPkg)
239     {
240         compilerEnableExternalPkg_ = compilerEnableExternalPkg;
241     }
242 
GetCompilerEnableExternalPkg()243     bool GetCompilerEnableExternalPkg() const
244     {
245         return compilerEnableExternalPkg_;
246     }
247 
WasStubFileSet()248     bool WasStubFileSet() const
249     {
250         return WasOptionSet(OPTION_STUB_FILE);
251     }
252 
SetEnableAOT(bool value)253     void SetEnableAOT(bool value)
254     {
255         enableAOT_ = value;
256     }
257 
GetEnableAOT()258     bool GetEnableAOT() const
259     {
260         return enableAOT_;
261     }
262 
GetAOTOutputFile()263     std::string GetAOTOutputFile() const
264     {
265         return aotOutputFile_;
266     }
267 
SetAOTOutputFile(const std::string & value)268     void SetAOTOutputFile(const std::string& value)
269     {
270         aotOutputFile_ = panda::os::file::File::GetExtendedFilePath(value);
271     }
272 
WasAOTOutputFileSet()273     bool WasAOTOutputFileSet() const
274     {
275         return WasOptionSet(OPTION_AOT_FILE);
276     }
277 
GetTargetTriple()278     std::string GetTargetTriple() const
279     {
280         return targetTriple_;
281     }
282 
SetTargetTriple(std::string value)283     void SetTargetTriple(std::string value)
284     {
285         targetTriple_ = std::move(value);
286     }
287 
GetOptLevel()288     size_t GetOptLevel() const
289     {
290         return asmOptLevel_;
291     }
292 
SetOptLevel(size_t value)293     void SetOptLevel(size_t value)
294     {
295         asmOptLevel_ = value;
296     }
297 
GetRelocMode()298     size_t GetRelocMode() const
299     {
300         return relocationMode_;
301     }
302 
SetRelocMode(size_t value)303     void SetRelocMode(size_t value)
304     {
305         relocationMode_ = value;
306     }
307 
EnableForceGC()308     bool EnableForceGC() const
309     {
310         return enableForceGc_;
311     }
312 
SetEnableForceGC(bool value)313     void SetEnableForceGC(bool value)
314     {
315         enableForceGc_ = value;
316     }
317 
ForceFullGC()318     bool ForceFullGC() const
319     {
320         return forceFullGc_;
321     }
322 
SetForceFullGC(bool value)323     void SetForceFullGC(bool value)
324     {
325         forceFullGc_ = value;
326     }
327 
SetGcThreadNum(size_t num)328     void SetGcThreadNum(size_t num)
329     {
330         gcThreadNum_ = num;
331     }
332 
GetGcThreadNum()333     size_t GetGcThreadNum() const
334     {
335         return gcThreadNum_;
336     }
337 
SetLongPauseTime(size_t time)338     void SetLongPauseTime(size_t time)
339     {
340         longPauseTime_ = time;
341     }
342 
GetLongPauseTime()343     size_t GetLongPauseTime() const
344     {
345         return longPauseTime_;
346     }
347 
SetArkProperties(int prop)348     void SetArkProperties(int prop)
349     {
350         if (prop != ArkProperties::DEFAULT) {
351             arkProperties_ = prop;
352         }
353     }
354 
SetArkBundleName(std::string bundleName)355     void SetArkBundleName(std::string bundleName)
356     {
357         if (bundleName != "") {
358             arkBundleName_ = bundleName;
359         }
360     }
361 
GetDefaultProperties()362     int GetDefaultProperties()
363     {
364         return ArkProperties::PARALLEL_GC | ArkProperties::CONCURRENT_MARK | ArkProperties::CONCURRENT_SWEEP |
365             ArkProperties::ENABLE_ARKTOOLS | ArkProperties::ENABLE_IDLE_GC;
366     }
367 
GetArkProperties()368     int GetArkProperties()
369     {
370         return arkProperties_;
371     }
372 
GetArkBundleName()373     std::string GetArkBundleName() const
374     {
375         return arkBundleName_;
376     }
377 
EnableOptionalLog()378     bool EnableOptionalLog() const
379     {
380         return (static_cast<uint32_t>(arkProperties_) & ArkProperties::OPTIONAL_LOG) != 0;
381     }
382 
EnableGCStatsPrint()383     bool EnableGCStatsPrint() const
384     {
385         return (static_cast<uint32_t>(arkProperties_) & ArkProperties::GC_STATS_PRINT) != 0;
386     }
387 
EnableParallelGC()388     bool EnableParallelGC() const
389     {
390         return (static_cast<uint32_t>(arkProperties_) & ArkProperties::PARALLEL_GC) != 0;
391     }
392 
EnableConcurrentMark()393     bool EnableConcurrentMark() const
394     {
395         return (static_cast<uint32_t>(arkProperties_) & ArkProperties::CONCURRENT_MARK) != 0;
396     }
397 
EnableExceptionBacktrace()398     bool EnableExceptionBacktrace() const
399     {
400         return (static_cast<uint32_t>(arkProperties_) & ArkProperties::EXCEPTION_BACKTRACE) != 0;
401     }
402 
EnableConcurrentSweep()403     bool EnableConcurrentSweep() const
404     {
405         return (static_cast<uint32_t>(arkProperties_) & ArkProperties::CONCURRENT_SWEEP) != 0;
406     }
407 
EnableThreadCheck()408     bool EnableThreadCheck() const
409     {
410         return (static_cast<uint32_t>(arkProperties_) & ArkProperties::THREAD_CHECK) != 0;
411     }
412 
EnableIdleGC()413     bool EnableIdleGC() const
414     {
415         return false;
416     }
417 
EnableGCTracer()418     bool EnableGCTracer() const
419     {
420         return (static_cast<uint32_t>(arkProperties_) & ArkProperties::ENABLE_GC_TRACER) != 0;
421     }
422 
EnableGlobalObjectLeakCheck()423     bool EnableGlobalObjectLeakCheck() const
424     {
425         return (static_cast<uint32_t>(arkProperties_) & ArkProperties::GLOBAL_OBJECT_LEAK_CHECK) != 0;
426     }
427 
EnableGlobalPrimitiveLeakCheck()428     bool EnableGlobalPrimitiveLeakCheck() const
429     {
430         return (static_cast<uint32_t>(arkProperties_) & ArkProperties::GLOBAL_PRIMITIVE_LEAK_CHECK) != 0;
431     }
432 
EnableGlobalLeakCheck()433     bool EnableGlobalLeakCheck() const
434     {
435         return EnableGlobalObjectLeakCheck() || EnableGlobalPrimitiveLeakCheck();
436     }
437 
EnableCpuProfilerColdStartMainThread()438     bool EnableCpuProfilerColdStartMainThread() const
439     {
440         return (static_cast<uint32_t>(arkProperties_) & ArkProperties::CPU_PROFILER_COLD_START_MAIN_THREAD) != 0;
441     }
442 
EnableCpuProfilerColdStartWorkerThread()443     bool EnableCpuProfilerColdStartWorkerThread() const
444     {
445         return (static_cast<uint32_t>(arkProperties_) & ArkProperties::CPU_PROFILER_COLD_START_WORKER_THREAD) != 0;
446     }
447 
EnableCpuProfilerAnyTimeMainThread()448     bool EnableCpuProfilerAnyTimeMainThread() const
449     {
450         return (static_cast<uint32_t>(arkProperties_) & ArkProperties::CPU_PROFILER_ANY_TIME_MAIN_THREAD) != 0;
451     }
452 
EnableCpuProfilerAnyTimeWorkerThread()453     bool EnableCpuProfilerAnyTimeWorkerThread() const
454     {
455         return (static_cast<uint32_t>(arkProperties_) & ArkProperties::CPU_PROFILER_ANY_TIME_WORKER_THREAD) != 0;
456     }
457 
EnableCpuProfilerVMTag()458     bool EnableCpuProfilerVMTag() const
459     {
460         return (static_cast<uint32_t>(arkProperties_) & ArkProperties::ENABLE_CPU_PROFILER_VM_TAG) != 0;
461     }
462 
IsStartGlobalLeakCheck()463     bool IsStartGlobalLeakCheck() const
464     {
465         return startGlobalLeakCheck_;
466     }
467 
SwitchStartGlobalLeakCheck()468     void SwitchStartGlobalLeakCheck()
469     {
470         startGlobalLeakCheck_ = !startGlobalLeakCheck_;
471     }
472 
EnableSnapshotSerialize()473     bool EnableSnapshotSerialize() const
474     {
475         return (static_cast<uint32_t>(arkProperties_) & ArkProperties::ENABLE_SNAPSHOT_SERIALIZE) != 0;
476     }
477 
EnableSnapshotDeserialize()478     bool EnableSnapshotDeserialize() const
479     {
480         if (WIN_OR_MAC_OR_IOS_PLATFORM) {
481             return false;
482         }
483 
484         return (static_cast<uint32_t>(arkProperties_) & ArkProperties::ENABLE_SNAPSHOT_DESERIALIZE) != 0;
485     }
486 
EnableHeapVerify()487     bool EnableHeapVerify() const
488     {
489         return (static_cast<uint32_t>(arkProperties_) & ArkProperties::ENABLE_HEAP_VERIFY) != 0;
490     }
491 
DisableReportModuleResolvingFailure()492     void DisableReportModuleResolvingFailure()
493     {
494         reportModuleResolvingFailure_ = false;
495     }
496 
EnableReportModuleResolvingFailure()497     bool EnableReportModuleResolvingFailure() const
498     {
499         return reportModuleResolvingFailure_;
500     }
501 
WasSetMaxNonmovableSpaceCapacity()502     bool WasSetMaxNonmovableSpaceCapacity() const
503     {
504         return WasOptionSet(OPTION_MAX_UNMOVABLE_SPACE);
505     }
506 
MaxNonmovableSpaceCapacity()507     size_t MaxNonmovableSpaceCapacity() const
508     {
509         return maxNonmovableSpaceCapacity_;
510     }
511 
SetMaxNonmovableSpaceCapacity(uint32_t value)512     void SetMaxNonmovableSpaceCapacity(uint32_t value)
513     {
514         maxNonmovableSpaceCapacity_ = value;
515     }
516 
SetEnableAsmInterpreter(bool value)517     void SetEnableAsmInterpreter(bool value)
518     {
519         enableAsmInterpreter_ = value;
520     }
521 
GetEnableAsmInterpreter()522     bool GetEnableAsmInterpreter() const
523     {
524         return enableAsmInterpreter_;
525     }
526 
SetEnableBuiltinsLazy(bool value)527     void SetEnableBuiltinsLazy(bool value)
528     {
529         enableBuiltinsLazy_ = value;
530     }
531 
GetEnableBuiltinsLazy()532     bool GetEnableBuiltinsLazy() const
533     {
534         return enableBuiltinsLazy_;
535     }
536 
SetAsmOpcodeDisableRange(std::string value)537     void SetAsmOpcodeDisableRange(std::string value)
538     {
539         asmOpcodeDisableRange_ = std::move(value);
540     }
541 
ParseAsmInterOption()542     void ParseAsmInterOption()
543     {
544         asmInterParsedOption_.enableAsm = enableAsmInterpreter_;
545         std::string strAsmOpcodeDisableRange = asmOpcodeDisableRange_;
546         if (strAsmOpcodeDisableRange.empty()) {
547             return;
548         }
549 
550         // asm interpreter handle disable range
551         size_t pos = strAsmOpcodeDisableRange.find(",");
552         if (pos != std::string::npos) {
553             std::string strStart = strAsmOpcodeDisableRange.substr(0, pos);
554             std::string strEnd = strAsmOpcodeDisableRange.substr(pos + 1);
555             int start = strStart.empty() ? 0 : std::stoi(strStart);
556             int end = strEnd.empty() ? kungfu::BYTECODE_STUB_END_ID : std::stoi(strEnd);
557             if (start >= 0 && start < kungfu::BytecodeStubCSigns::NUM_OF_ALL_NORMAL_STUBS &&
558                 end >= 0 && end < kungfu::BytecodeStubCSigns::NUM_OF_ALL_NORMAL_STUBS &&
559                 start <= end) {
560                 asmInterParsedOption_.handleStart = start;
561                 asmInterParsedOption_.handleEnd = end;
562             }
563         }
564     }
565 
GetAsmInterParsedOption()566     AsmInterParsedOption GetAsmInterParsedOption() const
567     {
568         return asmInterParsedOption_;
569     }
570 
GetCompilerLogOption()571     std::string GetCompilerLogOption() const
572     {
573         return compilerLogOpt_;
574     }
575 
SetCompilerLogOption(std::string value)576     void SetCompilerLogOption(std::string value)
577     {
578         compilerLogOpt_ = std::move(value);
579     }
580 
WasSetCompilerLogOption()581     bool WasSetCompilerLogOption() const
582     {
583         return 1ULL << static_cast<uint64_t>(OPTION_COMPILER_LOG_OPT) & wasSet_ &&
584             GetCompilerLogOption().find("none") == std::string::npos;
585     }
586 
GetMethodsListForLog()587     std::string GetMethodsListForLog() const
588     {
589         return compilerLogMethods_;
590     }
591 
SetMethodsListForLog(std::string value)592     void SetMethodsListForLog(std::string value)
593     {
594         compilerLogMethods_ = std::move(value);
595     }
596 
WasSetMethodsListForLog()597     bool WasSetMethodsListForLog() const
598     {
599         return 1ULL << static_cast<uint64_t>(OPTION_COMPILER_LOG_METHODS) & wasSet_ &&
600             GetCompilerLogOption().find("none") == std::string::npos &&
601             GetCompilerLogOption().find("all") == std::string::npos;
602     }
603 
SetCompilerLogSnapshot(bool value)604     void SetCompilerLogSnapshot(bool value)
605     {
606         compilerLogSnapshot_ = value;
607     }
608 
IsEnableCompilerLogSnapshot()609     bool IsEnableCompilerLogSnapshot() const
610     {
611         return compilerLogSnapshot_;
612     }
613 
WasSetCompilerLogSnapshot()614     bool WasSetCompilerLogSnapshot() const
615     {
616         return WasOptionSet(OPTION_COMPILER_LOG_SNAPSHOT);
617     }
618 
SetCompilerLogTime(bool value)619     void SetCompilerLogTime(bool value)
620     {
621         compilerLogTime_ = value;
622     }
623 
IsEnableCompilerLogTime()624     bool IsEnableCompilerLogTime() const
625     {
626         return compilerLogTime_;
627     }
628 
WasSetCompilerLogTime()629     bool WasSetCompilerLogTime() const
630     {
631         return WasOptionSet(OPTION_COMPILER_LOG_TIME);
632     }
633 
GetSerializerBufferSizeLimit()634     uint64_t GetSerializerBufferSizeLimit() const
635     {
636         return serializerBufferSizeLimit_;
637     }
638 
SetSerializerBufferSizeLimit(uint64_t value)639     void SetSerializerBufferSizeLimit(uint64_t value)
640     {
641         serializerBufferSizeLimit_ = value;
642     }
643 
GetHeapSizeLimit()644     uint32_t GetHeapSizeLimit() const
645     {
646         return heapSizeLimit_;
647     }
648 
SetHeapSizeLimit(uint32_t value)649     void SetHeapSizeLimit(uint32_t value)
650     {
651         heapSizeLimit_ = value;
652     }
653 
WasSetHeapSizeLimit()654     bool WasSetHeapSizeLimit() const
655     {
656         return WasOptionSet(OPTION_HEAP_SIZE_LIMIT);
657     }
658 
SetIsWorker(bool isWorker)659     void SetIsWorker(bool isWorker)
660     {
661         isWorker_ = isWorker;
662     }
663 
IsWorker()664     bool IsWorker() const
665     {
666         return isWorker_;
667     }
668 
EnableIC()669     bool EnableIC() const
670     {
671         return enableIC_;
672     }
673 
SetEnableIC(bool value)674     void SetEnableIC(bool value)
675     {
676         enableIC_ = value;
677     }
678 
WasSetEnableIC()679     bool WasSetEnableIC() const
680     {
681         return WasOptionSet(OPTION_ENABLE_IC);
682     }
683 
GetIcuDataPath()684     std::string GetIcuDataPath() const
685     {
686         return icuDataPath_;
687     }
688 
SetIcuDataPath(std::string value)689     void SetIcuDataPath(std::string value)
690     {
691         icuDataPath_ = std::move(value);
692     }
693 
WasSetIcuDataPath()694     bool WasSetIcuDataPath() const
695     {
696         return WasOptionSet(OPTION_ICU_DATA_PATH);
697     }
698 
IsStartupTime()699     bool IsStartupTime() const
700     {
701         return startupTime_;
702     }
703 
SetStartupTime(bool value)704     void SetStartupTime(bool value)
705     {
706         startupTime_ = value;
707     }
708 
WasSetStartupTime()709     bool WasSetStartupTime() const
710     {
711         return WasOptionSet(OPTION_STARTUP_TIME);
712     }
713 
AssertTypes()714     bool AssertTypes() const
715     {
716         return assertTypes_;
717     }
718 
SetAssertTypes(bool value)719     void SetAssertTypes(bool value)
720     {
721         assertTypes_ = value;
722     }
723 
PrintTypeInfo()724     bool PrintTypeInfo() const
725     {
726         return printTypeInfo_;
727     }
728 
SetPrintTypeInfo(bool value)729     void SetPrintTypeInfo(bool value)
730     {
731         printTypeInfo_ = value;
732     }
733 
SetBuiltinsDTS(const std::string & value)734     void SetBuiltinsDTS(const std::string& value)
735     {
736         builtinsDTS_ = panda::os::file::File::GetExtendedFilePath(value);
737     }
738 
WasSetBuiltinsDTS()739     bool WasSetBuiltinsDTS() const
740     {
741         return WasOptionSet(OPTION_BUILTINS_DTS);
742     }
743 
GetBuiltinsDTS()744     std::string GetBuiltinsDTS() const
745     {
746         return builtinsDTS_;
747     }
748 
SetTraceBc(bool value)749     void SetTraceBc(bool value)
750     {
751         traceBc_ = value;
752     }
753 
IsTraceBC()754     bool IsTraceBC() const
755     {
756         return traceBc_;
757     }
758 
WasSetTraceBc()759     bool WasSetTraceBc() const
760     {
761         return WasOptionSet(OPTION_COMPILER_TRACE_BC);
762     }
763 
GetLogLevel()764     std::string GetLogLevel() const
765     {
766         return logLevel_;
767     }
768 
SetLogLevel(std::string value)769     void SetLogLevel(std::string value)
770     {
771         logLevel_ = std::move(value);
772     }
773 
WasSetLogLevel()774     bool WasSetLogLevel() const
775     {
776         return WasOptionSet(OPTION_LOG_LEVEL);
777     }
778 
GetLogComponents()779     arg_list_t GetLogComponents() const
780     {
781         return logComponents_;
782     }
783 
SetLogComponents(arg_list_t value)784     void SetLogComponents(arg_list_t value)
785     {
786         logComponents_ = std::move(value);
787     }
788 
WasSetLogComponents()789     bool WasSetLogComponents() const
790     {
791         return WasOptionSet(OPTION_LOG_COMPONENTS);
792     }
793 
GetLogDebug()794     arg_list_t GetLogDebug() const
795     {
796         return logDebug_;
797     }
798 
SetLogDebug(arg_list_t value)799     void SetLogDebug(arg_list_t value)
800     {
801         logDebug_ = std::move(value);
802     }
803 
WasSetLogDebug()804     bool WasSetLogDebug() const
805     {
806         return WasOptionSet(OPTION_LOG_DEBUG);
807     }
808 
GetLogInfo()809     arg_list_t GetLogInfo() const
810     {
811         return logInfo_;
812     }
813 
SetLogInfo(arg_list_t value)814     void SetLogInfo(arg_list_t value)
815     {
816         logInfo_ = std::move(value);
817     }
818 
WasSetLogInfo()819     bool WasSetLogInfo() const
820     {
821         return WasOptionSet(OPTION_LOG_INFO);
822     }
823 
GetLogWarning()824     arg_list_t GetLogWarning() const
825     {
826         return logWarning_;
827     }
828 
SetLogWarning(arg_list_t value)829     void SetLogWarning(arg_list_t value)
830     {
831         logWarning_ = std::move(value);
832     }
833 
WasSetLogWarning()834     bool WasSetLogWarning() const
835     {
836         return WasOptionSet(OPTION_LOG_WARNING);
837     }
838 
GetLogError()839     arg_list_t GetLogError() const
840     {
841         return logError_;
842     }
843 
SetLogError(arg_list_t value)844     void SetLogError(arg_list_t value)
845     {
846         logError_ = std::move(value);
847     }
848 
WasSetLogError()849     bool WasSetLogError() const
850     {
851         return WasOptionSet(OPTION_LOG_ERROR);
852     }
853 
GetLogFatal()854     arg_list_t GetLogFatal() const
855     {
856         return logFatal_;
857     }
858 
SetLogFatal(arg_list_t value)859     void SetLogFatal(arg_list_t value)
860     {
861         logFatal_ = std::move(value);
862     }
863 
WasSetLogFatal()864     bool WasSetLogFatal() const
865     {
866         return WasOptionSet(OPTION_LOG_FATAL);
867     }
868 
GetMaxAotMethodSize()869     size_t GetMaxAotMethodSize() const
870     {
871         return maxAotMethodSize_;
872     }
873 
SetMaxAotMethodSize(uint32_t value)874     void SetMaxAotMethodSize(uint32_t value)
875     {
876         maxAotMethodSize_ = value;
877     }
878 
GetTypeThreshold()879     double GetTypeThreshold() const
880     {
881         return typeThreshold_;
882     }
883 
SetTypeThreshold(double threshold)884     void SetTypeThreshold(double threshold)
885     {
886         typeThreshold_ = threshold;
887     }
888 
GetEntryPoint()889     std::string GetEntryPoint() const
890     {
891         return entryPoint_;
892     }
893 
SetEntryPoint(std::string value)894     void SetEntryPoint(std::string value)
895     {
896         entryPoint_ = std::move(value);
897     }
898 
WasSetEntryPoint()899     bool WasSetEntryPoint() const
900     {
901         return WasOptionSet(OPTION_ENTRY_POINT);
902     }
903 
GetMergeAbc()904     bool GetMergeAbc() const
905     {
906         return mergeAbc_;
907     }
908 
SetMergeAbc(bool value)909     void SetMergeAbc(bool value)
910     {
911         mergeAbc_ = value;
912     }
913 
SetEnableContext(bool value)914     void SetEnableContext(bool value)
915     {
916         enableContext_ = value;
917     }
918 
IsEnableContext()919     bool IsEnableContext()
920     {
921         return enableContext_;
922     }
923 
SetEnablePrintExecuteTime(bool value)924     void SetEnablePrintExecuteTime(bool value)
925     {
926         enablePrintExecuteTime_ = value;
927     }
928 
IsEnablePrintExecuteTime()929     bool IsEnablePrintExecuteTime()
930     {
931         return enablePrintExecuteTime_;
932     }
933 
SetEnableElementsKind(bool value)934     void SetEnableElementsKind(bool value)
935     {
936         enableElementsKind_ = value;
937     }
938 
IsEnableElementsKind()939     bool IsEnableElementsKind() const
940     {
941         return enableElementsKind_;
942     }
943 
SetEnablePGOProfiler(bool value)944     void SetEnablePGOProfiler(bool value)
945     {
946         enablePGOProfiler_ = value;
947     }
948 
IsEnablePGOProfiler()949     bool IsEnablePGOProfiler() const
950     {
951         return enablePGOProfiler_;
952     }
953 
GetPGOHotnessThreshold()954     uint32_t GetPGOHotnessThreshold() const
955     {
956         return pgoHotnessThreshold_;
957     }
958 
SetPGOHotnessThreshold(uint32_t threshold)959     void SetPGOHotnessThreshold(uint32_t threshold)
960     {
961         pgoHotnessThreshold_ = threshold;
962     }
963 
GetPGOSaveMinInterval()964     uint32_t GetPGOSaveMinInterval() const
965     {
966         return pgoSaveMinInterval_;
967     }
968 
SetPGOSaveMinInterval(uint32_t value)969     void SetPGOSaveMinInterval(uint32_t value)
970     {
971         pgoSaveMinInterval_ = value;
972     }
973 
GetPGOProfilerPath()974     std::string GetPGOProfilerPath() const
975     {
976         return pgoProfilerPath_;
977     }
978 
SetPGOProfilerPath(const std::string & value)979     void SetPGOProfilerPath(const std::string& value)
980     {
981         pgoProfilerPath_ = panda::os::file::File::GetExtendedFilePath(value);
982     }
983 
IsPGOProfilerPathEmpty()984     bool IsPGOProfilerPathEmpty() const
985     {
986         return pgoProfilerPath_.empty();
987     }
988 
SetEnableTypeLowering(bool value)989     void SetEnableTypeLowering(bool value)
990     {
991         enableTypeLowering_ = value;
992     }
993 
IsEnableArrayBoundsCheckElimination()994     bool IsEnableArrayBoundsCheckElimination() const
995     {
996         return enableArrayBoundsCheckElimination_;
997     }
998 
SetEnableArrayBoundsCheckElimination(bool value)999     void SetEnableArrayBoundsCheckElimination(bool value)
1000     {
1001         enableArrayBoundsCheckElimination_ = value;
1002     }
1003 
IsEnableTypeLowering()1004     bool IsEnableTypeLowering() const
1005     {
1006         return enableTypeLowering_;
1007     }
1008 
SetEnableEarlyElimination(bool value)1009     void SetEnableEarlyElimination(bool value)
1010     {
1011         enableEarlyElimination_ = value;
1012     }
1013 
IsEnableEarlyElimination()1014     bool IsEnableEarlyElimination() const
1015     {
1016         return enableEarlyElimination_;
1017     }
1018 
SetEnableLaterElimination(bool value)1019     void SetEnableLaterElimination(bool value)
1020     {
1021         enableLaterElimination_ = value;
1022     }
1023 
IsEnableLaterElimination()1024     bool IsEnableLaterElimination() const
1025     {
1026         return enableLaterElimination_;
1027     }
1028 
SetEnableInstrcutionCombine(bool value)1029     void SetEnableInstrcutionCombine(bool value)
1030     {
1031         enableInstrcutionCombine = value;
1032     }
1033 
IsEnableInstrcutionCombine()1034     bool IsEnableInstrcutionCombine() const
1035     {
1036         return enableInstrcutionCombine;
1037     }
1038 
SetEnableValueNumbering(bool value)1039     void SetEnableValueNumbering(bool value)
1040     {
1041         enableValueNumbering_ = value;
1042     }
1043 
IsEnableValueNumbering()1044     bool IsEnableValueNumbering() const
1045     {
1046         return enableValueNumbering_;
1047     }
1048 
1049 
SetEnableJIT(bool value)1050     void SetEnableJIT(bool value)
1051     {
1052         enableJIT_ = value;
1053     }
1054 
IsEnableJIT()1055     bool IsEnableJIT() const
1056     {
1057         return enableJIT_;
1058     }
1059 
SetJitHotnessThreshold(uint16_t value)1060     void SetJitHotnessThreshold(uint16_t value)
1061     {
1062         jitHotnessThreshold_ = value;
1063     }
1064 
GetJitHotnessThreshold()1065     uint16_t GetJitHotnessThreshold() const
1066     {
1067         return jitHotnessThreshold_;
1068     }
1069 
SetForceJitCompileMain(bool value)1070     void SetForceJitCompileMain(bool value)
1071     {
1072         forceJitCompileMain_ = value;
1073     }
1074 
IsEnableForceJitCompileMain()1075     bool IsEnableForceJitCompileMain()
1076     {
1077         return forceJitCompileMain_;
1078     }
1079 
SetEnableNewValueNumbering(bool value)1080     void SetEnableNewValueNumbering(bool value)
1081     {
1082         enableNewValueNumbering_ = value;
1083     }
1084 
IsEnableNewValueNumbering()1085     bool IsEnableNewValueNumbering() const
1086     {
1087         return enableNewValueNumbering_;
1088     }
1089 
SetEnableOptString(bool value)1090     void SetEnableOptString(bool value)
1091     {
1092         enableOptString_ = value;
1093     }
1094 
IsEnableOptString()1095     bool IsEnableOptString() const
1096     {
1097         return enableOptString_;
1098     }
1099 
SetEnableOptInlining(bool value)1100     void SetEnableOptInlining(bool value)
1101     {
1102         enableOptInlining_ = value;
1103     }
1104 
IsEnableOptInlining()1105     bool IsEnableOptInlining() const
1106     {
1107         return enableOptInlining_;
1108     }
1109 
SetEnableOptPGOType(bool value)1110     void SetEnableOptPGOType(bool value)
1111     {
1112         enableOptPGOType_ = value;
1113     }
1114 
IsEnableOptPGOType()1115     bool IsEnableOptPGOType() const
1116     {
1117         return enableOptPGOType_;
1118     }
1119 
SetEnableOptTrackField(bool value)1120     void SetEnableOptTrackField(bool value)
1121     {
1122         enableOptTrackField_ = value;
1123     }
1124 
IsEnableOptTrackField()1125     bool IsEnableOptTrackField() const
1126     {
1127         return enableOptTrackField_;
1128     }
1129 
SetEnableGlobalTypeInfer(bool value)1130     void SetEnableGlobalTypeInfer(bool value)
1131     {
1132         enableGlobalTypeInfer_ = value;
1133     }
1134 
IsEnableGlobalTypeInfer()1135     bool IsEnableGlobalTypeInfer() const
1136     {
1137         return enableGlobalTypeInfer_;
1138     }
1139 
GetCompilerModuleMethods()1140     uint32_t GetCompilerModuleMethods() const
1141     {
1142         return compilerModuleMethods_;
1143     }
1144 
SetCompilerModuleMethods(uint32_t compilerModuleMethods)1145     void SetCompilerModuleMethods(uint32_t compilerModuleMethods)
1146     {
1147         compilerModuleMethods_ = compilerModuleMethods;
1148     }
1149 
WasSet(int opt)1150     void WasSet(int opt)
1151     {
1152         wasSet_ |= 1ULL << static_cast<uint64_t>(opt);
1153     }
1154 
SetTraceDeopt(bool value)1155     void SetTraceDeopt(bool value)
1156     {
1157         traceDeopt_ = value;
1158     }
1159 
GetTraceDeopt()1160     bool GetTraceDeopt() const
1161     {
1162         return traceDeopt_;
1163     }
1164 
SetDeoptThreshold(uint8_t value)1165     void SetDeoptThreshold(uint8_t value)
1166     {
1167         deoptThreshold_ = value;
1168     }
1169 
GetDeoptThreshold()1170     uint32_t GetDeoptThreshold() const
1171     {
1172         return deoptThreshold_;
1173     }
1174 
SetStressDeopt(bool value)1175     void SetStressDeopt(bool value)
1176     {
1177         stressDeopt_ = value;
1178     }
1179 
GetStressDeopt()1180     bool GetStressDeopt() const
1181     {
1182         return stressDeopt_;
1183     }
1184 
SetOptCodeProfiler(bool value)1185     void SetOptCodeProfiler(bool value)
1186     {
1187         optCodeProfiler_ = value;
1188     }
1189 
GetOptCodeProfiler()1190     bool GetOptCodeProfiler() const
1191     {
1192         return optCodeProfiler_;
1193     }
1194 
SetVerifyVTable(bool value)1195     void SetVerifyVTable(bool value)
1196     {
1197         verifyVTable_ = value;
1198     }
1199 
GetVerifyVTable()1200     bool GetVerifyVTable() const
1201     {
1202         return verifyVTable_;
1203     }
1204 
GetCompilerSelectMethods()1205     std::string GetCompilerSelectMethods() const
1206     {
1207         return compilerSelectMethods_;
1208     }
1209 
SetCompilerSelectMethods(std::string value)1210     void SetCompilerSelectMethods(std::string value)
1211     {
1212         compilerSelectMethods_ = std::move(value);
1213     }
1214 
GetCompilerSkipMethods()1215     std::string GetCompilerSkipMethods() const
1216     {
1217         return compilerSkipMethods_;
1218     }
1219 
SetCompilerSkipMethods(std::string value)1220     void SetCompilerSkipMethods(std::string value)
1221     {
1222         compilerSkipMethods_ = std::move(value);
1223     }
1224 
SetTraceInline(bool value)1225     void SetTraceInline(bool value)
1226     {
1227         traceInline_ = value;
1228     }
1229 
GetTraceInline()1230     bool GetTraceInline() const
1231     {
1232         return traceInline_;
1233     }
1234 
SetTraceValueNumbering(bool value)1235     void SetTraceValueNumbering(bool value)
1236     {
1237         traceValueNumbering_ = value;
1238     }
1239 
GetTraceValueNumbering()1240     bool GetTraceValueNumbering() const
1241     {
1242         return traceValueNumbering_;
1243     }
1244 
SetTraceJIT(bool value)1245     void SetTraceJIT(bool value)
1246     {
1247         traceJIT_ = value;
1248     }
1249 
GetTraceJIT()1250     bool GetTraceJIT() const
1251     {
1252         return traceJIT_;
1253     }
1254 
SetTraceInstructionCombine(bool value)1255     void SetTraceInstructionCombine(bool value)
1256     {
1257         traceInstructionCombine_ = value;
1258     }
1259 
GetTraceInstructionCombine()1260     bool GetTraceInstructionCombine() const
1261     {
1262         return traceInstructionCombine_;
1263     }
1264 
SetMaxInlineBytecodes(size_t value)1265     void SetMaxInlineBytecodes(size_t value)
1266     {
1267         maxInlineBytecodes_ = value;
1268     }
1269 
GetMaxInlineBytecodes()1270     size_t GetMaxInlineBytecodes()
1271     {
1272         return maxInlineBytecodes_;
1273     }
1274 
SetTargetCompilerMode(std::string mode)1275     void SetTargetCompilerMode(std::string mode)
1276     {
1277         targetCompilerMode_ = std::move(mode);
1278     }
1279 
GetTargetCompilerMode()1280     std::string GetTargetCompilerMode() const
1281     {
1282         return targetCompilerMode_;
1283     }
1284 
IsTargetCompilerMode()1285     bool IsTargetCompilerMode() const
1286     {
1287         return IsPartialCompilerMode() || IsFullCompilerMode();
1288     }
1289 
IsPartialCompilerMode()1290     bool IsPartialCompilerMode() const
1291     {
1292         return targetCompilerMode_ == "partial";
1293     }
1294 
IsFullCompilerMode()1295     bool IsFullCompilerMode() const
1296     {
1297         return targetCompilerMode_ == "full";
1298     }
1299 
SetHapPath(std::string path)1300     void SetHapPath(std::string path)
1301     {
1302         hapPath_ = std::move(path);
1303     }
1304 
GetHapPath()1305     std::string GetHapPath() const
1306     {
1307         return hapPath_;
1308     }
1309 
SetHapAbcOffset(uint32_t offset)1310     void SetHapAbcOffset(uint32_t offset)
1311     {
1312         hapAbcOffset_ = offset;
1313     }
1314 
GetHapAbcOffset()1315     uint32_t GetHapAbcOffset() const
1316     {
1317         return hapAbcOffset_;
1318     }
1319 
SetHapAbcSize(uint32_t size)1320     void SetHapAbcSize(uint32_t size)
1321     {
1322         hapAbcSize_ = size;
1323     }
1324 
GetHapAbcSize()1325     uint32_t GetHapAbcSize() const
1326     {
1327         return hapAbcSize_;
1328     }
1329 
SetCompilerNoCheck(bool value)1330     void SetCompilerNoCheck(bool value)
1331     {
1332         compilerNoCheck_ = value;
1333     }
1334 
IsCompilerNoCheck()1335     bool IsCompilerNoCheck() const
1336     {
1337         return compilerNoCheck_;
1338     }
1339 
1340     void SetTargetBuiltinsDtsPath();
1341 
1342     void SetOptionsForTargetCompilation();
1343 
SetFastAOTCompileMode(bool value)1344     void SetFastAOTCompileMode(bool value)
1345     {
1346         fastAOTCompileMode_ = value;
1347     }
1348 
GetFastAOTCompileMode()1349     bool GetFastAOTCompileMode() const
1350     {
1351         return fastAOTCompileMode_;
1352     }
1353 
SetEnableOptLoopPeeling(bool value)1354     void SetEnableOptLoopPeeling(bool value)
1355     {
1356         enableOptLoopPeeling_ = value;
1357     }
1358 
IsEnableOptLoopPeeling()1359     bool IsEnableOptLoopPeeling() const
1360     {
1361         return enableOptLoopPeeling_;
1362     }
1363 
SetEnableOptLoopInvariantCodeMotion(bool value)1364     void SetEnableOptLoopInvariantCodeMotion(bool value)
1365     {
1366         enableOptLoopInvariantCodeMotion_ = value;
1367     }
1368 
IsEnableOptLoopInvariantCodeMotion()1369     bool IsEnableOptLoopInvariantCodeMotion() const
1370     {
1371         return enableOptLoopInvariantCodeMotion_;
1372     }
1373 
IsEnableOptConstantFolding()1374     bool IsEnableOptConstantFolding() const
1375     {
1376         return enableOptConstantFolding_;
1377     }
1378 
SetEnableOptConstantFolding(bool value)1379     void SetEnableOptConstantFolding(bool value)
1380     {
1381         enableOptConstantFolding_ = value;
1382     }
1383 
SetEnableOptOnHeapCheck(bool value)1384     void SetEnableOptOnHeapCheck(bool value)
1385     {
1386         enableOptOnHeapCheck_ = value;
1387     }
1388 
IsEnableOptOnHeapCheck()1389     bool IsEnableOptOnHeapCheck() const
1390     {
1391         return enableOptOnHeapCheck_;
1392     }
1393 
IsEnableLexenvSpecialization()1394     bool IsEnableLexenvSpecialization() const
1395     {
1396         return enableLexenvSpecialization_;
1397     }
1398 
SetEnableLexenvSpecialization(bool value)1399     void SetEnableLexenvSpecialization(bool value)
1400     {
1401         enableLexenvSpecialization_ = value;
1402     }
1403 
IsEnableNativeInline()1404     bool IsEnableNativeInline() const
1405     {
1406         return enableNativeInline_;
1407     }
1408 
SetEnableNativeInline(bool value)1409     void SetEnableNativeInline(bool value)
1410     {
1411         enableNativeInline_ = value;
1412     }
1413 
IsEnableLoweringBuiltin()1414     bool IsEnableLoweringBuiltin() const
1415     {
1416         return enableLoweringBuiltin_;
1417     }
1418 
SetEnableLoweringBuiltin(bool value)1419     void SetEnableLoweringBuiltin(bool value)
1420     {
1421         enableLoweringBuiltin_ = value;
1422     }
1423 
SetCompilerEnableLiteCG(bool value)1424     void SetCompilerEnableLiteCG(bool value)
1425     {
1426         enableLiteCG_ = value;
1427     }
1428 
IsCompilerEnableLiteCG()1429     bool IsCompilerEnableLiteCG() const
1430     {
1431         return enableLiteCG_;
1432     }
1433 
SetTypedOpProfiler(bool value)1434     void SetTypedOpProfiler(bool value)
1435     {
1436         enableTypedOpProfiler_ = value;
1437     }
1438 
GetTypedOpProfiler()1439     bool GetTypedOpProfiler() const
1440     {
1441         return enableTypedOpProfiler_;
1442     }
1443 
IsEnableBranchProfiling()1444     bool IsEnableBranchProfiling() const
1445     {
1446         return enableBranchProfiling_;
1447     }
1448 
SetEnableBranchProfiling(bool value)1449     void SetEnableBranchProfiling(bool value)
1450     {
1451         enableBranchProfiling_ = value;
1452     }
1453 
1454 private:
StartsWith(const std::string & haystack,const std::string & needle)1455     static bool StartsWith(const std::string &haystack, const std::string &needle)
1456     {
1457         return std::equal(needle.begin(), needle.end(), haystack.begin());
1458     }
1459 
WasOptionSet(int option)1460     bool WasOptionSet(int option) const
1461     {
1462         return ((1ULL << static_cast<uint64_t>(option)) & wasSet_) != 0;
1463     }
1464 
1465     bool ParseBoolParam(bool* argBool);
1466     bool ParseDoubleParam(const std::string &option, double* argDouble);
1467     bool ParseIntParam(const std::string &option, int* argInt);
1468     bool ParseUint32Param(const std::string &option, uint32_t *argUInt32);
1469     bool ParseUint64Param(const std::string &option, uint64_t *argUInt64);
1470     void ParseListArgParam(const std::string &option, arg_list_t *argListStr, std::string delimiter);
1471 
1472     bool enableArkTools_ {true};
1473     std::string stubFile_ {"stub.an"};
1474     std::string compilerPkgInfo_ {};
1475     std::string compilerExternalPkgInfo_ {};
1476     bool compilerEnableExternalPkg_ {true};
1477     bool enableForceGc_ {true};
1478     bool forceFullGc_ {true};
1479     int arkProperties_ = GetDefaultProperties();
1480     std::string arkBundleName_ = {""};
1481     uint32_t gcThreadNum_ {7}; // 7: default thread num
1482     uint32_t longPauseTime_ {40}; // 40: default pause time
1483     std::string aotOutputFile_ {""};
1484     std::string targetTriple_ {TARGET_X64};
1485     uint32_t asmOptLevel_ {2};
1486     uint32_t relocationMode_ {2}; // 2: default relocation mode
1487     uint32_t maxNonmovableSpaceCapacity_ {4_MB};
1488     bool enableAsmInterpreter_ {true};
1489     bool enableBuiltinsLazy_ {true};
1490     std::string asmOpcodeDisableRange_ {""};
1491     AsmInterParsedOption asmInterParsedOption_;
1492     uint64_t serializerBufferSizeLimit_ {2_GB};
1493     uint32_t heapSizeLimit_ {512_MB};
1494     bool enableIC_ {true};
1495     std::string icuDataPath_ {"default"};
1496     bool startupTime_ {false};
1497     std::string compilerLogOpt_ {"none"};
1498     std::string compilerLogMethods_ {"none"};
1499     bool compilerLogSnapshot_ {false};
1500     bool compilerLogTime_ {false};
1501     bool enableRuntimeStat_ {false};
1502     bool assertTypes_ {false};
1503     bool printTypeInfo_ {false};
1504     bool isWorker_ {false};
1505     std::string builtinsDTS_ {""};
1506     bool traceBc_ {false};
1507     std::string logLevel_ {"error"};
1508     arg_list_t logDebug_ {{"all"}};
1509     arg_list_t logInfo_ {{"all"}};
1510     arg_list_t logWarning_ {{"all"}};
1511     arg_list_t logError_ {{"all"}};
1512     arg_list_t logFatal_ {{"all"}};
1513     arg_list_t logComponents_ {{"all"}};
1514     bool enableAOT_ {false};
1515     uint32_t maxAotMethodSize_ {32_KB};
1516     double typeThreshold_ {-1};
1517     std::string entryPoint_ {"_GLOBAL::func_main_0"};
1518     bool mergeAbc_ {false};
1519     bool enableArrayBoundsCheckElimination_ {false};
1520     bool enableTypeLowering_ {true};
1521     bool enableEarlyElimination_ {true};
1522     bool enableLaterElimination_ {true};
1523     bool enableValueNumbering_ {true};
1524     bool enableOptString_ {true};
1525     bool enableElementsKind_ {false};
1526     bool enableInstrcutionCombine {true};
1527     bool enableNewValueNumbering_ {true};
1528     bool enableOptInlining_ {true};
1529     bool enableOptPGOType_ {true};
1530     bool enableJIT_{false};
1531     uint16_t jitHotnessThreshold_ {2};
1532     bool forceJitCompileMain_{false};
1533     bool enableGlobalTypeInfer_ {false};
1534     bool enableOptTrackField_ {true};
1535     uint32_t compilerModuleMethods_ {100};
1536     uint64_t wasSet_ {0};
1537     bool enableContext_ {false};
1538     bool enablePrintExecuteTime_ {false};
1539     bool enablePGOProfiler_ {false};
1540     bool reportModuleResolvingFailure_ {true};
1541     uint32_t pgoHotnessThreshold_ {1};
1542     std::string pgoProfilerPath_ {""};
1543     uint32_t pgoSaveMinInterval_ {30};
1544     bool traceDeopt_ {false};
1545     uint8_t deoptThreshold_ {10};
1546     bool stressDeopt_ {false};
1547     bool optCodeProfiler_ {false};
1548     bool startGlobalLeakCheck_ {false};
1549     bool verifyVTable_ {false};
1550     std::string compilerSelectMethods_ {""};
1551     std::string compilerSkipMethods_ {""};
1552     bool traceInline_ {false};
1553     bool traceJIT_{false};
1554     bool traceValueNumbering_{false};
1555     bool traceInstructionCombine_{false};
1556     size_t maxInlineBytecodes_ {45};
1557     std::string targetCompilerMode_ {""};
1558     std::string hapPath_ {""};
1559     uint32_t hapAbcOffset_ {0};
1560     uint32_t hapAbcSize_ {0};
1561     bool compilerNoCheck_ {false};
1562     bool fastAOTCompileMode_ {false};
1563     bool enableOptLoopPeeling_ {true};
1564     bool enableOptConstantFolding_ {true};
1565     bool enableOptOnHeapCheck_ {true};
1566     bool enableOptLoopInvariantCodeMotion_ {false};
1567     bool enableLexenvSpecialization_ {false};
1568     bool enableNativeInline_ {true};
1569     bool enableLoweringBuiltin_ {true};
1570     bool enableLiteCG_ {false};
1571     bool enableTypedOpProfiler_ {false};
1572     bool enableBranchProfiling_ {true};
1573 };
1574 }  // namespace panda::ecmascript
1575 
1576 #endif  // ECMASCRIPT_JS_RUNTIME_OPTIONS_H_
1577