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

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: addressed comments 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/intermediate_language.h ('k') | 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/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 bool BlockEntryInstr::IsEmptyBlock() {
965 return !HasParallelMove() &&
966 next()->IsGoto() &&
967 !next()->AsGoto()->HasParallelMove() &&
968 (!IsJoinEntry() || (AsJoinEntry()->phis() == NULL));
969 }
970
971
972 void BlockEntryInstr::ClearAllInstructions() {
973 JoinEntryInstr* join = this->AsJoinEntry();
974 if (join != NULL) {
975 for (PhiIterator it(join); !it.Done(); it.Advance()) {
976 it.Current()->UnuseAllInputs();
977 }
978 }
979 UnuseAllInputs();
980 for (ForwardInstructionIterator it(this);
981 !it.Done();
982 it.Advance()) {
983 it.Current()->UnuseAllInputs();
984 }
985 }
986
987
964 void JoinEntryInstr::InsertPhi(intptr_t var_index, intptr_t var_count) { 988 void JoinEntryInstr::InsertPhi(intptr_t var_index, intptr_t var_count) {
965 // Lazily initialize the array of phis. 989 // Lazily initialize the array of phis.
966 // Currently, phis are stored in a sparse array that holds the phi 990 // Currently, phis are stored in a sparse array that holds the phi
967 // for variable with index i at position i. 991 // for variable with index i at position i.
968 // TODO(fschneider): Store phis in a more compact way. 992 // TODO(fschneider): Store phis in a more compact way.
969 if (phis_ == NULL) { 993 if (phis_ == NULL) {
970 phis_ = new ZoneGrowableArray<PhiInstr*>(var_count); 994 phis_ = new ZoneGrowableArray<PhiInstr*>(var_count);
971 for (intptr_t i = 0; i < var_count; i++) { 995 for (intptr_t i = 0; i < var_count; i++) {
972 phis_->Add(NULL); 996 phis_->Add(NULL);
973 } 997 }
(...skipping 1694 matching lines...) Expand 10 before | Expand all | Expand 10 after
2668 return kCosRuntimeEntry; 2692 return kCosRuntimeEntry;
2669 default: 2693 default:
2670 UNREACHABLE(); 2694 UNREACHABLE();
2671 } 2695 }
2672 return kSinRuntimeEntry; 2696 return kSinRuntimeEntry;
2673 } 2697 }
2674 2698
2675 #undef __ 2699 #undef __
2676 2700
2677 } // namespace dart 2701 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698