| 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/move-optimizer.h" | 5 #include "src/compiler/move-optimizer.h" |
| 6 | 6 |
| 7 namespace v8 { | 7 namespace v8 { |
| 8 namespace internal { | 8 namespace internal { |
| 9 namespace compiler { | 9 namespace compiler { |
| 10 | 10 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 return a.destination.CompareCanonicalized(b.destination); | 21 return a.destination.CompareCanonicalized(b.destination); |
| 22 } | 22 } |
| 23 return a.source.CompareCanonicalized(b.source); | 23 return a.source.CompareCanonicalized(b.source); |
| 24 } | 24 } |
| 25 }; | 25 }; |
| 26 | 26 |
| 27 typedef ZoneMap<MoveKey, unsigned, MoveKeyCompare> MoveMap; | 27 typedef ZoneMap<MoveKey, unsigned, MoveKeyCompare> MoveMap; |
| 28 typedef ZoneSet<InstructionOperand, CompareOperandModuloType> OperandSet; | 28 typedef ZoneSet<InstructionOperand, CompareOperandModuloType> OperandSet; |
| 29 | 29 |
| 30 bool Blocks(const OperandSet& set, const InstructionOperand& operand) { | 30 bool Blocks(const OperandSet& set, const InstructionOperand& operand) { |
| 31 if (!operand.IsFPRegister()) return set.find(operand) != set.end(); | 31 return set.find(operand) != set.end(); |
| 32 | |
| 33 const LocationOperand& loc = LocationOperand::cast(operand); | |
| 34 if (loc.representation() == MachineRepresentation::kFloat64) { | |
| 35 return set.find(operand) != set.end() || | |
| 36 set.find(LocationOperand(loc.kind(), loc.location_kind(), | |
| 37 MachineRepresentation::kFloat32, | |
| 38 loc.register_code())) != set.end(); | |
| 39 } | |
| 40 DCHECK_EQ(MachineRepresentation::kFloat32, loc.representation()); | |
| 41 return set.find(operand) != set.end() || | |
| 42 set.find(LocationOperand(loc.kind(), loc.location_kind(), | |
| 43 MachineRepresentation::kFloat64, | |
| 44 loc.register_code())) != set.end(); | |
| 45 } | 32 } |
| 46 | 33 |
| 47 int FindFirstNonEmptySlot(const Instruction* instr) { | 34 int FindFirstNonEmptySlot(const Instruction* instr) { |
| 48 int i = Instruction::FIRST_GAP_POSITION; | 35 int i = Instruction::FIRST_GAP_POSITION; |
| 49 for (; i <= Instruction::LAST_GAP_POSITION; i++) { | 36 for (; i <= Instruction::LAST_GAP_POSITION; i++) { |
| 50 ParallelMove* moves = instr->parallel_moves()[i]; | 37 ParallelMove* moves = instr->parallel_moves()[i]; |
| 51 if (moves == nullptr) continue; | 38 if (moves == nullptr) continue; |
| 52 for (MoveOperands* move : *moves) { | 39 for (MoveOperands* move : *moves) { |
| 53 if (!move->IsRedundant()) return i; | 40 if (!move->IsRedundant()) return i; |
| 54 move->Eliminate(); | 41 move->Eliminate(); |
| (...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 487 static_cast<Instruction::GapPosition>(1), code_zone()); | 474 static_cast<Instruction::GapPosition>(1), code_zone()); |
| 488 slot_1->AddMove(group_begin->destination(), load->destination()); | 475 slot_1->AddMove(group_begin->destination(), load->destination()); |
| 489 load->Eliminate(); | 476 load->Eliminate(); |
| 490 } | 477 } |
| 491 loads.clear(); | 478 loads.clear(); |
| 492 } | 479 } |
| 493 | 480 |
| 494 } // namespace compiler | 481 } // namespace compiler |
| 495 } // namespace internal | 482 } // namespace internal |
| 496 } // namespace v8 | 483 } // namespace v8 |
| OLD | NEW |