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

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

Issue 261823005: Optimize conditional branches that have same true/false targets. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 7 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/cpu.h" 9 #include "vm/cpu.h"
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 1042 matching lines...) Expand 10 before | Expand all | Expand 10 after
1053 use_idx += step) { 1053 use_idx += step) {
1054 phi->SetInputAt(use_idx, phi->InputAt(use_idx + step)); 1054 phi->SetInputAt(use_idx, phi->InputAt(use_idx + step));
1055 } 1055 }
1056 // Write the predecessor use. 1056 // Write the predecessor use.
1057 phi->SetInputAt(new_index, pred_use); 1057 phi->SetInputAt(new_index, pred_use);
1058 } 1058 }
1059 } 1059 }
1060 } 1060 }
1061 1061
1062 1062
1063 void BlockEntryInstr::ClearAllInstructions() {
1064 JoinEntryInstr* join = this->AsJoinEntry();
1065 if (join != NULL) {
1066 for (PhiIterator it(join); !it.Done(); it.Advance()) {
1067 it.Current()->UnuseAllInputs();
1068 }
1069 }
1070 UnuseAllInputs();
1071 for (ForwardInstructionIterator it(this);
1072 !it.Done();
1073 it.Advance()) {
1074 it.Current()->UnuseAllInputs();
1075 }
1076 }
1077
1078
1063 void JoinEntryInstr::InsertPhi(intptr_t var_index, intptr_t var_count) { 1079 void JoinEntryInstr::InsertPhi(intptr_t var_index, intptr_t var_count) {
1064 // Lazily initialize the array of phis. 1080 // Lazily initialize the array of phis.
1065 // Currently, phis are stored in a sparse array that holds the phi 1081 // Currently, phis are stored in a sparse array that holds the phi
1066 // for variable with index i at position i. 1082 // for variable with index i at position i.
1067 // TODO(fschneider): Store phis in a more compact way. 1083 // TODO(fschneider): Store phis in a more compact way.
1068 if (phis_ == NULL) { 1084 if (phis_ == NULL) {
1069 phis_ = new ZoneGrowableArray<PhiInstr*>(var_count); 1085 phis_ = new ZoneGrowableArray<PhiInstr*>(var_count);
1070 for (intptr_t i = 0; i < var_count; i++) { 1086 for (intptr_t i = 0; i < var_count; i++) {
1071 phis_->Add(NULL); 1087 phis_->Add(NULL);
1072 } 1088 }
(...skipping 2265 matching lines...) Expand 10 before | Expand all | Expand 10 after
3338 case Token::kTRUNCDIV: return 0; 3354 case Token::kTRUNCDIV: return 0;
3339 case Token::kMOD: return 1; 3355 case Token::kMOD: return 1;
3340 default: UNIMPLEMENTED(); return -1; 3356 default: UNIMPLEMENTED(); return -1;
3341 } 3357 }
3342 } 3358 }
3343 3359
3344 3360
3345 #undef __ 3361 #undef __
3346 3362
3347 } // namespace dart 3363 } // 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