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

Unified Diff: src/compiler/schedule.h

Issue 499363002: Schedule floating control. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: src/compiler/schedule.h
diff --git a/src/compiler/schedule.h b/src/compiler/schedule.h
index b9bb526a2c38c87f2f315cbf122bbdf95e13e556..0c8e73719eb5e1c3631760d0c1e4888576c0344c 100644
--- a/src/compiler/schedule.h
+++ b/src/compiler/schedule.h
@@ -40,6 +40,7 @@ class BasicBlockData {
};
int32_t rpo_number_; // special RPO number of the block.
+ BasicBlock* dominator_; // Immediate dominator of the block.
BasicBlock* loop_header_; // Pointer to dominating loop header basic block,
// NULL if none. For loop headers, this points to
// enclosing loop header.
@@ -55,6 +56,7 @@ class BasicBlockData {
explicit BasicBlockData(Zone* zone)
: rpo_number_(-1),
+ dominator_(NULL),
loop_header_(NULL),
loop_depth_(0),
loop_end_(-1),
@@ -161,8 +163,7 @@ class Schedule : public GenericGraph<BasicBlock> {
zone_(zone),
all_blocks_(BasicBlockVector::allocator_type(zone)),
nodeid_to_block_(BasicBlockVector::allocator_type(zone)),
- rpo_order_(BasicBlockVector::allocator_type(zone)),
- immediate_dominator_(BasicBlockVector::allocator_type(zone)) {
+ rpo_order_(BasicBlockVector::allocator_type(zone)) {
SetStart(NewBasicBlock()); // entry.
SetEnd(NewBasicBlock()); // exit.
}
@@ -175,10 +176,6 @@ class Schedule : public GenericGraph<BasicBlock> {
return NULL;
}
- BasicBlock* dominator(BasicBlock* block) {
- return immediate_dominator_[block->id()];
- }
-
bool IsScheduled(Node* node) {
int length = static_cast<int>(nodeid_to_block_.size());
if (node->id() >= length) return false;
@@ -213,8 +210,8 @@ class Schedule : public GenericGraph<BasicBlock> {
// doesn't actually add the node to the block.
inline void PlanNode(BasicBlock* block, Node* node) {
if (FLAG_trace_turbo_scheduler) {
- PrintF("Planning node %d for future add to block %d\n", node->id(),
- block->id());
+ PrintF("Planning #%d:%s for future add to B%d\n", node->id(),
+ node->op()->mnemonic(), block->id());
}
DCHECK(this->block(node) == NULL);
SetBlockForNode(block, node);
@@ -223,7 +220,8 @@ class Schedule : public GenericGraph<BasicBlock> {
// BasicBlock building: add a node to the end of the block.
inline void AddNode(BasicBlock* block, Node* node) {
if (FLAG_trace_turbo_scheduler) {
- PrintF("Adding node %d to block %d\n", node->id(), block->id());
+ PrintF("Adding #%d:%s to B%d\n", node->id(), node->op()->mnemonic(),
+ block->id());
}
DCHECK(this->block(node) == NULL || this->block(node) == block);
block->nodes_.push_back(node);
@@ -248,6 +246,7 @@ class Schedule : public GenericGraph<BasicBlock> {
AddSuccessor(block, deopt_block);
AddSuccessor(block, cont_block);
SetControlInput(block, call);
+ SetBlockForNode(block, call);
}
// BasicBlock building: add a branch at the end of {block}.
@@ -259,15 +258,22 @@ class Schedule : public GenericGraph<BasicBlock> {
AddSuccessor(block, tblock);
AddSuccessor(block, fblock);
SetControlInput(block, branch);
+ if (branch->opcode() == IrOpcode::kBranch) {
+ // TODO(titzer): require a Branch node here. (sloppy tests).
+ SetBlockForNode(block, branch);
+ }
}
// BasicBlock building: add a return at the end of {block}.
void AddReturn(BasicBlock* block, Node* input) {
- // TODO(titzer): require a Return node here.
DCHECK(block->control_ == BasicBlock::kNone);
block->control_ = BasicBlock::kReturn;
SetControlInput(block, input);
if (block != end()) AddSuccessor(block, end());
+ if (input->opcode() == IrOpcode::kReturn) {
+ // TODO(titzer): require a Return node here. (sloppy tests).
+ SetBlockForNode(block, input);
+ }
}
// BasicBlock building: add a throw at the end of {block}.
@@ -316,9 +322,6 @@ class Schedule : public GenericGraph<BasicBlock> {
BasicBlockVector all_blocks_; // All basic blocks in the schedule.
BasicBlockVector nodeid_to_block_; // Map from node to containing block.
BasicBlockVector rpo_order_; // Reverse-post-order block list.
- BasicBlockVector immediate_dominator_; // Maps to a block's immediate
- // dominator, indexed by block
- // id.
};
OStream& operator<<(OStream& os, const Schedule& s);
« no previous file with comments | « src/compiler/pipeline.cc ('k') | src/compiler/scheduler.h » ('j') | src/compiler/scheduler.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698