Line data Source code
1 : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 : * vim: set ts=8 sts=4 et sw=4 tw=99:
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 : #ifndef jit_JitOptions_h
8 : #define jit_JitOptions_h
9 :
10 : #include "mozilla/Maybe.h"
11 :
12 : #include "jit/IonTypes.h"
13 : #include "js/TypeDecls.h"
14 :
15 : namespace js {
16 : namespace jit {
17 :
18 : // Longer scripts can only be compiled off thread, as these compilations
19 : // can be expensive and stall the active thread for too long.
20 : static const uint32_t MAX_ACTIVE_THREAD_SCRIPT_SIZE = 2 * 1000;
21 : static const uint32_t MAX_ACTIVE_THREAD_LOCALS_AND_ARGS = 256;
22 :
23 : // Possible register allocators which may be used.
24 : enum IonRegisterAllocator {
25 : RegisterAllocator_Backtracking,
26 : RegisterAllocator_Testbed,
27 : RegisterAllocator_Stupid
28 : };
29 :
30 : static inline mozilla::Maybe<IonRegisterAllocator>
31 0 : LookupRegisterAllocator(const char* name)
32 : {
33 0 : if (!strcmp(name, "backtracking"))
34 0 : return mozilla::Some(RegisterAllocator_Backtracking);
35 0 : if (!strcmp(name, "testbed"))
36 0 : return mozilla::Some(RegisterAllocator_Testbed);
37 0 : if (!strcmp(name, "stupid"))
38 0 : return mozilla::Some(RegisterAllocator_Stupid);
39 0 : return mozilla::Nothing();
40 : }
41 :
42 3 : struct DefaultJitOptions
43 : {
44 : bool checkGraphConsistency;
45 : #ifdef CHECK_OSIPOINT_REGISTERS
46 : bool checkOsiPointRegisters;
47 : #endif
48 : bool checkRangeAnalysis;
49 : bool runExtraChecks;
50 : bool disableInlineBacktracking;
51 : bool disableAma;
52 : bool disableEaa;
53 : bool disableEagerSimdUnbox;
54 : bool disableEdgeCaseAnalysis;
55 : bool disableFlowAA;
56 : bool disableGvn;
57 : bool disableInlining;
58 : bool disableLicm;
59 : bool disableLoopUnrolling;
60 : bool disableOptimizationTracking;
61 : bool disablePgo;
62 : bool disableInstructionReordering;
63 : bool disableRangeAnalysis;
64 : bool disableRecoverIns;
65 : bool disableScalarReplacement;
66 : bool disableCacheIR;
67 : bool disableSharedStubs;
68 : bool disableSincos;
69 : bool disableSink;
70 : bool eagerCompilation;
71 : bool forceInlineCaches;
72 : bool fullDebugChecks;
73 : bool limitScriptSize;
74 : bool osr;
75 : bool asmJSAtomicsEnable;
76 : bool wasmTestMode;
77 : bool wasmAlwaysCheckBounds;
78 : bool wasmFoldOffsets;
79 : bool ionInterruptWithoutSignals;
80 : bool simulatorAlwaysInterrupt;
81 : uint32_t baselineWarmUpThreshold;
82 : uint32_t exceptionBailoutThreshold;
83 : uint32_t frequentBailoutThreshold;
84 : uint32_t maxStackArgs;
85 : uint32_t osrPcMismatchesBeforeRecompile;
86 : uint32_t smallFunctionMaxBytecodeLength_;
87 : uint32_t jumpThreshold;
88 : uint32_t branchPruningHitCountFactor;
89 : uint32_t branchPruningInstFactor;
90 : uint32_t branchPruningBlockSpanFactor;
91 : uint32_t branchPruningEffectfulInstFactor;
92 : uint32_t branchPruningThreshold;
93 : uint32_t wasmBatchIonThreshold;
94 : uint32_t wasmBatchBaselineThreshold;
95 : mozilla::Maybe<uint32_t> forcedDefaultIonWarmUpThreshold;
96 : mozilla::Maybe<uint32_t> forcedDefaultIonSmallFunctionWarmUpThreshold;
97 : mozilla::Maybe<IonRegisterAllocator> forcedRegisterAllocator;
98 :
99 : // The options below affect the rest of the VM, and not just the JIT.
100 : bool disableUnboxedObjects;
101 :
102 : DefaultJitOptions();
103 : bool isSmallFunction(JSScript* script) const;
104 : void setEagerCompilation();
105 : void setCompilerWarmUpThreshold(uint32_t warmUpThreshold);
106 : void resetCompilerWarmUpThreshold();
107 : void enableGvn(bool val);
108 : };
109 :
110 : extern DefaultJitOptions JitOptions;
111 :
112 : } // namespace jit
113 : } // namespace js
114 :
115 : #endif /* jit_JitOptions_h */
|