Refactor translation of short-circuit logical operations to avoid subgraphs.

Do not use a subgraph or subgraph scope for the Hydrogen translation
of the short-circuit logical operations.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7045 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent f5839996
...@@ -4915,28 +4915,23 @@ void HGraphBuilder::VisitBinaryOperation(BinaryOperation* expr) { ...@@ -4915,28 +4915,23 @@ void HGraphBuilder::VisitBinaryOperation(BinaryOperation* expr) {
VISIT_FOR_VALUE(expr->left()); VISIT_FOR_VALUE(expr->left());
ASSERT(current_block() != NULL); ASSERT(current_block() != NULL);
HValue* left = Top();
HEnvironment* environment_copy = environment()->Copy();
environment_copy->Pop();
HSubgraph* right_subgraph;
right_subgraph = CreateBranchSubgraph(environment_copy);
ADD_TO_SUBGRAPH(right_subgraph, expr->right());
ASSERT(current_block() != NULL &&
right_subgraph->exit_block() != NULL);
// We need an extra block to maintain edge-split form. // We need an extra block to maintain edge-split form.
HBasicBlock* empty_block = graph()->CreateBasicBlock(); HBasicBlock* empty_block = graph()->CreateBasicBlock();
HBasicBlock* join_block = graph()->CreateBasicBlock(); HBasicBlock* eval_right = graph()->CreateBasicBlock();
HTest* test = is_logical_and HTest* test = is_logical_and
? new HTest(left, right_subgraph->entry_block(), empty_block) ? new HTest(Top(), eval_right, empty_block)
: new HTest(left, empty_block, right_subgraph->entry_block()); : new HTest(Top(), empty_block, eval_right);
current_block()->Finish(test); current_block()->Finish(test);
empty_block->Goto(join_block);
right_subgraph->exit_block()->Goto(join_block); set_current_block(eval_right);
join_block->SetJoinId(expr->id()); Drop(1); // Value of the left subexpression.
VISIT_FOR_VALUE(expr->right());
HBasicBlock* join_block =
CreateJoin(empty_block, current_block(), expr->id());
set_current_block(join_block); set_current_block(join_block);
ast_context()->ReturnValue(Pop()); ast_context()->ReturnValue(Pop());
} else { } else {
ASSERT(ast_context()->IsEffect()); ASSERT(ast_context()->IsEffect());
// In an effect context, we don't need the value of the left // In an effect context, we don't need the value of the left
......
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