| 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 17 matching lines...) Expand all Loading... |
| 28 DECLARE_FLAG(bool, disassemble_optimized); | 28 DECLARE_FLAG(bool, disassemble_optimized); |
| 29 DECLARE_FLAG(bool, enable_type_checks); | 29 DECLARE_FLAG(bool, enable_type_checks); |
| 30 DECLARE_FLAG(bool, intrinsify); | 30 DECLARE_FLAG(bool, intrinsify); |
| 31 DECLARE_FLAG(bool, propagate_ic_data); | 31 DECLARE_FLAG(bool, propagate_ic_data); |
| 32 DECLARE_FLAG(bool, report_usage_count); | 32 DECLARE_FLAG(bool, report_usage_count); |
| 33 DECLARE_FLAG(int, optimization_counter_threshold); | 33 DECLARE_FLAG(int, optimization_counter_threshold); |
| 34 DECLARE_FLAG(bool, use_cha); | 34 DECLARE_FLAG(bool, use_cha); |
| 35 DECLARE_FLAG(bool, use_osr); | 35 DECLARE_FLAG(bool, use_osr); |
| 36 DEFINE_FLAG(bool, enable_simd_inline, true, | 36 DEFINE_FLAG(bool, enable_simd_inline, true, |
| 37 "Enable inlining of SIMD related method calls."); | 37 "Enable inlining of SIMD related method calls."); |
| 38 DEFINE_FLAG(charp, deoptimize_filter, NULL, |
| 39 "Force deoptimization in named function"); |
| 38 | 40 |
| 39 // Assign locations to incoming arguments, i.e., values pushed above spill slots | 41 // Assign locations to incoming arguments, i.e., values pushed above spill slots |
| 40 // with PushArgument. Recursively allocates from outermost to innermost | 42 // with PushArgument. Recursively allocates from outermost to innermost |
| 41 // environment. | 43 // environment. |
| 42 void CompilerDeoptInfo::AllocateIncomingParametersRecursive( | 44 void CompilerDeoptInfo::AllocateIncomingParametersRecursive( |
| 43 Environment* env, | 45 Environment* env, |
| 44 intptr_t* stack_height) { | 46 intptr_t* stack_height) { |
| 45 if (env == NULL) return; | 47 if (env == NULL) return; |
| 46 AllocateIncomingParametersRecursive(env->outer(), stack_height); | 48 AllocateIncomingParametersRecursive(env->outer(), stack_height); |
| 47 for (Environment::ShallowIterator it(env); !it.Done(); it.Advance()) { | 49 for (Environment::ShallowIterator it(env); !it.Done(); it.Advance()) { |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 bool FlowGraphCompiler::CanOptimizeFunction() const { | 164 bool FlowGraphCompiler::CanOptimizeFunction() const { |
| 163 return CanOptimize() && !parsed_function().function().HasBreakpoint(); | 165 return CanOptimize() && !parsed_function().function().HasBreakpoint(); |
| 164 } | 166 } |
| 165 | 167 |
| 166 | 168 |
| 167 bool FlowGraphCompiler::CanOSRFunction() const { | 169 bool FlowGraphCompiler::CanOSRFunction() const { |
| 168 return FLAG_use_osr & CanOptimizeFunction() && !is_optimizing(); | 170 return FLAG_use_osr & CanOptimizeFunction() && !is_optimizing(); |
| 169 } | 171 } |
| 170 | 172 |
| 171 | 173 |
| 174 bool FlowGraphCompiler::ShouldDeoptimizeFunction() const { |
| 175 return (is_optimizing() && |
| 176 (FLAG_deoptimize_filter != NULL) && |
| 177 (strstr(parsed_function().function().ToFullyQualifiedCString(), |
| 178 FLAG_deoptimize_filter) != NULL)); |
| 179 } |
| 180 |
| 181 |
| 172 static bool IsEmptyBlock(BlockEntryInstr* block) { | 182 static bool IsEmptyBlock(BlockEntryInstr* block) { |
| 173 return !block->HasParallelMove() && | 183 return !block->HasParallelMove() && |
| 174 block->next()->IsGoto() && | 184 block->next()->IsGoto() && |
| 175 !block->next()->AsGoto()->HasParallelMove(); | 185 !block->next()->AsGoto()->HasParallelMove(); |
| 176 } | 186 } |
| 177 | 187 |
| 178 | 188 |
| 179 void FlowGraphCompiler::CompactBlock(BlockEntryInstr* block) { | 189 void FlowGraphCompiler::CompactBlock(BlockEntryInstr* block) { |
| 180 BlockInfo* block_info = block_info_[block->postorder_number()]; | 190 BlockInfo* block_info = block_info_[block->postorder_number()]; |
| 181 | 191 |
| (...skipping 1077 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1259 | 1269 |
| 1260 for (int i = 0; i < len; i++) { | 1270 for (int i = 0; i < len; i++) { |
| 1261 sorted->Add(CidTarget(ic_data.GetReceiverClassIdAt(i), | 1271 sorted->Add(CidTarget(ic_data.GetReceiverClassIdAt(i), |
| 1262 &Function::ZoneHandle(ic_data.GetTargetAt(i)), | 1272 &Function::ZoneHandle(ic_data.GetTargetAt(i)), |
| 1263 ic_data.GetCountAt(i))); | 1273 ic_data.GetCountAt(i))); |
| 1264 } | 1274 } |
| 1265 sorted->Sort(HighestCountFirst); | 1275 sorted->Sort(HighestCountFirst); |
| 1266 } | 1276 } |
| 1267 | 1277 |
| 1268 } // namespace dart | 1278 } // namespace dart |
| OLD | NEW |