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 1054 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1065 intptr_t token_pos, | 1065 intptr_t token_pos, |
1066 intptr_t argument_count, | 1066 intptr_t argument_count, |
1067 LocationSummary* locs, | 1067 LocationSummary* locs, |
1068 const ICData& ic_data) { | 1068 const ICData& ic_data) { |
1069 if (FLAG_always_megamorphic_calls) { | 1069 if (FLAG_always_megamorphic_calls) { |
1070 EmitMegamorphicInstanceCall(ic_data, argument_count, | 1070 EmitMegamorphicInstanceCall(ic_data, argument_count, |
1071 deopt_id, token_pos, locs); | 1071 deopt_id, token_pos, locs); |
1072 return; | 1072 return; |
1073 } | 1073 } |
1074 ASSERT(!ic_data.IsNull()); | 1074 ASSERT(!ic_data.IsNull()); |
1075 uword label_address = 0; | |
1076 if (is_optimizing() && (ic_data.NumberOfUsedChecks() == 0)) { | 1075 if (is_optimizing() && (ic_data.NumberOfUsedChecks() == 0)) { |
1077 // Emit IC call that will count and thus may need reoptimization at | 1076 // Emit IC call that will count and thus may need reoptimization at |
1078 // function entry. | 1077 // function entry. |
1079 ASSERT(!is_optimizing() | 1078 ASSERT(!is_optimizing() |
1080 || may_reoptimize() | 1079 || may_reoptimize() |
1081 || flow_graph().IsCompiledForOsr()); | 1080 || flow_graph().IsCompiledForOsr()); |
1082 switch (ic_data.NumArgsTested()) { | 1081 switch (ic_data.NumArgsTested()) { |
1083 case 1: | 1082 case 1: |
1084 label_address = StubCode::OneArgOptimizedCheckInlineCacheEntryPoint(); | 1083 EmitOptimizedInstanceCall( |
1085 break; | 1084 *StubCode::OneArgOptimizedCheckInlineCache_entry(), ic_data, |
| 1085 argument_count, deopt_id, token_pos, locs); |
| 1086 return; |
1086 case 2: | 1087 case 2: |
1087 label_address = StubCode::TwoArgsOptimizedCheckInlineCacheEntryPoint(); | 1088 EmitOptimizedInstanceCall( |
1088 break; | 1089 *StubCode::TwoArgsOptimizedCheckInlineCache_entry(), ic_data, |
| 1090 argument_count, deopt_id, token_pos, locs); |
| 1091 return; |
1089 default: | 1092 default: |
1090 UNIMPLEMENTED(); | 1093 UNIMPLEMENTED(); |
1091 } | 1094 } |
1092 ExternalLabel target_label(label_address); | |
1093 EmitOptimizedInstanceCall(&target_label, ic_data, | |
1094 argument_count, deopt_id, token_pos, locs); | |
1095 return; | 1095 return; |
1096 } | 1096 } |
1097 | 1097 |
1098 if (is_optimizing() && | 1098 if (is_optimizing() && |
1099 // Do not make the instance call megamorphic if the callee needs to decode | 1099 // Do not make the instance call megamorphic if the callee needs to decode |
1100 // the calling code sequence to lookup the ic data and verify if a JS | 1100 // the calling code sequence to lookup the ic data and verify if a JS |
1101 // warning has already been issued or not. | 1101 // warning has already been issued or not. |
1102 (!FLAG_warn_on_javascript_compatibility || | 1102 (!FLAG_warn_on_javascript_compatibility || |
1103 !ic_data.MayCheckForJSWarning())) { | 1103 !ic_data.MayCheckForJSWarning())) { |
1104 EmitMegamorphicInstanceCall(ic_data, argument_count, | 1104 EmitMegamorphicInstanceCall(ic_data, argument_count, |
1105 deopt_id, token_pos, locs); | 1105 deopt_id, token_pos, locs); |
1106 return; | 1106 return; |
1107 } | 1107 } |
1108 | 1108 |
1109 switch (ic_data.NumArgsTested()) { | 1109 switch (ic_data.NumArgsTested()) { |
1110 case 1: | 1110 case 1: |
1111 label_address = StubCode::OneArgCheckInlineCacheEntryPoint(); | 1111 EmitInstanceCall( |
| 1112 *StubCode::OneArgCheckInlineCache_entry(), ic_data, argument_count, |
| 1113 deopt_id, token_pos, locs); |
1112 break; | 1114 break; |
1113 case 2: | 1115 case 2: |
1114 label_address = StubCode::TwoArgsCheckInlineCacheEntryPoint(); | 1116 EmitInstanceCall( |
| 1117 *StubCode::TwoArgsCheckInlineCache_entry(), ic_data, argument_count, |
| 1118 deopt_id, token_pos, locs); |
1115 break; | 1119 break; |
1116 default: | 1120 default: |
1117 UNIMPLEMENTED(); | 1121 UNIMPLEMENTED(); |
1118 } | 1122 } |
1119 ExternalLabel target_label(label_address); | |
1120 EmitInstanceCall(&target_label, ic_data, argument_count, | |
1121 deopt_id, token_pos, locs); | |
1122 } | 1123 } |
1123 | 1124 |
1124 | 1125 |
1125 void FlowGraphCompiler::GenerateStaticCall(intptr_t deopt_id, | 1126 void FlowGraphCompiler::GenerateStaticCall(intptr_t deopt_id, |
1126 intptr_t token_pos, | 1127 intptr_t token_pos, |
1127 const Function& function, | 1128 const Function& function, |
1128 intptr_t argument_count, | 1129 intptr_t argument_count, |
1129 const Array& argument_names, | 1130 const Array& argument_names, |
1130 LocationSummary* locs, | 1131 LocationSummary* locs, |
1131 const ICData& ic_data) { | 1132 const ICData& ic_data) { |
(...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1817 | 1818 |
1818 | 1819 |
1819 void FlowGraphCompiler::FrameStateClear() { | 1820 void FlowGraphCompiler::FrameStateClear() { |
1820 ASSERT(!is_optimizing()); | 1821 ASSERT(!is_optimizing()); |
1821 frame_state_.TruncateTo(0); | 1822 frame_state_.TruncateTo(0); |
1822 } | 1823 } |
1823 #endif | 1824 #endif |
1824 | 1825 |
1825 | 1826 |
1826 } // namespace dart | 1827 } // namespace dart |
OLD | NEW |