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 15 matching lines...) Expand all Loading... |
26 DECLARE_FLAG(bool, code_comments); | 26 DECLARE_FLAG(bool, code_comments); |
27 DECLARE_FLAG(bool, disassemble); | 27 DECLARE_FLAG(bool, disassemble); |
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 DECLARE_FLAG(int, stacktrace_every); |
| 37 DECLARE_FLAG(charp, stacktrace_filter); |
| 38 DECLARE_FLAG(int, deoptimize_every); |
| 39 DECLARE_FLAG(charp, deoptimize_filter); |
| 40 |
36 DEFINE_FLAG(bool, enable_simd_inline, true, | 41 DEFINE_FLAG(bool, enable_simd_inline, true, |
37 "Enable inlining of SIMD related method calls."); | 42 "Enable inlining of SIMD related method calls."); |
38 DEFINE_FLAG(charp, deoptimize_filter, NULL, | |
39 "Force deoptimization in named function"); | |
40 | 43 |
41 // Assign locations to incoming arguments, i.e., values pushed above spill slots | 44 // Assign locations to incoming arguments, i.e., values pushed above spill slots |
42 // with PushArgument. Recursively allocates from outermost to innermost | 45 // with PushArgument. Recursively allocates from outermost to innermost |
43 // environment. | 46 // environment. |
44 void CompilerDeoptInfo::AllocateIncomingParametersRecursive( | 47 void CompilerDeoptInfo::AllocateIncomingParametersRecursive( |
45 Environment* env, | 48 Environment* env, |
46 intptr_t* stack_height) { | 49 intptr_t* stack_height) { |
47 if (env == NULL) return; | 50 if (env == NULL) return; |
48 AllocateIncomingParametersRecursive(env->outer(), stack_height); | 51 AllocateIncomingParametersRecursive(env->outer(), stack_height); |
49 for (Environment::ShallowIterator it(env); !it.Done(); it.Advance()) { | 52 for (Environment::ShallowIterator it(env); !it.Done(); it.Advance()) { |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 bool FlowGraphCompiler::CanOptimizeFunction() const { | 167 bool FlowGraphCompiler::CanOptimizeFunction() const { |
165 return CanOptimize() && !parsed_function().function().HasBreakpoint(); | 168 return CanOptimize() && !parsed_function().function().HasBreakpoint(); |
166 } | 169 } |
167 | 170 |
168 | 171 |
169 bool FlowGraphCompiler::CanOSRFunction() const { | 172 bool FlowGraphCompiler::CanOSRFunction() const { |
170 return FLAG_use_osr & CanOptimizeFunction() && !is_optimizing(); | 173 return FLAG_use_osr & CanOptimizeFunction() && !is_optimizing(); |
171 } | 174 } |
172 | 175 |
173 | 176 |
174 bool FlowGraphCompiler::ShouldDeoptimizeFunction() const { | 177 bool FlowGraphCompiler::ForceSlowPathForStackOverflow() const { |
175 return (is_optimizing() && | 178 if (FLAG_stacktrace_every > 0 || FLAG_deoptimize_every > 0) { |
176 (FLAG_deoptimize_filter != NULL) && | 179 return true; |
177 (strstr(parsed_function().function().ToFullyQualifiedCString(), | 180 } |
178 FLAG_deoptimize_filter) != NULL)); | 181 if (FLAG_stacktrace_filter != NULL && |
| 182 strstr(parsed_function().function().ToFullyQualifiedCString(), |
| 183 FLAG_stacktrace_filter) != NULL) { |
| 184 return true; |
| 185 } |
| 186 if (is_optimizing() && |
| 187 FLAG_deoptimize_filter != NULL && |
| 188 strstr(parsed_function().function().ToFullyQualifiedCString(), |
| 189 FLAG_deoptimize_filter) != NULL) { |
| 190 return true; |
| 191 } |
| 192 return false; |
179 } | 193 } |
180 | 194 |
181 | 195 |
182 static bool IsEmptyBlock(BlockEntryInstr* block) { | 196 static bool IsEmptyBlock(BlockEntryInstr* block) { |
183 return !block->HasParallelMove() && | 197 return !block->HasParallelMove() && |
184 block->next()->IsGoto() && | 198 block->next()->IsGoto() && |
185 !block->next()->AsGoto()->HasParallelMove(); | 199 !block->next()->AsGoto()->HasParallelMove(); |
186 } | 200 } |
187 | 201 |
188 | 202 |
(...skipping 1080 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1269 | 1283 |
1270 for (int i = 0; i < len; i++) { | 1284 for (int i = 0; i < len; i++) { |
1271 sorted->Add(CidTarget(ic_data.GetReceiverClassIdAt(i), | 1285 sorted->Add(CidTarget(ic_data.GetReceiverClassIdAt(i), |
1272 &Function::ZoneHandle(ic_data.GetTargetAt(i)), | 1286 &Function::ZoneHandle(ic_data.GetTargetAt(i)), |
1273 ic_data.GetCountAt(i))); | 1287 ic_data.GetCountAt(i))); |
1274 } | 1288 } |
1275 sorted->Sort(HighestCountFirst); | 1289 sorted->Sort(HighestCountFirst); |
1276 } | 1290 } |
1277 | 1291 |
1278 } // namespace dart | 1292 } // namespace dart |
OLD | NEW |