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

Side by Side Diff: src/compiler/all-nodes.cc

Issue 2216353002: [turbofan] Also inline into try blocks. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@p5-base
Patch Set: Remove failing test that depends on changing Turbofan internals. Created 4 years, 3 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/compiler/all-nodes.h ('k') | src/compiler/js-inlining.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/compiler/all-nodes.h" 5 #include "src/compiler/all-nodes.h"
6 6
7 #include "src/compiler/graph.h" 7 #include "src/compiler/graph.h"
8 8
9 namespace v8 { 9 namespace v8 {
10 namespace internal { 10 namespace internal {
11 namespace compiler { 11 namespace compiler {
12 12
13 AllNodes::AllNodes(Zone* local_zone, const Graph* graph, bool only_inputs) 13 AllNodes::AllNodes(Zone* local_zone, const Graph* graph, bool only_inputs)
14 : reachable(local_zone), 14 : reachable(local_zone),
15 is_reachable_(graph->NodeCount(), false, local_zone), 15 is_reachable_(graph->NodeCount(), false, local_zone),
16 only_inputs_(only_inputs) { 16 only_inputs_(only_inputs) {
17 Node* end = graph->end(); 17 Mark(local_zone, graph->end(), graph);
18 }
19
20 AllNodes::AllNodes(Zone* local_zone, Node* end, const Graph* graph,
21 bool only_inputs)
22 : reachable(local_zone),
23 is_reachable_(graph->NodeCount(), false, local_zone),
24 only_inputs_(only_inputs) {
25 Mark(local_zone, end, graph);
26 }
27
28 void AllNodes::Mark(Zone* local_zone, Node* end, const Graph* graph) {
29 DCHECK_LT(end->id(), graph->NodeCount());
18 is_reachable_[end->id()] = true; 30 is_reachable_[end->id()] = true;
19 reachable.push_back(end); 31 reachable.push_back(end);
20 // Find all nodes reachable from end. 32 // Find all nodes reachable from {end}.
21 for (size_t i = 0; i < reachable.size(); i++) { 33 for (size_t i = 0; i < reachable.size(); i++) {
22 for (Node* input : reachable[i]->inputs()) { 34 for (Node* const input : reachable[i]->inputs()) {
23 if (input == nullptr || input->id() >= graph->NodeCount()) { 35 if (input == nullptr) {
36 // TODO(titzer): print a warning.
24 continue; 37 continue;
25 } 38 }
26 if (!is_reachable_[input->id()]) { 39 if (!is_reachable_[input->id()]) {
27 is_reachable_[input->id()] = true; 40 is_reachable_[input->id()] = true;
28 reachable.push_back(input); 41 reachable.push_back(input);
29 } 42 }
30 } 43 }
31 if (!only_inputs) { 44 if (!only_inputs_) {
32 for (Node* use : reachable[i]->uses()) { 45 for (Node* use : reachable[i]->uses()) {
33 if (use == nullptr || use->id() >= graph->NodeCount()) { 46 if (use == nullptr || use->id() >= graph->NodeCount()) {
34 continue; 47 continue;
35 } 48 }
36 if (!is_reachable_[use->id()]) { 49 if (!is_reachable_[use->id()]) {
37 is_reachable_[use->id()] = true; 50 is_reachable_[use->id()] = true;
38 reachable.push_back(use); 51 reachable.push_back(use);
39 } 52 }
40 } 53 }
41 } 54 }
42 } 55 }
43 } 56 }
44 57
45 } // namespace compiler 58 } // namespace compiler
46 } // namespace internal 59 } // namespace internal
47 } // namespace v8 60 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/all-nodes.h ('k') | src/compiler/js-inlining.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698