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

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

Issue 1714743002: VM: Separate precompilation-specific code, make flags const. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: fix build after merge Created 4 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
« no previous file with comments | « runtime/vm/flow_graph.cc ('k') | runtime/vm/flow_graph_inliner.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) 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, link_natives_lazily); 69 DECLARE_FLAG(bool, link_natives_lazily);
74 DECLARE_FLAG(bool, trace_compiler); 70 DECLARE_FLAG(bool, trace_compiler);
75 DECLARE_FLAG(int, inlining_hotness); 71 DECLARE_FLAG(int, inlining_hotness);
76 DECLARE_FLAG(int, inlining_size_threshold); 72 DECLARE_FLAG(int, inlining_size_threshold);
77 DECLARE_FLAG(int, inlining_callee_size_threshold); 73 DECLARE_FLAG(int, inlining_callee_size_threshold);
78 DECLARE_FLAG(int, inline_getters_setters_smaller_than); 74 DECLARE_FLAG(int, inline_getters_setters_smaller_than);
79 DECLARE_FLAG(int, inlining_depth_threshold); 75 DECLARE_FLAG(int, inlining_depth_threshold);
80 DECLARE_FLAG(int, inlining_caller_size_threshold); 76 DECLARE_FLAG(int, inlining_caller_size_threshold);
81 DECLARE_FLAG(int, inlining_constant_arguments_max_size_threshold); 77 DECLARE_FLAG(int, inlining_constant_arguments_max_size_threshold);
82 DECLARE_FLAG(int, inlining_constant_arguments_min_size_threshold); 78 DECLARE_FLAG(int, inlining_constant_arguments_min_size_threshold);
83 79
84 bool FLAG_precompilation = false; 80 bool FLAG_precompilation = false;
85 static void PrecompilationModeHandler(bool value) { 81 static void PrecompilationModeHandler(bool value) {
86 if (value) { 82 if (value) {
87 #if defined(TARGET_ARCH_IA32) 83 #if defined(TARGET_ARCH_IA32)
88 FATAL("Precompilation not supported on IA32"); 84 FATAL("Precompilation not supported on IA32");
89 #endif 85 #endif
90 FLAG_precompilation = true; 86 FLAG_precompilation = true;
91 87
92 FLAG_always_megamorphic_calls = true; 88 FLAG_always_megamorphic_calls = true;
93 FLAG_polymorphic_with_deopt = false;
94 FLAG_optimization_counter_threshold = -1; 89 FLAG_optimization_counter_threshold = -1;
95 FLAG_use_field_guards = false; 90 FLAG_use_field_guards = false;
96 FLAG_use_osr = false; 91 FLAG_use_osr = false;
97 FLAG_emit_edge_counters = false; 92 FLAG_emit_edge_counters = false;
98 #ifndef PRODUCT 93 #ifndef PRODUCT
99 FLAG_support_debugger = false; 94 FLAG_support_debugger = false;
100 #endif // !PRODUCT 95 #endif // !PRODUCT
101 FLAG_ic_range_profiling = false; 96 FLAG_ic_range_profiling = false;
102 FLAG_collect_code = false; 97 FLAG_collect_code = false;
103 FLAG_load_deferred_eagerly = true; 98 FLAG_load_deferred_eagerly = true;
104 FLAG_deoptimize_alot = false; // Used in some tests. 99 FLAG_deoptimize_alot = false; // Used in some tests.
105 FLAG_deoptimize_every = 0; // Used in some tests. 100 FLAG_deoptimize_every = 0; // Used in some tests.
106 // Precompilation finalizes all classes and thus allows CHA optimizations.
107 // Do not require CHA triggered deoptimization.
108 FLAG_use_cha_deopt = false;
109 // Calling the PrintStopMessage stub is not supported in precompiled code 101 // Calling the PrintStopMessage stub is not supported in precompiled code
110 // since it is done at places where no pool pointer is loaded. 102 // since it is done at places where no pool pointer is loaded.
111 FLAG_print_stop_message = false; 103 FLAG_print_stop_message = false;
112 104
113 FLAG_lazy_dispatchers = false;
114 FLAG_interpret_irregexp = true; 105 FLAG_interpret_irregexp = true;
115 #ifndef PRODUCT 106 #ifndef PRODUCT
116 FLAG_enable_mirrors = false; 107 FLAG_enable_mirrors = false;
117 #endif // !PRODUCT 108 #endif // !PRODUCT
118 FLAG_link_natives_lazily = true; 109 FLAG_link_natives_lazily = true;
119 FLAG_fields_may_be_reset = true; 110 FLAG_fields_may_be_reset = true;
120 FLAG_allow_absolute_addresses = false; 111 FLAG_allow_absolute_addresses = false;
121 112
122 // There is no counter feedback in precompilation, so ignore the counter 113 // There is no counter feedback in precompilation, so ignore the counter
123 // when making inlining decisions. 114 // when making inlining decisions.
124 FLAG_inlining_hotness = 0; 115 FLAG_inlining_hotness = 0;
125 // Use smaller thresholds in precompilation as we are compiling everything 116 // Use smaller thresholds in precompilation as we are compiling everything
126 // with the optimizing compiler instead of only hot functions. 117 // with the optimizing compiler instead of only hot functions.
127 FLAG_inlining_size_threshold = 5; 118 FLAG_inlining_size_threshold = 5;
128 FLAG_inline_getters_setters_smaller_than = 5; 119 FLAG_inline_getters_setters_smaller_than = 5;
129 FLAG_inlining_callee_size_threshold = 20; 120 FLAG_inlining_callee_size_threshold = 20;
130 FLAG_inlining_depth_threshold = 2; 121 FLAG_inlining_depth_threshold = 2;
131 FLAG_inlining_caller_size_threshold = 1000; 122 FLAG_inlining_caller_size_threshold = 1000;
132 123
133 FLAG_inlining_constant_arguments_max_size_threshold = 100; 124 FLAG_inlining_constant_arguments_max_size_threshold = 100;
134 FLAG_inlining_constant_arguments_min_size_threshold = 30; 125 FLAG_inlining_constant_arguments_min_size_threshold = 30;
135 126
136 // Background compilation relies on two-stage compilation pipeline, 127 // Background compilation relies on two-stage compilation pipeline,
137 // while precompilation has only one. 128 // while precompilation has only one.
138 FLAG_background_compilation = false; 129 FLAG_background_compilation = false;
139 FLAG_collect_dynamic_function_names = true; 130 FLAG_collect_dynamic_function_names = true;
131 #if !defined(DART_PRECOMPILED_RUNTIME)
132 FLAG_lazy_dispatchers = false;
133 FLAG_polymorphic_with_deopt = false;
134 // Precompilation finalizes all classes and thus allows CHA optimizations.
135 // Do not require CHA triggered deoptimization.
136 FLAG_use_cha_deopt = false;
137 #else
138 COMPILE_ASSERT(!FLAG_lazy_dispatchers);
139 COMPILE_ASSERT(!FLAG_polymorphic_with_deopt);
140 COMPILE_ASSERT(!FLAG_use_cha_deopt);
141 #endif
140 } 142 }
141 } 143 }
142 144
143 145
144 DEFINE_FLAG_HANDLER(PrecompilationModeHandler, 146 DEFINE_FLAG_HANDLER(PrecompilationModeHandler,
145 precompilation, 147 precompilation,
146 "Precompilation mode"); 148 "Precompilation mode");
147 149
148 150
149 // Assign locations to incoming arguments, i.e., values pushed above spill slots 151 // Assign locations to incoming arguments, i.e., values pushed above spill slots
(...skipping 1723 matching lines...) Expand 10 before | Expand all | Expand 10 after
1873 1875
1874 1876
1875 void FlowGraphCompiler::FrameStateClear() { 1877 void FlowGraphCompiler::FrameStateClear() {
1876 ASSERT(!is_optimizing()); 1878 ASSERT(!is_optimizing());
1877 frame_state_.TruncateTo(0); 1879 frame_state_.TruncateTo(0);
1878 } 1880 }
1879 #endif 1881 #endif
1880 1882
1881 1883
1882 } // namespace dart 1884 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph.cc ('k') | runtime/vm/flow_graph_inliner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698