LCOV - code coverage report
Current view: top level - src/compiler - graph-trimmer.cc (source / functions) Hit Total Coverage
Test: app.info Lines: 16 19 84.2 %
Date: 2017-04-26 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     4894068 : GraphTrimmer::GraphTrimmer(Zone* zone, Graph* graph)
      14     2447036 :     : graph_(graph), is_live_(graph, 2), live_(zone) {
      15     2447032 :   live_.reserve(graph->NodeCount());
      16     2447073 : }
      17             : 
      18             : 
      19     2447024 : GraphTrimmer::~GraphTrimmer() {}
      20             : 
      21             : 
      22     2447054 : void GraphTrimmer::TrimGraph() {
      23             :   // Mark end node as live.
      24     2447054 :   MarkAsLive(graph()->end());
      25             :   // Compute transitive closure of live nodes.
      26   460828587 :   for (size_t i = 0; i < live_.size(); ++i) {
      27   460829952 :     Node* const live = live_[i];
      28   764814416 :     for (Node* const input : live->inputs()) MarkAsLive(input);
      29             :   }
      30             :   // Remove dead->live edges.
      31   460832961 :   for (Node* const live : live_) {
      32             :     DCHECK(IsLive(live));
      33  1376547423 :     for (Edge edge : live->use_edges()) {
      34             :       Node* const user = edge.from();
      35   573677000 :       if (!IsLive(user)) {
      36    38067699 :         if (FLAG_trace_turbo_trimming) {
      37           0 :           OFStream os(stdout);
      38           0 :           os << "DeadLink: " << *user << "(" << edge.index() << ") -> " << *live
      39           0 :              << std::endl;
      40             :         }
      41    38067699 :         edge.UpdateTo(nullptr);
      42             :       }
      43             :     }
      44             :   }
      45     2447057 : }
      46             : 
      47             : }  // namespace compiler
      48             : }  // namespace internal
      49             : }  // namespace v8

Generated by: LCOV version 1.10