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 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 } | 248 } |
249 if (move_map.empty() || correct_counts != move_map.size()) return; | 249 if (move_map.empty() || correct_counts != move_map.size()) return; |
250 // Find insertion point. | 250 // Find insertion point. |
251 Instruction* instr = nullptr; | 251 Instruction* instr = nullptr; |
252 for (int i = block->first_instruction_index(); | 252 for (int i = block->first_instruction_index(); |
253 i <= block->last_instruction_index(); ++i) { | 253 i <= block->last_instruction_index(); ++i) { |
254 instr = code()->instructions()[i]; | 254 instr = code()->instructions()[i]; |
255 if (!GapsCanMoveOver(instr, local_zone()) || !instr->AreMovesRedundant()) | 255 if (!GapsCanMoveOver(instr, local_zone()) || !instr->AreMovesRedundant()) |
256 break; | 256 break; |
257 } | 257 } |
258 DCHECK(instr != nullptr); | 258 DCHECK_NOT_NULL(instr); |
259 bool gap_initialized = true; | 259 bool gap_initialized = true; |
260 if (instr->parallel_moves()[0] == nullptr || | 260 if (instr->parallel_moves()[0] == nullptr || |
261 instr->parallel_moves()[0]->empty()) { | 261 instr->parallel_moves()[0]->empty()) { |
262 to_finalize_.push_back(instr); | 262 to_finalize_.push_back(instr); |
263 } else { | 263 } else { |
264 // Will compress after insertion. | 264 // Will compress after insertion. |
265 gap_initialized = false; | 265 gap_initialized = false; |
266 std::swap(instr->parallel_moves()[0], instr->parallel_moves()[1]); | 266 std::swap(instr->parallel_moves()[0], instr->parallel_moves()[1]); |
267 } | 267 } |
268 ParallelMove* moves = instr->GetOrCreateParallelMove( | 268 ParallelMove* moves = instr->GetOrCreateParallelMove( |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 static_cast<Instruction::GapPosition>(1), code_zone()); | 342 static_cast<Instruction::GapPosition>(1), code_zone()); |
343 slot_1->AddMove(group_begin->destination(), load->destination()); | 343 slot_1->AddMove(group_begin->destination(), load->destination()); |
344 load->Eliminate(); | 344 load->Eliminate(); |
345 } | 345 } |
346 loads.clear(); | 346 loads.clear(); |
347 } | 347 } |
348 | 348 |
349 } // namespace compiler | 349 } // namespace compiler |
350 } // namespace internal | 350 } // namespace internal |
351 } // namespace v8 | 351 } // namespace v8 |
OLD | NEW |