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.
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 | #ifndef jit_CompileWrappers_h |
michael@0 | 8 | #define jit_CompileWrappers_h |
michael@0 | 9 | |
michael@0 | 10 | #ifdef JS_ION |
michael@0 | 11 | |
michael@0 | 12 | #include "jscntxt.h" |
michael@0 | 13 | |
michael@0 | 14 | namespace js { |
michael@0 | 15 | namespace jit { |
michael@0 | 16 | |
michael@0 | 17 | class JitRuntime; |
michael@0 | 18 | |
michael@0 | 19 | // During Ion compilation we need access to various bits of the current |
michael@0 | 20 | // compartment, runtime and so forth. However, since compilation can run off |
michael@0 | 21 | // thread while the main thread is actively mutating the VM, this access needs |
michael@0 | 22 | // to be restricted. The classes below give the compiler an interface to access |
michael@0 | 23 | // all necessary information in a threadsafe fashion. |
michael@0 | 24 | |
michael@0 | 25 | class CompileRuntime |
michael@0 | 26 | { |
michael@0 | 27 | JSRuntime *runtime(); |
michael@0 | 28 | |
michael@0 | 29 | public: |
michael@0 | 30 | static CompileRuntime *get(JSRuntime *rt); |
michael@0 | 31 | |
michael@0 | 32 | bool onMainThread(); |
michael@0 | 33 | |
michael@0 | 34 | js::PerThreadData *mainThread(); |
michael@0 | 35 | |
michael@0 | 36 | // &mainThread.ionTop |
michael@0 | 37 | const void *addressOfIonTop(); |
michael@0 | 38 | |
michael@0 | 39 | // rt->mainThread.jitStackLimit; |
michael@0 | 40 | const void *addressOfJitStackLimit(); |
michael@0 | 41 | |
michael@0 | 42 | // &mainThread.ionJSContext |
michael@0 | 43 | const void *addressOfJSContext(); |
michael@0 | 44 | |
michael@0 | 45 | // &mainThread.activation_ |
michael@0 | 46 | const void *addressOfActivation(); |
michael@0 | 47 | |
michael@0 | 48 | // &GetIonContext()->runtime->nativeIterCache.last |
michael@0 | 49 | const void *addressOfLastCachedNativeIterator(); |
michael@0 | 50 | |
michael@0 | 51 | #ifdef JS_GC_ZEAL |
michael@0 | 52 | const void *addressOfGCZeal(); |
michael@0 | 53 | #endif |
michael@0 | 54 | |
michael@0 | 55 | const void *addressOfInterrupt(); |
michael@0 | 56 | |
michael@0 | 57 | #ifdef JS_THREADSAFE |
michael@0 | 58 | const void *addressOfInterruptPar(); |
michael@0 | 59 | #endif |
michael@0 | 60 | |
michael@0 | 61 | const void *addressOfThreadPool(); |
michael@0 | 62 | |
michael@0 | 63 | const JitRuntime *jitRuntime(); |
michael@0 | 64 | |
michael@0 | 65 | // Compilation does not occur off thread when the SPS profiler is enabled. |
michael@0 | 66 | SPSProfiler &spsProfiler(); |
michael@0 | 67 | |
michael@0 | 68 | bool signalHandlersInstalled(); |
michael@0 | 69 | bool jitSupportsFloatingPoint(); |
michael@0 | 70 | bool hadOutOfMemory(); |
michael@0 | 71 | |
michael@0 | 72 | const JSAtomState &names(); |
michael@0 | 73 | const StaticStrings &staticStrings(); |
michael@0 | 74 | const Value &NaNValue(); |
michael@0 | 75 | const Value &positiveInfinityValue(); |
michael@0 | 76 | |
michael@0 | 77 | #ifdef DEBUG |
michael@0 | 78 | bool isInsideNursery(gc::Cell *cell); |
michael@0 | 79 | #endif |
michael@0 | 80 | |
michael@0 | 81 | // DOM callbacks must be threadsafe (and will hopefully be removed soon). |
michael@0 | 82 | const DOMCallbacks *DOMcallbacks(); |
michael@0 | 83 | |
michael@0 | 84 | const MathCache *maybeGetMathCache(); |
michael@0 | 85 | |
michael@0 | 86 | #ifdef JSGC_GENERATIONAL |
michael@0 | 87 | const Nursery &gcNursery(); |
michael@0 | 88 | #endif |
michael@0 | 89 | }; |
michael@0 | 90 | |
michael@0 | 91 | class CompileZone |
michael@0 | 92 | { |
michael@0 | 93 | Zone *zone(); |
michael@0 | 94 | |
michael@0 | 95 | public: |
michael@0 | 96 | static CompileZone *get(Zone *zone); |
michael@0 | 97 | |
michael@0 | 98 | const void *addressOfNeedsBarrier(); |
michael@0 | 99 | |
michael@0 | 100 | // allocator.arenas.getFreeList(allocKind) |
michael@0 | 101 | const void *addressOfFreeListFirst(gc::AllocKind allocKind); |
michael@0 | 102 | const void *addressOfFreeListLast(gc::AllocKind allocKind); |
michael@0 | 103 | }; |
michael@0 | 104 | |
michael@0 | 105 | class CompileCompartment |
michael@0 | 106 | { |
michael@0 | 107 | JSCompartment *compartment(); |
michael@0 | 108 | |
michael@0 | 109 | public: |
michael@0 | 110 | static CompileCompartment *get(JSCompartment *comp); |
michael@0 | 111 | |
michael@0 | 112 | CompileZone *zone(); |
michael@0 | 113 | CompileRuntime *runtime(); |
michael@0 | 114 | |
michael@0 | 115 | const void *addressOfEnumerators(); |
michael@0 | 116 | |
michael@0 | 117 | const CallsiteCloneTable &callsiteClones(); |
michael@0 | 118 | |
michael@0 | 119 | const JitCompartment *jitCompartment(); |
michael@0 | 120 | |
michael@0 | 121 | bool hasObjectMetadataCallback(); |
michael@0 | 122 | |
michael@0 | 123 | // Mirror CompartmentOptions. |
michael@0 | 124 | void setSingletonsAsValues(); |
michael@0 | 125 | }; |
michael@0 | 126 | |
michael@0 | 127 | class JitCompileOptions |
michael@0 | 128 | { |
michael@0 | 129 | public: |
michael@0 | 130 | JitCompileOptions(); |
michael@0 | 131 | JitCompileOptions(JSContext *cx); |
michael@0 | 132 | |
michael@0 | 133 | bool cloneSingletons() const { |
michael@0 | 134 | return cloneSingletons_; |
michael@0 | 135 | } |
michael@0 | 136 | |
michael@0 | 137 | bool spsSlowAssertionsEnabled() const { |
michael@0 | 138 | return spsSlowAssertionsEnabled_; |
michael@0 | 139 | } |
michael@0 | 140 | |
michael@0 | 141 | private: |
michael@0 | 142 | bool cloneSingletons_; |
michael@0 | 143 | bool spsSlowAssertionsEnabled_; |
michael@0 | 144 | }; |
michael@0 | 145 | |
michael@0 | 146 | |
michael@0 | 147 | } // namespace jit |
michael@0 | 148 | } // namespace js |
michael@0 | 149 | |
michael@0 | 150 | #endif // JS_ION |
michael@0 | 151 | |
michael@0 | 152 | #endif // jit_CompileWrappers_h |