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

Unified Diff: src/hydrogen.cc

Issue 6615010: Refactor translation of short-circuit logical operations to avoid subgraphs. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge/build/ia32
Patch Set: Created 9 years, 10 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index 1ddd17cb14959d1b68ef9fd9716f1fc87db1cabc..30cc08839a5dd64a31cf795f822bf34be0232c8b 100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -4915,28 +4915,23 @@ void HGraphBuilder::VisitBinaryOperation(BinaryOperation* expr) {
VISIT_FOR_VALUE(expr->left());
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.
HBasicBlock* empty_block = graph()->CreateBasicBlock();
- HBasicBlock* join_block = graph()->CreateBasicBlock();
-
+ HBasicBlock* eval_right = graph()->CreateBasicBlock();
HTest* test = is_logical_and
- ? new HTest(left, right_subgraph->entry_block(), empty_block)
- : new HTest(left, empty_block, right_subgraph->entry_block());
+ ? new HTest(Top(), eval_right, empty_block)
+ : new HTest(Top(), empty_block, eval_right);
current_block()->Finish(test);
- empty_block->Goto(join_block);
- right_subgraph->exit_block()->Goto(join_block);
- join_block->SetJoinId(expr->id());
+
+ set_current_block(eval_right);
+ 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);
ast_context()->ReturnValue(Pop());
+
} else {
ASSERT(ast_context()->IsEffect());
// In an effect context, we don't need the value of the left
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698