js/src/jit/CompileWrappers.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/jit/CompileWrappers.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,152 @@
     1.4 +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
     1.5 + * vim: set ts=8 sts=4 et sw=4 tw=99:
     1.6 + * This Source Code Form is subject to the terms of the Mozilla Public
     1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.9 +
    1.10 +#ifndef jit_CompileWrappers_h
    1.11 +#define jit_CompileWrappers_h
    1.12 +
    1.13 +#ifdef JS_ION
    1.14 +
    1.15 +#include "jscntxt.h"
    1.16 +
    1.17 +namespace js {
    1.18 +namespace jit {
    1.19 +
    1.20 +class JitRuntime;
    1.21 +
    1.22 +// During Ion compilation we need access to various bits of the current
    1.23 +// compartment, runtime and so forth. However, since compilation can run off
    1.24 +// thread while the main thread is actively mutating the VM, this access needs
    1.25 +// to be restricted. The classes below give the compiler an interface to access
    1.26 +// all necessary information in a threadsafe fashion.
    1.27 +
    1.28 +class CompileRuntime
    1.29 +{
    1.30 +    JSRuntime *runtime();
    1.31 +
    1.32 +  public:
    1.33 +    static CompileRuntime *get(JSRuntime *rt);
    1.34 +
    1.35 +    bool onMainThread();
    1.36 +
    1.37 +    js::PerThreadData *mainThread();
    1.38 +
    1.39 +    // &mainThread.ionTop
    1.40 +    const void *addressOfIonTop();
    1.41 +
    1.42 +    // rt->mainThread.jitStackLimit;
    1.43 +    const void *addressOfJitStackLimit();
    1.44 +
    1.45 +    // &mainThread.ionJSContext
    1.46 +    const void *addressOfJSContext();
    1.47 +
    1.48 +    // &mainThread.activation_
    1.49 +    const void *addressOfActivation();
    1.50 +
    1.51 +    // &GetIonContext()->runtime->nativeIterCache.last
    1.52 +    const void *addressOfLastCachedNativeIterator();
    1.53 +
    1.54 +#ifdef JS_GC_ZEAL
    1.55 +    const void *addressOfGCZeal();
    1.56 +#endif
    1.57 +
    1.58 +    const void *addressOfInterrupt();
    1.59 +
    1.60 +#ifdef JS_THREADSAFE
    1.61 +    const void *addressOfInterruptPar();
    1.62 +#endif
    1.63 +
    1.64 +    const void *addressOfThreadPool();
    1.65 +
    1.66 +    const JitRuntime *jitRuntime();
    1.67 +
    1.68 +    // Compilation does not occur off thread when the SPS profiler is enabled.
    1.69 +    SPSProfiler &spsProfiler();
    1.70 +
    1.71 +    bool signalHandlersInstalled();
    1.72 +    bool jitSupportsFloatingPoint();
    1.73 +    bool hadOutOfMemory();
    1.74 +
    1.75 +    const JSAtomState &names();
    1.76 +    const StaticStrings &staticStrings();
    1.77 +    const Value &NaNValue();
    1.78 +    const Value &positiveInfinityValue();
    1.79 +
    1.80 +#ifdef DEBUG
    1.81 +    bool isInsideNursery(gc::Cell *cell);
    1.82 +#endif
    1.83 +
    1.84 +    // DOM callbacks must be threadsafe (and will hopefully be removed soon).
    1.85 +    const DOMCallbacks *DOMcallbacks();
    1.86 +
    1.87 +    const MathCache *maybeGetMathCache();
    1.88 +
    1.89 +#ifdef JSGC_GENERATIONAL
    1.90 +    const Nursery &gcNursery();
    1.91 +#endif
    1.92 +};
    1.93 +
    1.94 +class CompileZone
    1.95 +{
    1.96 +    Zone *zone();
    1.97 +
    1.98 +  public:
    1.99 +    static CompileZone *get(Zone *zone);
   1.100 +
   1.101 +    const void *addressOfNeedsBarrier();
   1.102 +
   1.103 +    // allocator.arenas.getFreeList(allocKind)
   1.104 +    const void *addressOfFreeListFirst(gc::AllocKind allocKind);
   1.105 +    const void *addressOfFreeListLast(gc::AllocKind allocKind);
   1.106 +};
   1.107 +
   1.108 +class CompileCompartment
   1.109 +{
   1.110 +    JSCompartment *compartment();
   1.111 +
   1.112 +  public:
   1.113 +    static CompileCompartment *get(JSCompartment *comp);
   1.114 +
   1.115 +    CompileZone *zone();
   1.116 +    CompileRuntime *runtime();
   1.117 +
   1.118 +    const void *addressOfEnumerators();
   1.119 +
   1.120 +    const CallsiteCloneTable &callsiteClones();
   1.121 +
   1.122 +    const JitCompartment *jitCompartment();
   1.123 +
   1.124 +    bool hasObjectMetadataCallback();
   1.125 +
   1.126 +    // Mirror CompartmentOptions.
   1.127 +    void setSingletonsAsValues();
   1.128 +};
   1.129 +
   1.130 +class JitCompileOptions
   1.131 +{
   1.132 +  public:
   1.133 +    JitCompileOptions();
   1.134 +    JitCompileOptions(JSContext *cx);
   1.135 +
   1.136 +    bool cloneSingletons() const {
   1.137 +        return cloneSingletons_;
   1.138 +    }
   1.139 +
   1.140 +    bool spsSlowAssertionsEnabled() const {
   1.141 +        return spsSlowAssertionsEnabled_;
   1.142 +    }
   1.143 +
   1.144 +  private:
   1.145 +    bool cloneSingletons_;
   1.146 +    bool spsSlowAssertionsEnabled_;
   1.147 +};
   1.148 +
   1.149 +
   1.150 +} // namespace jit
   1.151 +} // namespace js
   1.152 +
   1.153 +#endif // JS_ION
   1.154 +
   1.155 +#endif // jit_CompileWrappers_h

mercurial