LCOV - code coverage report
Current view: top level - js/src/vm - ObjectGroup-inl.h (source / functions) Hit Total Coverage
Test: output.info Lines: 39 44 88.6 %
Date: 2017-07-14 16:53:18 Functions: 14 15 93.3 %
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             : #ifndef vm_ObjectGroup_inl_h
       8             : #define vm_ObjectGroup_inl_h
       9             : 
      10             : #include "vm/ObjectGroup.h"
      11             : 
      12             : namespace js {
      13             : 
      14             : inline bool
      15     1351553 : ObjectGroup::needsSweep()
      16             : {
      17             :     // Note: this can be called off thread during compacting GCs, in which case
      18             :     // nothing will be running on the active thread.
      19     1351553 :     return generation() != zoneFromAnyThread()->types.generation;
      20             : }
      21             : 
      22             : inline void
      23     1325183 : ObjectGroup::maybeSweep(AutoClearTypeInferenceStateOnOOM* oom)
      24             : {
      25     1325183 :     if (needsSweep())
      26           0 :         sweep(oom);
      27     1325401 : }
      28             : 
      29             : inline ObjectGroupFlags
      30     1093889 : ObjectGroup::flags()
      31             : {
      32     1093889 :     maybeSweep(nullptr);
      33     1094028 :     return flagsDontCheckGeneration();
      34             : }
      35             : 
      36             : inline void
      37         977 : ObjectGroup::addFlags(ObjectGroupFlags flags)
      38             : {
      39         977 :     maybeSweep(nullptr);
      40         977 :     flags_ |= flags;
      41         977 : }
      42             : 
      43             : inline void
      44             : ObjectGroup::clearFlags(ObjectGroupFlags flags)
      45             : {
      46             :     maybeSweep(nullptr);
      47             :     flags_ &= ~flags;
      48             : }
      49             : 
      50             : inline bool
      51       31426 : ObjectGroup::hasAnyFlags(ObjectGroupFlags flags)
      52             : {
      53       31426 :     MOZ_ASSERT((flags & OBJECT_FLAG_DYNAMIC_MASK) == flags);
      54       31426 :     return !!(this->flags() & flags);
      55             : }
      56             : 
      57             : inline bool
      58       49841 : ObjectGroup::hasAllFlags(ObjectGroupFlags flags)
      59             : {
      60       49841 :     MOZ_ASSERT((flags & OBJECT_FLAG_DYNAMIC_MASK) == flags);
      61       49841 :     return (this->flags() & flags) == flags;
      62             : }
      63             : 
      64             : inline bool
      65      413807 : ObjectGroup::unknownProperties()
      66             : {
      67      413807 :     MOZ_ASSERT_IF(flags() & OBJECT_FLAG_UNKNOWN_PROPERTIES,
      68             :                   hasAllFlags(OBJECT_FLAG_DYNAMIC_MASK));
      69      413832 :     return !!(flags() & OBJECT_FLAG_UNKNOWN_PROPERTIES);
      70             : }
      71             : 
      72             : inline bool
      73       30570 : ObjectGroup::shouldPreTenure()
      74             : {
      75       30570 :     return hasAnyFlags(OBJECT_FLAG_PRE_TENURE) && !unknownProperties();
      76             : }
      77             : 
      78             : inline bool
      79          16 : ObjectGroup::canPreTenure()
      80             : {
      81          16 :     return !unknownProperties();
      82             : }
      83             : 
      84             : inline bool
      85         784 : ObjectGroup::fromAllocationSite()
      86             : {
      87         784 :     return flags() & OBJECT_FLAG_FROM_ALLOCATION_SITE;
      88             : }
      89             : 
      90             : inline void
      91           0 : ObjectGroup::setShouldPreTenure(JSContext* cx)
      92             : {
      93           0 :     MOZ_ASSERT(canPreTenure());
      94           0 :     setFlags(cx, OBJECT_FLAG_PRE_TENURE);
      95           0 : }
      96             : 
      97             : inline TypeNewScript*
      98      150853 : ObjectGroup::newScript()
      99             : {
     100      150853 :     maybeSweep(nullptr);
     101      150855 :     return newScriptDontCheckGeneration();
     102             : }
     103             : 
     104             : inline PreliminaryObjectArrayWithTemplate*
     105       28513 : ObjectGroup::maybePreliminaryObjects()
     106             : {
     107       28513 :     maybeSweep(nullptr);
     108       28513 :     return maybePreliminaryObjectsDontCheckGeneration();
     109             : }
     110             : 
     111             : inline UnboxedLayout*
     112       36185 : ObjectGroup::maybeUnboxedLayout()
     113             : {
     114       36185 :     maybeSweep(nullptr);
     115       36185 :     return maybeUnboxedLayoutDontCheckGeneration();
     116             : }
     117             : 
     118             : inline UnboxedLayout&
     119       14397 : ObjectGroup::unboxedLayout()
     120             : {
     121       14397 :     maybeSweep(nullptr);
     122       14397 :     return unboxedLayoutDontCheckGeneration();
     123             : }
     124             : 
     125             : } // namespace js
     126             : 
     127             : #endif /* vm_ObjectGroup_inl_h */

Generated by: LCOV version 1.13