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

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

Issue 710323002: [turbofan] put gaps before instructions (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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 | Annotate | Revision Log
« 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/generic-node-inl.h" 6 #include "src/compiler/generic-node-inl.h"
7 #include "src/compiler/graph.h" 7 #include "src/compiler/graph.h"
8 #include "src/compiler/instruction.h" 8 #include "src/compiler/instruction.h"
9 9
10 namespace v8 { 10 namespace v8 {
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 if (i > 0) os << ", "; 273 if (i > 0) os << ", ";
274 printable_op.op_ = instr.OutputAt(i); 274 printable_op.op_ = instr.OutputAt(i);
275 os << printable_op; 275 os << printable_op;
276 } 276 }
277 277
278 if (instr.OutputCount() > 1) os << ") = "; 278 if (instr.OutputCount() > 1) os << ") = ";
279 if (instr.OutputCount() == 1) os << " = "; 279 if (instr.OutputCount() == 1) os << " = ";
280 280
281 if (instr.IsGapMoves()) { 281 if (instr.IsGapMoves()) {
282 const GapInstruction* gap = GapInstruction::cast(&instr); 282 const GapInstruction* gap = GapInstruction::cast(&instr);
283 os << (instr.IsBlockStart() ? " block-start" : "gap "); 283 os << "gap ";
284 for (int i = GapInstruction::FIRST_INNER_POSITION; 284 for (int i = GapInstruction::FIRST_INNER_POSITION;
285 i <= GapInstruction::LAST_INNER_POSITION; i++) { 285 i <= GapInstruction::LAST_INNER_POSITION; i++) {
286 os << "("; 286 os << "(";
287 if (gap->parallel_moves_[i] != NULL) { 287 if (gap->parallel_moves_[i] != NULL) {
288 PrintableParallelMove ppm = {printable.register_configuration_, 288 PrintableParallelMove ppm = {printable.register_configuration_,
289 gap->parallel_moves_[i]}; 289 gap->parallel_moves_[i]};
290 os << ppm; 290 os << ppm;
291 } 291 }
292 os << ") "; 292 os << ") ";
293 } 293 }
294 } else if (instr.IsBlockStart()) {
295 os << "block-start";
294 } else if (instr.IsSourcePosition()) { 296 } else if (instr.IsSourcePosition()) {
295 const SourcePositionInstruction* pos = 297 const SourcePositionInstruction* pos =
296 SourcePositionInstruction::cast(&instr); 298 SourcePositionInstruction::cast(&instr);
297 os << "position (" << pos->source_position().raw() << ")"; 299 os << "position (" << pos->source_position().raw() << ")";
298 } else { 300 } else {
299 os << ArchOpcodeField::decode(instr.opcode()); 301 os << ArchOpcodeField::decode(instr.opcode());
300 AddressingMode am = AddressingModeField::decode(instr.opcode()); 302 AddressingMode am = AddressingModeField::decode(instr.opcode());
301 if (am != kMode_None) { 303 if (am != kMode_None) {
302 os << " : " << AddressingModeField::decode(instr.opcode()); 304 os << " : " << AddressingModeField::decode(instr.opcode());
303 } 305 }
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 instructions_(zone()), 429 instructions_(zone()),
428 next_virtual_register_(0), 430 next_virtual_register_(0),
429 pointer_maps_(zone()), 431 pointer_maps_(zone()),
430 doubles_(std::less<int>(), VirtualRegisterSet::allocator_type(zone())), 432 doubles_(std::less<int>(), VirtualRegisterSet::allocator_type(zone())),
431 references_(std::less<int>(), VirtualRegisterSet::allocator_type(zone())), 433 references_(std::less<int>(), VirtualRegisterSet::allocator_type(zone())),
432 deoptimization_entries_(zone()) { 434 deoptimization_entries_(zone()) {
433 block_starts_.reserve(instruction_blocks_->size()); 435 block_starts_.reserve(instruction_blocks_->size());
434 } 436 }
435 437
436 438
437 BlockStartInstruction* InstructionSequence::GetBlockStart( 439 const BlockStartInstruction* InstructionSequence::GetBlockStart(
438 BasicBlock::RpoNumber rpo) const { 440 BasicBlock::RpoNumber rpo) const {
439 const InstructionBlock* block = InstructionBlockAt(rpo); 441 const InstructionBlock* block = InstructionBlockAt(rpo);
440 return BlockStartInstruction::cast(InstructionAt(block->code_start())); 442 return BlockStartInstruction::cast(InstructionAt(block->code_start()));
441 } 443 }
442 444
443 445
444 void InstructionSequence::StartBlock(BasicBlock::RpoNumber rpo) { 446 void InstructionSequence::StartBlock(BasicBlock::RpoNumber rpo) {
445 DCHECK(block_starts_.size() == rpo.ToSize()); 447 DCHECK(block_starts_.size() == rpo.ToSize());
446 InstructionBlock* block = InstructionBlockAt(rpo); 448 InstructionBlock* block = InstructionBlockAt(rpo);
447 int code_start = static_cast<int>(instructions_.size()); 449 int code_start = static_cast<int>(instructions_.size());
448 block->set_code_start(code_start); 450 block->set_code_start(code_start);
449 block_starts_.push_back(code_start); 451 block_starts_.push_back(code_start);
450 BlockStartInstruction* block_start = BlockStartInstruction::New(zone()); 452 instructions_.push_back(BlockStartInstruction::New(zone()));
451 AddInstruction(block_start);
452 } 453 }
453 454
454 455
455 void InstructionSequence::EndBlock(BasicBlock::RpoNumber rpo) { 456 void InstructionSequence::EndBlock(BasicBlock::RpoNumber rpo) {
456 int end = static_cast<int>(instructions_.size()); 457 int end = static_cast<int>(instructions_.size());
457 InstructionBlock* block = InstructionBlockAt(rpo); 458 InstructionBlock* block = InstructionBlockAt(rpo);
458 DCHECK(block->code_start() >= 0 && block->code_start() < end); 459 DCHECK(block->code_start() >= 0 && block->code_start() < end);
459 block->set_code_end(end); 460 block->set_code_end(end);
460 } 461 }
461 462
462 463
463 int InstructionSequence::AddInstruction(Instruction* instr) { 464 int InstructionSequence::AddInstruction(Instruction* instr) {
464 // TODO(titzer): the order of these gaps is a holdover from Lithium.
465 GapInstruction* gap = GapInstruction::New(zone()); 465 GapInstruction* gap = GapInstruction::New(zone());
466 if (instr->IsControl()) instructions_.push_back(gap); 466 instructions_.push_back(gap);
467 int index = static_cast<int>(instructions_.size()); 467 int index = static_cast<int>(instructions_.size());
468 instructions_.push_back(instr); 468 instructions_.push_back(instr);
469 if (!instr->IsControl()) instructions_.push_back(gap);
470 if (instr->NeedsPointerMap()) { 469 if (instr->NeedsPointerMap()) {
471 DCHECK(instr->pointer_map() == NULL); 470 DCHECK(instr->pointer_map() == NULL);
472 PointerMap* pointer_map = new (zone()) PointerMap(zone()); 471 PointerMap* pointer_map = new (zone()) PointerMap(zone());
473 pointer_map->set_instruction_position(index); 472 pointer_map->set_instruction_position(index);
474 instr->set_pointer_map(pointer_map); 473 instr->set_pointer_map(pointer_map);
475 pointer_maps_.push_back(pointer_map); 474 pointer_maps_.push_back(pointer_map);
476 } 475 }
477 return index; 476 return index;
478 } 477 }
479 478
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 os << " B" << succ_block->id(); 669 os << " B" << succ_block->id();
671 } 670 }
672 os << "\n"; 671 os << "\n";
673 } 672 }
674 return os; 673 return os;
675 } 674 }
676 675
677 } // namespace compiler 676 } // namespace compiler
678 } // namespace internal 677 } // namespace internal
679 } // namespace v8 678 } // 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