Remove some more uses of subgraphs and more cleanup of the graph builder.

Do not use subgraphs to implement the translation of simple branching
control flow, for the function body entry, or for labeled blocks.

Combine all the loop construction functions into a single one.

Resolve a possible problem with duplicate AST IDs used both for joined loop
break blocks, the normal loop exit, and for their common successor, by never
introducing the extra (successor) block and instead making the normal loop
exit a predecessor of the break join block.  There is a similar issue with
joined continue blocks.

Remove a (never needed) two-element zone list per each time we replace one
hydrogen value with another.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7027 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 9390c69a
......@@ -285,24 +285,19 @@ void HValue::SetOperandAt(int index, HValue* value) {
void HValue::ReplaceAndDelete(HValue* other) {
ReplaceValue(other);
if (other != NULL) ReplaceValue(other);
Delete();
}
void HValue::ReplaceValue(HValue* other) {
ZoneList<HValue*> start_uses(2);
for (int i = 0; i < uses_.length(); ++i) {
HValue* use = uses_.at(i);
if (!use->block()->IsStartBlock()) {
InternalReplaceAtUse(use, other);
other->uses_.Add(use);
} else {
start_uses.Add(use);
}
HValue* use = uses_[i];
ASSERT(!use->block()->IsStartBlock());
InternalReplaceAtUse(use, other);
other->uses_.Add(use);
}
uses_.Clear();
uses_.AddAll(start_uses);
uses_.Rewind(0);
}
......
This diff is collapsed.
......@@ -605,7 +605,6 @@ class HGraphBuilder: public AstVisitor {
: oracle_(oracle),
graph_(NULL),
current_subgraph_(NULL),
peeled_statement_(NULL),
ast_context_(NULL),
call_context_(NULL),
function_return_(NULL),
......@@ -676,25 +675,24 @@ class HGraphBuilder: public AstVisitor {
HBasicBlock* CreateJoin(HBasicBlock* first,
HBasicBlock* second,
int join_id);
HBasicBlock* CreateWhile(IterationStatement* statement,
HBasicBlock* loop_entry,
HBasicBlock* cond_false,
HBasicBlock* body_exit,
HBasicBlock* break_block);
HBasicBlock* CreateDoWhile(IterationStatement* statement,
HBasicBlock* body_entry,
HBasicBlock* go_back,
HBasicBlock* exit_block,
HBasicBlock* break_block);
HBasicBlock* CreateEndless(IterationStatement* statement,
HBasicBlock* body_entry,
HBasicBlock* body_exit,
HBasicBlock* break_block);
// Create a back edge in the flow graph. body_exit is the predecessor
// block and loop_entry is the successor block. loop_successor is the
// block where control flow exits the loop normally (e.g., via failure of
// the condition) and break_block is the block where control flow breaks
// from the loop. All blocks except loop_entry can be NULL. The return
// value is the new successor block which is the join of loop_successor
// and break_block, or NULL.
HBasicBlock* CreateLoop(IterationStatement* statement,
HBasicBlock* loop_entry,
HBasicBlock* body_exit,
HBasicBlock* loop_successor,
HBasicBlock* break_block);
HBasicBlock* JoinContinue(IterationStatement* statement,
HBasicBlock* exit_block,
HBasicBlock* continue_block);
void AddToSubgraph(HSubgraph* graph, ZoneList<Statement*>* stmts);
void AddToSubgraph(HSubgraph* graph, Statement* stmt);
void AddToSubgraph(HSubgraph* graph, Expression* expr);
......@@ -737,9 +735,8 @@ class HGraphBuilder: public AstVisitor {
HBasicBlock* CreateBasicBlock(HEnvironment* env);
HSubgraph* CreateEmptySubgraph();
HSubgraph* CreateGotoSubgraph(HEnvironment* env);
HSubgraph* CreateBranchSubgraph(HEnvironment* env);
HBasicBlock* CreateLoopHeader();
HBasicBlock* CreateLoopHeaderBlock();
HSubgraph* CreateInlinedSubgraph(HEnvironment* outer,
Handle<JSFunction> target,
FunctionLiteral* function);
......@@ -851,7 +848,6 @@ class HGraphBuilder: public AstVisitor {
TypeFeedbackOracle* oracle_;
HGraph* graph_;
HSubgraph* current_subgraph_;
IterationStatement* peeled_statement_;
// Expression context of the currently visited subexpression. NULL when
// visiting statements.
AstContext* ast_context_;
......
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