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

Unified Diff: src/compiler/instruction.cc

Issue 683133005: [turbofan] initial framework for unittesting of register allocator (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/instruction.h ('k') | src/compiler/pipeline.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/instruction.cc
diff --git a/src/compiler/instruction.cc b/src/compiler/instruction.cc
index 7ee5a6961415164f718c7b71faf6a00ac803ae77..9705bea20716a2e9428079f26975efd70fbb46e9 100644
--- a/src/compiler/instruction.cc
+++ b/src/compiler/instruction.cc
@@ -373,9 +373,11 @@ size_t InstructionBlock::PredecessorIndexOf(
}
-static void InitializeInstructionBlocks(Zone* zone, const Schedule* schedule,
- InstructionBlocks* blocks) {
- DCHECK(blocks->size() == schedule->rpo_order()->size());
+InstructionBlocks* InstructionSequence::InstructionBlocksFor(
+ Zone* zone, const Schedule* schedule) {
+ InstructionBlocks* blocks = zone->NewArray<InstructionBlocks>(1);
+ new (blocks) InstructionBlocks(
+ static_cast<int>(schedule->rpo_order()->size()), NULL, zone);
size_t rpo_number = 0;
for (BasicBlockVector::const_iterator it = schedule->rpo_order()->begin();
it != schedule->rpo_order()->end(); ++it, ++rpo_number) {
@@ -383,14 +385,14 @@ static void InitializeInstructionBlocks(Zone* zone, const Schedule* schedule,
DCHECK((*it)->GetRpoNumber().ToSize() == rpo_number);
(*blocks)[rpo_number] = new (zone) InstructionBlock(zone, *it);
}
+ return blocks;
}
InstructionSequence::InstructionSequence(Zone* instruction_zone,
- const Schedule* schedule)
+ InstructionBlocks* instruction_blocks)
: zone_(instruction_zone),
- instruction_blocks_(static_cast<int>(schedule->rpo_order()->size()), NULL,
- zone()),
+ instruction_blocks_(instruction_blocks),
constants_(ConstantMap::key_compare(),
ConstantMap::allocator_type(zone())),
immediates_(zone()),
@@ -399,9 +401,7 @@ InstructionSequence::InstructionSequence(Zone* instruction_zone,
pointer_maps_(zone()),
doubles_(std::less<int>(), VirtualRegisterSet::allocator_type(zone())),
references_(std::less<int>(), VirtualRegisterSet::allocator_type(zone())),
- deoptimization_entries_(zone()) {
- InitializeInstructionBlocks(zone(), schedule, &instruction_blocks_);
-}
+ deoptimization_entries_(zone()) {}
Label* InstructionSequence::GetLabel(BasicBlock::RpoNumber rpo) {
@@ -461,8 +461,8 @@ const InstructionBlock* InstructionSequence::GetInstructionBlock(
DCHECK_LE(0, instruction_index);
Instruction* instruction = InstructionAt(instruction_index--);
if (instruction->IsBlockStart()) {
- return instruction_blocks_
- [BlockStartInstruction::cast(instruction)->rpo_number().ToSize()];
+ return instruction_blocks_->at(
+ BlockStartInstruction::cast(instruction)->rpo_number().ToSize());
}
}
}
« no previous file with comments | « src/compiler/instruction.h ('k') | src/compiler/pipeline.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698