LCOV - code coverage report
Current view: top level - src/crankshaft - hydrogen-mark-unreachable.cc (source / functions) Hit Total Coverage
Test: app.info Lines: 20 20 100.0 %
Date: 2017-04-26 Functions: 2 2 100.0 %

          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/crankshaft/hydrogen-mark-unreachable.h"
       6             : #include "src/objects-inl.h"
       7             : 
       8             : namespace v8 {
       9             : namespace internal {
      10             : 
      11             : 
      12      566391 : void HMarkUnreachableBlocksPhase::MarkUnreachableBlocks() {
      13             :   // If there is unreachable code in the graph, propagate the unreachable marks
      14             :   // using a fixed-point iteration.
      15             :   bool changed = true;
      16      566391 :   const ZoneList<HBasicBlock*>* blocks = graph()->blocks();
      17     1723287 :   while (changed) {
      18             :     changed = false;
      19    26351976 :     for (int i = 0; i < blocks->length(); i++) {
      20    26351975 :       HBasicBlock* block = blocks->at(i);
      21    12880735 :       if (!block->IsReachable()) continue;
      22     9880650 :       bool is_reachable = blocks->at(0) == block;
      23    11142477 :       for (HPredecessorIterator it(block); !it.Done(); it.Advance()) {
      24     8334674 :         HBasicBlock* predecessor = it.Current();
      25             :         // A block is reachable if one of its predecessors is reachable,
      26             :         // doesn't deoptimize and either is known to transfer control to the
      27             :         // block or has a control flow instruction for which the next block
      28             :         // cannot be determined.
      29    17867584 :         if (predecessor->IsReachable() && !predecessor->IsDeoptimizing()) {
      30             :           HBasicBlock* pred_succ;
      31             :           bool known_pred_succ =
      32     8334674 :               predecessor->end()->KnownSuccessorBlock(&pred_succ);
      33     8334665 :           if (!known_pred_succ || pred_succ == block) {
      34             :             is_reachable = true;
      35     8226264 :             break;
      36             :           }
      37             :         }
      38     1261827 :         if (block->is_osr_entry()) {
      39             :           is_reachable = true;
      40             :         }
      41             :       }
      42     9880776 :       if (!is_reachable) {
      43     1057592 :         block->MarkUnreachable();
      44             :         changed = true;
      45             :       }
      46             :     }
      47             :   }
      48      566392 : }
      49             : 
      50             : 
      51      566391 : void HMarkUnreachableBlocksPhase::Run() {
      52      566391 :   MarkUnreachableBlocks();
      53      566392 : }
      54             : 
      55             : }  // namespace internal
      56             : }  // namespace v8

Generated by: LCOV version 1.10