#ifndef jit_JitOptions_h
#define jit_JitOptions_h
#include "mozilla/Maybe.h"
#include "jit/IonTypes.h"
#include "js/TypeDecls.h"
namespace js {
namespace jit {
static const uint32_t MAX_MAIN_THREAD_SCRIPT_SIZE = 2 * 1000;
static const uint32_t MAX_MAIN_THREAD_LOCALS_AND_ARGS = 256;
enum IonRegisterAllocator {
RegisterAllocator_Backtracking,
RegisterAllocator_Testbed,
RegisterAllocator_Stupid
};
static inline mozilla::Maybe<IonRegisterAllocator> LookupRegisterAllocator(
const char* name) {
if (!strcmp(name, "backtracking")) {
return mozilla::Some(RegisterAllocator_Backtracking);
}
if (!strcmp(name, "testbed")) {
return mozilla::Some(RegisterAllocator_Testbed);
}
if (!strcmp(name, "stupid")) {
return mozilla::Some(RegisterAllocator_Stupid);
}
return mozilla::Nothing();
}
struct DefaultJitOptions {
bool checkGraphConsistency;
#ifdef CHECK_OSIPOINT_REGISTERS
bool checkOsiPointRegisters;
#endif
bool checkRangeAnalysis;
bool runExtraChecks;
bool disableInlineBacktracking;
bool disableAma;
bool disableEaa;
bool disableEdgeCaseAnalysis;
bool disableGvn;
bool disableInlining;
bool disableLicm;
bool disableOptimizationTracking;
bool disablePgo;
bool disableInstructionReordering;
bool disableRangeAnalysis;
bool disableRecoverIns;
bool disableScalarReplacement;
bool disableCacheIR;
bool disableCacheIRBinaryArith;
bool disableSincos;
bool disableSink;
bool disableOptimizationLevels;
bool forceInlineCaches;
bool fullDebugChecks;
bool limitScriptSize;
bool osr;
bool wasmFoldOffsets;
bool wasmDelayTier2;
#ifdef JS_TRACE_LOGGING
bool enableTraceLogger;
#endif
#ifdef WASM_CODEGEN_DEBUG
bool enableWasmJitExit;
bool enableWasmJitEntry;
bool enableWasmIonFastCalls;
bool enableWasmImportCallSpew;
bool enableWasmFuncCallSpew;
#endif
uint32_t baselineWarmUpThreshold;
uint32_t normalIonWarmUpThreshold;
uint32_t fullIonWarmUpThreshold;
uint32_t exceptionBailoutThreshold;
uint32_t frequentBailoutThreshold;
uint32_t maxStackArgs;
uint32_t osrPcMismatchesBeforeRecompile;
uint32_t smallFunctionMaxBytecodeLength_;
uint32_t jumpThreshold;
uint32_t branchPruningHitCountFactor;
uint32_t branchPruningInstFactor;
uint32_t branchPruningBlockSpanFactor;
uint32_t branchPruningEffectfulInstFactor;
uint32_t branchPruningThreshold;
uint32_t wasmBatchIonThreshold;
uint32_t wasmBatchBaselineThreshold;
mozilla::Maybe<IonRegisterAllocator> forcedRegisterAllocator;
bool spectreIndexMasking;
bool spectreObjectMitigationsBarriers;
bool spectreObjectMitigationsMisc;
bool spectreStringMitigations;
bool spectreValueMasking;
bool spectreJitToCxxCalls;
bool disableUnboxedObjects;
DefaultJitOptions();
bool isSmallFunction(JSScript* script) const;
void setEagerIonCompilation();
void setNormalIonWarmUpThreshold(uint32_t warmUpThreshold);
void setFullIonWarmUpThreshold(uint32_t warmUpThreshold);
void resetNormalIonWarmUpThreshold();
void resetFullIonWarmUpThreshold();
void enableGvn(bool val);
bool eagerIonCompilation() const {
return normalIonWarmUpThreshold == 0;
}
};
extern DefaultJitOptions JitOptions;
} }
#endif