Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1445)

Side by Side Diff: src/compiler/register-allocator-verifier.cc

Issue 738853002: [turbofan]: delay ssa deconstruction in register allocator (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebase Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/instruction.h" 5 #include "src/compiler/instruction.h"
6 #include "src/compiler/register-allocator-verifier.h" 6 #include "src/compiler/register-allocator-verifier.h"
7 7
8 namespace v8 { 8 namespace v8 {
9 namespace internal { 9 namespace internal {
10 namespace compiler { 10 namespace compiler {
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 LocationMap::allocator_type(zone)) {} 237 LocationMap::allocator_type(zone)) {}
238 238
239 LocationMap* locations() { return &locations_; } 239 LocationMap* locations() { return &locations_; }
240 240
241 void RunPhis(const InstructionSequence* sequence, 241 void RunPhis(const InstructionSequence* sequence,
242 const InstructionBlock* block, size_t phi_index) { 242 const InstructionBlock* block, size_t phi_index) {
243 // This operation is only valid in edge split form. 243 // This operation is only valid in edge split form.
244 size_t predecessor_index = block->predecessors()[phi_index].ToSize(); 244 size_t predecessor_index = block->predecessors()[phi_index].ToSize();
245 CHECK(sequence->instruction_blocks()[predecessor_index]->SuccessorCount() == 245 CHECK(sequence->instruction_blocks()[predecessor_index]->SuccessorCount() ==
246 1); 246 1);
247 const auto* gap = sequence->GetBlockStart(block->rpo_number());
248 // The first moves in the BlockStartInstruction are the phi moves inserted
249 // by ResolvePhis.
250 const ParallelMove* move = gap->GetParallelMove(GapInstruction::START);
251 CHECK_NE(nullptr, move);
252 const auto* move_ops = move->move_operands();
253 CHECK(block->phis().size() <= static_cast<size_t>(move_ops->length()));
254 auto move_it = move_ops->begin();
255 for (const auto* phi : block->phis()) { 247 for (const auto* phi : block->phis()) {
256 const auto* op = move_it->source(); 248 auto input = phi->inputs()[phi_index];
257 auto it = locations()->find(op); 249 CHECK(locations()->find(input) != locations()->end());
250 auto it = locations()->find(phi->output());
258 CHECK(it != locations()->end()); 251 CHECK(it != locations()->end());
259 CHECK_EQ(it->second, phi->operands()[phi_index]); 252 if (input->IsConstant()) {
253 CHECK_EQ(it->second, input->index());
254 } else {
255 CHECK_EQ(it->second, phi->operands()[phi_index]);
256 }
260 it->second = phi->virtual_register(); 257 it->second = phi->virtual_register();
261 ++move_it;
262 } 258 }
263 } 259 }
264 260
265 void RunGapInstruction(Zone* zone, const GapInstruction* gap) { 261 void RunGapInstruction(Zone* zone, const GapInstruction* gap) {
266 for (int i = GapInstruction::FIRST_INNER_POSITION; 262 for (int i = GapInstruction::FIRST_INNER_POSITION;
267 i <= GapInstruction::LAST_INNER_POSITION; i++) { 263 i <= GapInstruction::LAST_INNER_POSITION; i++) {
268 GapInstruction::InnerPosition inner_pos = 264 GapInstruction::InnerPosition inner_pos =
269 static_cast<GapInstruction::InnerPosition>(i); 265 static_cast<GapInstruction::InnerPosition>(i);
270 const ParallelMove* move = gap->GetParallelMove(inner_pos); 266 const ParallelMove* move = gap->GetParallelMove(inner_pos);
271 if (move == nullptr) continue; 267 if (move == nullptr) continue;
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 const auto* gap = GapInstruction::cast(instr); 453 const auto* gap = GapInstruction::cast(instr);
458 current->RunGapInstruction(zone(), gap); 454 current->RunGapInstruction(zone(), gap);
459 } 455 }
460 } 456 }
461 } 457 }
462 } 458 }
463 459
464 } // namespace compiler 460 } // namespace compiler
465 } // namespace internal 461 } // namespace internal
466 } // namespace v8 462 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/register-allocator.cc ('k') | test/unittests/compiler/register-allocator-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698