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

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

Issue 683933004: [turbofan] move Node to vreg mapping to InstructionSelector (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/instruction-selector.h » ('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 #include "src/macro-assembler.h" 9 #include "src/macro-assembler.h"
10 10
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 for (BasicBlockVector::const_iterator it = schedule->rpo_order()->begin(); 380 for (BasicBlockVector::const_iterator it = schedule->rpo_order()->begin();
381 it != schedule->rpo_order()->end(); ++it, ++rpo_number) { 381 it != schedule->rpo_order()->end(); ++it, ++rpo_number) {
382 DCHECK_EQ(NULL, (*blocks)[rpo_number]); 382 DCHECK_EQ(NULL, (*blocks)[rpo_number]);
383 DCHECK((*it)->GetRpoNumber().ToSize() == rpo_number); 383 DCHECK((*it)->GetRpoNumber().ToSize() == rpo_number);
384 (*blocks)[rpo_number] = new (zone) InstructionBlock(zone, *it); 384 (*blocks)[rpo_number] = new (zone) InstructionBlock(zone, *it);
385 } 385 }
386 } 386 }
387 387
388 388
389 InstructionSequence::InstructionSequence(Zone* instruction_zone, 389 InstructionSequence::InstructionSequence(Zone* instruction_zone,
390 const Graph* graph,
391 const Schedule* schedule) 390 const Schedule* schedule)
392 : zone_(instruction_zone), 391 : zone_(instruction_zone),
393 node_map_(graph->NodeCount(), kNodeUnmapped, zone()),
394 instruction_blocks_(static_cast<int>(schedule->rpo_order()->size()), NULL, 392 instruction_blocks_(static_cast<int>(schedule->rpo_order()->size()), NULL,
395 zone()), 393 zone()),
396 constants_(ConstantMap::key_compare(), 394 constants_(ConstantMap::key_compare(),
397 ConstantMap::allocator_type(zone())), 395 ConstantMap::allocator_type(zone())),
398 immediates_(zone()), 396 immediates_(zone()),
399 instructions_(zone()), 397 instructions_(zone()),
400 next_virtual_register_(0), 398 next_virtual_register_(0),
401 pointer_maps_(zone()), 399 pointer_maps_(zone()),
402 doubles_(std::less<int>(), VirtualRegisterSet::allocator_type(zone())), 400 doubles_(std::less<int>(), VirtualRegisterSet::allocator_type(zone())),
403 references_(std::less<int>(), VirtualRegisterSet::allocator_type(zone())), 401 references_(std::less<int>(), VirtualRegisterSet::allocator_type(zone())),
404 deoptimization_entries_(zone()) { 402 deoptimization_entries_(zone()) {
405 InitializeInstructionBlocks(zone(), schedule, &instruction_blocks_); 403 InitializeInstructionBlocks(zone(), schedule, &instruction_blocks_);
406 } 404 }
407 405
408 406
409 int InstructionSequence::GetVirtualRegister(const Node* node) {
410 if (node_map_[node->id()] == kNodeUnmapped) {
411 node_map_[node->id()] = NextVirtualRegister();
412 }
413 return node_map_[node->id()];
414 }
415
416
417 Label* InstructionSequence::GetLabel(BasicBlock::RpoNumber rpo) { 407 Label* InstructionSequence::GetLabel(BasicBlock::RpoNumber rpo) {
418 return GetBlockStart(rpo)->label(); 408 return GetBlockStart(rpo)->label();
419 } 409 }
420 410
421 411
422 BlockStartInstruction* InstructionSequence::GetBlockStart( 412 BlockStartInstruction* InstructionSequence::GetBlockStart(
423 BasicBlock::RpoNumber rpo) { 413 BasicBlock::RpoNumber rpo) {
424 InstructionBlock* block = InstructionBlockAt(rpo); 414 InstructionBlock* block = InstructionBlockAt(rpo);
425 BlockStartInstruction* block_start = 415 BlockStartInstruction* block_start =
426 BlockStartInstruction::cast(InstructionAt(block->code_start())); 416 BlockStartInstruction::cast(InstructionAt(block->code_start()));
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
655 os << " B" << succ_block->id(); 645 os << " B" << succ_block->id();
656 } 646 }
657 os << "\n"; 647 os << "\n";
658 } 648 }
659 return os; 649 return os;
660 } 650 }
661 651
662 } // namespace compiler 652 } // namespace compiler
663 } // namespace internal 653 } // namespace internal
664 } // namespace v8 654 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/instruction.h ('k') | src/compiler/instruction-selector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698