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 870 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
881 EmitInstanceCall(&target_label, ic_data, argument_count, | 881 EmitInstanceCall(&target_label, ic_data, argument_count, |
882 deopt_id, token_pos, locs); | 882 deopt_id, token_pos, locs); |
883 } | 883 } |
884 | 884 |
885 | 885 |
886 void FlowGraphCompiler::GenerateStaticCall(intptr_t deopt_id, | 886 void FlowGraphCompiler::GenerateStaticCall(intptr_t deopt_id, |
887 intptr_t token_pos, | 887 intptr_t token_pos, |
888 const Function& function, | 888 const Function& function, |
889 intptr_t argument_count, | 889 intptr_t argument_count, |
890 const Array& argument_names, | 890 const Array& argument_names, |
891 LocationSummary* locs) { | 891 LocationSummary* locs, |
892 const Array& arguments_descriptor = | 892 const ICData& ic_data) { |
893 Array::ZoneHandle(ArgumentsDescriptor::New(argument_count, | 893 const Array& arguments_descriptor = Array::ZoneHandle( |
894 argument_names)); | 894 ic_data.IsNull() ? ArgumentsDescriptor::New(argument_count, |
| 895 argument_names) |
| 896 : ic_data.arguments_descriptor()); |
895 // Proper reporting of Javascript incompatibilities requires icdata and | 897 // Proper reporting of Javascript incompatibilities requires icdata and |
896 // may therefore prevent the optimization of some static calls. | 898 // may therefore prevent the optimization of some static calls. |
897 if (is_optimizing() && | 899 if (is_optimizing() && |
898 !(FLAG_warn_on_javascript_compatibility && | 900 !(FLAG_warn_on_javascript_compatibility && |
899 (MethodRecognizer::RecognizeKind(function) == | 901 (MethodRecognizer::RecognizeKind(function) == |
900 MethodRecognizer::kObjectIdentical))) { | 902 MethodRecognizer::kObjectIdentical))) { |
901 EmitOptimizedStaticCall(function, arguments_descriptor, argument_count, | 903 EmitOptimizedStaticCall(function, arguments_descriptor, |
902 deopt_id, token_pos, locs); | 904 argument_count, deopt_id, token_pos, locs); |
903 } else { | 905 } else { |
904 EmitUnoptimizedStaticCall(function, arguments_descriptor, argument_count, | 906 ICData& call_ic_data = ICData::ZoneHandle(ic_data.raw()); |
905 deopt_id, token_pos, locs); | 907 if (call_ic_data.IsNull()) { |
| 908 call_ic_data = ICData::New(parsed_function().function(), // Caller fun. |
| 909 String::Handle(function.name()), |
| 910 arguments_descriptor, |
| 911 deopt_id, |
| 912 0); // No arguments checked. |
| 913 call_ic_data.AddTarget(function); |
| 914 } |
| 915 EmitUnoptimizedStaticCall(argument_count, deopt_id, token_pos, locs, |
| 916 call_ic_data); |
906 } | 917 } |
907 } | 918 } |
908 | 919 |
909 | 920 |
910 void FlowGraphCompiler::GenerateNumberTypeCheck(Register kClassIdReg, | 921 void FlowGraphCompiler::GenerateNumberTypeCheck(Register kClassIdReg, |
911 const AbstractType& type, | 922 const AbstractType& type, |
912 Label* is_instance_lbl, | 923 Label* is_instance_lbl, |
913 Label* is_not_instance_lbl) { | 924 Label* is_not_instance_lbl) { |
914 assembler()->Comment("NumberTypeCheck"); | 925 assembler()->Comment("NumberTypeCheck"); |
915 GrowableArray<intptr_t> args; | 926 GrowableArray<intptr_t> args; |
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1308 | 1319 |
1309 for (int i = 0; i < len; i++) { | 1320 for (int i = 0; i < len; i++) { |
1310 sorted->Add(CidTarget(ic_data.GetReceiverClassIdAt(i), | 1321 sorted->Add(CidTarget(ic_data.GetReceiverClassIdAt(i), |
1311 &Function::ZoneHandle(ic_data.GetTargetAt(i)), | 1322 &Function::ZoneHandle(ic_data.GetTargetAt(i)), |
1312 ic_data.GetCountAt(i))); | 1323 ic_data.GetCountAt(i))); |
1313 } | 1324 } |
1314 sorted->Sort(HighestCountFirst); | 1325 sorted->Sort(HighestCountFirst); |
1315 } | 1326 } |
1316 | 1327 |
1317 } // namespace dart | 1328 } // namespace dart |
OLD | NEW |