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