LCOV - code coverage report
Current view: top level - src/compiler - graph-trimmer.cc (source / functions) Hit Total Coverage
Test: app.info Lines: 15 17 88.2 %
Date: 2019-04-18 Functions: 3 3 100.0 %

          Line data    Source code
       1             : // Copyright 2015 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-trimmer.h"
       6             : 
       7             : #include "src/compiler/graph.h"
       8             : 
       9             : namespace v8 {
      10             : namespace internal {
      11             : namespace compiler {
      12             : 
      13     4775249 : GraphTrimmer::GraphTrimmer(Zone* zone, Graph* graph)
      14     4775249 :     : graph_(graph), is_live_(graph, 2), live_(zone) {
      15     4775333 :   live_.reserve(graph->NodeCount());
      16     4778432 : }
      17             : 
      18             : 
      19             : GraphTrimmer::~GraphTrimmer() = default;
      20             : 
      21             : 
      22     4775273 : void GraphTrimmer::TrimGraph() {
      23             :   // Mark end node as live.
      24             :   MarkAsLive(graph()->end());
      25             :   // Compute transitive closure of live nodes.
      26   641133805 :   for (size_t i = 0; i < live_.size(); ++i) {
      27   318173039 :     Node* const live = live_[i];
      28  1070474158 :     for (Node* const input : live->inputs()) MarkAsLive(input);
      29             :   }
      30             :   // Remove dead->live edges.
      31   322967085 :   for (Node* const live : live_) {
      32             :     DCHECK(IsLive(live));
      33  1908197988 :     for (Edge edge : live->use_edges()) {
      34             :       Node* const user = edge.from();
      35   795006186 :       if (!IsLive(user)) {
      36    42717576 :         if (FLAG_trace_turbo_trimming) {
      37           0 :           StdoutStream{} << "DeadLink: " << *user << "(" << edge.index()
      38           0 :                          << ") -> " << *live << std::endl;
      39             :         }
      40    42717576 :         edge.UpdateTo(nullptr);
      41             :       }
      42             :     }
      43             :   }
      44     4778513 : }
      45             : 
      46             : }  // namespace compiler
      47             : }  // namespace internal
      48      122036 : }  // namespace v8

Generated by: LCOV version 1.10