| 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" |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 FLAG_optimization_counter_threshold = -1; | 100 FLAG_optimization_counter_threshold = -1; |
| 101 FLAG_use_field_guards = false; | 101 FLAG_use_field_guards = false; |
| 102 FLAG_use_osr = false; | 102 FLAG_use_osr = false; |
| 103 FLAG_emit_edge_counters = false; | 103 FLAG_emit_edge_counters = false; |
| 104 FLAG_support_debugger = false; | 104 FLAG_support_debugger = false; |
| 105 FLAG_ic_range_profiling = false; | 105 FLAG_ic_range_profiling = false; |
| 106 FLAG_collect_code = false; | 106 FLAG_collect_code = false; |
| 107 FLAG_load_deferred_eagerly = true; | 107 FLAG_load_deferred_eagerly = true; |
| 108 FLAG_deoptimize_alot = false; // Used in some tests. | 108 FLAG_deoptimize_alot = false; // Used in some tests. |
| 109 FLAG_deoptimize_every = 0; // Used in some tests. | 109 FLAG_deoptimize_every = 0; // Used in some tests. |
| 110 Compiler::set_always_optimize(true); | |
| 111 // Triggers assert if we try to recompile (e.g., because of deferred | |
| 112 // loading, deoptimization, ...). Noopt mode simulates behavior | |
| 113 // of precompiled code, therefore do not allow recompilation. | |
| 114 Compiler::set_allow_recompilation(false); | |
| 115 // Precompilation finalizes all classes and thus allows CHA optimizations. | 110 // Precompilation finalizes all classes and thus allows CHA optimizations. |
| 116 // Do not require CHA triggered deoptimization. | 111 // Do not require CHA triggered deoptimization. |
| 117 FLAG_use_cha_deopt = false; | 112 FLAG_use_cha_deopt = false; |
| 118 // Calling the PrintStopMessage stub is not supported in precompiled code | 113 // Calling the PrintStopMessage stub is not supported in precompiled code |
| 119 // since it is done at places where no pool pointer is loaded. | 114 // since it is done at places where no pool pointer is loaded. |
| 120 FLAG_print_stop_message = false; | 115 FLAG_print_stop_message = false; |
| 121 | 116 |
| 122 FLAG_lazy_dispatchers = false; | 117 FLAG_lazy_dispatchers = false; |
| 123 FLAG_interpret_irregexp = true; | 118 FLAG_interpret_irregexp = true; |
| 124 FLAG_enable_mirrors = false; | 119 FLAG_enable_mirrors = false; |
| (...skipping 808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 933 | 928 |
| 934 | 929 |
| 935 Label* FlowGraphCompiler::AddDeoptStub(intptr_t deopt_id, | 930 Label* FlowGraphCompiler::AddDeoptStub(intptr_t deopt_id, |
| 936 ICData::DeoptReasonId reason, | 931 ICData::DeoptReasonId reason, |
| 937 uint32_t flags) { | 932 uint32_t flags) { |
| 938 if (intrinsic_mode()) { | 933 if (intrinsic_mode()) { |
| 939 return &intrinsic_slow_path_label_; | 934 return &intrinsic_slow_path_label_; |
| 940 } | 935 } |
| 941 | 936 |
| 942 // No deoptimization allowed when 'always_optimize' is set. | 937 // No deoptimization allowed when 'always_optimize' is set. |
| 943 if (Compiler::always_optimize()) { | 938 if (FLAG_precompilation) { |
| 944 if (FLAG_trace_compiler) { | 939 if (FLAG_trace_compiler) { |
| 945 THR_Print( | 940 THR_Print( |
| 946 "Retrying compilation %s, suppressing inlining of deopt_id:%" Pd "\n", | 941 "Retrying compilation %s, suppressing inlining of deopt_id:%" Pd "\n", |
| 947 parsed_function_.function().ToFullyQualifiedCString(), deopt_id); | 942 parsed_function_.function().ToFullyQualifiedCString(), deopt_id); |
| 948 } | 943 } |
| 949 ASSERT(deopt_id != 0); // longjmp must return non-zero value. | 944 ASSERT(deopt_id != 0); // longjmp must return non-zero value. |
| 950 Thread::Current()->long_jump_base()->Jump( | 945 Thread::Current()->long_jump_base()->Jump( |
| 951 deopt_id, Object::speculative_inlining_error()); | 946 deopt_id, Object::speculative_inlining_error()); |
| 952 } | 947 } |
| 953 | 948 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 981 const PcDescriptors& descriptors = PcDescriptors::Handle( | 976 const PcDescriptors& descriptors = PcDescriptors::Handle( |
| 982 pc_descriptors_list_->FinalizePcDescriptors(code.EntryPoint())); | 977 pc_descriptors_list_->FinalizePcDescriptors(code.EntryPoint())); |
| 983 if (!is_optimizing_) descriptors.Verify(parsed_function_.function()); | 978 if (!is_optimizing_) descriptors.Verify(parsed_function_.function()); |
| 984 code.set_pc_descriptors(descriptors); | 979 code.set_pc_descriptors(descriptors); |
| 985 code.set_lazy_deopt_pc_offset(lazy_deopt_pc_offset_); | 980 code.set_lazy_deopt_pc_offset(lazy_deopt_pc_offset_); |
| 986 } | 981 } |
| 987 | 982 |
| 988 | 983 |
| 989 RawArray* FlowGraphCompiler::CreateDeoptInfo(Assembler* assembler) { | 984 RawArray* FlowGraphCompiler::CreateDeoptInfo(Assembler* assembler) { |
| 990 // No deopt information if we 'always_optimize' (no deoptimization allowed). | 985 // No deopt information if we 'always_optimize' (no deoptimization allowed). |
| 991 if (Compiler::always_optimize()) { | 986 if (FLAG_precompilation) { |
| 992 return Array::empty_array().raw(); | 987 return Array::empty_array().raw(); |
| 993 } | 988 } |
| 994 // For functions with optional arguments, all incoming arguments are copied | 989 // For functions with optional arguments, all incoming arguments are copied |
| 995 // to spill slots. The deoptimization environment does not track them. | 990 // to spill slots. The deoptimization environment does not track them. |
| 996 const Function& function = parsed_function().function(); | 991 const Function& function = parsed_function().function(); |
| 997 const intptr_t incoming_arg_count = | 992 const intptr_t incoming_arg_count = |
| 998 function.HasOptionalParameters() ? 0 : function.num_fixed_parameters(); | 993 function.HasOptionalParameters() ? 0 : function.num_fixed_parameters(); |
| 999 DeoptInfoBuilder builder(zone(), incoming_arg_count, assembler); | 994 DeoptInfoBuilder builder(zone(), incoming_arg_count, assembler); |
| 1000 | 995 |
| 1001 intptr_t deopt_info_table_size = DeoptTable::SizeFor(deopt_infos_.length()); | 996 intptr_t deopt_info_table_size = DeoptTable::SizeFor(deopt_infos_.length()); |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1138 } | 1133 } |
| 1139 | 1134 |
| 1140 | 1135 |
| 1141 void FlowGraphCompiler::GenerateInstanceCall( | 1136 void FlowGraphCompiler::GenerateInstanceCall( |
| 1142 intptr_t deopt_id, | 1137 intptr_t deopt_id, |
| 1143 intptr_t token_pos, | 1138 intptr_t token_pos, |
| 1144 intptr_t argument_count, | 1139 intptr_t argument_count, |
| 1145 LocationSummary* locs, | 1140 LocationSummary* locs, |
| 1146 const ICData& ic_data_in) { | 1141 const ICData& ic_data_in) { |
| 1147 const ICData& ic_data = ICData::ZoneHandle(ic_data_in.Original()); | 1142 const ICData& ic_data = ICData::ZoneHandle(ic_data_in.Original()); |
| 1148 if (Compiler::always_optimize()) { | 1143 if (FLAG_precompilation) { |
| 1149 EmitSwitchableInstanceCall(ic_data, argument_count, | 1144 EmitSwitchableInstanceCall(ic_data, argument_count, |
| 1150 deopt_id, token_pos, locs); | 1145 deopt_id, token_pos, locs); |
| 1151 return; | 1146 return; |
| 1152 } | 1147 } |
| 1153 if (FLAG_always_megamorphic_calls) { | 1148 if (FLAG_always_megamorphic_calls) { |
| 1154 EmitMegamorphicInstanceCall(ic_data, argument_count, | 1149 EmitMegamorphicInstanceCall(ic_data, argument_count, |
| 1155 deopt_id, token_pos, locs); | 1150 deopt_id, token_pos, locs); |
| 1156 return; | 1151 return; |
| 1157 } | 1152 } |
| 1158 ASSERT(!ic_data.IsNull()); | 1153 ASSERT(!ic_data.IsNull()); |
| (...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1883 | 1878 |
| 1884 | 1879 |
| 1885 void FlowGraphCompiler::FrameStateClear() { | 1880 void FlowGraphCompiler::FrameStateClear() { |
| 1886 ASSERT(!is_optimizing()); | 1881 ASSERT(!is_optimizing()); |
| 1887 frame_state_.TruncateTo(0); | 1882 frame_state_.TruncateTo(0); |
| 1888 } | 1883 } |
| 1889 #endif | 1884 #endif |
| 1890 | 1885 |
| 1891 | 1886 |
| 1892 } // namespace dart | 1887 } // namespace dart |
| OLD | NEW |