V8 Project
v8::internal::HMarkUnreachableBlocksPhase Class Reference

#include <hydrogen-mark-unreachable.h>

+ Inheritance diagram for v8::internal::HMarkUnreachableBlocksPhase:
+ Collaboration diagram for v8::internal::HMarkUnreachableBlocksPhase:

Public Member Functions

 HMarkUnreachableBlocksPhase (HGraph *graph)
 
void Run ()
 
- Public Member Functions inherited from v8::internal::HPhase
 HPhase (const char *name, HGraph *graph)
 
 ~HPhase ()
 

Private Member Functions

void MarkUnreachableBlocks ()
 
 DISALLOW_COPY_AND_ASSIGN (HMarkUnreachableBlocksPhase)
 

Additional Inherited Members

- Protected Member Functions inherited from v8::internal::HPhase
HGraph * graph () const
 

Detailed Description

Definition at line 14 of file hydrogen-mark-unreachable.h.

Constructor & Destructor Documentation

◆ HMarkUnreachableBlocksPhase()

v8::internal::HMarkUnreachableBlocksPhase::HMarkUnreachableBlocksPhase ( HGraph *  graph)
inlineexplicit

Definition at line 16 of file hydrogen-mark-unreachable.h.

17  : HPhase("H_Mark unreachable blocks", graph) { }
HGraph * graph() const
Definition: hydrogen.h:2802
HPhase(const char *name, HGraph *graph)
Definition: hydrogen.h:2796

Member Function Documentation

◆ DISALLOW_COPY_AND_ASSIGN()

v8::internal::HMarkUnreachableBlocksPhase::DISALLOW_COPY_AND_ASSIGN ( HMarkUnreachableBlocksPhase  )
private

◆ MarkUnreachableBlocks()

void v8::internal::HMarkUnreachableBlocksPhase::MarkUnreachableBlocks ( )
private

Definition at line 11 of file hydrogen-mark-unreachable.cc.

11  {
12  // If there is unreachable code in the graph, propagate the unreachable marks
13  // using a fixed-point iteration.
14  bool changed = true;
15  const ZoneList<HBasicBlock*>* blocks = graph()->blocks();
16  while (changed) {
17  changed = false;
18  for (int i = 0; i < blocks->length(); i++) {
19  HBasicBlock* block = blocks->at(i);
20  if (!block->IsReachable()) continue;
21  bool is_reachable = blocks->at(0) == block;
22  for (HPredecessorIterator it(block); !it.Done(); it.Advance()) {
23  HBasicBlock* predecessor = it.Current();
24  // A block is reachable if one of its predecessors is reachable,
25  // doesn't deoptimize and either is known to transfer control to the
26  // block or has a control flow instruction for which the next block
27  // cannot be determined.
28  if (predecessor->IsReachable() && !predecessor->IsDeoptimizing()) {
29  HBasicBlock* pred_succ;
30  bool known_pred_succ =
31  predecessor->end()->KnownSuccessorBlock(&pred_succ);
32  if (!known_pred_succ || pred_succ == block) {
33  is_reachable = true;
34  break;
35  }
36  }
37  if (block->is_osr_entry()) {
38  is_reachable = true;
39  }
40  }
41  if (!is_reachable) {
42  block->MarkUnreachable();
43  changed = true;
44  }
45  }
46  }
47 }

References v8::internal::List< T, AllocationPolicy >::at(), and v8::internal::HPhase::graph().

Referenced by Run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Run()

void v8::internal::HMarkUnreachableBlocksPhase::Run ( )

Definition at line 50 of file hydrogen-mark-unreachable.cc.

References MarkUnreachableBlocks().

+ Here is the call graph for this function:

The documentation for this class was generated from the following files: