Partial refactoring of subgraphs.

Change the interface to the Hydrogen graph builder to appear like it
directly holds a current basic block and a current environment.
Remove some direct accesses to the current subgraph, and remove
subgraph accessors that simply forwarded to the exit block.

Review URL: http://codereview.chromium.org/6532088

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6887 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent b0fa9477
This diff is collapsed.
......@@ -200,13 +200,12 @@ class HSubgraph: public ZoneObject {
}
HGraph* graph() const { return graph_; }
HEnvironment* environment() const {
ASSERT(HasExit());
return exit_block_->last_environment();
HBasicBlock* entry_block() const { return entry_block_; }
HBasicBlock* exit_block() const { return exit_block_; }
void set_exit_block(HBasicBlock* block) {
exit_block_ = block;
}
bool HasExit() const { return exit_block_ != NULL; }
void PreProcessOsrEntry(IterationStatement* statement);
void AppendJoin(HSubgraph* then_graph, HSubgraph* else_graph, AstNode* node);
......@@ -237,17 +236,6 @@ class HSubgraph: public ZoneObject {
entry_block_ = block;
exit_block_ = block;
}
HBasicBlock* entry_block() const { return entry_block_; }
HBasicBlock* exit_block() const { return exit_block_; }
void set_exit_block(HBasicBlock* block) {
exit_block_ = block;
}
void ConnectExitTo(HBasicBlock* other, bool include_stack_check = false) {
if (HasExit()) {
exit_block()->Goto(other, include_stack_check);
}
}
protected:
HGraph* graph_; // The graph this is a subgraph of.
......@@ -657,8 +645,13 @@ class HGraphBuilder: public AstVisitor {
BreakAndContinueScope* break_scope() const { return break_scope_; }
void set_break_scope(BreakAndContinueScope* head) { break_scope_ = head; }
HEnvironment* environment() const { return subgraph()->environment(); }
HBasicBlock* CurrentBlock() const { return subgraph()->exit_block(); }
HBasicBlock* current_block() const { return subgraph()->exit_block(); }
void set_current_block(HBasicBlock* block) {
subgraph()->set_exit_block(block);
}
HEnvironment* environment() const {
return current_block()->last_environment();
}
// Adding instructions.
HInstruction* AddInstruction(HInstruction* instr);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment