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

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

Issue 197283004: Generate smaller unoptimized code for certain expressions. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 9 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 | runtime/vm/flow_graph_builder.cc » ('j') | 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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.h" 5 #include "vm/flow_graph.h"
6 6
7 #include "vm/bit_vector.h" 7 #include "vm/bit_vector.h"
8 #include "vm/flow_graph_builder.h" 8 #include "vm/flow_graph_builder.h"
9 #include "vm/intermediate_language.h" 9 #include "vm/intermediate_language.h"
10 #include "vm/longjump.h" 10 #include "vm/longjump.h"
(...skipping 850 matching lines...) Expand 10 before | Expand all | Expand 10 after
861 LoadLocalInstr* load = definition->AsLoadLocal(); 861 LoadLocalInstr* load = definition->AsLoadLocal();
862 StoreLocalInstr* store = definition->AsStoreLocal(); 862 StoreLocalInstr* store = definition->AsStoreLocal();
863 PushTempInstr* push = definition->AsPushTemp(); 863 PushTempInstr* push = definition->AsPushTemp();
864 DropTempsInstr* drop = definition->AsDropTemps(); 864 DropTempsInstr* drop = definition->AsDropTemps();
865 ConstantInstr* constant = definition->AsConstant(); 865 ConstantInstr* constant = definition->AsConstant();
866 if ((load != NULL) || 866 if ((load != NULL) ||
867 (store != NULL) || 867 (store != NULL) ||
868 (push != NULL) || 868 (push != NULL) ||
869 (drop != NULL) || 869 (drop != NULL) ||
870 (constant != NULL)) { 870 (constant != NULL)) {
871 intptr_t index; 871 Definition* result = NULL;
872 Definition* result;
873 if (store != NULL) { 872 if (store != NULL) {
874 // Update renaming environment. 873 // Update renaming environment.
875 index = store->local().BitIndexIn(num_non_copied_params_); 874 intptr_t index = store->local().BitIndexIn(num_non_copied_params_);
876 result = store->value()->definition(); 875 result = store->value()->definition();
877 876
878 if (variable_liveness->IsStoreAlive(block_entry, store)) { 877 if (variable_liveness->IsStoreAlive(block_entry, store)) {
879 (*env)[index] = result; 878 (*env)[index] = result;
880 } else { 879 } else {
881 (*env)[index] = constant_dead(); 880 (*env)[index] = constant_dead();
882 } 881 }
883 } else if (load != NULL) { 882 } else if (load != NULL) {
884 // The graph construction ensures we do not have an unused LoadLocal 883 // The graph construction ensures we do not have an unused LoadLocal
885 // computation. 884 // computation.
886 ASSERT(definition->is_used()); 885 ASSERT(definition->is_used());
887 index = load->local().BitIndexIn(num_non_copied_params_); 886 intptr_t index = load->local().BitIndexIn(num_non_copied_params_);
888 result = (*env)[index]; 887 result = (*env)[index];
889 888
890 PhiInstr* phi = result->AsPhi(); 889 PhiInstr* phi = result->AsPhi();
891 if ((phi != NULL) && !phi->is_alive()) { 890 if ((phi != NULL) && !phi->is_alive()) {
892 phi->mark_alive(); 891 phi->mark_alive();
893 live_phis->Add(phi); 892 live_phis->Add(phi);
894 } 893 }
895 894
896 if (variable_liveness->IsLastLoad(block_entry, load)) { 895 if (variable_liveness->IsLastLoad(block_entry, load)) {
897 (*env)[index] = constant_dead(); 896 (*env)[index] = constant_dead();
898 } 897 }
899 } else if (push != NULL) { 898 } else if (push != NULL) {
900 result = push->value()->definition(); 899 result = push->value()->definition();
901 env->Add(result); 900 env->Add(result);
902 it.RemoveCurrentFromGraph(); 901 it.RemoveCurrentFromGraph();
903 continue; 902 continue;
904 } else if (drop != NULL) { 903 } else if (drop != NULL) {
905 // Drop temps from the environment. 904 // Drop temps from the environment.
906 for (intptr_t j = 0; j < drop->num_temps(); j++) { 905 for (intptr_t j = 0; j < drop->num_temps(); j++) {
907 env->RemoveLast(); 906 env->RemoveLast();
908 } 907 }
909 result = drop->value()->definition(); 908 if (drop->value() != NULL) {
909 result = drop->value()->definition();
910 }
911 ASSERT((drop->value() != NULL) || !drop->is_used());
910 } else { 912 } else {
911 ASSERT(definition->is_used()); 913 ASSERT(definition->is_used());
912 result = GetConstant(constant->value()); 914 result = GetConstant(constant->value());
913 } 915 }
914 // Update expression stack or remove from graph. 916 // Update expression stack or remove from graph.
915 if (definition->is_used()) { 917 if (definition->is_used()) {
916 ASSERT(result != NULL); 918 ASSERT(result != NULL);
917 env->Add(result); 919 env->Add(result);
918 // We remove load/store/constant instructions when we find their 920 // We remove load/store/constant instructions when we find their
919 // use in 2a. 921 // use in 2a.
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
1216 } 1218 }
1217 1219
1218 1220
1219 bool BlockEffects::IsSideEffectFreePath(BlockEntryInstr* from, 1221 bool BlockEffects::IsSideEffectFreePath(BlockEntryInstr* from,
1220 BlockEntryInstr* to) const { 1222 BlockEntryInstr* to) const {
1221 return available_at_[to->postorder_number()]->Contains( 1223 return available_at_[to->postorder_number()]->Contains(
1222 from->postorder_number()); 1224 from->postorder_number());
1223 } 1225 }
1224 1226
1225 } // namespace dart 1227 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/flow_graph_builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698