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

Side by Side Diff: runtime/vm/flow_graph_optimizer.cc

Issue 23011043: Correctly clone comparisons in branch optimizations of Dart VM. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/flow_graph_optimizer.h" 5 #include "vm/flow_graph_optimizer.h"
6 6
7 #include "vm/bit_vector.h" 7 #include "vm/bit_vector.h"
8 #include "vm/cha.h" 8 #include "vm/cha.h"
9 #include "vm/dart_entry.h" 9 #include "vm/dart_entry.h"
10 #include "vm/flow_graph_builder.h" 10 #include "vm/flow_graph_builder.h"
(...skipping 6950 matching lines...) Expand 10 before | Expand all | Expand 10 after
6961 right); 6961 right);
6962 } else if (comparison->IsEqualityCompare()) { 6962 } else if (comparison->IsEqualityCompare()) {
6963 EqualityCompareInstr* equality_compare = comparison->AsEqualityCompare(); 6963 EqualityCompareInstr* equality_compare = comparison->AsEqualityCompare();
6964 EqualityCompareInstr* new_equality_compare = 6964 EqualityCompareInstr* new_equality_compare =
6965 new EqualityCompareInstr(equality_compare->token_pos(), 6965 new EqualityCompareInstr(equality_compare->token_pos(),
6966 comparison->kind(), 6966 comparison->kind(),
6967 left, 6967 left,
6968 right, 6968 right,
6969 Object::null_array()); 6969 Object::null_array());
6970 new_equality_compare->set_ic_data(equality_compare->ic_data()); 6970 new_equality_compare->set_ic_data(equality_compare->ic_data());
6971 new_equality_compare->set_operation_cid(equality_compare->operation_cid());
6971 new_comparison = new_equality_compare; 6972 new_comparison = new_equality_compare;
6972 } else { 6973 } else {
6973 ASSERT(comparison->IsRelationalOp()); 6974 ASSERT(comparison->IsRelationalOp());
6974 RelationalOpInstr* relational_op = comparison->AsRelationalOp(); 6975 RelationalOpInstr* relational_op = comparison->AsRelationalOp();
6975 RelationalOpInstr* new_relational_op = 6976 RelationalOpInstr* new_relational_op =
6976 new RelationalOpInstr(relational_op->token_pos(), 6977 new RelationalOpInstr(relational_op->token_pos(),
6977 comparison->kind(), 6978 comparison->kind(),
6978 left, 6979 left,
6979 right, 6980 right,
6980 Object::null_array()); 6981 Object::null_array());
6981 new_relational_op->set_ic_data(relational_op->ic_data()); 6982 new_relational_op->set_ic_data(relational_op->ic_data());
6983 new_relational_op->set_operation_cid(relational_op->operation_cid());
6982 new_comparison = new_relational_op; 6984 new_comparison = new_relational_op;
6983 } 6985 }
6984 return new BranchInstr(new_comparison, branch->is_checked()); 6986 return new BranchInstr(new_comparison, branch->is_checked());
6985 } 6987 }
6986 6988
6987 6989
6988 void BranchSimplifier::Simplify(FlowGraph* flow_graph) { 6990 void BranchSimplifier::Simplify(FlowGraph* flow_graph) {
6989 // Optimize some branches that test the value of a phi. When it is safe 6991 // Optimize some branches that test the value of a phi. When it is safe
6990 // to do so, push the branch to each of the predecessor blocks. This is 6992 // to do so, push the branch to each of the predecessor blocks. This is
6991 // an optimization when (a) it can avoid materializing a boolean object at 6993 // an optimization when (a) it can avoid materializing a boolean object at
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after
7504 } 7506 }
7505 7507
7506 // Insert materializations at environment uses. 7508 // Insert materializations at environment uses.
7507 for (intptr_t i = 0; i < exits.length(); i++) { 7509 for (intptr_t i = 0; i < exits.length(); i++) {
7508 CreateMaterializationAt(exits[i], alloc, alloc->cls(), *fields); 7510 CreateMaterializationAt(exits[i], alloc, alloc->cls(), *fields);
7509 } 7511 }
7510 } 7512 }
7511 7513
7512 7514
7513 } // namespace dart 7515 } // namespace dart
OLDNEW
« 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