| 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/graph.h" | 6 #include "src/compiler/graph.h" |
| 7 #include "src/compiler/instruction.h" | 7 #include "src/compiler/instruction.h" |
| 8 | 8 |
| 9 namespace v8 { | 9 namespace v8 { |
| 10 namespace internal { | 10 namespace internal { |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 | 74 |
| 75 | 75 |
| 76 bool ParallelMove::IsRedundant() const { | 76 bool ParallelMove::IsRedundant() const { |
| 77 for (int i = 0; i < move_operands_.length(); ++i) { | 77 for (int i = 0; i < move_operands_.length(); ++i) { |
| 78 if (!move_operands_[i].IsRedundant()) return false; | 78 if (!move_operands_[i].IsRedundant()) return false; |
| 79 } | 79 } |
| 80 return true; | 80 return true; |
| 81 } | 81 } |
| 82 | 82 |
| 83 | 83 |
| 84 MoveOperands* ParallelMove::PrepareInsertAfter(MoveOperands* move) const { |
| 85 auto move_ops = move_operands(); |
| 86 MoveOperands* replacement = nullptr; |
| 87 MoveOperands* to_eliminate = nullptr; |
| 88 for (auto curr = move_ops->begin(); curr != move_ops->end(); ++curr) { |
| 89 if (curr->IsEliminated()) continue; |
| 90 if (curr->destination()->Equals(move->source())) { |
| 91 DCHECK(!replacement); |
| 92 replacement = curr; |
| 93 if (to_eliminate != nullptr) break; |
| 94 } else if (curr->destination()->Equals(move->destination())) { |
| 95 DCHECK(!to_eliminate); |
| 96 to_eliminate = curr; |
| 97 if (replacement != nullptr) break; |
| 98 } |
| 99 } |
| 100 DCHECK_IMPLIES(replacement == to_eliminate, replacement == nullptr); |
| 101 if (replacement != nullptr) move->set_source(replacement->source()); |
| 102 return to_eliminate; |
| 103 } |
| 104 |
| 105 |
| 84 Instruction::Instruction(InstructionCode opcode) | 106 Instruction::Instruction(InstructionCode opcode) |
| 85 : opcode_(opcode), | 107 : opcode_(opcode), |
| 86 bit_field_(OutputCountField::encode(0) | InputCountField::encode(0) | | 108 bit_field_(OutputCountField::encode(0) | InputCountField::encode(0) | |
| 87 TempCountField::encode(0) | IsCallField::encode(false) | | 109 TempCountField::encode(0) | IsCallField::encode(false) | |
| 88 IsControlField::encode(false)), | 110 IsControlField::encode(false)), |
| 89 pointer_map_(NULL) {} | 111 pointer_map_(NULL) {} |
| 90 | 112 |
| 91 | 113 |
| 92 Instruction::Instruction(InstructionCode opcode, size_t output_count, | 114 Instruction::Instruction(InstructionCode opcode, size_t output_count, |
| 93 InstructionOperand* outputs, size_t input_count, | 115 InstructionOperand* outputs, size_t input_count, |
| (...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 707 os << " B" << succ_block->id(); | 729 os << " B" << succ_block->id(); |
| 708 } | 730 } |
| 709 os << "\n"; | 731 os << "\n"; |
| 710 } | 732 } |
| 711 return os; | 733 return os; |
| 712 } | 734 } |
| 713 | 735 |
| 714 } // namespace compiler | 736 } // namespace compiler |
| 715 } // namespace internal | 737 } // namespace internal |
| 716 } // namespace v8 | 738 } // namespace v8 |
| OLD | NEW |