| 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-reducer.h" | 5 #include "src/compiler/common-operator-reducer.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "src/compiler/common-operator.h" | 9 #include "src/compiler/common-operator.h" |
| 10 #include "src/compiler/graph.h" | 10 #include "src/compiler/graph.h" |
| 11 #include "src/compiler/machine-operator.h" | 11 #include "src/compiler/machine-operator.h" |
| 12 #include "src/compiler/node.h" | 12 #include "src/compiler/node.h" |
| 13 #include "src/compiler/node-matchers.h" | 13 #include "src/compiler/node-matchers.h" |
| 14 #include "src/compiler/node-properties.h" | 14 #include "src/compiler/node-properties.h" |
| 15 | 15 |
| 16 namespace v8 { | 16 namespace v8 { |
| 17 namespace internal { | 17 namespace internal { |
| 18 namespace compiler { | 18 namespace compiler { |
| 19 | 19 |
| 20 namespace { | 20 namespace { |
| 21 | 21 |
| 22 enum class Decision { kUnknown, kTrue, kFalse }; | |
| 23 | |
| 24 Decision DecideCondition(Node* const cond) { | 22 Decision DecideCondition(Node* const cond) { |
| 25 switch (cond->opcode()) { | 23 switch (cond->opcode()) { |
| 26 case IrOpcode::kInt32Constant: { | 24 case IrOpcode::kInt32Constant: { |
| 27 Int32Matcher mcond(cond); | 25 Int32Matcher mcond(cond); |
| 28 return mcond.Value() ? Decision::kTrue : Decision::kFalse; | 26 return mcond.Value() ? Decision::kTrue : Decision::kFalse; |
| 29 } | 27 } |
| 30 case IrOpcode::kHeapConstant: { | 28 case IrOpcode::kHeapConstant: { |
| 31 HeapObjectMatcher mcond(cond); | 29 HeapObjectMatcher mcond(cond); |
| 32 return mcond.Value()->BooleanValue() ? Decision::kTrue : Decision::kFalse; | 30 return mcond.Value()->BooleanValue() ? Decision::kTrue : Decision::kFalse; |
| 33 } | 31 } |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 node->ReplaceInput(0, a); | 403 node->ReplaceInput(0, a); |
| 406 node->ReplaceInput(1, b); | 404 node->ReplaceInput(1, b); |
| 407 node->TrimInputCount(2); | 405 node->TrimInputCount(2); |
| 408 NodeProperties::ChangeOp(node, op); | 406 NodeProperties::ChangeOp(node, op); |
| 409 return Changed(node); | 407 return Changed(node); |
| 410 } | 408 } |
| 411 | 409 |
| 412 } // namespace compiler | 410 } // namespace compiler |
| 413 } // namespace internal | 411 } // namespace internal |
| 414 } // namespace v8 | 412 } // namespace v8 |
| OLD | NEW |