| 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/bit_vector.h" | 9 #include "vm/bit_vector.h" |
| 10 #include "vm/cha.h" | 10 #include "vm/cha.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 namespace dart { | 26 namespace dart { |
| 27 | 27 |
| 28 DECLARE_FLAG(bool, code_comments); | 28 DECLARE_FLAG(bool, code_comments); |
| 29 DECLARE_FLAG(bool, disassemble); | 29 DECLARE_FLAG(bool, disassemble); |
| 30 DECLARE_FLAG(bool, disassemble_optimized); | 30 DECLARE_FLAG(bool, disassemble_optimized); |
| 31 DECLARE_FLAG(bool, emit_edge_counters); | 31 DECLARE_FLAG(bool, emit_edge_counters); |
| 32 DECLARE_FLAG(bool, enable_type_checks); | 32 DECLARE_FLAG(bool, enable_type_checks); |
| 33 DECLARE_FLAG(bool, intrinsify); | 33 DECLARE_FLAG(bool, intrinsify); |
| 34 DECLARE_FLAG(bool, propagate_ic_data); | 34 DECLARE_FLAG(bool, propagate_ic_data); |
| 35 DECLARE_FLAG(int, optimization_counter_threshold); | 35 DECLARE_FLAG(int, optimization_counter_threshold); |
| 36 DEFINE_FLAG(int, optimization_counter_scale, 2000, |
| 37 "The scale of invocation count, by size of the function."); |
| 38 DEFINE_FLAG(int, min_optimization_counter_threshold, 5000, |
| 39 "The minimum invocation count for a function."); |
| 40 DECLARE_FLAG(int, reoptimization_counter_threshold); |
| 36 DECLARE_FLAG(bool, use_cha); | 41 DECLARE_FLAG(bool, use_cha); |
| 37 DECLARE_FLAG(bool, use_osr); | 42 DECLARE_FLAG(bool, use_osr); |
| 38 DECLARE_FLAG(int, stacktrace_every); | 43 DECLARE_FLAG(int, stacktrace_every); |
| 39 DECLARE_FLAG(charp, stacktrace_filter); | 44 DECLARE_FLAG(charp, stacktrace_filter); |
| 40 DECLARE_FLAG(int, deoptimize_every); | 45 DECLARE_FLAG(int, deoptimize_every); |
| 41 DECLARE_FLAG(charp, deoptimize_filter); | 46 DECLARE_FLAG(charp, deoptimize_filter); |
| 42 DECLARE_FLAG(bool, warn_on_javascript_compatibility); | 47 DECLARE_FLAG(bool, warn_on_javascript_compatibility); |
| 43 DEFINE_FLAG(bool, enable_simd_inline, true, | 48 DEFINE_FLAG(bool, enable_simd_inline, true, |
| 44 "Enable inlining of SIMD related method calls."); | 49 "Enable inlining of SIMD related method calls."); |
| 45 DEFINE_FLAG(bool, source_lines, false, "Emit source line as assembly comment."); | 50 DEFINE_FLAG(bool, source_lines, false, "Emit source line as assembly comment."); |
| (...skipping 1376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1422 return res; | 1427 return res; |
| 1423 } | 1428 } |
| 1424 const ICData& ic_data = ICData::ZoneHandle(isolate(), ICData::New( | 1429 const ICData& ic_data = ICData::ZoneHandle(isolate(), ICData::New( |
| 1425 parsed_function().function(), String::Handle(isolate(), target.name()), | 1430 parsed_function().function(), String::Handle(isolate(), target.name()), |
| 1426 arguments_descriptor, deopt_id, num_args_tested)); | 1431 arguments_descriptor, deopt_id, num_args_tested)); |
| 1427 ic_data.AddTarget(target); | 1432 ic_data.AddTarget(target); |
| 1428 (*deopt_id_to_ic_data_)[deopt_id] = &ic_data; | 1433 (*deopt_id_to_ic_data_)[deopt_id] = &ic_data; |
| 1429 return &ic_data; | 1434 return &ic_data; |
| 1430 } | 1435 } |
| 1431 | 1436 |
| 1437 |
| 1438 intptr_t FlowGraphCompiler::GetOptimizationThreshold() const { |
| 1439 intptr_t threshold; |
| 1440 if (is_optimizing()) { |
| 1441 threshold = FLAG_reoptimization_counter_threshold; |
| 1442 } else { |
| 1443 const intptr_t basic_blocks = flow_graph().preorder().length(); |
| 1444 ASSERT(basic_blocks > 0); |
| 1445 threshold = FLAG_optimization_counter_scale * basic_blocks + |
| 1446 FLAG_min_optimization_counter_threshold; |
| 1447 if (threshold > FLAG_optimization_counter_threshold) { |
| 1448 threshold = FLAG_optimization_counter_threshold; |
| 1449 } |
| 1450 } |
| 1451 return threshold; |
| 1452 } |
| 1453 |
| 1432 } // namespace dart | 1454 } // namespace dart |
| OLD | NEW |