Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(295)

Side by Side Diff: src/hydrogen-mark-unreachable.cc

Issue 1405363003: Move Hydrogen and Lithium to src/crankshaft/ (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebased Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/hydrogen-mark-unreachable.h ('k') | src/hydrogen-osr.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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/hydrogen-mark-unreachable.h"
6
7 namespace v8 {
8 namespace internal {
9
10
11 void HMarkUnreachableBlocksPhase::MarkUnreachableBlocks() {
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 }
48
49
50 void HMarkUnreachableBlocksPhase::Run() {
51 MarkUnreachableBlocks();
52 }
53
54 } // namespace internal
55 } // namespace v8
OLDNEW
« no previous file with comments | « src/hydrogen-mark-unreachable.h ('k') | src/hydrogen-osr.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698