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

Unified Diff: runtime/vm/flow_graph_builder.cc

Issue 25630002: Fix issue 13474. Simplify graph builder for Boolean operators AND, OR: do not optimize code when th… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 2 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 | tests/language/issue13474_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/flow_graph_builder.cc
===================================================================
--- runtime/vm/flow_graph_builder.cc (revision 28272)
+++ runtime/vm/flow_graph_builder.cc (working copy)
@@ -970,13 +970,26 @@
temp_index(),
node->left()->token_pos());
node->left()->Visit(&for_left);
- EffectGraphVisitor for_right(owner(), temp_index());
- node->right()->Visit(&for_right);
EffectGraphVisitor empty(owner(), temp_index());
- if (node->kind() == Token::kAND) {
- Join(for_left, for_right, empty);
+ if (FLAG_enable_type_checks) {
+ ValueGraphVisitor for_right(owner(), temp_index());
+ node->right()->Visit(&for_right);
+ Value* right_value = for_right.value();
+ for_right.Do(new AssertBooleanInstr(node->right()->token_pos(),
+ right_value));
+ if (node->kind() == Token::kAND) {
+ Join(for_left, for_right, empty);
+ } else {
+ Join(for_left, empty, for_right);
+ }
} else {
- Join(for_left, empty, for_right);
+ EffectGraphVisitor for_right(owner(), temp_index());
+ node->right()->Visit(&for_right);
+ if (node->kind() == Token::kAND) {
+ Join(for_left, for_right, empty);
+ } else {
+ Join(for_left, empty, for_right);
+ }
}
return;
}
« no previous file with comments | « no previous file | tests/language/issue13474_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698