LCOV - code coverage report
Current view: top level - js/src/jit - CompileWrappers.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 62 95 65.3 %
Date: 2017-07-14 16:53:18 Functions: 31 45 68.9 %
Legend: Lines: hit not hit

          Line data    Source code
       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/. */
       6             : 
       7             : #include "jit/Ion.h"
       8             : 
       9             : #include "jscompartmentinlines.h"
      10             : 
      11             : using namespace js;
      12             : using namespace js::jit;
      13             : 
      14             : JSRuntime*
      15       63513 : CompileRuntime::runtime()
      16             : {
      17       63513 :     return reinterpret_cast<JSRuntime*>(this);
      18             : }
      19             : 
      20             : /* static */ CompileRuntime*
      21        3859 : CompileRuntime::get(JSRuntime* rt)
      22             : {
      23        3859 :     return reinterpret_cast<CompileRuntime*>(rt);
      24             : }
      25             : 
      26             : #ifdef JS_GC_ZEAL
      27             : const void*
      28         115 : CompileRuntime::addressOfGCZealModeBits()
      29             : {
      30         115 :     return runtime()->gc.addressOfZealModeBits();
      31             : }
      32             : #endif
      33             : 
      34             : const JitRuntime*
      35        2142 : CompileRuntime::jitRuntime()
      36             : {
      37        2142 :     return runtime()->jitRuntime();
      38             : }
      39             : 
      40             : GeckoProfiler&
      41         183 : CompileRuntime::geckoProfiler()
      42             : {
      43         183 :     return runtime()->geckoProfiler();
      44             : }
      45             : 
      46             : bool
      47           0 : CompileRuntime::jitSupportsFloatingPoint()
      48             : {
      49           0 :     return runtime()->jitSupportsFloatingPoint;
      50             : }
      51             : 
      52             : bool
      53       59715 : CompileRuntime::hadOutOfMemory()
      54             : {
      55       59715 :     return runtime()->hadOutOfMemory;
      56             : }
      57             : 
      58             : bool
      59           8 : CompileRuntime::profilingScripts()
      60             : {
      61           8 :     return runtime()->profilingScripts;
      62             : }
      63             : 
      64             : const JSAtomState&
      65         278 : CompileRuntime::names()
      66             : {
      67         278 :     return *runtime()->commonNames;
      68             : }
      69             : 
      70             : const PropertyName*
      71           0 : CompileRuntime::emptyString()
      72             : {
      73           0 :     return runtime()->emptyString;
      74             : }
      75             : 
      76             : const StaticStrings&
      77           2 : CompileRuntime::staticStrings()
      78             : {
      79           2 :     return *runtime()->staticStrings;
      80             : }
      81             : 
      82             : const Value&
      83           0 : CompileRuntime::NaNValue()
      84             : {
      85           0 :     return runtime()->NaNValue;
      86             : }
      87             : 
      88             : const Value&
      89           0 : CompileRuntime::positiveInfinityValue()
      90             : {
      91           0 :     return runtime()->positiveInfinityValue;
      92             : }
      93             : 
      94             : const WellKnownSymbols&
      95           5 : CompileRuntime::wellKnownSymbols()
      96             : {
      97           5 :     return *runtime()->wellKnownSymbols;
      98             : }
      99             : 
     100             : const void*
     101        1064 : CompileRuntime::addressOfActiveJSContext()
     102             : {
     103        1064 :     return runtime()->addressOfActiveContext();
     104             : }
     105             : 
     106             : #ifdef DEBUG
     107             : bool
     108           0 : CompileRuntime::isInsideNursery(gc::Cell* cell)
     109             : {
     110           0 :     return UninlinedIsInsideNursery(cell);
     111             : }
     112             : #endif
     113             : 
     114             : const DOMCallbacks*
     115           0 : CompileRuntime::DOMcallbacks()
     116             : {
     117           0 :     return runtime()->DOMcallbacks;
     118             : }
     119             : 
     120             : bool
     121           2 : CompileRuntime::runtimeMatches(JSRuntime* rt)
     122             : {
     123           2 :     return rt == runtime();
     124             : }
     125             : 
     126             : Zone*
     127        7089 : CompileZone::zone()
     128             : {
     129        7089 :     return reinterpret_cast<Zone*>(this);
     130             : }
     131             : 
     132             : /* static */ CompileZone*
     133        6697 : CompileZone::get(Zone* zone)
     134             : {
     135        6697 :     return reinterpret_cast<CompileZone*>(zone);
     136             : }
     137             : 
     138             : CompileRuntime*
     139           0 : CompileZone::runtime()
     140             : {
     141           0 :     return CompileRuntime::get(zone()->runtimeFromAnyThread());
     142             : }
     143             : 
     144             : bool
     145        3522 : CompileZone::isAtomsZone()
     146             : {
     147        3522 :     return zone()->isAtomsZone();
     148             : }
     149             : 
     150             : #ifdef DEBUG
     151             : const void*
     152         181 : CompileZone::addressOfIonBailAfter()
     153             : {
     154         181 :     return zone()->group()->addressOfIonBailAfter();
     155             : }
     156             : #endif
     157             : 
     158             : const void*
     159        2470 : CompileZone::addressOfJSContext()
     160             : {
     161        2470 :     return zone()->group()->addressOfOwnerContext();
     162             : }
     163             : 
     164             : const void*
     165         247 : CompileZone::addressOfNeedsIncrementalBarrier()
     166             : {
     167         247 :     return zone()->addressOfNeedsIncrementalBarrier();
     168             : }
     169             : 
     170             : const void*
     171          60 : CompileZone::addressOfFreeList(gc::AllocKind allocKind)
     172             : {
     173          60 :     return zone()->arenas.addressOfFreeList(allocKind);
     174             : }
     175             : 
     176             : const void*
     177         190 : CompileZone::addressOfNurseryPosition()
     178             : {
     179         190 :     return zone()->runtimeFromAnyThread()->gc.addressOfNurseryPosition();
     180             : }
     181             : 
     182             : const void*
     183          95 : CompileZone::addressOfNurseryCurrentEnd()
     184             : {
     185          95 :     return zone()->runtimeFromAnyThread()->gc.addressOfNurseryCurrentEnd();
     186             : }
     187             : 
     188             : bool
     189         162 : CompileZone::nurseryExists()
     190             : {
     191         162 :     MOZ_ASSERT(CurrentThreadCanAccessZone(zone()));
     192         162 :     return zone()->group()->nursery().exists();
     193             : }
     194             : 
     195             : void
     196           0 : CompileZone::setMinorGCShouldCancelIonCompilations()
     197             : {
     198           0 :     MOZ_ASSERT(CurrentThreadCanAccessZone(zone()));
     199           0 :     zone()->group()->storeBuffer().setShouldCancelIonCompilations();
     200           0 : }
     201             : 
     202             : JSCompartment*
     203        7103 : CompileCompartment::compartment()
     204             : {
     205        7103 :     return reinterpret_cast<JSCompartment*>(this);
     206             : }
     207             : 
     208             : /* static */ CompileCompartment*
     209        3734 : CompileCompartment::get(JSCompartment* comp)
     210             : {
     211        3734 :     return reinterpret_cast<CompileCompartment*>(comp);
     212             : }
     213             : 
     214             : CompileZone*
     215        6697 : CompileCompartment::zone()
     216             : {
     217        6697 :     return CompileZone::get(compartment()->zone());
     218             : }
     219             : 
     220             : CompileRuntime*
     221         271 : CompileCompartment::runtime()
     222             : {
     223         271 :     return CompileRuntime::get(compartment()->runtimeFromAnyThread());
     224             : }
     225             : 
     226             : const void*
     227           0 : CompileCompartment::addressOfEnumerators()
     228             : {
     229           0 :     return &compartment()->enumerators;
     230             : }
     231             : 
     232             : const void*
     233           0 : CompileCompartment::addressOfLastCachedNativeIterator()
     234             : {
     235           0 :     return &compartment()->lastCachedNativeIterator;
     236             : }
     237             : 
     238             : const void*
     239           0 : CompileCompartment::addressOfRandomNumberGenerator()
     240             : {
     241           0 :     return compartment()->randomNumberGenerator.ptr();
     242             : }
     243             : 
     244             : const JitCompartment*
     245          20 : CompileCompartment::jitCompartment()
     246             : {
     247          20 :     return compartment()->jitCompartment();
     248             : }
     249             : 
     250             : const GlobalObject*
     251           0 : CompileCompartment::maybeGlobal()
     252             : {
     253             :     // This uses unsafeUnbarrieredMaybeGlobal() so as not to trigger the read
     254             :     // barrier on the global from off thread.  This is safe because we
     255             :     // abort Ion compilation when we GC.
     256           0 :     return compartment()->unsafeUnbarrieredMaybeGlobal();
     257             : }
     258             : 
     259             : bool
     260         115 : CompileCompartment::hasAllocationMetadataBuilder()
     261             : {
     262         115 :     return compartment()->hasAllocationMetadataBuilder();
     263             : }
     264             : 
     265             : // Note: This function is thread-safe because setSingletonAsValue sets a boolean
     266             : // variable to false, and this boolean variable has no way to be resetted to
     267             : // true. So even if there is a concurrent write, this concurrent write will
     268             : // always have the same value.  If there is a concurrent read, then we will
     269             : // clone a singleton instead of using the value which is baked in the JSScript,
     270             : // and this would be an unfortunate allocation, but this will not change the
     271             : // semantics of the JavaScript code which is executed.
     272             : void
     273           0 : CompileCompartment::setSingletonsAsValues()
     274             : {
     275           0 :     compartment()->behaviors().setSingletonsAsValues();
     276           0 : }
     277             : 
     278           0 : JitCompileOptions::JitCompileOptions()
     279             :   : cloneSingletons_(false),
     280             :     profilerSlowAssertionsEnabled_(false),
     281           0 :     offThreadCompilationAvailable_(false)
     282             : {
     283           0 : }
     284             : 
     285         146 : JitCompileOptions::JitCompileOptions(JSContext* cx)
     286             : {
     287         146 :     cloneSingletons_ = cx->compartment()->creationOptions().cloneSingletons();
     288         146 :     profilerSlowAssertionsEnabled_ = cx->runtime()->geckoProfiler().enabled() &&
     289           0 :                                      cx->runtime()->geckoProfiler().slowAssertionsEnabled();
     290         146 :     offThreadCompilationAvailable_ = OffThreadCompilationAvailable(cx);
     291         155 : }

Generated by: LCOV version 1.13