| OLD | NEW |
| 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/common-operator.h" | 5 #include "src/compiler/common-operator.h" |
| 6 #include "src/compiler/control-reducer.h" | 6 #include "src/compiler/control-reducer.h" |
| 7 #include "src/compiler/graph.h" | 7 #include "src/compiler/graph.h" |
| 8 #include "src/compiler/graph-reducer.h" | 8 #include "src/compiler/graph-reducer.h" |
| 9 #include "src/compiler/js-graph.h" | 9 #include "src/compiler/js-graph.h" |
| 10 #include "src/compiler/node-marker.h" | 10 #include "src/compiler/node-marker.h" |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 Decision decision = DecideCondition(cond->InputAt(i), false); | 205 Decision decision = DecideCondition(cond->InputAt(i), false); |
| 206 if (decision == kUnknown) return kUnknown; | 206 if (decision == kUnknown) return kUnknown; |
| 207 if (result == kUnknown) result = decision; | 207 if (result == kUnknown) result = decision; |
| 208 if (result != decision) return kUnknown; | 208 if (result != decision) return kUnknown; |
| 209 } | 209 } |
| 210 return result; | 210 return result; |
| 211 } | 211 } |
| 212 default: | 212 default: |
| 213 break; | 213 break; |
| 214 } | 214 } |
| 215 if (NodeProperties::IsTyped(cond)) { | |
| 216 // If the node has a range type, check whether the range excludes 0. | |
| 217 Type* type = NodeProperties::GetBounds(cond).upper; | |
| 218 if (type->IsRange() && (type->Min() > 0 || type->Max() < 0)) return kTrue; | |
| 219 } | |
| 220 return kUnknown; | 215 return kUnknown; |
| 221 } | 216 } |
| 222 | 217 |
| 223 // Reduce redundant selects. | 218 // Reduce redundant selects. |
| 224 Node* ReduceSelect(Node* const node) { | 219 Node* ReduceSelect(Node* const node) { |
| 225 Node* const tvalue = node->InputAt(1); | 220 Node* const tvalue = node->InputAt(1); |
| 226 Node* const fvalue = node->InputAt(2); | 221 Node* const fvalue = node->InputAt(2); |
| 227 if (tvalue == fvalue) return tvalue; | 222 if (tvalue == fvalue) return tvalue; |
| 228 Decision result = DecideCondition(node->InputAt(0)); | 223 Decision result = DecideCondition(node->InputAt(0)); |
| 229 if (result == kTrue) return tvalue; | 224 if (result == kTrue) return tvalue; |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 case IrOpcode::kIfFalse: | 478 case IrOpcode::kIfFalse: |
| 484 return impl.ReduceIfProjection(node, kFalse); | 479 return impl.ReduceIfProjection(node, kFalse); |
| 485 default: | 480 default: |
| 486 return node; | 481 return node; |
| 487 } | 482 } |
| 488 } | 483 } |
| 489 | 484 |
| 490 } // namespace compiler | 485 } // namespace compiler |
| 491 } // namespace internal | 486 } // namespace internal |
| 492 } // namespace v8 | 487 } // namespace v8 |
| OLD | NEW |