LCOV - code coverage report
Current view: top level - src/compiler - redundancy-elimination.h (source / functions) Hit Total Coverage
Test: app.info Lines: 5 5 100.0 %
Date: 2019-04-17 Functions: 2 3 66.7 %

          Line data    Source code
       1             : // Copyright 2016 the V8 project authors. All rights reserved.
       2             : // Use of this source code is governed by a BSD-style license that can be
       3             : // found in the LICENSE file.
       4             : 
       5             : #ifndef V8_COMPILER_REDUNDANCY_ELIMINATION_H_
       6             : #define V8_COMPILER_REDUNDANCY_ELIMINATION_H_
       7             : 
       8             : #include "src/compiler/graph-reducer.h"
       9             : 
      10             : namespace v8 {
      11             : namespace internal {
      12             : namespace compiler {
      13             : 
      14     1856734 : class V8_EXPORT_PRIVATE RedundancyElimination final : public AdvancedReducer {
      15             :  public:
      16             :   RedundancyElimination(Editor* editor, Zone* zone);
      17             :   ~RedundancyElimination() final;
      18             : 
      19          54 :   const char* reducer_name() const override { return "RedundancyElimination"; }
      20             : 
      21             :   Reduction Reduce(Node* node) final;
      22             : 
      23             :  private:
      24             :   struct Check {
      25      428806 :     Check(Node* node, Check* next) : node(node), next(next) {}
      26             :     Node* node;
      27             :     Check* next;
      28             :   };
      29             : 
      30             :   class EffectPathChecks final {
      31             :    public:
      32             :     static EffectPathChecks* Copy(Zone* zone, EffectPathChecks const* checks);
      33             :     static EffectPathChecks const* Empty(Zone* zone);
      34             :     bool Equals(EffectPathChecks const* that) const;
      35             :     void Merge(EffectPathChecks const* that);
      36             : 
      37             :     EffectPathChecks const* AddCheck(Zone* zone, Node* node) const;
      38             :     Node* LookupCheck(Node* node) const;
      39             :     Node* LookupBoundsCheckFor(Node* node) const;
      40             : 
      41             :    private:
      42     1357181 :     EffectPathChecks(Check* head, size_t size) : head_(head), size_(size) {}
      43             : 
      44             :     // We keep track of the list length so that we can find the longest
      45             :     // common tail easily.
      46             :     Check* head_;
      47             :     size_t size_;
      48             :   };
      49             : 
      50      928367 :   class PathChecksForEffectNodes final {
      51             :    public:
      52             :     explicit PathChecksForEffectNodes(Zone* zone) : info_for_node_(zone) {}
      53             :     EffectPathChecks const* Get(Node* node) const;
      54             :     void Set(Node* node, EffectPathChecks const* checks);
      55             : 
      56             :    private:
      57             :     ZoneVector<EffectPathChecks const*> info_for_node_;
      58             :   };
      59             : 
      60             :   Reduction ReduceCheckNode(Node* node);
      61             :   Reduction ReduceEffectPhi(Node* node);
      62             :   Reduction ReduceSpeculativeNumberComparison(Node* node);
      63             :   Reduction ReduceSpeculativeNumberOperation(Node* node);
      64             :   Reduction ReduceStart(Node* node);
      65             :   Reduction ReduceOtherNode(Node* node);
      66             : 
      67             :   Reduction TakeChecksFromFirstEffect(Node* node);
      68             :   Reduction UpdateChecks(Node* node, EffectPathChecks const* checks);
      69             : 
      70             :   Zone* zone() const { return zone_; }
      71             : 
      72             :   PathChecksForEffectNodes node_checks_;
      73             :   Zone* const zone_;
      74             : 
      75             :   DISALLOW_COPY_AND_ASSIGN(RedundancyElimination);
      76             : };
      77             : 
      78             : }  // namespace compiler
      79             : }  // namespace internal
      80             : }  // namespace v8
      81             : 
      82             : #endif  // V8_COMPILER_REDUNDANCY_ELIMINATION_H_

Generated by: LCOV version 1.10