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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 DECLARE_FLAG(bool, load_deferred_eagerly); | 60 DECLARE_FLAG(bool, load_deferred_eagerly); |
61 DECLARE_FLAG(int, optimization_counter_threshold); | 61 DECLARE_FLAG(int, optimization_counter_threshold); |
62 DECLARE_FLAG(bool, propagate_ic_data); | 62 DECLARE_FLAG(bool, propagate_ic_data); |
63 DECLARE_FLAG(int, regexp_optimization_counter_threshold); | 63 DECLARE_FLAG(int, regexp_optimization_counter_threshold); |
64 DECLARE_FLAG(int, reoptimization_counter_threshold); | 64 DECLARE_FLAG(int, reoptimization_counter_threshold); |
65 DECLARE_FLAG(int, stacktrace_every); | 65 DECLARE_FLAG(int, stacktrace_every); |
66 DECLARE_FLAG(charp, stacktrace_filter); | 66 DECLARE_FLAG(charp, stacktrace_filter); |
67 DECLARE_FLAG(bool, use_field_guards); | 67 DECLARE_FLAG(bool, use_field_guards); |
68 DECLARE_FLAG(bool, use_cha_deopt); | 68 DECLARE_FLAG(bool, use_cha_deopt); |
69 DECLARE_FLAG(bool, use_osr); | 69 DECLARE_FLAG(bool, use_osr); |
70 DECLARE_FLAG(bool, warn_on_javascript_compatibility); | |
71 DECLARE_FLAG(bool, print_stop_message); | 70 DECLARE_FLAG(bool, print_stop_message); |
72 DECLARE_FLAG(bool, lazy_dispatchers); | 71 DECLARE_FLAG(bool, lazy_dispatchers); |
73 DECLARE_FLAG(bool, interpret_irregexp); | 72 DECLARE_FLAG(bool, interpret_irregexp); |
74 DECLARE_FLAG(bool, enable_mirrors); | 73 DECLARE_FLAG(bool, enable_mirrors); |
75 DECLARE_FLAG(bool, link_natives_lazily); | 74 DECLARE_FLAG(bool, link_natives_lazily); |
76 DECLARE_FLAG(bool, trace_compiler); | 75 DECLARE_FLAG(bool, trace_compiler); |
77 DECLARE_FLAG(int, inlining_hotness); | 76 DECLARE_FLAG(int, inlining_hotness); |
78 DECLARE_FLAG(int, inlining_size_threshold); | 77 DECLARE_FLAG(int, inlining_size_threshold); |
79 DECLARE_FLAG(int, inlining_callee_size_threshold); | 78 DECLARE_FLAG(int, inlining_callee_size_threshold); |
80 DECLARE_FLAG(int, inline_getters_setters_smaller_than); | 79 DECLARE_FLAG(int, inline_getters_setters_smaller_than); |
(...skipping 1084 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1165 EmitOptimizedInstanceCall( | 1164 EmitOptimizedInstanceCall( |
1166 *StubCode::TwoArgsOptimizedCheckInlineCache_entry(), ic_data, | 1165 *StubCode::TwoArgsOptimizedCheckInlineCache_entry(), ic_data, |
1167 argument_count, deopt_id, token_pos, locs); | 1166 argument_count, deopt_id, token_pos, locs); |
1168 return; | 1167 return; |
1169 default: | 1168 default: |
1170 UNIMPLEMENTED(); | 1169 UNIMPLEMENTED(); |
1171 } | 1170 } |
1172 return; | 1171 return; |
1173 } | 1172 } |
1174 | 1173 |
1175 if (is_optimizing() && | 1174 if (is_optimizing()) { |
1176 // Do not make the instance call megamorphic if the callee needs to decode | |
1177 // the calling code sequence to lookup the ic data and verify if a JS | |
1178 // warning has already been issued or not. | |
1179 (!FLAG_warn_on_javascript_compatibility || | |
1180 !ic_data.MayCheckForJSWarning())) { | |
1181 EmitMegamorphicInstanceCall(ic_data, argument_count, | 1175 EmitMegamorphicInstanceCall(ic_data, argument_count, |
1182 deopt_id, token_pos, locs); | 1176 deopt_id, token_pos, locs); |
1183 return; | 1177 return; |
1184 } | 1178 } |
1185 | 1179 |
1186 switch (ic_data.NumArgsTested()) { | 1180 switch (ic_data.NumArgsTested()) { |
1187 case 1: | 1181 case 1: |
1188 EmitInstanceCall( | 1182 EmitInstanceCall( |
1189 *StubCode::OneArgCheckInlineCache_entry(), ic_data, argument_count, | 1183 *StubCode::OneArgCheckInlineCache_entry(), ic_data, argument_count, |
1190 deopt_id, token_pos, locs); | 1184 deopt_id, token_pos, locs); |
(...skipping 14 matching lines...) Expand all Loading... |
1205 const Function& function, | 1199 const Function& function, |
1206 intptr_t argument_count, | 1200 intptr_t argument_count, |
1207 const Array& argument_names, | 1201 const Array& argument_names, |
1208 LocationSummary* locs, | 1202 LocationSummary* locs, |
1209 const ICData& ic_data_in) { | 1203 const ICData& ic_data_in) { |
1210 const ICData& ic_data = ICData::ZoneHandle(ic_data_in.Original()); | 1204 const ICData& ic_data = ICData::ZoneHandle(ic_data_in.Original()); |
1211 const Array& arguments_descriptor = Array::ZoneHandle( | 1205 const Array& arguments_descriptor = Array::ZoneHandle( |
1212 ic_data.IsNull() ? ArgumentsDescriptor::New(argument_count, | 1206 ic_data.IsNull() ? ArgumentsDescriptor::New(argument_count, |
1213 argument_names) | 1207 argument_names) |
1214 : ic_data.arguments_descriptor()); | 1208 : ic_data.arguments_descriptor()); |
1215 // Proper reporting of Javascript incompatibilities requires icdata and | 1209 if (is_optimizing()) { |
1216 // may therefore prevent the optimization of some static calls. | |
1217 if (is_optimizing() && | |
1218 !(FLAG_warn_on_javascript_compatibility && | |
1219 (MethodRecognizer::RecognizeKind(function) == | |
1220 MethodRecognizer::kObjectIdentical))) { | |
1221 EmitOptimizedStaticCall(function, arguments_descriptor, | 1210 EmitOptimizedStaticCall(function, arguments_descriptor, |
1222 argument_count, deopt_id, token_pos, locs); | 1211 argument_count, deopt_id, token_pos, locs); |
1223 } else { | 1212 } else { |
1224 ICData& call_ic_data = ICData::ZoneHandle(ic_data.raw()); | 1213 ICData& call_ic_data = ICData::ZoneHandle(ic_data.raw()); |
1225 if (call_ic_data.IsNull()) { | 1214 if (call_ic_data.IsNull()) { |
1226 const intptr_t kNumArgsChecked = 0; | 1215 const intptr_t kNumArgsChecked = 0; |
1227 call_ic_data = GetOrAddStaticCallICData(deopt_id, | 1216 call_ic_data = GetOrAddStaticCallICData(deopt_id, |
1228 function, | 1217 function, |
1229 arguments_descriptor, | 1218 arguments_descriptor, |
1230 kNumArgsChecked)->raw(); | 1219 kNumArgsChecked)->raw(); |
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1883 | 1872 |
1884 | 1873 |
1885 void FlowGraphCompiler::FrameStateClear() { | 1874 void FlowGraphCompiler::FrameStateClear() { |
1886 ASSERT(!is_optimizing()); | 1875 ASSERT(!is_optimizing()); |
1887 frame_state_.TruncateTo(0); | 1876 frame_state_.TruncateTo(0); |
1888 } | 1877 } |
1889 #endif | 1878 #endif |
1890 | 1879 |
1891 | 1880 |
1892 } // namespace dart | 1881 } // namespace dart |
OLD | NEW |