Chromium Code Reviews| 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" |
| 11 #include "vm/compiler.h" | 11 #include "vm/compiler.h" |
| 12 #include "vm/dart_entry.h" | 12 #include "vm/dart_entry.h" |
| 13 #include "vm/debugger.h" | 13 #include "vm/debugger.h" |
| 14 #include "vm/deopt_instructions.h" | 14 #include "vm/deopt_instructions.h" |
| 15 #include "vm/exceptions.h" | 15 #include "vm/exceptions.h" |
| 16 #include "vm/flags.h" | |
| 16 #include "vm/flow_graph_allocator.h" | 17 #include "vm/flow_graph_allocator.h" |
| 17 #include "vm/il_printer.h" | 18 #include "vm/il_printer.h" |
| 18 #include "vm/intrinsifier.h" | 19 #include "vm/intrinsifier.h" |
| 19 #include "vm/locations.h" | 20 #include "vm/locations.h" |
| 20 #include "vm/log.h" | 21 #include "vm/log.h" |
| 21 #include "vm/longjump.h" | 22 #include "vm/longjump.h" |
| 22 #include "vm/object_store.h" | 23 #include "vm/object_store.h" |
| 23 #include "vm/parser.h" | 24 #include "vm/parser.h" |
| 24 #include "vm/raw_object.h" | 25 #include "vm/raw_object.h" |
| 25 #include "vm/stack_frame.h" | 26 #include "vm/stack_frame.h" |
| 26 #include "vm/stub_code.h" | 27 #include "vm/stub_code.h" |
| 27 #include "vm/symbols.h" | 28 #include "vm/symbols.h" |
| 28 #include "vm/timeline.h" | 29 #include "vm/timeline.h" |
| 29 | 30 |
| 30 namespace dart { | 31 namespace dart { |
| 31 | 32 |
| 32 DEFINE_FLAG(bool, allow_absolute_addresses, true, | 33 DEFINE_FLAG(bool, allow_absolute_addresses, true, |
| 33 "Allow embedding absolute addresses in generated code."); | 34 "Allow embedding absolute addresses in generated code."); |
| 34 DEFINE_FLAG(bool, always_megamorphic_calls, false, | 35 DEFINE_FLAG(bool, always_megamorphic_calls, false, |
| 35 "Instance call always as megamorphic."); | 36 "Instance call always as megamorphic."); |
| 36 DEFINE_FLAG(bool, enable_simd_inline, true, | 37 DEFINE_FLAG(bool, enable_simd_inline, true, |
| 37 "Enable inlining of SIMD related method calls."); | 38 "Enable inlining of SIMD related method calls."); |
| 38 DEFINE_FLAG(int, min_optimization_counter_threshold, 5000, | 39 DEFINE_FLAG(int, min_optimization_counter_threshold, 5000, |
| 39 "The minimum invocation count for a function."); | 40 "The minimum invocation count for a function."); |
| 40 DEFINE_FLAG(int, optimization_counter_scale, 2000, | 41 DEFINE_FLAG(int, optimization_counter_scale, 2000, |
| 41 "The scale of invocation count, by size of the function."); | 42 "The scale of invocation count, by size of the function."); |
| 42 DEFINE_FLAG(bool, polymorphic_with_deopt, true, | |
| 43 "Polymorphic calls can be generated so that failure either causes " | |
| 44 "deoptimization or falls through to a megamorphic call"); | |
| 45 DEFINE_FLAG(bool, source_lines, false, "Emit source line as assembly comment."); | 43 DEFINE_FLAG(bool, source_lines, false, "Emit source line as assembly comment."); |
| 46 DEFINE_FLAG(bool, trace_inlining_intervals, false, | 44 DEFINE_FLAG(bool, trace_inlining_intervals, false, |
| 47 "Inlining interval diagnostics"); | 45 "Inlining interval diagnostics"); |
| 48 DEFINE_FLAG(bool, use_megamorphic_stub, true, "Out of line megamorphic lookup"); | 46 DEFINE_FLAG(bool, use_megamorphic_stub, true, "Out of line megamorphic lookup"); |
| 49 | 47 |
| 50 DECLARE_FLAG(bool, background_compilation); | 48 DECLARE_FLAG(bool, background_compilation); |
| 51 DECLARE_FLAG(bool, code_comments); | 49 DECLARE_FLAG(bool, code_comments); |
| 52 DECLARE_FLAG(bool, collect_dynamic_function_names); | 50 DECLARE_FLAG(bool, collect_dynamic_function_names); |
| 53 DECLARE_FLAG(bool, deoptimize_alot); | 51 DECLARE_FLAG(bool, deoptimize_alot); |
| 54 DECLARE_FLAG(int, deoptimize_every); | 52 DECLARE_FLAG(int, deoptimize_every); |
| 55 DECLARE_FLAG(charp, deoptimize_filter); | 53 DECLARE_FLAG(charp, deoptimize_filter); |
| 56 DECLARE_FLAG(bool, emit_edge_counters); | 54 DECLARE_FLAG(bool, emit_edge_counters); |
| 57 DECLARE_FLAG(bool, fields_may_be_reset); | 55 DECLARE_FLAG(bool, fields_may_be_reset); |
| 58 DECLARE_FLAG(bool, ic_range_profiling); | 56 DECLARE_FLAG(bool, ic_range_profiling); |
| 59 DECLARE_FLAG(bool, intrinsify); | 57 DECLARE_FLAG(bool, intrinsify); |
| 60 DECLARE_FLAG(bool, load_deferred_eagerly); | 58 DECLARE_FLAG(bool, load_deferred_eagerly); |
| 61 DECLARE_FLAG(int, optimization_counter_threshold); | 59 DECLARE_FLAG(int, optimization_counter_threshold); |
| 62 DECLARE_FLAG(bool, propagate_ic_data); | 60 DECLARE_FLAG(bool, propagate_ic_data); |
| 63 DECLARE_FLAG(int, regexp_optimization_counter_threshold); | 61 DECLARE_FLAG(int, regexp_optimization_counter_threshold); |
| 64 DECLARE_FLAG(int, reoptimization_counter_threshold); | 62 DECLARE_FLAG(int, reoptimization_counter_threshold); |
| 65 DECLARE_FLAG(int, stacktrace_every); | 63 DECLARE_FLAG(int, stacktrace_every); |
| 66 DECLARE_FLAG(charp, stacktrace_filter); | 64 DECLARE_FLAG(charp, stacktrace_filter); |
| 67 DECLARE_FLAG(bool, use_field_guards); | 65 DECLARE_FLAG(bool, use_field_guards); |
| 68 DECLARE_FLAG(bool, use_cha_deopt); | |
| 69 DECLARE_FLAG(bool, use_osr); | 66 DECLARE_FLAG(bool, use_osr); |
| 70 DECLARE_FLAG(bool, print_stop_message); | 67 DECLARE_FLAG(bool, print_stop_message); |
| 71 DECLARE_FLAG(bool, lazy_dispatchers); | |
| 72 DECLARE_FLAG(bool, interpret_irregexp); | 68 DECLARE_FLAG(bool, interpret_irregexp); |
| 73 DECLARE_FLAG(bool, enable_mirrors); | 69 DECLARE_FLAG(bool, enable_mirrors); |
| 74 DECLARE_FLAG(bool, link_natives_lazily); | 70 DECLARE_FLAG(bool, link_natives_lazily); |
| 75 DECLARE_FLAG(bool, trace_compiler); | 71 DECLARE_FLAG(bool, trace_compiler); |
| 76 DECLARE_FLAG(int, inlining_hotness); | 72 DECLARE_FLAG(int, inlining_hotness); |
| 77 DECLARE_FLAG(int, inlining_size_threshold); | 73 DECLARE_FLAG(int, inlining_size_threshold); |
| 78 DECLARE_FLAG(int, inlining_callee_size_threshold); | 74 DECLARE_FLAG(int, inlining_callee_size_threshold); |
| 79 DECLARE_FLAG(int, inline_getters_setters_smaller_than); | 75 DECLARE_FLAG(int, inline_getters_setters_smaller_than); |
| 80 DECLARE_FLAG(int, inlining_depth_threshold); | 76 DECLARE_FLAG(int, inlining_depth_threshold); |
| 81 DECLARE_FLAG(int, inlining_caller_size_threshold); | 77 DECLARE_FLAG(int, inlining_caller_size_threshold); |
| 82 DECLARE_FLAG(int, inlining_constant_arguments_max_size_threshold); | 78 DECLARE_FLAG(int, inlining_constant_arguments_max_size_threshold); |
| 83 DECLARE_FLAG(int, inlining_constant_arguments_min_size_threshold); | 79 DECLARE_FLAG(int, inlining_constant_arguments_min_size_threshold); |
| 84 | 80 |
| 85 bool FLAG_precompilation = false; | 81 bool FLAG_precompilation = false; |
| 86 static void PrecompilationModeHandler(bool value) { | 82 static void PrecompilationModeHandler(bool value) { |
| 87 if (value) { | 83 if (value) { |
| 88 #if defined(TARGET_ARCH_IA32) | 84 #if defined(TARGET_ARCH_IA32) |
| 89 FATAL("Precompilation not supported on IA32"); | 85 FATAL("Precompilation not supported on IA32"); |
| 90 #endif | 86 #endif |
| 91 FLAG_precompilation = true; | 87 FLAG_precompilation = true; |
| 92 | 88 |
| 93 FLAG_always_megamorphic_calls = true; | 89 FLAG_always_megamorphic_calls = true; |
| 94 FLAG_polymorphic_with_deopt = false; | |
| 95 FLAG_optimization_counter_threshold = -1; | 90 FLAG_optimization_counter_threshold = -1; |
| 96 FLAG_use_field_guards = false; | 91 FLAG_use_field_guards = false; |
| 97 FLAG_use_osr = false; | 92 FLAG_use_osr = false; |
| 98 FLAG_emit_edge_counters = false; | 93 FLAG_emit_edge_counters = false; |
| 99 #ifndef PRODUCT | 94 #ifndef PRODUCT |
| 100 FLAG_support_debugger = false; | 95 FLAG_support_debugger = false; |
| 101 #endif | 96 #endif |
| 102 FLAG_ic_range_profiling = false; | 97 FLAG_ic_range_profiling = false; |
| 103 FLAG_collect_code = false; | 98 FLAG_collect_code = false; |
| 104 FLAG_load_deferred_eagerly = true; | 99 FLAG_load_deferred_eagerly = true; |
| 105 FLAG_deoptimize_alot = false; // Used in some tests. | 100 FLAG_deoptimize_alot = false; // Used in some tests. |
| 106 FLAG_deoptimize_every = 0; // Used in some tests. | 101 FLAG_deoptimize_every = 0; // Used in some tests. |
| 107 // Precompilation finalizes all classes and thus allows CHA optimizations. | 102 // Precompilation finalizes all classes and thus allows CHA optimizations. |
| 108 // Do not require CHA triggered deoptimization. | 103 // Do not require CHA triggered deoptimization. |
| 109 FLAG_use_cha_deopt = false; | 104 FLAG_use_cha_deopt = false; |
| 110 // Calling the PrintStopMessage stub is not supported in precompiled code | 105 // Calling the PrintStopMessage stub is not supported in precompiled code |
| 111 // since it is done at places where no pool pointer is loaded. | 106 // since it is done at places where no pool pointer is loaded. |
| 112 FLAG_print_stop_message = false; | 107 FLAG_print_stop_message = false; |
| 113 | 108 |
| 114 FLAG_lazy_dispatchers = false; | |
| 115 FLAG_interpret_irregexp = true; | 109 FLAG_interpret_irregexp = true; |
| 116 FLAG_enable_mirrors = false; | 110 FLAG_enable_mirrors = false; |
| 117 FLAG_link_natives_lazily = true; | 111 FLAG_link_natives_lazily = true; |
| 118 FLAG_fields_may_be_reset = true; | 112 FLAG_fields_may_be_reset = true; |
| 119 FLAG_allow_absolute_addresses = false; | 113 FLAG_allow_absolute_addresses = false; |
| 120 | 114 |
| 121 // There is no counter feedback in precompilation, so ignore the counter | 115 // There is no counter feedback in precompilation, so ignore the counter |
| 122 // when making inlining decisions. | 116 // when making inlining decisions. |
| 123 FLAG_inlining_hotness = 0; | 117 FLAG_inlining_hotness = 0; |
| 124 // Use smaller thresholds in precompilation as we are compiling everything | 118 // Use smaller thresholds in precompilation as we are compiling everything |
| 125 // with the optimizing compiler instead of only hot functions. | 119 // with the optimizing compiler instead of only hot functions. |
| 126 FLAG_inlining_size_threshold = 5; | 120 FLAG_inlining_size_threshold = 5; |
| 127 FLAG_inline_getters_setters_smaller_than = 5; | 121 FLAG_inline_getters_setters_smaller_than = 5; |
| 128 FLAG_inlining_callee_size_threshold = 20; | 122 FLAG_inlining_callee_size_threshold = 20; |
| 129 FLAG_inlining_depth_threshold = 2; | 123 FLAG_inlining_depth_threshold = 2; |
| 130 FLAG_inlining_caller_size_threshold = 1000; | 124 FLAG_inlining_caller_size_threshold = 1000; |
| 131 | 125 |
| 132 FLAG_inlining_constant_arguments_max_size_threshold = 100; | 126 FLAG_inlining_constant_arguments_max_size_threshold = 100; |
| 133 FLAG_inlining_constant_arguments_min_size_threshold = 30; | 127 FLAG_inlining_constant_arguments_min_size_threshold = 30; |
| 134 | 128 |
| 135 // Background compilation relies on two-stage compilation pipeline, | 129 // Background compilation relies on two-stage compilation pipeline, |
| 136 // while precompilation has only one. | 130 // while precompilation has only one. |
| 137 FLAG_background_compilation = false; | 131 FLAG_background_compilation = false; |
| 138 FLAG_collect_dynamic_function_names = true; | 132 FLAG_collect_dynamic_function_names = true; |
| 133 #if !defined(DART_PRECOMPILED_RUNTIME) | |
| 134 FLAG_lazy_dispatchers = false; | |
| 135 FLAG_polymorphic_with_deopt = false; | |
|
rmacnak
2016/02/19 23:46:04
use_cha_deopt
Florian Schneider
2016/02/23 15:27:03
Done.
| |
| 136 #else | |
| 137 COMPILE_ASSERT(!FLAG_lazy_dispatchers); | |
| 138 COMPILE_ASSERT(!FLAG_polymorphic_with_deopt); | |
| 139 #endif | |
| 139 } | 140 } |
| 140 } | 141 } |
| 141 | 142 |
| 142 | 143 |
| 143 DEFINE_FLAG_HANDLER(PrecompilationModeHandler, | 144 DEFINE_FLAG_HANDLER(PrecompilationModeHandler, |
| 144 precompilation, | 145 precompilation, |
| 145 "Precompilation mode"); | 146 "Precompilation mode"); |
| 146 | 147 |
| 147 | 148 |
| 148 // Assign locations to incoming arguments, i.e., values pushed above spill slots | 149 // Assign locations to incoming arguments, i.e., values pushed above spill slots |
| (...skipping 1723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1872 | 1873 |
| 1873 | 1874 |
| 1874 void FlowGraphCompiler::FrameStateClear() { | 1875 void FlowGraphCompiler::FrameStateClear() { |
| 1875 ASSERT(!is_optimizing()); | 1876 ASSERT(!is_optimizing()); |
| 1876 frame_state_.TruncateTo(0); | 1877 frame_state_.TruncateTo(0); |
| 1877 } | 1878 } |
| 1878 #endif | 1879 #endif |
| 1879 | 1880 |
| 1880 | 1881 |
| 1881 } // namespace dart | 1882 } // namespace dart |
| OLD | NEW |