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

Unified Diff: runtime/vm/flow_graph_builder.cc

Issue 9456009: Fix a pair of bugs in the translation of 'if' nodes. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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: runtime/vm/flow_graph_builder.cc
diff --git a/runtime/vm/flow_graph_builder.cc b/runtime/vm/flow_graph_builder.cc
index 2424a1d6182db3274ebecf7e0169ed23674f40f1..5224718ed66d8edf4a0ca87958bf1b3cbd26380d 100644
--- a/runtime/vm/flow_graph_builder.cc
+++ b/runtime/vm/flow_graph_builder.cc
@@ -53,9 +53,9 @@ void EffectGraphVisitor::Join(const TestGraphVisitor& test_fragment,
// 2. Connect the true and false bodies to the test if they are reachable,
// and if so record their exits (if any).
+ Instruction* true_exit = NULL;
+ Instruction* false_exit = NULL;
if (test_fragment.can_be_true()) {
- Instruction* true_exit = NULL;
- Instruction* false_exit = NULL;
TargetEntryInstr* true_entry = new TargetEntryInstr();
*test_fragment.true_successor_address() = true_entry;
true_entry->SetSuccessor(true_fragment.entry());
@@ -66,7 +66,14 @@ void EffectGraphVisitor::Join(const TestGraphVisitor& test_fragment,
false_entry->SetSuccessor(false_fragment.entry());
false_exit =
false_fragment.is_empty() ? false_entry : false_fragment.exit();
srdjan 2012/02/23 16:27:22 When can false_exit and true_exit be NULL, i.e., w
+ }
+ // 3. Add a join or select one (or neither) of the arms as exit.
+ if (true_exit == NULL) {
+ exit_ = false_exit; // May be NULL.
+ } else if (false_exit == NULL) {
+ exit_ = true_exit;
+ } else {
exit_ = new JoinEntryInstr();
true_exit->SetSuccessor(exit_);
false_exit->SetSuccessor(exit_);
@@ -405,7 +412,6 @@ void TestGraphVisitor::VisitConditionalExprNode(ConditionalExprNode* node) {
void EffectGraphVisitor::VisitIfNode(IfNode* node) {
TestGraphVisitor for_test(owner(), temp_index());
node->condition()->Visit(&for_test);
- Append(for_test);
EffectGraphVisitor for_true(owner(), temp_index());
EffectGraphVisitor for_false(owner(), temp_index());
« 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