LCOV - code coverage report
Current view: top level - src/crankshaft - hydrogen-infer-types.cc (source / functions) Hit Total Coverage
Test: app.info Lines: 23 23 100.0 %
Date: 2017-04-26 Functions: 1 1 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-infer-types.h"
       6             : #include "src/objects-inl.h"
       7             : 
       8             : namespace v8 {
       9             : namespace internal {
      10             : 
      11      342939 : void HInferTypesPhase::InferTypes(int from_inclusive, int to_inclusive) {
      12     4836498 :   for (int i = from_inclusive; i <= to_inclusive; ++i) {
      13     8987116 :     HBasicBlock* block = graph()->blocks()->at(i);
      14             : 
      15             :     const ZoneList<HPhi*>* phis = block->phis();
      16     9618378 :     for (int j = 0; j < phis->length(); j++) {
      17     5124819 :       phis->at(j)->UpdateInferredType();
      18             :     }
      19             : 
      20    33452850 :     for (HInstructionIterator it(block); !it.Done(); it.Advance()) {
      21    28959291 :       it.Current()->UpdateInferredType();
      22             :     }
      23             : 
      24     4493559 :     if (block->IsLoopHeader()) {
      25      119486 :       HBasicBlock* last_back_edge =
      26       59743 :           block->loop_information()->GetLastBackEdge();
      27       59743 :       InferTypes(i + 1, last_back_edge->block_id());
      28             :       // Skip all blocks already processed by the recursive call.
      29             :       i = last_back_edge->block_id();
      30             :       // Update phis of the loop header now after the whole loop body is
      31             :       // guaranteed to be processed.
      32      165723 :       for (int j = 0; j < block->phis()->length(); ++j) {
      33      105980 :         HPhi* phi = block->phis()->at(j);
      34      105980 :         worklist_.Add(phi, zone());
      35      239041 :         in_worklist_.Add(phi->id());
      36             :       }
      37      178374 :       while (!worklist_.is_empty()) {
      38      418037 :         HValue* current = worklist_.RemoveLast();
      39             :         in_worklist_.Remove(current->id());
      40      118631 :         if (current->UpdateInferredType()) {
      41       14430 :           for (HUseIterator it(current->uses()); !it.Done(); it.Advance()) {
      42       14430 :             HValue* use = it.value();
      43       28860 :             if (!in_worklist_.Contains(use->id())) {
      44             :               in_worklist_.Add(use->id());
      45       12651 :               worklist_.Add(use, zone());
      46             :             }
      47             :           }
      48             :         }
      49             :       }
      50             :       DCHECK(in_worklist_.IsEmpty());
      51             :     }
      52             :   }
      53      342940 : }
      54             : 
      55             : }  // namespace internal
      56             : }  // namespace v8

Generated by: LCOV version 1.10