Chromium Code Reviews| 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 790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 801 pending_deoptimization_env_); | 801 pending_deoptimization_env_); |
| 802 info->set_pc_offset(assembler()->CodeSize()); | 802 info->set_pc_offset(assembler()->CodeSize()); |
| 803 deopt_infos_.Add(info); | 803 deopt_infos_.Add(info); |
| 804 } | 804 } |
| 805 | 805 |
| 806 | 806 |
| 807 // This function must be in sync with FlowGraphCompiler::SaveLiveRegisters | 807 // This function must be in sync with FlowGraphCompiler::SaveLiveRegisters |
| 808 // and FlowGraphCompiler::SlowPathEnvironmentFor. | 808 // and FlowGraphCompiler::SlowPathEnvironmentFor. |
| 809 // See StackFrame::VisitObjectPointers for the details of how stack map is | 809 // See StackFrame::VisitObjectPointers for the details of how stack map is |
| 810 // interpreted. | 810 // interpreted. |
| 811 void FlowGraphCompiler::RecordSafepoint(LocationSummary* locs) { | 811 void FlowGraphCompiler::RecordSafepoint(LocationSummary* locs, |
| 812 intptr_t slow_path_argument_count) { | |
| 812 if (is_optimizing() || locs->live_registers()->HasUntaggedValues()) { | 813 if (is_optimizing() || locs->live_registers()->HasUntaggedValues()) { |
| 813 const intptr_t spill_area_size = is_optimizing() ? | 814 const intptr_t spill_area_size = is_optimizing() ? |
| 814 flow_graph_.graph_entry()->spill_slot_count() : 0; | 815 flow_graph_.graph_entry()->spill_slot_count() : 0; |
| 815 | 816 |
| 816 RegisterSet* registers = locs->live_registers(); | 817 RegisterSet* registers = locs->live_registers(); |
| 817 ASSERT(registers != NULL); | 818 ASSERT(registers != NULL); |
| 818 const intptr_t kFpuRegisterSpillFactor = | 819 const intptr_t kFpuRegisterSpillFactor = |
| 819 kFpuRegisterSize / kWordSize; | 820 kFpuRegisterSize / kWordSize; |
| 820 const intptr_t live_registers_size = registers->CpuRegisterCount() + | 821 const intptr_t live_registers_size = registers->CpuRegisterCount() + |
| 821 (registers->FpuRegisterCount() * kFpuRegisterSpillFactor); | 822 (registers->FpuRegisterCount() * kFpuRegisterSpillFactor); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 861 // General purpose registers have the highest register number at the | 862 // General purpose registers have the highest register number at the |
| 862 // highest address (i.e., first in the stackmap). | 863 // highest address (i.e., first in the stackmap). |
| 863 for (intptr_t i = kNumberOfCpuRegisters - 1; i >= 0; --i) { | 864 for (intptr_t i = kNumberOfCpuRegisters - 1; i >= 0; --i) { |
| 864 Register reg = static_cast<Register>(i); | 865 Register reg = static_cast<Register>(i); |
| 865 if (locs->live_registers()->ContainsRegister(reg)) { | 866 if (locs->live_registers()->ContainsRegister(reg)) { |
| 866 bitmap->Set(bitmap->Length(), locs->live_registers()->IsTagged(reg)); | 867 bitmap->Set(bitmap->Length(), locs->live_registers()->IsTagged(reg)); |
| 867 } | 868 } |
| 868 } | 869 } |
| 869 } | 870 } |
| 870 | 871 |
| 872 // Arguments pushed on top of live registers in the slow path are tagged. | |
| 873 for (intptr_t i = 0; i < slow_path_argument_count; ++i) { | |
| 874 bitmap->Set(bitmap->Length(), true); | |
| 875 } | |
| 876 | |
| 871 intptr_t register_bit_count = bitmap->Length() - spill_area_size; | 877 intptr_t register_bit_count = bitmap->Length() - spill_area_size; |
| 872 stackmap_table_builder()->AddEntry(assembler()->CodeSize(), | 878 stackmap_table_builder()->AddEntry(assembler()->CodeSize(), |
| 873 bitmap, | 879 bitmap, |
| 874 register_bit_count); | 880 register_bit_count); |
|
Vyacheslav Egorov (Google)
2016/03/04 13:30:36
this variable name and respective getter on the st
Florian Schneider
2016/03/04 16:55:09
Renamed to slow_path_bit_count.
| |
| 875 } | 881 } |
| 876 } | 882 } |
| 877 | 883 |
| 878 | 884 |
| 879 // This function must be kept in sync with: | 885 // This function must be kept in sync with: |
| 880 // | 886 // |
| 881 // FlowGraphCompiler::RecordSafepoint | 887 // FlowGraphCompiler::RecordSafepoint |
| 882 // FlowGraphCompiler::SaveLiveRegisters | 888 // FlowGraphCompiler::SaveLiveRegisters |
| 883 // MaterializeObjectInstr::RemapRegisters | 889 // MaterializeObjectInstr::RemapRegisters |
| 884 // | 890 // |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1146 LocationSummary* locs, | 1152 LocationSummary* locs, |
| 1147 const ICData& ic_data_in) { | 1153 const ICData& ic_data_in) { |
| 1148 const ICData& ic_data = ICData::ZoneHandle(ic_data_in.Original()); | 1154 const ICData& ic_data = ICData::ZoneHandle(ic_data_in.Original()); |
| 1149 if (FLAG_precompiled_mode) { | 1155 if (FLAG_precompiled_mode) { |
| 1150 EmitSwitchableInstanceCall(ic_data, argument_count, | 1156 EmitSwitchableInstanceCall(ic_data, argument_count, |
| 1151 deopt_id, token_pos, locs); | 1157 deopt_id, token_pos, locs); |
| 1152 return; | 1158 return; |
| 1153 } | 1159 } |
| 1154 if (FLAG_always_megamorphic_calls) { | 1160 if (FLAG_always_megamorphic_calls) { |
| 1155 EmitMegamorphicInstanceCall(ic_data, argument_count, | 1161 EmitMegamorphicInstanceCall(ic_data, argument_count, |
| 1156 deopt_id, token_pos, locs); | 1162 deopt_id, token_pos, locs, |
| 1163 CatchClauseNode::kInvalidTryIndex); | |
| 1157 return; | 1164 return; |
| 1158 } | 1165 } |
| 1159 ASSERT(!ic_data.IsNull()); | 1166 ASSERT(!ic_data.IsNull()); |
| 1160 if (is_optimizing() && (ic_data.NumberOfUsedChecks() == 0)) { | 1167 if (is_optimizing() && (ic_data.NumberOfUsedChecks() == 0)) { |
| 1161 // Emit IC call that will count and thus may need reoptimization at | 1168 // Emit IC call that will count and thus may need reoptimization at |
| 1162 // function entry. | 1169 // function entry. |
| 1163 ASSERT(may_reoptimize() || flow_graph().IsCompiledForOsr()); | 1170 ASSERT(may_reoptimize() || flow_graph().IsCompiledForOsr()); |
| 1164 switch (ic_data.NumArgsTested()) { | 1171 switch (ic_data.NumArgsTested()) { |
| 1165 case 1: | 1172 case 1: |
| 1166 EmitOptimizedInstanceCall( | 1173 EmitOptimizedInstanceCall( |
| 1167 *StubCode::OneArgOptimizedCheckInlineCache_entry(), ic_data, | 1174 *StubCode::OneArgOptimizedCheckInlineCache_entry(), ic_data, |
| 1168 argument_count, deopt_id, token_pos, locs); | 1175 argument_count, deopt_id, token_pos, locs); |
| 1169 return; | 1176 return; |
| 1170 case 2: | 1177 case 2: |
| 1171 EmitOptimizedInstanceCall( | 1178 EmitOptimizedInstanceCall( |
| 1172 *StubCode::TwoArgsOptimizedCheckInlineCache_entry(), ic_data, | 1179 *StubCode::TwoArgsOptimizedCheckInlineCache_entry(), ic_data, |
| 1173 argument_count, deopt_id, token_pos, locs); | 1180 argument_count, deopt_id, token_pos, locs); |
| 1174 return; | 1181 return; |
| 1175 default: | 1182 default: |
| 1176 UNIMPLEMENTED(); | 1183 UNIMPLEMENTED(); |
| 1177 } | 1184 } |
| 1178 return; | 1185 return; |
| 1179 } | 1186 } |
| 1180 | 1187 |
| 1181 if (is_optimizing()) { | 1188 if (is_optimizing()) { |
| 1182 EmitMegamorphicInstanceCall(ic_data, argument_count, | 1189 EmitMegamorphicInstanceCall(ic_data, argument_count, |
| 1183 deopt_id, token_pos, locs); | 1190 deopt_id, token_pos, locs, |
| 1191 CatchClauseNode::kInvalidTryIndex); | |
| 1184 return; | 1192 return; |
| 1185 } | 1193 } |
| 1186 | 1194 |
| 1187 switch (ic_data.NumArgsTested()) { | 1195 switch (ic_data.NumArgsTested()) { |
| 1188 case 1: | 1196 case 1: |
| 1189 EmitInstanceCall( | 1197 EmitInstanceCall( |
| 1190 *StubCode::OneArgCheckInlineCache_entry(), ic_data, argument_count, | 1198 *StubCode::OneArgCheckInlineCache_entry(), ic_data, argument_count, |
| 1191 deopt_id, token_pos, locs); | 1199 deopt_id, token_pos, locs); |
| 1192 break; | 1200 break; |
| 1193 case 2: | 1201 case 2: |
| (...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1924 | 1932 |
| 1925 | 1933 |
| 1926 void FlowGraphCompiler::FrameStateClear() { | 1934 void FlowGraphCompiler::FrameStateClear() { |
| 1927 ASSERT(!is_optimizing()); | 1935 ASSERT(!is_optimizing()); |
| 1928 frame_state_.TruncateTo(0); | 1936 frame_state_.TruncateTo(0); |
| 1929 } | 1937 } |
| 1930 #endif | 1938 #endif |
| 1931 | 1939 |
| 1932 | 1940 |
| 1933 } // namespace dart | 1941 } // namespace dart |
| OLD | NEW |