| OLD | NEW |
| 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/globals.h" // Needed here to get TARGET_ARCH_XXX. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_XXX. |
| 6 | 6 |
| 7 #include "vm/flow_graph_compiler.h" | 7 #include "vm/flow_graph_compiler.h" |
| 8 | 8 |
| 9 #include "vm/cha.h" | 9 #include "vm/cha.h" |
| 10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 namespace dart { | 23 namespace dart { |
| 24 | 24 |
| 25 DEFINE_FLAG(bool, print_scopes, false, "Print scopes of local variables."); | 25 DEFINE_FLAG(bool, print_scopes, false, "Print scopes of local variables."); |
| 26 DECLARE_FLAG(bool, code_comments); | 26 DECLARE_FLAG(bool, code_comments); |
| 27 DECLARE_FLAG(bool, enable_type_checks); | 27 DECLARE_FLAG(bool, enable_type_checks); |
| 28 DECLARE_FLAG(bool, intrinsify); | 28 DECLARE_FLAG(bool, intrinsify); |
| 29 DECLARE_FLAG(bool, propagate_ic_data); | 29 DECLARE_FLAG(bool, propagate_ic_data); |
| 30 DECLARE_FLAG(bool, report_usage_count); | 30 DECLARE_FLAG(bool, report_usage_count); |
| 31 DECLARE_FLAG(int, optimization_counter_threshold); | 31 DECLARE_FLAG(int, optimization_counter_threshold); |
| 32 DECLARE_FLAG(bool, use_cha); | 32 DECLARE_FLAG(bool, use_cha); |
| 33 DECLARE_FLAG(bool, use_osr); |
| 33 | 34 |
| 34 | 35 |
| 35 // Assign locations to incoming arguments, i.e., values pushed above spill slots | 36 // Assign locations to incoming arguments, i.e., values pushed above spill slots |
| 36 // with PushArgument. Recursively allocates from outermost to innermost | 37 // with PushArgument. Recursively allocates from outermost to innermost |
| 37 // environment. | 38 // environment. |
| 38 void CompilerDeoptInfo::AllocateIncomingParametersRecursive( | 39 void CompilerDeoptInfo::AllocateIncomingParametersRecursive( |
| 39 Environment* env, | 40 Environment* env, |
| 40 intptr_t* stack_height) { | 41 intptr_t* stack_height) { |
| 41 if (env == NULL) return; | 42 if (env == NULL) return; |
| 42 AllocateIncomingParametersRecursive(env->outer(), stack_height); | 43 AllocateIncomingParametersRecursive(env->outer(), stack_height); |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 return !FLAG_report_usage_count && | 158 return !FLAG_report_usage_count && |
| 158 (FLAG_optimization_counter_threshold >= 0); | 159 (FLAG_optimization_counter_threshold >= 0); |
| 159 } | 160 } |
| 160 | 161 |
| 161 | 162 |
| 162 bool FlowGraphCompiler::CanOptimizeFunction() const { | 163 bool FlowGraphCompiler::CanOptimizeFunction() const { |
| 163 return CanOptimize() && !parsed_function().function().HasBreakpoint(); | 164 return CanOptimize() && !parsed_function().function().HasBreakpoint(); |
| 164 } | 165 } |
| 165 | 166 |
| 166 | 167 |
| 168 bool FlowGraphCompiler::CanOSRFunction() const { |
| 169 return FLAG_use_osr & CanOptimizeFunction() && !is_optimizing(); |
| 170 } |
| 171 |
| 172 |
| 167 static bool IsEmptyBlock(BlockEntryInstr* block) { | 173 static bool IsEmptyBlock(BlockEntryInstr* block) { |
| 168 return !block->HasParallelMove() && | 174 return !block->HasParallelMove() && |
| 169 block->next()->IsGoto() && | 175 block->next()->IsGoto() && |
| 170 !block->next()->AsGoto()->HasParallelMove(); | 176 !block->next()->AsGoto()->HasParallelMove(); |
| 171 } | 177 } |
| 172 | 178 |
| 173 | 179 |
| 174 void FlowGraphCompiler::CompactBlock(BlockEntryInstr* block) { | 180 void FlowGraphCompiler::CompactBlock(BlockEntryInstr* block) { |
| 175 BlockInfo* block_info = block_info_[block->postorder_number()]; | 181 BlockInfo* block_info = block_info_[block->postorder_number()]; |
| 176 | 182 |
| (...skipping 909 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1086 | 1092 |
| 1087 for (int i = 0; i < len; i++) { | 1093 for (int i = 0; i < len; i++) { |
| 1088 sorted->Add(CidTarget(ic_data.GetReceiverClassIdAt(i), | 1094 sorted->Add(CidTarget(ic_data.GetReceiverClassIdAt(i), |
| 1089 &Function::ZoneHandle(ic_data.GetTargetAt(i)), | 1095 &Function::ZoneHandle(ic_data.GetTargetAt(i)), |
| 1090 ic_data.GetCountAt(i))); | 1096 ic_data.GetCountAt(i))); |
| 1091 } | 1097 } |
| 1092 sorted->Sort(HighestCountFirst); | 1098 sorted->Sort(HighestCountFirst); |
| 1093 } | 1099 } |
| 1094 | 1100 |
| 1095 } // namespace dart | 1101 } // namespace dart |
| OLD | NEW |