Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
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/. */
7 #ifndef jit_JitOptions_h
8 #define jit_JitOptions_h
10 #include "jit/IonTypes.h"
11 #include "js/TypeDecls.h"
13 #ifdef JS_ION
15 namespace js {
16 namespace jit {
18 // Longer scripts can only be compiled off thread, as these compilations
19 // can be expensive and stall the main thread for too long.
20 static const uint32_t MAX_OFF_THREAD_SCRIPT_SIZE = 100 * 1000;
21 static const uint32_t MAX_MAIN_THREAD_SCRIPT_SIZE = 2 * 1000;
22 static const uint32_t MAX_MAIN_THREAD_LOCALS_AND_ARGS = 256;
24 // DOM Worker runtimes don't have off thread compilation, but can also compile
25 // larger scripts since this doesn't stall the main thread.
26 static const uint32_t MAX_DOM_WORKER_SCRIPT_SIZE = 16 * 1000;
27 static const uint32_t MAX_DOM_WORKER_LOCALS_AND_ARGS = 2048;
29 // Possible register allocators which may be used.
30 enum IonRegisterAllocator {
31 RegisterAllocator_LSRA,
32 RegisterAllocator_Backtracking,
33 RegisterAllocator_Stupid
34 };
36 enum IonGvnKind {
37 GVN_Optimistic,
38 GVN_Pessimistic
39 };
41 struct JitOptions
42 {
43 bool checkGraphConsistency;
44 #ifdef CHECK_OSIPOINT_REGISTERS
45 bool checkOsiPointRegisters;
46 #endif
47 bool checkRangeAnalysis;
48 bool compileTryCatch;
49 bool disableGvn;
50 bool disableLicm;
51 bool disableInlining;
52 bool disableEdgeCaseAnalysis;
53 bool disableRangeAnalysis;
54 bool disableUce;
55 bool disableEaa;
56 bool eagerCompilation;
57 bool forceDefaultIonUsesBeforeCompile;
58 uint32_t forcedDefaultIonUsesBeforeCompile;
59 bool forceGvnKind;
60 IonGvnKind forcedGvnKind;
61 bool forceRegisterAllocator;
62 IonRegisterAllocator forcedRegisterAllocator;
63 bool limitScriptSize;
64 bool osr;
65 uint32_t baselineUsesBeforeCompile;
66 uint32_t exceptionBailoutThreshold;
67 uint32_t frequentBailoutThreshold;
68 uint32_t maxStackArgs;
69 uint32_t osrPcMismatchesBeforeRecompile;
70 uint32_t smallFunctionMaxBytecodeLength_;
71 uint32_t usesBeforeCompilePar;
72 bool profileInlineFrames;
74 JitOptions();
75 bool isSmallFunction(JSScript *script) const;
76 void setEagerCompilation();
77 void setUsesBeforeCompile(uint32_t useCount);
78 void resetUsesBeforeCompile();
79 };
81 extern JitOptions js_JitOptions;
83 } // namespace jit
84 } // namespace js
86 #endif // JS_ION
88 #endif /* jit_JitOptions_h */