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