LCOV - code coverage report
Current view: top level - src/compiler - graph.cc (source / functions) Hit Total Coverage
Test: app.info Lines: 23 26 88.5 %
Date: 2019-04-17 Functions: 7 9 77.8 %

          Line data    Source code
       1             : // Copyright 2013 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             : #include "src/compiler/graph.h"
       6             : 
       7             : #include <algorithm>
       8             : 
       9             : #include "src/base/bits.h"
      10             : #include "src/compiler/graph-visualizer.h"
      11             : #include "src/compiler/node-properties.h"
      12             : #include "src/compiler/node.h"
      13             : #include "src/compiler/verifier.h"
      14             : 
      15             : namespace v8 {
      16             : namespace internal {
      17             : namespace compiler {
      18             : 
      19     4254217 : Graph::Graph(Zone* zone)
      20             :     : zone_(zone),
      21             :       start_(nullptr),
      22             :       end_(nullptr),
      23             :       mark_max_(0),
      24             :       next_node_id_(0),
      25     8508434 :       decorators_(zone) {}
      26             : 
      27             : 
      28           0 : void Graph::Decorate(Node* node) {
      29   259474636 :   for (GraphDecorator* const decorator : decorators_) {
      30   108520414 :     decorator->Decorate(node);
      31             :   }
      32           0 : }
      33             : 
      34             : 
      35     1179895 : void Graph::AddDecorator(GraphDecorator* decorator) {
      36     1179895 :   decorators_.push_back(decorator);
      37     1179898 : }
      38             : 
      39             : 
      40     1110211 : void Graph::RemoveDecorator(GraphDecorator* decorator) {
      41     1110211 :   auto const it = std::find(decorators_.begin(), decorators_.end(), decorator);
      42             :   DCHECK(it != decorators_.end());
      43     1110211 :   decorators_.erase(it);
      44     1110212 : }
      45             : 
      46   123599846 : Node* Graph::NewNode(const Operator* op, int input_count, Node* const* inputs,
      47             :                      bool incomplete) {
      48   123599846 :   Node* node = NewNodeUnchecked(op, input_count, inputs, incomplete);
      49             :   Verifier::VerifyNode(node);
      50   123600905 :   return node;
      51             : }
      52             : 
      53   148546091 : Node* Graph::NewNodeUnchecked(const Operator* op, int input_count,
      54             :                               Node* const* inputs, bool incomplete) {
      55             :   Node* const node =
      56   297092182 :       Node::New(zone(), NextNodeId(), op, input_count, inputs, incomplete);
      57             :   Decorate(node);
      58   148548542 :   return node;
      59             : }
      60             : 
      61             : 
      62     2405685 : Node* Graph::CloneNode(const Node* node) {
      63             :   DCHECK_NOT_NULL(node);
      64     2405685 :   Node* const clone = Node::Clone(zone(), NextNodeId(), node);
      65             :   Decorate(clone);
      66     2405680 :   return clone;
      67             : }
      68             : 
      69             : 
      70             : NodeId Graph::NextNodeId() {
      71   150951776 :   NodeId const id = next_node_id_;
      72   150951776 :   CHECK(!base::bits::UnsignedAddOverflow32(id, 1, &next_node_id_));
      73             :   return id;
      74             : }
      75             : 
      76           0 : void Graph::Print() const { StdoutStream{} << AsRPO(*this); }
      77             : 
      78             : }  // namespace compiler
      79             : }  // namespace internal
      80      121996 : }  // namespace v8

Generated by: LCOV version 1.10