| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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_macros.h" | 7 #include "vm/assembler_macros.h" |
| 8 #include "vm/ast.h" | 8 #include "vm/ast.h" |
| 9 #include "vm/code_patcher.h" | 9 #include "vm/code_patcher.h" |
| 10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 #include "vm/verifier.h" | 25 #include "vm/verifier.h" |
| 26 | 26 |
| 27 namespace dart { | 27 namespace dart { |
| 28 | 28 |
| 29 DEFINE_FLAG(bool, deoptimize_alot, false, | 29 DEFINE_FLAG(bool, deoptimize_alot, false, |
| 30 "Deoptimizes all live frames when we are about to return to Dart code from" | 30 "Deoptimizes all live frames when we are about to return to Dart code from" |
| 31 " native entries."); | 31 " native entries."); |
| 32 DEFINE_FLAG(bool, inline_cache, true, "Enable inline caches"); | 32 DEFINE_FLAG(bool, inline_cache, true, "Enable inline caches"); |
| 33 DEFINE_FLAG(bool, trace_deopt, false, "Trace deoptimization"); | 33 DEFINE_FLAG(bool, trace_deopt, false, "Trace deoptimization"); |
| 34 DEFINE_FLAG(bool, trace_ic, false, "Trace IC handling"); | 34 DEFINE_FLAG(bool, trace_ic, false, "Trace IC handling"); |
| 35 DEFINE_FLAG(bool, trace_ic_miss_in_optimized, false, |
| 36 "Trace IC miss in optimized code"); |
| 35 DEFINE_FLAG(bool, trace_patching, false, "Trace patching of code."); | 37 DEFINE_FLAG(bool, trace_patching, false, "Trace patching of code."); |
| 36 DEFINE_FLAG(bool, trace_runtime_calls, false, "Trace runtime calls"); | 38 DEFINE_FLAG(bool, trace_runtime_calls, false, "Trace runtime calls"); |
| 37 DEFINE_FLAG(int, optimization_counter_threshold, 2000, | 39 DEFINE_FLAG(int, optimization_counter_threshold, 2000, |
| 38 "Function's usage-counter value before it is optimized, -1 means never"); | 40 "Function's usage-counter value before it is optimized, -1 means never"); |
| 39 DECLARE_FLAG(bool, enable_type_checks); | 41 DECLARE_FLAG(bool, enable_type_checks); |
| 40 DECLARE_FLAG(bool, trace_type_checks); | 42 DECLARE_FLAG(bool, trace_type_checks); |
| 41 DECLARE_FLAG(bool, report_usage_count); | 43 DECLARE_FLAG(bool, report_usage_count); |
| 42 DECLARE_FLAG(int, deoptimization_counter_threshold); | 44 DECLARE_FLAG(int, deoptimization_counter_threshold); |
| 43 DEFINE_FLAG(charp, optimization_filter, NULL, "Optimize only named function"); | 45 DEFINE_FLAG(charp, optimization_filter, NULL, "Optimize only named function"); |
| 44 DEFINE_FLAG(bool, trace_failed_optimization_attempts, false, | 46 DEFINE_FLAG(bool, trace_failed_optimization_attempts, false, |
| (...skipping 868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 913 ic_data.AddReceiverCheck(Class::Handle(args[0]->clazz()).id(), | 915 ic_data.AddReceiverCheck(Class::Handle(args[0]->clazz()).id(), |
| 914 target_function); | 916 target_function); |
| 915 } else { | 917 } else { |
| 916 GrowableArray<intptr_t> class_ids(args.length()); | 918 GrowableArray<intptr_t> class_ids(args.length()); |
| 917 ASSERT(ic_data.num_args_tested() == args.length()); | 919 ASSERT(ic_data.num_args_tested() == args.length()); |
| 918 for (intptr_t i = 0; i < args.length(); i++) { | 920 for (intptr_t i = 0; i < args.length(); i++) { |
| 919 class_ids.Add(Class::Handle(args[i]->clazz()).id()); | 921 class_ids.Add(Class::Handle(args[i]->clazz()).id()); |
| 920 } | 922 } |
| 921 ic_data.AddCheck(class_ids, target_function); | 923 ic_data.AddCheck(class_ids, target_function); |
| 922 } | 924 } |
| 925 if (FLAG_trace_ic_miss_in_optimized) { |
| 926 const Code& caller = Code::Handle(Code::LookupCode(caller_frame->pc())); |
| 927 if (caller.is_optimized()) { |
| 928 OS::Print("IC miss in optimized code; call %s -> %s\n", |
| 929 Function::Handle(caller.function()).ToCString(), |
| 930 target_function.ToCString()); |
| 931 } |
| 932 } |
| 923 if (FLAG_trace_ic) { | 933 if (FLAG_trace_ic) { |
| 924 OS::Print("InlineCacheMissHandler %d call at %#"Px"' " | 934 OS::Print("InlineCacheMissHandler %d call at %#"Px"' " |
| 925 "adding <%s> id:%"Pd" -> <%s>\n", | 935 "adding <%s> id:%"Pd" -> <%s>\n", |
| 926 args.length(), | 936 args.length(), |
| 927 caller_frame->pc(), | 937 caller_frame->pc(), |
| 928 Class::Handle(receiver.clazz()).ToCString(), | 938 Class::Handle(receiver.clazz()).ToCString(), |
| 929 Class::Handle(receiver.clazz()).id(), | 939 Class::Handle(receiver.clazz()).id(), |
| 930 target_function.ToCString()); | 940 target_function.ToCString()); |
| 931 } | 941 } |
| 932 return target_function.raw(); | 942 return target_function.raw(); |
| (...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1693 current->slot(), | 1703 current->slot(), |
| 1694 current->value()); | 1704 current->value()); |
| 1695 } | 1705 } |
| 1696 | 1706 |
| 1697 delete current; | 1707 delete current; |
| 1698 } | 1708 } |
| 1699 } | 1709 } |
| 1700 | 1710 |
| 1701 | 1711 |
| 1702 } // namespace dart | 1712 } // namespace dart |
| OLD | NEW |