| 1 |
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- |
| 2 |
* vim: set ts=8 sts=2 et sw=2 tw=80: |
| 3 |
* This Source Code Form is subject to the terms of the Mozilla Public |
| 4 |
* License, v. 2.0. If a copy of the MPL was not distributed with this |
| 5 |
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
| 6 |
|
| 7 |
#include "jit/JitOptions.h" |
| 8 |
|
| 9 |
#include <cstdlib> |
| 10 |
#include <type_traits> |
| 11 |
|
| 12 |
#include "vm/JSScript.h" |
| 13 |
|
| 14 |
using namespace js; |
| 15 |
using namespace js::jit; |
| 16 |
|
| 17 |
using mozilla::Maybe; |
| 18 |
|
| 19 |
namespace js { |
| 20 |
namespace jit { |
| 21 |
|
| 22 |
MOZ_RUNINIT DefaultJitOptions JitOptions; |
| 23 |
|
| 24 |
static void Warn(const char* env, const char* value) { |
| 25 |
fprintf(stderr, "Warning: I didn't understand %s=\"%s\"\n", env, value); |
| 26 |
} |
| 27 |
|
| 28 |
static Maybe<int> ParseInt(const char* str) { |
| 29 |
char* endp; |
| 30 |
int retval = strtol(str, &endp, 0); |
| 31 |
if (*endp == '\0') { |
| 32 |
return mozilla::Some(retval); |
| 33 |
} |
| 34 |
return mozilla::Nothing(); |
| 35 |
} |
| 36 |
|
| 37 |
template <typename T> |
| 38 |
T overrideDefault(const char* param, T dflt) { |
| 39 |
char* str = getenv(param); |
| 40 |
if (!str) { |
| 41 |
return dflt; |
| 42 |
} |
| 43 |
if constexpr (std::is_same_v<T, bool>) { |
| 44 |
if (strcmp(str, "true") == 0 || strcmp(str, "yes") == 0) { |
| 45 |
return true; |
| 46 |
} |
| 47 |
if (strcmp(str, "false") == 0 || strcmp(str, "no") == 0) { |
| 48 |
return false; |
| 49 |
} |
| 50 |
Warn(param, str); |
| 51 |
} else { |
| 52 |
Maybe<int> value = ParseInt(str); |
| 53 |
if (value.isSome()) { |
| 54 |
return value.ref(); |
| 55 |
} |
| 56 |
Warn(param, str); |
| 57 |
} |
| 58 |
return dflt; |
| 59 |
} |
| 60 |
|
| 61 |
#define SET_DEFAULT(var, dflt) var = overrideDefault("JIT_OPTION_" #var, dflt) |
| 62 |
DefaultJitOptions::DefaultJitOptions() { |
| 63 |
// Whether to perform expensive graph-consistency DEBUG-only assertions. |
| 64 |
// It can be useful to disable this to reduce DEBUG-compile time of large |
| 65 |
// wasm programs. |
| 66 |
SET_DEFAULT(checkGraphConsistency, true); |
| 67 |
|
| 68 |
#ifdef CHECK_OSIPOINT_REGISTERS |
| 69 |
// Emit extra code to verify live regs at the start of a VM call |
| 70 |
// are not modified before its OsiPoint. |
| 71 |
SET_DEFAULT(checkOsiPointRegisters, false); |
| 72 |
#endif |
| 73 |
|
| 74 |
// Whether to enable extra code to perform dynamic validation of |
| 75 |
// RangeAnalysis results. |
| 76 |
SET_DEFAULT(checkRangeAnalysis, false); |
| 77 |
|
| 78 |
// Toggles whether Alignment Mask Analysis is globally disabled. |
| 79 |
SET_DEFAULT(disableAma, false); |
| 80 |
|
| 81 |
// Toggles whether Effective Address Analysis is globally disabled. |
| 82 |
SET_DEFAULT(disableEaa, false); |
| 83 |
|
| 84 |
// Toggles whether Edge Case Analysis is gobally disabled. |
| 85 |
SET_DEFAULT(disableEdgeCaseAnalysis, false); |
| 86 |
|
| 87 |
// Toggle whether global value numbering is globally disabled. |
| 88 |
SET_DEFAULT(disableGvn, false); |
| 89 |
|
| 90 |
// Toggles whether inlining is globally disabled. |
| 91 |
SET_DEFAULT(disableInlining, false); |
| 92 |
|
| 93 |
// Toggles whether loop invariant code motion is globally disabled. |
| 94 |
SET_DEFAULT(disableLicm, false); |
| 95 |
|
| 96 |
// Toggle whether branch pruning is globally disabled. |
| 97 |
SET_DEFAULT(disablePruning, false); |
| 98 |
|
| 99 |
// Toggles whether the iterator indices optimization is globally disabled. |
| 100 |
// Note: this optimization is disabled on this ESR branch (bug 2052207). |
| 101 |
SET_DEFAULT(disableIteratorIndices, true); |
| 102 |
|
| 103 |
// Toggles whether instruction reordering is globally disabled. |
| 104 |
SET_DEFAULT(disableInstructionReordering, false); |
| 105 |
|
| 106 |
// Toggles whether atomizing loads used as property keys is globally disabled. |
| 107 |
SET_DEFAULT(disableMarkLoadsUsedAsPropertyKeys, false); |
| 108 |
|
| 109 |
// Toggles whether Range Analysis is globally disabled. |
| 110 |
SET_DEFAULT(disableRangeAnalysis, false); |
| 111 |
|
| 112 |
// Toggles wheter Recover instructions is globally disabled. |
| 113 |
SET_DEFAULT(disableRecoverIns, false); |
| 114 |
|
| 115 |
// Toggle whether eager scalar replacement is globally disabled. |
| 116 |
SET_DEFAULT(disableScalarReplacement, false); |
| 117 |
|
| 118 |
// Toggles whether CacheIR stubs are used. |
| 119 |
SET_DEFAULT(disableCacheIR, false); |
| 120 |
|
| 121 |
// Toggles whether sink code motion is globally disabled. |
| 122 |
SET_DEFAULT(disableSink, true); |
| 123 |
|
| 124 |
// Toggles whether redundant shape guard elimination is globally disabled. |
| 125 |
SET_DEFAULT(disableRedundantShapeGuards, false); |
| 126 |
|
| 127 |
// Toggles whether redundant GC barrier elimination is globally disabled. |
| 128 |
SET_DEFAULT(disableRedundantGCBarriers, false); |
| 129 |
|
| 130 |
// Toggles whether we verify that we don't recompile with the same CacheIR. |
| 131 |
SET_DEFAULT(disableBailoutLoopCheck, false); |
| 132 |
|
| 133 |
// Whether the Baseline Interpreter is enabled. |
| 134 |
SET_DEFAULT(baselineInterpreter, true); |
| 135 |
|
| 136 |
#ifdef ENABLE_PORTABLE_BASELINE_INTERP |
| 137 |
// Whether the Portable Baseline Interpreter is enabled. |
| 138 |
SET_DEFAULT(portableBaselineInterpreter, false); |
| 139 |
#endif |
| 140 |
|
| 141 |
#ifdef ENABLE_PORTABLE_BASELINE_INTERP_FORCE |
| 142 |
SET_DEFAULT(portableBaselineInterpreter, true); |
| 143 |
SET_DEFAULT(portableBaselineInterpreterWarmUpThreshold, 0); |
| 144 |
#endif |
| 145 |
|
| 146 |
// emitInterpreterEntryTrampoline and enableICFramePointers are used in |
| 147 |
// combination with perf jitdump profiling. The first will enable |
| 148 |
// trampolines for interpreter and baseline interpreter frames to |
| 149 |
// identify which function is being executed, and the latter enables |
| 150 |
// frame pointers for IC stubs. They are both enabled by default |
| 151 |
// when the |IONPERF| environment variable is set. |
| 152 |
bool perfEnabled = !!getenv("IONPERF"); |
| 153 |
SET_DEFAULT(emitInterpreterEntryTrampoline, perfEnabled); |
| 154 |
SET_DEFAULT(enableICFramePointers, perfEnabled); |
| 155 |
|
| 156 |
// Whether the Baseline JIT is enabled. |
| 157 |
SET_DEFAULT(baselineJit, true); |
| 158 |
|
| 159 |
// Whether the IonMonkey JIT is enabled. |
| 160 |
SET_DEFAULT(ion, true); |
| 161 |
|
| 162 |
// Whether the IonMonkey and Baseline JITs are enabled for Trusted Principals. |
| 163 |
// (Ignored if ion or baselineJit is set to true.) |
| 164 |
SET_DEFAULT(jitForTrustedPrincipals, false); |
| 165 |
|
| 166 |
// Whether the RegExp JIT is enabled. |
| 167 |
SET_DEFAULT(nativeRegExp, true); |
| 168 |
|
| 169 |
// Whether offthread baseline compilation should be batched. |
| 170 |
SET_DEFAULT(baselineBatching, false); |
| 171 |
|
| 172 |
// Whether Warp should use ICs instead of transpiling Baseline CacheIR. |
| 173 |
SET_DEFAULT(forceInlineCaches, false); |
| 174 |
|
| 175 |
// Whether all ICs should be initialized as megamorphic ICs. |
| 176 |
SET_DEFAULT(forceMegamorphicICs, false); |
| 177 |
|
| 178 |
// Toggles whether large scripts are rejected. |
| 179 |
SET_DEFAULT(limitScriptSize, true); |
| 180 |
|
| 181 |
// Toggles whether functions may be entered at loop headers. |
| 182 |
SET_DEFAULT(osr, true); |
| 183 |
|
| 184 |
// Whether the JIT backend (used by JITs, Wasm, Baseline Interpreter) has been |
| 185 |
// disabled for this process. See JS::DisableJitBackend. |
| 186 |
SET_DEFAULT(disableJitBackend, false); |
| 187 |
|
| 188 |
// Whether to enable extra code to perform dynamic validations. |
| 189 |
SET_DEFAULT(runExtraChecks, false); |
| 190 |
|
| 191 |
#ifdef ENABLE_JS_AOT_ICS |
| 192 |
SET_DEFAULT(enableAOTICs, false); |
| 193 |
SET_DEFAULT(enableAOTICEnforce, false); |
| 194 |
#endif |
| 195 |
|
| 196 |
#ifdef ENABLE_JS_AOT_ICS_FORCE |
| 197 |
SET_DEFAULT(enableAOTICs, true); |
| 198 |
#endif |
| 199 |
|
| 200 |
#ifdef ENABLE_JS_AOT_ICS_ENFORCE |
| 201 |
SET_DEFAULT(enableAOTICs, true); |
| 202 |
SET_DEFAULT(enableAOTICEnforce, true); |
| 203 |
#endif |
| 204 |
|
| 205 |
// How many invocations or loop iterations are needed before functions |
| 206 |
// enter the Baseline Interpreter. |
| 207 |
SET_DEFAULT(baselineInterpreterWarmUpThreshold, 10); |
| 208 |
|
| 209 |
#ifdef ENABLE_PORTABLE_BASELINE_INTERP |
| 210 |
// How many invocations are needed before functions enter the |
| 211 |
// Portable Baseline Interpreter. |
| 212 |
SET_DEFAULT(portableBaselineInterpreterWarmUpThreshold, 10); |
| 213 |
#endif |
| 214 |
|
| 215 |
// How many invocations or loop iterations are needed before functions |
| 216 |
// are compiled with the baseline compiler. |
| 217 |
// Duplicated in all.js - ensure both match. |
| 218 |
SET_DEFAULT(baselineJitWarmUpThreshold, 100); |
| 219 |
|
| 220 |
// How many scripts can be queued up for offthread baseline compilation |
| 221 |
// before they are dispatched. |
| 222 |
SET_DEFAULT(baselineQueueCapacity, 8); |
| 223 |
|
| 224 |
// Disable eager baseline jit hints |
| 225 |
SET_DEFAULT(disableJitHints, false); |
| 226 |
|
| 227 |
// How many invocations or loop iterations are needed before functions |
| 228 |
// are considered for trial inlining. |
| 229 |
SET_DEFAULT(trialInliningWarmUpThreshold, 500); |
| 230 |
|
| 231 |
// The initial warm-up count for ICScripts created by trial inlining. |
| 232 |
// |
| 233 |
// Note: the difference between trialInliningInitialWarmUpCount and |
| 234 |
// trialInliningWarmUpThreshold must be: |
| 235 |
// |
| 236 |
// * Small enough to allow inlining multiple levels deep before the outer |
| 237 |
// script reaches its normalIonWarmUpThreshold. |
| 238 |
// |
| 239 |
// * Greater than inliningEntryThreshold or no scripts can be inlined. |
| 240 |
SET_DEFAULT(trialInliningInitialWarmUpCount, 250); |
| 241 |
|
| 242 |
// How many invocations or loop iterations are needed before functions |
| 243 |
// are compiled with the Ion compiler at OptimizationLevel::Normal. |
| 244 |
// Duplicated in all.js - ensure both match. |
| 245 |
SET_DEFAULT(normalIonWarmUpThreshold, 1500); |
| 246 |
|
| 247 |
// How many invocations are needed before regexps are compiled to |
| 248 |
// native code. |
| 249 |
SET_DEFAULT(regexpWarmUpThreshold, 10); |
| 250 |
|
| 251 |
// Number of exception bailouts (resuming into catch/finally block) before |
| 252 |
// we invalidate and forbid Ion compilation. |
| 253 |
SET_DEFAULT(exceptionBailoutThreshold, 10); |
| 254 |
|
| 255 |
// Number of bailouts without invalidation before we set |
| 256 |
// JSScript::hadFrequentBailouts and invalidate. |
| 257 |
// Duplicated in all.js - ensure both match. |
| 258 |
SET_DEFAULT(frequentBailoutThreshold, 10); |
| 259 |
|
| 260 |
// Whether to run all debug checks in debug builds. |
| 261 |
// Disabling might make it more enjoyable to run JS in debug builds. |
| 262 |
SET_DEFAULT(fullDebugChecks, true); |
| 263 |
|
| 264 |
// How many actual arguments are accepted on the C stack. |
| 265 |
SET_DEFAULT(maxStackArgs, 20'000); |
| 266 |
|
| 267 |
// How many times we will try to enter a script via OSR before |
| 268 |
// invalidating the script. |
| 269 |
SET_DEFAULT(osrPcMismatchesBeforeRecompile, 6000); |
| 270 |
|
| 271 |
// The bytecode length limit for small function. |
| 272 |
SET_DEFAULT(smallFunctionMaxBytecodeLength, 130); |
| 273 |
|
| 274 |
// The minimum entry count for an IC stub before it can be trial-inlined. |
| 275 |
SET_DEFAULT(inliningEntryThreshold, 100); |
| 276 |
|
| 277 |
// An artificial testing limit for the maximum supported offset of |
| 278 |
// pc-relative jump and call instructions. |
| 279 |
SET_DEFAULT(jumpThreshold, UINT32_MAX); |
| 280 |
|
| 281 |
// Branch pruning heuristic is based on a scoring system, which is look at |
| 282 |
// different metrics and provide a score. The score is computed as a |
| 283 |
// projection where each factor defines the weight of each metric. Then this |
| 284 |
// score is compared against a threshold to prevent a branch from being |
| 285 |
// removed. |
| 286 |
SET_DEFAULT(branchPruningHitCountFactor, 1); |
| 287 |
SET_DEFAULT(branchPruningInstFactor, 10); |
| 288 |
SET_DEFAULT(branchPruningBlockSpanFactor, 100); |
| 289 |
SET_DEFAULT(branchPruningEffectfulInstFactor, 3500); |
| 290 |
SET_DEFAULT(branchPruningThreshold, 4000); |
| 291 |
|
| 292 |
// Limits on bytecode length and number of locals/arguments for Ion |
| 293 |
// compilation. There are different (lower) limits for when off-thread Ion |
| 294 |
// compilation isn't available. |
| 295 |
SET_DEFAULT(ionMaxScriptSize, 100 * 1000); |
| 296 |
SET_DEFAULT(ionMaxScriptSizeMainThread, 2 * 1000); |
| 297 |
SET_DEFAULT(ionMaxLocalsAndArgs, 10 * 1000); |
| 298 |
SET_DEFAULT(ionMaxLocalsAndArgsMainThread, 256); |
| 299 |
|
| 300 |
#if defined(JS_CODEGEN_MIPS64) || defined(JS_CODEGEN_LOONG64) || \ |
| 301 |
defined(JS_CODEGEN_RISCV64) |
| 302 |
SET_DEFAULT(spectreIndexMasking, false); |
| 303 |
SET_DEFAULT(spectreObjectMitigations, false); |
| 304 |
SET_DEFAULT(spectreStringMitigations, false); |
| 305 |
SET_DEFAULT(spectreValueMasking, false); |
| 306 |
SET_DEFAULT(spectreJitToCxxCalls, false); |
| 307 |
#else |
| 308 |
SET_DEFAULT(spectreIndexMasking, true); |
| 309 |
SET_DEFAULT(spectreObjectMitigations, true); |
| 310 |
SET_DEFAULT(spectreStringMitigations, true); |
| 311 |
SET_DEFAULT(spectreValueMasking, true); |
| 312 |
SET_DEFAULT(spectreJitToCxxCalls, false); |
| 313 |
#endif |
| 314 |
|
| 315 |
// Whether the W^X policy is enforced to mark JIT code pages as either |
| 316 |
// writable or executable but never both at the same time. On Apple Silicon |
| 317 |
// this must always be false because we use pthread_jit_write_protect_np. |
| 318 |
#ifdef JS_USE_APPLE_FAST_WX |
| 319 |
SET_DEFAULT(writeProtectCode, false); |
| 320 |
#else |
| 321 |
SET_DEFAULT(writeProtectCode, true); |
| 322 |
#endif |
| 323 |
|
| 324 |
// This is set to its actual value in InitializeJit. |
| 325 |
SET_DEFAULT(supportsUnalignedAccesses, false); |
| 326 |
|
| 327 |
// To access local (non-argument) slots, it's more efficient to use the frame |
| 328 |
// pointer (FP) instead of the stack pointer (SP) as base register on x86 and |
| 329 |
// x64 (because instructions are one byte shorter, for example). |
| 330 |
// |
| 331 |
// However, because this requires a negative offset from FP, on ARM64 it can |
| 332 |
// be more efficient to use SP-relative addresses for larger stack frames |
| 333 |
// because the range for load/store immediate offsets is [-256, 4095] and |
| 334 |
// offsets outside this range will require an extra instruction. |
| 335 |
// |
| 336 |
// We default to FP-relative addresses on x86/x64 and SP-relative on other |
| 337 |
// platforms, but to improve fuzzing we allow changing this in the shell: |
| 338 |
// |
| 339 |
// setJitCompilerOption("base-reg-for-locals", N); // 0 for SP, 1 for FP |
| 340 |
#if defined(JS_CODEGEN_X86) || defined(JS_CODEGEN_X64) |
| 341 |
baseRegForLocals = BaseRegForAddress::FP; |
| 342 |
#else |
| 343 |
baseRegForLocals = BaseRegForAddress::SP; |
| 344 |
#endif |
| 345 |
|
| 346 |
// Toggles the optimization whereby offsets are folded into loads and not |
| 347 |
// included in the bounds check. |
| 348 |
SET_DEFAULT(wasmFoldOffsets, true); |
| 349 |
|
| 350 |
// Controls whether two-tiered compilation should be requested when |
| 351 |
// compiling a new wasm module, independently of other heuristics, and |
| 352 |
// should be delayed to test both baseline and ion paths in compiled code, |
| 353 |
// as well as the transition from one tier to the other. |
| 354 |
SET_DEFAULT(wasmDelayTier2, false); |
| 355 |
|
| 356 |
// Until which wasm bytecode size should we accumulate functions, in order |
| 357 |
// to compile efficiently on helper threads. Baseline code compiles much |
| 358 |
// faster than Ion code so use scaled thresholds (see also bug 1320374 |
| 359 |
// and bug 1930875). Ion compilation can use a lot of memory, so having a |
| 360 |
// low threshold here (1100) helps avoid OOMs in the per-task pool allocators. |
| 361 |
SET_DEFAULT(wasmBatchBaselineThreshold, 25000); |
| 362 |
SET_DEFAULT(wasmBatchIonThreshold, 1100); |
| 363 |
|
| 364 |
// Controls how much assertion checking code is emitted |
| 365 |
SET_DEFAULT(lessDebugCode, false); |
| 366 |
|
| 367 |
SET_DEFAULT(onlyInlineSelfHosted, false); |
| 368 |
|
| 369 |
SET_DEFAULT(enableWasmJitExit, true); |
| 370 |
SET_DEFAULT(enableWasmJitEntry, true); |
| 371 |
SET_DEFAULT(enableWasmIonFastCalls, true); |
| 372 |
#ifdef WASM_CODEGEN_DEBUG |
| 373 |
SET_DEFAULT(enableWasmImportCallSpew, false); |
| 374 |
SET_DEFAULT(enableWasmFuncCallSpew, false); |
| 375 |
#endif |
| 376 |
|
| 377 |
// This is used to control whether regexps tier up from interpreted to |
| 378 |
// compiled. We control this with --no-native-regexp and |
| 379 |
// --regexp-warmup-threshold. |
| 380 |
SET_DEFAULT(regexp_tier_up, true); |
| 381 |
|
| 382 |
// Dumps a representation of parsed regexps to stderr |
| 383 |
SET_DEFAULT(trace_regexp_parser, false); |
| 384 |
// Dumps the calls made to the regexp assembler to stderr |
| 385 |
SET_DEFAULT(trace_regexp_assembler, false); |
| 386 |
// Dumps the bytecodes interpreted by the regexp engine to stderr |
| 387 |
SET_DEFAULT(trace_regexp_bytecodes, false); |
| 388 |
// Dumps the changes made by the regexp peephole optimizer to stderr |
| 389 |
SET_DEFAULT(trace_regexp_peephole_optimization, false); |
| 390 |
|
| 391 |
// ***** Irregexp shim flags ***** |
| 392 |
|
| 393 |
// Whether the stage 3 regexp modifiers proposal is enabled. |
| 394 |
SET_DEFAULT(js_regexp_modifiers, true); |
| 395 |
// Whether the stage 3 duplicate named capture groups proposal is enabled. |
| 396 |
SET_DEFAULT(js_regexp_duplicate_named_groups, true); |
| 397 |
// V8 uses this for differential fuzzing to handle stack overflows. |
| 398 |
// We address the same problem in StackLimitCheck::HasOverflowed. |
| 399 |
SET_DEFAULT(correctness_fuzzer_suppressions, false); |
| 400 |
// Instead of using a flag for this, we provide an implementation of |
| 401 |
// CanReadUnaligned in SMRegExpMacroAssembler. |
| 402 |
SET_DEFAULT(enable_regexp_unaligned_accesses, false); |
| 403 |
// This is used to guard an old prototype implementation of possessive |
| 404 |
// quantifiers, which never got past the point of adding parser support. |
| 405 |
SET_DEFAULT(regexp_possessive_quantifier, false); |
| 406 |
// These affect the default level of optimization. We can still turn |
| 407 |
// optimization off on a case-by-case basis in CompilePattern - for |
| 408 |
// example, if a regexp is too long - so we might as well turn these |
| 409 |
// flags on unconditionally. |
| 410 |
SET_DEFAULT(regexp_optimization, true); |
| 411 |
#if MOZ_BIG_ENDIAN() |
| 412 |
// peephole optimization not supported on big endian |
| 413 |
SET_DEFAULT(regexp_peephole_optimization, false); |
| 414 |
#else |
| 415 |
SET_DEFAULT(regexp_peephole_optimization, true); |
| 416 |
#endif |
| 417 |
} |
| 418 |
|
| 419 |
bool DefaultJitOptions::isSmallFunction(JSScript* script) const { |
| 420 |
return script->length() <= smallFunctionMaxBytecodeLength; |
| 421 |
} |
| 422 |
|
| 423 |
void DefaultJitOptions::enableGvn(bool enable) { disableGvn = !enable; } |
| 424 |
|
| 425 |
#ifdef ENABLE_PORTABLE_BASELINE_INTERP |
| 426 |
void DefaultJitOptions::setEagerPortableBaselineInterpreter() { |
| 427 |
portableBaselineInterpreterWarmUpThreshold = 0; |
| 428 |
} |
| 429 |
#endif |
| 430 |
|
| 431 |
void DefaultJitOptions::setEagerBaselineCompilation() { |
| 432 |
baselineInterpreterWarmUpThreshold = 0; |
| 433 |
baselineJitWarmUpThreshold = 0; |
| 434 |
regexpWarmUpThreshold = 0; |
| 435 |
} |
| 436 |
|
| 437 |
void DefaultJitOptions::setEagerIonCompilation() { |
| 438 |
setEagerBaselineCompilation(); |
| 439 |
normalIonWarmUpThreshold = 0; |
| 440 |
} |
| 441 |
|
| 442 |
void DefaultJitOptions::setFastWarmUp() { |
| 443 |
baselineInterpreterWarmUpThreshold = 4; |
| 444 |
baselineJitWarmUpThreshold = 10; |
| 445 |
trialInliningWarmUpThreshold = 14; |
| 446 |
trialInliningInitialWarmUpCount = 12; |
| 447 |
normalIonWarmUpThreshold = 30; |
| 448 |
|
| 449 |
inliningEntryThreshold = 2; |
| 450 |
smallFunctionMaxBytecodeLength = 2000; |
| 451 |
} |
| 452 |
|
| 453 |
void DefaultJitOptions::setNormalIonWarmUpThreshold(uint32_t warmUpThreshold) { |
| 454 |
normalIonWarmUpThreshold = warmUpThreshold; |
| 455 |
} |
| 456 |
|
| 457 |
void DefaultJitOptions::resetNormalIonWarmUpThreshold() { |
| 458 |
jit::DefaultJitOptions defaultValues; |
| 459 |
setNormalIonWarmUpThreshold(defaultValues.normalIonWarmUpThreshold); |
| 460 |
} |
| 461 |
|
| 462 |
void DefaultJitOptions::maybeSetWriteProtectCode(bool val) { |
| 463 |
#ifdef JS_USE_APPLE_FAST_WX |
| 464 |
// On Apple Silicon we always use pthread_jit_write_protect_np, or |
| 465 |
// be_memory_inline_jit_restrict_*. |
| 466 |
MOZ_ASSERT(!writeProtectCode); |
| 467 |
#else |
| 468 |
writeProtectCode = val; |
| 469 |
#endif |
| 470 |
} |
| 471 |
|
| 472 |
} // namespace jit |
| 473 |
} // namespace js |