js/src/jit/JitOptions.cpp

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
michael@0 2 * vim: set ts=8 sts=4 et sw=4 tw=99:
michael@0 3 * This Source Code Form is subject to the terms of the Mozilla Public
michael@0 4 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 6
michael@0 7 #include "jit/JitOptions.h"
michael@0 8
michael@0 9 #include "jsscript.h"
michael@0 10
michael@0 11 using namespace js;
michael@0 12 using namespace js::jit;
michael@0 13
michael@0 14 namespace js {
michael@0 15 namespace jit {
michael@0 16
michael@0 17 JitOptions js_JitOptions;
michael@0 18
michael@0 19 JitOptions::JitOptions()
michael@0 20 {
michael@0 21 // Whether to perform expensive graph-consistency DEBUG-only assertions.
michael@0 22 // It can be useful to disable this to reduce DEBUG-compile time of large
michael@0 23 // asm.js programs.
michael@0 24 checkGraphConsistency = true;
michael@0 25
michael@0 26 #ifdef CHECK_OSIPOINT_REGISTERS
michael@0 27 // Emit extra code to verify live regs at the start of a VM call
michael@0 28 // are not modified before its OsiPoint.
michael@0 29 checkOsiPointRegisters = false;
michael@0 30 #endif
michael@0 31
michael@0 32 // Whether to enable extra code to perform dynamic validation of
michael@0 33 // RangeAnalysis results.
michael@0 34 checkRangeAnalysis = false;
michael@0 35
michael@0 36 // Whether Ion should compile try-catch statements.
michael@0 37 compileTryCatch = true;
michael@0 38
michael@0 39 // Toggle whether global value numbering is globally disabled.
michael@0 40 disableGvn = false;
michael@0 41
michael@0 42 // Toggles whether loop invariant code motion is globally disabled.
michael@0 43 disableLicm = false;
michael@0 44
michael@0 45 // Toggles whether inlining is globally disabled.
michael@0 46 disableInlining = false;
michael@0 47
michael@0 48 // Toggles whether Edge Case Analysis is gobally disabled.
michael@0 49 disableEdgeCaseAnalysis = false;
michael@0 50
michael@0 51 // Toggles whether Range Analysis is globally disabled.
michael@0 52 disableRangeAnalysis = false;
michael@0 53
michael@0 54 // Toggles whether Unreachable Code Elimination is globally disabled.
michael@0 55 disableUce = false;
michael@0 56
michael@0 57 // Toggles whether Effective Address Analysis is globally disabled.
michael@0 58 disableEaa = false;
michael@0 59
michael@0 60 // Whether functions are compiled immediately.
michael@0 61 eagerCompilation = false;
michael@0 62
michael@0 63 // Force how many invocation or loop iterations are needed before compiling
michael@0 64 // a function with the highest ionmonkey optimization level.
michael@0 65 // (i.e. OptimizationLevel_Normal)
michael@0 66 forceDefaultIonUsesBeforeCompile = false;
michael@0 67 forcedDefaultIonUsesBeforeCompile = 1000;
michael@0 68
michael@0 69 // Force the GVN kind to be optimistic or pessimistic instead of letting
michael@0 70 // the optimization pass decide.
michael@0 71 forceGvnKind = false;
michael@0 72 forcedGvnKind = GVN_Optimistic;
michael@0 73
michael@0 74 // Force the used register allocator instead of letting the
michael@0 75 // optimization pass decide.
michael@0 76 forceRegisterAllocator = false;
michael@0 77 forcedRegisterAllocator = RegisterAllocator_LSRA;
michael@0 78
michael@0 79 // Toggles whether large scripts are rejected.
michael@0 80 limitScriptSize = true;
michael@0 81
michael@0 82 // Toggles whether functions may be entered at loop headers.
michael@0 83 osr = true;
michael@0 84
michael@0 85 // How many invocations or loop iterations are needed before functions
michael@0 86 // are compiled with the baseline compiler.
michael@0 87 baselineUsesBeforeCompile = 10;
michael@0 88
michael@0 89 // Number of exception bailouts (resuming into catch/finally block) before
michael@0 90 // we invalidate and forbid Ion compilation.
michael@0 91 exceptionBailoutThreshold = 10;
michael@0 92
michael@0 93 // Number of bailouts without invalidation before we set
michael@0 94 // JSScript::hadFrequentBailouts and invalidate.
michael@0 95 frequentBailoutThreshold = 10;
michael@0 96
michael@0 97 // How many actual arguments are accepted on the C stack.
michael@0 98 maxStackArgs = 4096;
michael@0 99
michael@0 100 // How many times we will try to enter a script via OSR before
michael@0 101 // invalidating the script.
michael@0 102 osrPcMismatchesBeforeRecompile = 6000;
michael@0 103
michael@0 104 // The bytecode length limit for small function.
michael@0 105 //
michael@0 106 // The default for this was arrived at empirically via benchmarking.
michael@0 107 // We may want to tune it further after other optimizations have gone
michael@0 108 // in.
michael@0 109 smallFunctionMaxBytecodeLength_ = 100;
michael@0 110
michael@0 111 // How many uses of a parallel kernel before we attempt compilation.
michael@0 112 usesBeforeCompilePar = 1;
michael@0 113
michael@0 114 // Whether to profile inlined functions in Ion or not.
michael@0 115 profileInlineFrames = false;
michael@0 116 }
michael@0 117
michael@0 118 bool
michael@0 119 JitOptions::isSmallFunction(JSScript *script) const
michael@0 120 {
michael@0 121 return script->length() <= smallFunctionMaxBytecodeLength_;
michael@0 122 }
michael@0 123
michael@0 124 void
michael@0 125 JitOptions::setEagerCompilation()
michael@0 126 {
michael@0 127 eagerCompilation = true;
michael@0 128 baselineUsesBeforeCompile = 0;
michael@0 129 forceDefaultIonUsesBeforeCompile = true;
michael@0 130 forcedDefaultIonUsesBeforeCompile = 0;
michael@0 131 }
michael@0 132
michael@0 133 void
michael@0 134 JitOptions::setUsesBeforeCompile(uint32_t useCount)
michael@0 135 {
michael@0 136 forceDefaultIonUsesBeforeCompile = true;
michael@0 137 forcedDefaultIonUsesBeforeCompile = useCount;
michael@0 138
michael@0 139 // Undo eager compilation
michael@0 140 if (eagerCompilation && useCount != 0) {
michael@0 141 jit::JitOptions defaultValues;
michael@0 142 eagerCompilation = false;
michael@0 143 baselineUsesBeforeCompile = defaultValues.baselineUsesBeforeCompile;
michael@0 144 }
michael@0 145 }
michael@0 146
michael@0 147 void
michael@0 148 JitOptions::resetUsesBeforeCompile()
michael@0 149 {
michael@0 150 forceDefaultIonUsesBeforeCompile = false;
michael@0 151
michael@0 152 // Undo eager compilation
michael@0 153 if (eagerCompilation) {
michael@0 154 jit::JitOptions defaultValues;
michael@0 155 eagerCompilation = false;
michael@0 156 baselineUsesBeforeCompile = defaultValues.baselineUsesBeforeCompile;
michael@0 157 }
michael@0 158 }
michael@0 159
michael@0 160 } // namespace jit
michael@0 161 } // namespace js

mercurial