OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/common-operator.h" | 5 #include "src/compiler/common-operator.h" |
6 #include "src/compiler/graph.h" | 6 #include "src/compiler/graph.h" |
7 #include "src/compiler/node-properties.h" | 7 #include "src/compiler/node-properties.h" |
8 #include "src/compiler/operator-properties.h" | 8 #include "src/compiler/operator-properties.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 // static | 113 // static |
114 bool NodeProperties::IsControlEdge(Edge edge) { | 114 bool NodeProperties::IsControlEdge(Edge edge) { |
115 Node* const node = edge.from(); | 115 Node* const node = edge.from(); |
116 return IsInputRange(edge, FirstControlIndex(node), | 116 return IsInputRange(edge, FirstControlIndex(node), |
117 node->op()->ControlInputCount()); | 117 node->op()->ControlInputCount()); |
118 } | 118 } |
119 | 119 |
120 | 120 |
121 // static | 121 // static |
122 bool NodeProperties::IsExceptionalCall(Node* node) { | 122 bool NodeProperties::IsExceptionalCall(Node* node) { |
123 for (Node* const use : node->uses()) { | 123 for (Edge const edge : node->use_edges()) { |
124 if (use->opcode() == IrOpcode::kIfException) return true; | 124 if (!NodeProperties::IsControlEdge(edge)) continue; |
| 125 if (edge.from()->opcode() == IrOpcode::kIfException) return true; |
125 } | 126 } |
126 return false; | 127 return false; |
127 } | 128 } |
128 | 129 |
129 | 130 |
130 // static | 131 // static |
131 void NodeProperties::ReplaceContextInput(Node* node, Node* context) { | 132 void NodeProperties::ReplaceContextInput(Node* node, Node* context) { |
132 node->ReplaceInput(FirstContextIndex(node), context); | 133 node->ReplaceInput(FirstContextIndex(node), context); |
133 } | 134 } |
134 | 135 |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 switch (use->opcode()) { | 222 switch (use->opcode()) { |
222 case IrOpcode::kIfTrue: | 223 case IrOpcode::kIfTrue: |
223 DCHECK_EQ(IrOpcode::kBranch, node->opcode()); | 224 DCHECK_EQ(IrOpcode::kBranch, node->opcode()); |
224 index = 0; | 225 index = 0; |
225 break; | 226 break; |
226 case IrOpcode::kIfFalse: | 227 case IrOpcode::kIfFalse: |
227 DCHECK_EQ(IrOpcode::kBranch, node->opcode()); | 228 DCHECK_EQ(IrOpcode::kBranch, node->opcode()); |
228 index = 1; | 229 index = 1; |
229 break; | 230 break; |
230 case IrOpcode::kIfSuccess: | 231 case IrOpcode::kIfSuccess: |
231 DCHECK_EQ(IrOpcode::kCall, node->opcode()); | 232 DCHECK(!node->op()->HasProperty(Operator::kNoThrow)); |
232 index = 0; | 233 index = 0; |
233 break; | 234 break; |
234 case IrOpcode::kIfException: | 235 case IrOpcode::kIfException: |
235 DCHECK_EQ(IrOpcode::kCall, node->opcode()); | 236 DCHECK(!node->op()->HasProperty(Operator::kNoThrow)); |
236 index = 1; | 237 index = 1; |
237 break; | 238 break; |
238 case IrOpcode::kIfValue: | 239 case IrOpcode::kIfValue: |
239 DCHECK_EQ(IrOpcode::kSwitch, node->opcode()); | 240 DCHECK_EQ(IrOpcode::kSwitch, node->opcode()); |
240 index = if_value_index++; | 241 index = if_value_index++; |
241 break; | 242 break; |
242 case IrOpcode::kIfDefault: | 243 case IrOpcode::kIfDefault: |
243 DCHECK_EQ(IrOpcode::kSwitch, node->opcode()); | 244 DCHECK_EQ(IrOpcode::kSwitch, node->opcode()); |
244 index = projection_count - 1; | 245 index = projection_count - 1; |
245 break; | 246 break; |
(...skipping 26 matching lines...) Expand all Loading... |
272 // static | 273 // static |
273 bool NodeProperties::IsInputRange(Edge edge, int first, int num) { | 274 bool NodeProperties::IsInputRange(Edge edge, int first, int num) { |
274 if (num == 0) return false; | 275 if (num == 0) return false; |
275 int const index = edge.index(); | 276 int const index = edge.index(); |
276 return first <= index && index < first + num; | 277 return first <= index && index < first + num; |
277 } | 278 } |
278 | 279 |
279 } // namespace compiler | 280 } // namespace compiler |
280 } // namespace internal | 281 } // namespace internal |
281 } // namespace v8 | 282 } // namespace v8 |
OLD | NEW |