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 1025 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1036 intptr_t token_pos, | 1036 intptr_t token_pos, |
1037 intptr_t argument_count, | 1037 intptr_t argument_count, |
1038 LocationSummary* locs, | 1038 LocationSummary* locs, |
1039 const ICData& ic_data) { | 1039 const ICData& ic_data) { |
1040 if (FLAG_always_megamorphic_calls) { | 1040 if (FLAG_always_megamorphic_calls) { |
1041 EmitMegamorphicInstanceCall(ic_data, argument_count, | 1041 EmitMegamorphicInstanceCall(ic_data, argument_count, |
1042 deopt_id, token_pos, locs); | 1042 deopt_id, token_pos, locs); |
1043 return; | 1043 return; |
1044 } | 1044 } |
1045 ASSERT(!ic_data.IsNull()); | 1045 ASSERT(!ic_data.IsNull()); |
1046 uword label_address = 0; | 1046 Code& target = Code::Handle(); |
1047 StubCode* stub_code = isolate()->stub_code(); | 1047 StubCode* stub_code = isolate()->stub_code(); |
1048 if (is_optimizing() && (ic_data.NumberOfUsedChecks() == 0)) { | 1048 if (is_optimizing() && (ic_data.NumberOfUsedChecks() == 0)) { |
1049 // Emit IC call that will count and thus may need reoptimization at | 1049 // Emit IC call that will count and thus may need reoptimization at |
1050 // function entry. | 1050 // function entry. |
1051 ASSERT(!is_optimizing() | 1051 ASSERT(!is_optimizing() |
1052 || may_reoptimize() | 1052 || may_reoptimize() |
1053 || flow_graph().IsCompiledForOsr()); | 1053 || flow_graph().IsCompiledForOsr()); |
1054 switch (ic_data.NumArgsTested()) { | 1054 switch (ic_data.NumArgsTested()) { |
1055 case 1: | 1055 case 1: |
1056 label_address = stub_code->OneArgOptimizedCheckInlineCacheEntryPoint(); | 1056 target = stub_code->OneArgOptimizedCheckInlineCacheCode(); |
1057 break; | 1057 break; |
1058 case 2: | 1058 case 2: |
1059 label_address = stub_code->TwoArgsOptimizedCheckInlineCacheEntryPoint(); | 1059 target = stub_code->TwoArgsOptimizedCheckInlineCacheCode(); |
1060 break; | 1060 break; |
1061 default: | 1061 default: |
1062 UNIMPLEMENTED(); | 1062 UNIMPLEMENTED(); |
1063 } | 1063 } |
1064 ExternalLabel target_label(label_address); | 1064 EmitOptimizedInstanceCall(target, ic_data, |
1065 EmitOptimizedInstanceCall(&target_label, ic_data, | |
1066 argument_count, deopt_id, token_pos, locs); | 1065 argument_count, deopt_id, token_pos, locs); |
1067 return; | 1066 return; |
1068 } | 1067 } |
1069 | 1068 |
1070 if (is_optimizing() && | 1069 if (is_optimizing() && |
1071 // Do not make the instance call megamorphic if the callee needs to decode | 1070 // Do not make the instance call megamorphic if the callee needs to decode |
1072 // the calling code sequence to lookup the ic data and verify if a JS | 1071 // the calling code sequence to lookup the ic data and verify if a JS |
1073 // warning has already been issued or not. | 1072 // warning has already been issued or not. |
1074 (!FLAG_warn_on_javascript_compatibility || | 1073 (!FLAG_warn_on_javascript_compatibility || |
1075 !ic_data.MayCheckForJSWarning())) { | 1074 !ic_data.MayCheckForJSWarning())) { |
1076 EmitMegamorphicInstanceCall(ic_data, argument_count, | 1075 EmitMegamorphicInstanceCall(ic_data, argument_count, |
1077 deopt_id, token_pos, locs); | 1076 deopt_id, token_pos, locs); |
1078 return; | 1077 return; |
1079 } | 1078 } |
1080 | 1079 |
1081 switch (ic_data.NumArgsTested()) { | 1080 switch (ic_data.NumArgsTested()) { |
1082 case 1: | 1081 case 1: |
1083 label_address = stub_code->OneArgCheckInlineCacheEntryPoint(); | 1082 target = stub_code->OneArgCheckInlineCacheCode(); |
1084 break; | 1083 break; |
1085 case 2: | 1084 case 2: |
1086 label_address = stub_code->TwoArgsCheckInlineCacheEntryPoint(); | 1085 target = stub_code->TwoArgsCheckInlineCacheCode(); |
1087 break; | 1086 break; |
1088 default: | 1087 default: |
1089 UNIMPLEMENTED(); | 1088 UNIMPLEMENTED(); |
1090 } | 1089 } |
1091 ExternalLabel target_label(label_address); | 1090 EmitInstanceCall(target, ic_data, argument_count, |
1092 EmitInstanceCall(&target_label, ic_data, argument_count, | |
1093 deopt_id, token_pos, locs); | 1091 deopt_id, token_pos, locs); |
1094 } | 1092 } |
1095 | 1093 |
1096 | 1094 |
1097 void FlowGraphCompiler::GenerateStaticCall(intptr_t deopt_id, | 1095 void FlowGraphCompiler::GenerateStaticCall(intptr_t deopt_id, |
1098 intptr_t token_pos, | 1096 intptr_t token_pos, |
1099 const Function& function, | 1097 const Function& function, |
1100 intptr_t argument_count, | 1098 intptr_t argument_count, |
1101 const Array& argument_names, | 1099 const Array& argument_names, |
1102 LocationSummary* locs, | 1100 LocationSummary* locs, |
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1774 | 1772 |
1775 | 1773 |
1776 void FlowGraphCompiler::FrameStateClear() { | 1774 void FlowGraphCompiler::FrameStateClear() { |
1777 ASSERT(!is_optimizing()); | 1775 ASSERT(!is_optimizing()); |
1778 frame_state_.TruncateTo(0); | 1776 frame_state_.TruncateTo(0); |
1779 } | 1777 } |
1780 #endif | 1778 #endif |
1781 | 1779 |
1782 | 1780 |
1783 } // namespace dart | 1781 } // namespace dart |
OLD | NEW |