js/src/jit/CompileWrappers.h

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.

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

mercurial