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

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

Issue 23549020: Optimize conditional branches that have same true/false targets. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 3 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
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/intermediate_language.h" 5 #include "vm/intermediate_language.h"
6 6
7 #include "vm/bigint_operations.h" 7 #include "vm/bigint_operations.h"
8 #include "vm/bit_vector.h" 8 #include "vm/bit_vector.h"
9 #include "vm/dart_entry.h" 9 #include "vm/dart_entry.h"
10 #include "vm/flow_graph_allocator.h" 10 #include "vm/flow_graph_allocator.h"
(...skipping 943 matching lines...) Expand 10 before | Expand all | Expand 10 after
954 use_idx += step) { 954 use_idx += step) {
955 phi->SetInputAt(use_idx, phi->InputAt(use_idx + step)); 955 phi->SetInputAt(use_idx, phi->InputAt(use_idx + step));
956 } 956 }
957 // Write the predecessor use. 957 // Write the predecessor use.
958 phi->SetInputAt(new_index, pred_use); 958 phi->SetInputAt(new_index, pred_use);
959 } 959 }
960 } 960 }
961 } 961 }
962 962
963 963
964 void BlockEntryInstr::UnuseAllInstructions() {
Kevin Millikin (Google) 2013/09/27 11:03:43 The name is a bit off. We don't use instructions
Florian Schneider 2013/09/30 12:19:23 Done.
965 JoinEntryInstr* join = this->AsJoinEntry();
966 if (join != NULL) {
967 for (PhiIterator it(join); !it.Done(); it.Advance()) {
968 it.Current()->UnuseAllInputs();
969 }
970 }
971 UnuseAllInputs();
972 for (ForwardInstructionIterator it(this);
973 !it.Done();
974 it.Advance()) {
975 it.Current()->UnuseAllInputs();
976 }
977 }
978
979
964 void JoinEntryInstr::InsertPhi(intptr_t var_index, intptr_t var_count) { 980 void JoinEntryInstr::InsertPhi(intptr_t var_index, intptr_t var_count) {
965 // Lazily initialize the array of phis. 981 // Lazily initialize the array of phis.
966 // Currently, phis are stored in a sparse array that holds the phi 982 // Currently, phis are stored in a sparse array that holds the phi
967 // for variable with index i at position i. 983 // for variable with index i at position i.
968 // TODO(fschneider): Store phis in a more compact way. 984 // TODO(fschneider): Store phis in a more compact way.
969 if (phis_ == NULL) { 985 if (phis_ == NULL) {
970 phis_ = new ZoneGrowableArray<PhiInstr*>(var_count); 986 phis_ = new ZoneGrowableArray<PhiInstr*>(var_count);
971 for (intptr_t i = 0; i < var_count; i++) { 987 for (intptr_t i = 0; i < var_count; i++) {
972 phis_->Add(NULL); 988 phis_->Add(NULL);
973 } 989 }
(...skipping 1694 matching lines...) Expand 10 before | Expand all | Expand 10 after
2668 return kCosRuntimeEntry; 2684 return kCosRuntimeEntry;
2669 default: 2685 default:
2670 UNREACHABLE(); 2686 UNREACHABLE();
2671 } 2687 }
2672 return kSinRuntimeEntry; 2688 return kSinRuntimeEntry;
2673 } 2689 }
2674 2690
2675 #undef __ 2691 #undef __
2676 2692
2677 } // namespace dart 2693 } // namespace dart
OLDNEW
« runtime/vm/flow_graph_optimizer.cc ('K') | « runtime/vm/intermediate_language.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698