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

Side by Side Diff: src/compiler/select-lowering.cc

Issue 1366753003: [turbofan] Make Node::set_op safer via wrapper. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressed comments. 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/compiler/osr.cc ('k') | src/compiler/simplified-lowering.cc » ('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/select-lowering.h" 5 #include "src/compiler/select-lowering.h"
6 6
7 #include "src/compiler/common-operator.h" 7 #include "src/compiler/common-operator.h"
8 #include "src/compiler/diamond.h" 8 #include "src/compiler/diamond.h"
9 #include "src/compiler/graph.h" 9 #include "src/compiler/graph.h"
10 #include "src/compiler/node.h" 10 #include "src/compiler/node.h"
11 #include "src/compiler/node-properties.h"
11 12
12 namespace v8 { 13 namespace v8 {
13 namespace internal { 14 namespace internal {
14 namespace compiler { 15 namespace compiler {
15 16
16 SelectLowering::SelectLowering(Graph* graph, CommonOperatorBuilder* common) 17 SelectLowering::SelectLowering(Graph* graph, CommonOperatorBuilder* common)
17 : common_(common), 18 : common_(common),
18 graph_(graph), 19 graph_(graph),
19 merges_(Merges::key_compare(), Merges::allocator_type(graph->zone())) {} 20 merges_(Merges::key_compare(), Merges::allocator_type(graph->zone())) {}
20 21
(...skipping 23 matching lines...) Expand all
44 45
45 // If the diamond is reachable from the Select, merging them would result in 46 // If the diamond is reachable from the Select, merging them would result in
46 // an unschedulable graph, so we cannot reuse the diamond in that case. 47 // an unschedulable graph, so we cannot reuse the diamond in that case.
47 merge = i->second; 48 merge = i->second;
48 if (!ReachableFrom(merge, node)) { 49 if (!ReachableFrom(merge, node)) {
49 break; 50 break;
50 } 51 }
51 } 52 }
52 53
53 // Create a Phi hanging off the previously determined merge. 54 // Create a Phi hanging off the previously determined merge.
54 node->set_op(common()->Phi(p.type(), 2)); 55 NodeProperties::ChangeOp(node, common()->Phi(p.type(), 2));
55 node->ReplaceInput(0, vthen); 56 node->ReplaceInput(0, vthen);
56 node->ReplaceInput(1, velse); 57 node->ReplaceInput(1, velse);
57 node->ReplaceInput(2, merge); 58 node->ReplaceInput(2, merge);
58 return Changed(node); 59 return Changed(node);
59 } 60 }
60 61
61 62
62 bool SelectLowering::ReachableFrom(Node* const sink, Node* const source) { 63 bool SelectLowering::ReachableFrom(Node* const sink, Node* const source) {
63 // TODO(turbofan): This is probably horribly expensive, and it should be moved 64 // TODO(turbofan): This is probably horribly expensive, and it should be moved
64 // into node.h or somewhere else?! 65 // into node.h or somewhere else?!
(...skipping 12 matching lines...) Expand all
77 visited[input->id()] = true; 78 visited[input->id()] = true;
78 } 79 }
79 } 80 }
80 } 81 }
81 return false; 82 return false;
82 } 83 }
83 84
84 } // namespace compiler 85 } // namespace compiler
85 } // namespace internal 86 } // namespace internal
86 } // namespace v8 87 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/osr.cc ('k') | src/compiler/simplified-lowering.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698