| 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/dead-code-elimination.h" | 5 #include "src/compiler/dead-code-elimination.h" |
| 6 | 6 |
| 7 #include "src/compiler/common-operator.h" | 7 #include "src/compiler/common-operator.h" |
| 8 #include "src/compiler/graph.h" | 8 #include "src/compiler/graph.h" |
| 9 #include "src/compiler/node-properties.h" | 9 #include "src/compiler/node-properties.h" |
| 10 #include "src/compiler/operator-properties.h" | 10 #include "src/compiler/operator-properties.h" |
| 11 | 11 |
| 12 namespace v8 { | 12 namespace v8 { |
| 13 namespace internal { | 13 namespace internal { |
| 14 namespace compiler { | 14 namespace compiler { |
| 15 | 15 |
| 16 DeadCodeElimination::DeadCodeElimination(Editor* editor, Graph* graph, | 16 DeadCodeElimination::DeadCodeElimination(Editor* editor, Graph* graph, |
| 17 CommonOperatorBuilder* common) | 17 CommonOperatorBuilder* common) |
| 18 : AdvancedReducer(editor), | 18 : AdvancedReducer(editor), |
| 19 graph_(graph), | 19 graph_(graph), |
| 20 common_(common), | 20 common_(common), |
| 21 dead_(graph->NewNode(common->Dead())) {} | 21 dead_(graph->NewNode(common->Dead())) { |
| 22 | 22 NodeProperties::SetType(dead_, Type::None()); |
| 23 } |
| 23 | 24 |
| 24 Reduction DeadCodeElimination::Reduce(Node* node) { | 25 Reduction DeadCodeElimination::Reduce(Node* node) { |
| 25 switch (node->opcode()) { | 26 switch (node->opcode()) { |
| 26 case IrOpcode::kEnd: | 27 case IrOpcode::kEnd: |
| 27 return ReduceEnd(node); | 28 return ReduceEnd(node); |
| 28 case IrOpcode::kLoop: | 29 case IrOpcode::kLoop: |
| 29 case IrOpcode::kMerge: | 30 case IrOpcode::kMerge: |
| 30 return ReduceLoopOrMerge(node); | 31 return ReduceLoopOrMerge(node); |
| 31 case IrOpcode::kLoopExit: | 32 case IrOpcode::kLoopExit: |
| 32 return ReduceLoopExit(node); | 33 return ReduceLoopExit(node); |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 | 163 |
| 163 void DeadCodeElimination::TrimMergeOrPhi(Node* node, int size) { | 164 void DeadCodeElimination::TrimMergeOrPhi(Node* node, int size) { |
| 164 const Operator* const op = common()->ResizeMergeOrPhi(node->op(), size); | 165 const Operator* const op = common()->ResizeMergeOrPhi(node->op(), size); |
| 165 node->TrimInputCount(OperatorProperties::GetTotalInputCount(op)); | 166 node->TrimInputCount(OperatorProperties::GetTotalInputCount(op)); |
| 166 NodeProperties::ChangeOp(node, op); | 167 NodeProperties::ChangeOp(node, op); |
| 167 } | 168 } |
| 168 | 169 |
| 169 } // namespace compiler | 170 } // namespace compiler |
| 170 } // namespace internal | 171 } // namespace internal |
| 171 } // namespace v8 | 172 } // namespace v8 |
| OLD | NEW |