LCOV - code coverage report
Current view: top level - js/src/jit - AliasAnalysisShared.h (source / functions) Hit Total Coverage
Test: output.info Lines: 23 25 92.0 %
Date: 2017-07-14 16:53:18 Functions: 6 7 85.7 %
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 jit_AliasAnalysisShared_h
       8             : #define jit_AliasAnalysisShared_h
       9             : 
      10             : #include "jit/MIR.h"
      11             : #include "jit/MIRGraph.h"
      12             : 
      13             : namespace js {
      14             : namespace jit {
      15             : 
      16             : class MIRGraph;
      17             : 
      18             : class AliasAnalysisShared
      19             : {
      20             :   protected:
      21             :     MIRGenerator* mir;
      22             :     MIRGraph& graph_;
      23             : 
      24             :   public:
      25          10 :     AliasAnalysisShared(MIRGenerator* mir, MIRGraph& graph)
      26          10 :       : mir(mir),
      27          10 :         graph_(graph)
      28          10 :     {}
      29             : 
      30           0 :     virtual MOZ_MUST_USE bool analyze() {
      31           0 :         return true;
      32             :     }
      33             : 
      34             :     static MDefinition::AliasType genericMightAlias(const MDefinition* load,
      35             :                                                     const MDefinition* store);
      36             : 
      37             : 
      38             :   protected:
      39             :     void spewDependencyList();
      40             : 
      41         134 :     TempAllocator& alloc() const {
      42         134 :         return graph_.alloc();
      43             :     }
      44             : };
      45             : 
      46             : // Iterates over the flags in an AliasSet.
      47             : class AliasSetIterator
      48             : {
      49             :   private:
      50             :     uint32_t flags;
      51             :     unsigned pos;
      52             : 
      53             :   public:
      54         432 :     explicit AliasSetIterator(AliasSet set)
      55         432 :       : flags(set.flags()), pos(0)
      56             :     {
      57        1776 :         while (flags && (flags & 1) == 0) {
      58         672 :             flags >>= 1;
      59         672 :             pos++;
      60             :         }
      61         432 :     }
      62        2242 :     AliasSetIterator& operator ++(int) {
      63           6 :         do {
      64        2242 :             flags >>= 1;
      65        2242 :             pos++;
      66        2242 :         } while (flags && (flags & 1) == 0);
      67        2236 :         return *this;
      68             :     }
      69        2668 :     explicit operator bool() const {
      70        2668 :         return !!flags;
      71             :     }
      72        2270 :     unsigned operator*() const {
      73        2270 :         MOZ_ASSERT(pos < AliasSet::NumCategories);
      74        2270 :         return pos;
      75             :     }
      76             : };
      77             : 
      78             : } // namespace jit
      79             : } // namespace js
      80             : 
      81             : #endif /* jit_AliasAnalysisShared_h */

Generated by: LCOV version 1.13