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

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

Issue 17770003: Add --deoptimization_counter_inlining_threshold=10 that stops inlining in a method that has reached… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/vm/compiler.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/code_generator.h" 5 #include "vm/code_generator.h"
6 6
7 #include "vm/assembler.h" 7 #include "vm/assembler.h"
8 #include "vm/ast.h" 8 #include "vm/ast.h"
9 #include "vm/bigint_operations.h" 9 #include "vm/bigint_operations.h"
10 #include "vm/code_patcher.h" 10 #include "vm/code_patcher.h"
(...skipping 12 matching lines...) Expand all
23 #include "vm/runtime_entry.h" 23 #include "vm/runtime_entry.h"
24 #include "vm/stack_frame.h" 24 #include "vm/stack_frame.h"
25 #include "vm/symbols.h" 25 #include "vm/symbols.h"
26 #include "vm/verifier.h" 26 #include "vm/verifier.h"
27 27
28 namespace dart { 28 namespace dart {
29 29
30 DEFINE_FLAG(bool, deoptimize_alot, false, 30 DEFINE_FLAG(bool, deoptimize_alot, false,
31 "Deoptimizes all live frames when we are about to return to Dart code from" 31 "Deoptimizes all live frames when we are about to return to Dart code from"
32 " native entries."); 32 " native entries.");
33 DEFINE_FLAG(int, max_subtype_cache_entries, 100,
34 "Maximum number of subtype cache entries (number of checks cached).");
35 DEFINE_FLAG(int, optimization_counter_threshold, 15000,
36 "Function's usage-counter value before it is optimized, -1 means never");
37 DEFINE_FLAG(charp, optimization_filter, NULL, "Optimize only named function");
38 DEFINE_FLAG(int, reoptimization_counter_threshold, 2000,
39 "Counter threshold before a function gets reoptimized.");
40 DEFINE_FLAG(bool, stop_on_excessive_deoptimization, false,
41 "Debugging: stops program if deoptimizing same function too often");
33 DEFINE_FLAG(bool, trace_deoptimization, false, "Trace deoptimization"); 42 DEFINE_FLAG(bool, trace_deoptimization, false, "Trace deoptimization");
34 DEFINE_FLAG(bool, trace_deoptimization_verbose, false, 43 DEFINE_FLAG(bool, trace_deoptimization_verbose, false,
35 "Trace deoptimization verbose"); 44 "Trace deoptimization verbose");
45 DEFINE_FLAG(bool, trace_failed_optimization_attempts, false,
46 "Traces all failed optimization attempts");
36 DEFINE_FLAG(bool, trace_ic, false, "Trace IC handling"); 47 DEFINE_FLAG(bool, trace_ic, false, "Trace IC handling");
37 DEFINE_FLAG(bool, trace_ic_miss_in_optimized, false, 48 DEFINE_FLAG(bool, trace_ic_miss_in_optimized, false,
38 "Trace IC miss in optimized code"); 49 "Trace IC miss in optimized code");
50 DEFINE_FLAG(bool, trace_optimized_ic_calls, false,
51 "Trace IC calls in optimized code.");
39 DEFINE_FLAG(bool, trace_patching, false, "Trace patching of code."); 52 DEFINE_FLAG(bool, trace_patching, false, "Trace patching of code.");
40 DEFINE_FLAG(bool, trace_runtime_calls, false, "Trace runtime calls"); 53 DEFINE_FLAG(bool, trace_runtime_calls, false, "Trace runtime calls");
41 DEFINE_FLAG(int, optimization_counter_threshold, 15000, 54
42 "Function's usage-counter value before it is optimized, -1 means never"); 55 DECLARE_FLAG(int, deoptimization_counter_threshold);
43 DECLARE_FLAG(bool, enable_type_checks); 56 DECLARE_FLAG(bool, enable_type_checks);
57 DECLARE_FLAG(bool, report_usage_count);
44 DECLARE_FLAG(bool, trace_type_checks); 58 DECLARE_FLAG(bool, trace_type_checks);
45 DECLARE_FLAG(bool, report_usage_count);
46 DECLARE_FLAG(int, deoptimization_counter_threshold);
47 DEFINE_FLAG(charp, optimization_filter, NULL, "Optimize only named function");
48 DEFINE_FLAG(bool, trace_failed_optimization_attempts, false,
49 "Traces all failed optimization attempts");
50 DEFINE_FLAG(bool, trace_optimized_ic_calls, false,
51 "Trace IC calls in optimized code.");
52 DEFINE_FLAG(int, reoptimization_counter_threshold, 2000,
53 "Counter threshold before a function gets reoptimized.");
54 DEFINE_FLAG(int, max_subtype_cache_entries, 100,
55 "Maximum number of subtype cache entries (number of checks cached).");
56 59
57 #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) 60 #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64)
58 DEFINE_FLAG(bool, use_osr, true, "Use on-stack replacement."); 61 DEFINE_FLAG(bool, use_osr, true, "Use on-stack replacement.");
59 #else 62 #else
60 DEFINE_FLAG(bool, use_osr, false, "Use on-stack replacement."); 63 DEFINE_FLAG(bool, use_osr, false, "Use on-stack replacement.");
61 #endif 64 #endif
62 DEFINE_FLAG(bool, trace_osr, false, "Trace attempts at on-stack replacement."); 65 DEFINE_FLAG(bool, trace_osr, false, "Trace attempts at on-stack replacement.");
63 66
64 67
65 DEFINE_RUNTIME_ENTRY(TraceFunctionEntry, 1) { 68 DEFINE_RUNTIME_ENTRY(TraceFunctionEntry, 1) {
(...skipping 1224 matching lines...) Expand 10 before | Expand all | Expand 10 after
1290 static bool CanOptimizeFunction(const Function& function, Isolate* isolate) { 1293 static bool CanOptimizeFunction(const Function& function, Isolate* isolate) {
1291 const intptr_t kLowInvocationCount = -100000000; 1294 const intptr_t kLowInvocationCount = -100000000;
1292 if (isolate->debugger()->HasBreakpoint(function)) { 1295 if (isolate->debugger()->HasBreakpoint(function)) {
1293 // We cannot set breakpoints in optimized code, so do not optimize 1296 // We cannot set breakpoints in optimized code, so do not optimize
1294 // the function. 1297 // the function.
1295 function.set_usage_counter(0); 1298 function.set_usage_counter(0);
1296 return false; 1299 return false;
1297 } 1300 }
1298 if (function.deoptimization_counter() >= 1301 if (function.deoptimization_counter() >=
1299 FLAG_deoptimization_counter_threshold) { 1302 FLAG_deoptimization_counter_threshold) {
1300 if (FLAG_trace_failed_optimization_attempts) { 1303 if (FLAG_trace_failed_optimization_attempts ||
1304 FLAG_stop_on_excessive_deoptimization) {
1301 OS::PrintErr("Too Many Deoptimizations: %s\n", 1305 OS::PrintErr("Too Many Deoptimizations: %s\n",
1302 function.ToFullyQualifiedCString()); 1306 function.ToFullyQualifiedCString());
1307 if (FLAG_stop_on_excessive_deoptimization) {
1308 FATAL("Stop on excessive deoptimization");
1309 }
1303 } 1310 }
1304 // TODO(srdjan): Investigate excessive deoptimization. 1311 // TODO(srdjan): Investigate excessive deoptimization.
1305 function.set_usage_counter(kLowInvocationCount); 1312 function.set_usage_counter(kLowInvocationCount);
1306 return false; 1313 return false;
1307 } 1314 }
1308 if ((FLAG_optimization_filter != NULL) && 1315 if ((FLAG_optimization_filter != NULL) &&
1309 (strstr(function.ToFullyQualifiedCString(), 1316 (strstr(function.ToFullyQualifiedCString(),
1310 FLAG_optimization_filter) == NULL)) { 1317 FLAG_optimization_filter) == NULL)) {
1311 function.set_usage_counter(kLowInvocationCount); 1318 function.set_usage_counter(kLowInvocationCount);
1312 return false; 1319 return false;
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after
1868 // Arg1: Value that is being stored. 1875 // Arg1: Value that is being stored.
1869 DEFINE_RUNTIME_ENTRY(UpdateFieldCid, 2) { 1876 DEFINE_RUNTIME_ENTRY(UpdateFieldCid, 2) {
1870 ASSERT(arguments.ArgCount() == kUpdateFieldCidRuntimeEntry.argument_count()); 1877 ASSERT(arguments.ArgCount() == kUpdateFieldCidRuntimeEntry.argument_count());
1871 const Field& field = Field::CheckedHandle(arguments.ArgAt(0)); 1878 const Field& field = Field::CheckedHandle(arguments.ArgAt(0));
1872 const Object& value = Object::Handle(arguments.ArgAt(1)); 1879 const Object& value = Object::Handle(arguments.ArgAt(1));
1873 1880
1874 field.UpdateCid(value.GetClassId()); 1881 field.UpdateCid(value.GetClassId());
1875 } 1882 }
1876 1883
1877 } // namespace dart 1884 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698