| 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 #include "src/compiler/schedule.h" |    8 #include "src/compiler/schedule.h" | 
|    9  |    9  | 
|   10 namespace v8 { |   10 namespace v8 { | 
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   98                 << "]"; |   98                 << "]"; | 
|   99     case InstructionOperand::IMMEDIATE: { |   99     case InstructionOperand::IMMEDIATE: { | 
|  100       auto imm = ImmediateOperand::cast(op); |  100       auto imm = ImmediateOperand::cast(op); | 
|  101       switch (imm.type()) { |  101       switch (imm.type()) { | 
|  102         case ImmediateOperand::INLINE: |  102         case ImmediateOperand::INLINE: | 
|  103           return os << "#" << imm.inline_value(); |  103           return os << "#" << imm.inline_value(); | 
|  104         case ImmediateOperand::INDEXED: |  104         case ImmediateOperand::INDEXED: | 
|  105           return os << "[immediate:" << imm.indexed_value() << "]"; |  105           return os << "[immediate:" << imm.indexed_value() << "]"; | 
|  106       } |  106       } | 
|  107     } |  107     } | 
 |  108     case InstructionOperand::EXPLICIT: | 
|  108     case InstructionOperand::ALLOCATED: { |  109     case InstructionOperand::ALLOCATED: { | 
|  109       auto allocated = AllocatedOperand::cast(op); |  110       auto allocated = LocationOperand::cast(op); | 
|  110       switch (allocated.allocated_kind()) { |  111       if (op.IsStackSlot()) { | 
|  111         case AllocatedOperand::STACK_SLOT: |  112         os << "[stack:" << LocationOperand::cast(op).index(); | 
|  112           os << "[stack:" << StackSlotOperand::cast(op).index(); |  113       } else if (op.IsDoubleStackSlot()) { | 
|  113           break; |  114         os << "[double_stack:" << LocationOperand::cast(op).index(); | 
|  114         case AllocatedOperand::DOUBLE_STACK_SLOT: |  115       } else if (op.IsRegister()) { | 
|  115           os << "[double_stack:" << DoubleStackSlotOperand::cast(op).index(); |  116         os << "[" << LocationOperand::cast(op).GetRegister().ToString() << "|R"; | 
|  116           break; |  117       } else { | 
|  117         case AllocatedOperand::REGISTER: |  118         DCHECK(op.IsDoubleRegister()); | 
|  118           os << "[" << RegisterOperand::cast(op).GetRegister().ToString() |  119         os << "[" << LocationOperand::cast(op).GetDoubleRegister().ToString() | 
|  119              << "|R"; |  120            << "|R"; | 
|  120           break; |  121       } | 
|  121         case AllocatedOperand::DOUBLE_REGISTER: |  122       if (allocated.IsExplicit()) { | 
|  122           os << "[" |  123         os << "|E"; | 
|  123              << DoubleRegisterOperand::cast(op).GetDoubleRegister().ToString() |  | 
|  124              << "|R"; |  | 
|  125           break; |  | 
|  126       } |  124       } | 
|  127       switch (allocated.machine_type()) { |  125       switch (allocated.machine_type()) { | 
|  128         case kRepWord32: |  126         case kRepWord32: | 
|  129           os << "|w32"; |  127           os << "|w32"; | 
|  130           break; |  128           break; | 
|  131         case kRepWord64: |  129         case kRepWord64: | 
|  132           os << "|w64"; |  130           os << "|w64"; | 
|  133           break; |  131           break; | 
|  134         case kRepFloat32: |  132         case kRepFloat32: | 
|  135           os << "|f32"; |  133           os << "|f32"; | 
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  174   } |  172   } | 
|  175   return true; |  173   return true; | 
|  176 } |  174 } | 
|  177  |  175  | 
|  178  |  176  | 
|  179 MoveOperands* ParallelMove::PrepareInsertAfter(MoveOperands* move) const { |  177 MoveOperands* ParallelMove::PrepareInsertAfter(MoveOperands* move) const { | 
|  180   MoveOperands* replacement = nullptr; |  178   MoveOperands* replacement = nullptr; | 
|  181   MoveOperands* to_eliminate = nullptr; |  179   MoveOperands* to_eliminate = nullptr; | 
|  182   for (auto curr : *this) { |  180   for (auto curr : *this) { | 
|  183     if (curr->IsEliminated()) continue; |  181     if (curr->IsEliminated()) continue; | 
|  184     if (curr->destination().EqualsModuloType(move->source())) { |  182     if (curr->destination().EqualsCanonicalized(move->source())) { | 
|  185       DCHECK(!replacement); |  183       DCHECK(!replacement); | 
|  186       replacement = curr; |  184       replacement = curr; | 
|  187       if (to_eliminate != nullptr) break; |  185       if (to_eliminate != nullptr) break; | 
|  188     } else if (curr->destination().EqualsModuloType(move->destination())) { |  186     } else if (curr->destination().EqualsCanonicalized(move->destination())) { | 
|  189       DCHECK(!to_eliminate); |  187       DCHECK(!to_eliminate); | 
|  190       to_eliminate = curr; |  188       to_eliminate = curr; | 
|  191       if (replacement != nullptr) break; |  189       if (replacement != nullptr) break; | 
|  192     } |  190     } | 
|  193   } |  191   } | 
|  194   DCHECK_IMPLIES(replacement == to_eliminate, replacement == nullptr); |  192   DCHECK_IMPLIES(replacement == to_eliminate, replacement == nullptr); | 
|  195   if (replacement != nullptr) move->set_source(replacement->source()); |  193   if (replacement != nullptr) move->set_source(replacement->source()); | 
|  196   return to_eliminate; |  194   return to_eliminate; | 
|  197 } |  195 } | 
|  198  |  196  | 
|  199  |  197  | 
 |  198 ExplicitOperand::ExplicitOperand(LocationKind kind, MachineType machine_type, | 
 |  199                                  int index) | 
 |  200     : LocationOperand(EXPLICIT, kind, machine_type, index) { | 
 |  201   DCHECK_IMPLIES(kind == REGISTER && !IsFloatingPoint(machine_type), | 
 |  202                  Register::from_code(index).IsAllocatable()); | 
 |  203   DCHECK_IMPLIES(kind == REGISTER && IsFloatingPoint(machine_type), | 
 |  204                  DoubleRegister::from_code(index).IsAllocatable()); | 
 |  205 } | 
 |  206  | 
 |  207  | 
|  200 Instruction::Instruction(InstructionCode opcode) |  208 Instruction::Instruction(InstructionCode opcode) | 
|  201     : opcode_(opcode), |  209     : opcode_(opcode), | 
|  202       bit_field_(OutputCountField::encode(0) | InputCountField::encode(0) | |  210       bit_field_(OutputCountField::encode(0) | InputCountField::encode(0) | | 
|  203                  TempCountField::encode(0) | IsCallField::encode(false)), |  211                  TempCountField::encode(0) | IsCallField::encode(false)), | 
|  204       reference_map_(NULL) { |  212       reference_map_(NULL) { | 
|  205   parallel_moves_[0] = nullptr; |  213   parallel_moves_[0] = nullptr; | 
|  206   parallel_moves_[1] = nullptr; |  214   parallel_moves_[1] = nullptr; | 
|  207 } |  215 } | 
|  208  |  216  | 
|  209  |  217  | 
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  256     first = false; |  264     first = false; | 
|  257     PrintableMoveOperands pmo = {printable.register_configuration_, move}; |  265     PrintableMoveOperands pmo = {printable.register_configuration_, move}; | 
|  258     os << pmo; |  266     os << pmo; | 
|  259   } |  267   } | 
|  260   return os; |  268   return os; | 
|  261 } |  269 } | 
|  262  |  270  | 
|  263  |  271  | 
|  264 void ReferenceMap::RecordReference(const AllocatedOperand& op) { |  272 void ReferenceMap::RecordReference(const AllocatedOperand& op) { | 
|  265   // Do not record arguments as pointers. |  273   // Do not record arguments as pointers. | 
|  266   if (op.IsStackSlot() && StackSlotOperand::cast(op).index() < 0) return; |  274   if (op.IsStackSlot() && LocationOperand::cast(op).index() < 0) return; | 
|  267   DCHECK(!op.IsDoubleRegister() && !op.IsDoubleStackSlot()); |  275   DCHECK(!op.IsDoubleRegister() && !op.IsDoubleStackSlot()); | 
|  268   reference_operands_.push_back(op); |  276   reference_operands_.push_back(op); | 
|  269 } |  277 } | 
|  270  |  278  | 
|  271  |  279  | 
|  272 std::ostream& operator<<(std::ostream& os, const ReferenceMap& pm) { |  280 std::ostream& operator<<(std::ostream& os, const ReferenceMap& pm) { | 
|  273   os << "{"; |  281   os << "{"; | 
|  274   bool first = true; |  282   bool first = true; | 
|  275   PrintableInstructionOperand poi = { |  283   PrintableInstructionOperand poi = { | 
|  276       RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN), |  284       RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN), | 
| (...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  877       os << " B" << succ.ToInt(); |  885       os << " B" << succ.ToInt(); | 
|  878     } |  886     } | 
|  879     os << "\n"; |  887     os << "\n"; | 
|  880   } |  888   } | 
|  881   return os; |  889   return os; | 
|  882 } |  890 } | 
|  883  |  891  | 
|  884 }  // namespace compiler |  892 }  // namespace compiler | 
|  885 }  // namespace internal |  893 }  // namespace internal | 
|  886 }  // namespace v8 |  894 }  // namespace v8 | 
| OLD | NEW |