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

Side by Side Diff: src/compiler/instruction.cc

Issue 854703002: Reland "[turbofan] simplify gap ordering" (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 11 months 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
« no previous file with comments | « src/compiler/instruction.h ('k') | src/compiler/register-allocator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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 8
9 namespace v8 { 9 namespace v8 {
10 namespace internal { 10 namespace internal {
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 if (i > 0) os << ", "; 272 if (i > 0) os << ", ";
273 printable_op.op_ = instr.OutputAt(i); 273 printable_op.op_ = instr.OutputAt(i);
274 os << printable_op; 274 os << printable_op;
275 } 275 }
276 276
277 if (instr.OutputCount() > 1) os << ") = "; 277 if (instr.OutputCount() > 1) os << ") = ";
278 if (instr.OutputCount() == 1) os << " = "; 278 if (instr.OutputCount() == 1) os << " = ";
279 279
280 if (instr.IsGapMoves()) { 280 if (instr.IsGapMoves()) {
281 const GapInstruction* gap = GapInstruction::cast(&instr); 281 const GapInstruction* gap = GapInstruction::cast(&instr);
282 os << (instr.IsBlockStart() ? " block-start" : "gap "); 282 os << "gap ";
283 for (int i = GapInstruction::FIRST_INNER_POSITION; 283 for (int i = GapInstruction::FIRST_INNER_POSITION;
284 i <= GapInstruction::LAST_INNER_POSITION; i++) { 284 i <= GapInstruction::LAST_INNER_POSITION; i++) {
285 os << "("; 285 os << "(";
286 if (gap->parallel_moves_[i] != NULL) { 286 if (gap->parallel_moves_[i] != NULL) {
287 PrintableParallelMove ppm = {printable.register_configuration_, 287 PrintableParallelMove ppm = {printable.register_configuration_,
288 gap->parallel_moves_[i]}; 288 gap->parallel_moves_[i]};
289 os << ppm; 289 os << ppm;
290 } 290 }
291 os << ") "; 291 os << ") ";
292 } 292 }
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 } 450 }
451 451
452 452
453 int InstructionSequence::NextVirtualRegister() { 453 int InstructionSequence::NextVirtualRegister() {
454 int virtual_register = next_virtual_register_++; 454 int virtual_register = next_virtual_register_++;
455 CHECK_NE(virtual_register, UnallocatedOperand::kInvalidVirtualRegister); 455 CHECK_NE(virtual_register, UnallocatedOperand::kInvalidVirtualRegister);
456 return virtual_register; 456 return virtual_register;
457 } 457 }
458 458
459 459
460 BlockStartInstruction* InstructionSequence::GetBlockStart( 460 GapInstruction* InstructionSequence::GetBlockStart(
461 BasicBlock::RpoNumber rpo) const { 461 BasicBlock::RpoNumber rpo) const {
462 const InstructionBlock* block = InstructionBlockAt(rpo); 462 const InstructionBlock* block = InstructionBlockAt(rpo);
463 return BlockStartInstruction::cast(InstructionAt(block->code_start())); 463 return GapInstruction::cast(InstructionAt(block->code_start()));
464 } 464 }
465 465
466 466
467 void InstructionSequence::StartBlock(BasicBlock::RpoNumber rpo) { 467 void InstructionSequence::StartBlock(BasicBlock::RpoNumber rpo) {
468 DCHECK(block_starts_.size() == rpo.ToSize()); 468 DCHECK(block_starts_.size() == rpo.ToSize());
469 InstructionBlock* block = InstructionBlockAt(rpo); 469 InstructionBlock* block = InstructionBlockAt(rpo);
470 int code_start = static_cast<int>(instructions_.size()); 470 int code_start = static_cast<int>(instructions_.size());
471 block->set_code_start(code_start); 471 block->set_code_start(code_start);
472 block_starts_.push_back(code_start); 472 block_starts_.push_back(code_start);
473 BlockStartInstruction* block_start = BlockStartInstruction::New(zone());
474 AddInstruction(block_start);
475 } 473 }
476 474
477 475
478 void InstructionSequence::EndBlock(BasicBlock::RpoNumber rpo) { 476 void InstructionSequence::EndBlock(BasicBlock::RpoNumber rpo) {
479 int end = static_cast<int>(instructions_.size()); 477 int end = static_cast<int>(instructions_.size());
480 InstructionBlock* block = InstructionBlockAt(rpo); 478 InstructionBlock* block = InstructionBlockAt(rpo);
479 if (block->code_start() == end) { // Empty block. Insert a nop.
480 AddInstruction(Instruction::New(zone(), kArchNop));
481 end = static_cast<int>(instructions_.size());
482 }
481 DCHECK(block->code_start() >= 0 && block->code_start() < end); 483 DCHECK(block->code_start() >= 0 && block->code_start() < end);
482 block->set_code_end(end); 484 block->set_code_end(end);
483 } 485 }
484 486
485 487
486 int InstructionSequence::AddInstruction(Instruction* instr) { 488 int InstructionSequence::AddInstruction(Instruction* instr) {
487 // TODO(titzer): the order of these gaps is a holdover from Lithium.
488 GapInstruction* gap = GapInstruction::New(zone()); 489 GapInstruction* gap = GapInstruction::New(zone());
489 if (instr->IsControl()) instructions_.push_back(gap); 490 instructions_.push_back(gap);
490 int index = static_cast<int>(instructions_.size()); 491 int index = static_cast<int>(instructions_.size());
491 instructions_.push_back(instr); 492 instructions_.push_back(instr);
492 if (!instr->IsControl()) instructions_.push_back(gap);
493 if (instr->NeedsPointerMap()) { 493 if (instr->NeedsPointerMap()) {
494 DCHECK(instr->pointer_map() == NULL); 494 DCHECK(instr->pointer_map() == NULL);
495 PointerMap* pointer_map = new (zone()) PointerMap(zone()); 495 PointerMap* pointer_map = new (zone()) PointerMap(zone());
496 pointer_map->set_instruction_position(index); 496 pointer_map->set_instruction_position(index);
497 instr->set_pointer_map(pointer_map); 497 instr->set_pointer_map(pointer_map);
498 pointer_maps_.push_back(pointer_map); 498 pointer_maps_.push_back(pointer_map);
499 } 499 }
500 return index; 500 return index;
501 } 501 }
502 502
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
693 os << " B" << succ_block->id(); 693 os << " B" << succ_block->id();
694 } 694 }
695 os << "\n"; 695 os << "\n";
696 } 696 }
697 return os; 697 return os;
698 } 698 }
699 699
700 } // namespace compiler 700 } // namespace compiler
701 } // namespace internal 701 } // namespace internal
702 } // namespace v8 702 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/instruction.h ('k') | src/compiler/register-allocator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698