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 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 const Instruction* last_instr = | 310 const Instruction* last_instr = |
311 code()->instructions()[pred->last_instruction_index()]; | 311 code()->instructions()[pred->last_instruction_index()]; |
312 if (last_instr->IsCall()) return; | 312 if (last_instr->IsCall()) return; |
313 if (last_instr->TempCount() != 0) return; | 313 if (last_instr->TempCount() != 0) return; |
314 if (last_instr->OutputCount() != 0) return; | 314 if (last_instr->OutputCount() != 0) return; |
315 for (size_t i = 0; i < last_instr->InputCount(); ++i) { | 315 for (size_t i = 0; i < last_instr->InputCount(); ++i) { |
316 const InstructionOperand* op = last_instr->InputAt(i); | 316 const InstructionOperand* op = last_instr->InputAt(i); |
317 if (!op->IsConstant() && !op->IsImmediate()) return; | 317 if (!op->IsConstant() && !op->IsImmediate()) return; |
318 } | 318 } |
319 } | 319 } |
320 // TODO(dcarney): pass a ZonePool down for this? | 320 // TODO(dcarney): pass a ZoneStats down for this? |
321 MoveMap move_map(local_zone()); | 321 MoveMap move_map(local_zone()); |
322 size_t correct_counts = 0; | 322 size_t correct_counts = 0; |
323 // Accumulate set of shared moves. | 323 // Accumulate set of shared moves. |
324 for (RpoNumber& pred_index : block->predecessors()) { | 324 for (RpoNumber& pred_index : block->predecessors()) { |
325 const InstructionBlock* pred = code()->InstructionBlockAt(pred_index); | 325 const InstructionBlock* pred = code()->InstructionBlockAt(pred_index); |
326 const Instruction* instr = LastInstruction(pred); | 326 const Instruction* instr = LastInstruction(pred); |
327 if (instr->parallel_moves()[0] == nullptr || | 327 if (instr->parallel_moves()[0] == nullptr || |
328 instr->parallel_moves()[0]->empty()) { | 328 instr->parallel_moves()[0]->empty()) { |
329 return; | 329 return; |
330 } | 330 } |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 static_cast<Instruction::GapPosition>(1), code_zone()); | 474 static_cast<Instruction::GapPosition>(1), code_zone()); |
475 slot_1->AddMove(group_begin->destination(), load->destination()); | 475 slot_1->AddMove(group_begin->destination(), load->destination()); |
476 load->Eliminate(); | 476 load->Eliminate(); |
477 } | 477 } |
478 loads.clear(); | 478 loads.clear(); |
479 } | 479 } |
480 | 480 |
481 } // namespace compiler | 481 } // namespace compiler |
482 } // namespace internal | 482 } // namespace internal |
483 } // namespace v8 | 483 } // namespace v8 |
OLD | NEW |