| 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 1053 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1064 targets.SetAt(target_ix + Code::kSCallTableCodeEntry, | 1064 targets.SetAt(target_ix + Code::kSCallTableCodeEntry, |
| 1065 *static_calls_target_table_[i]->code); | 1065 *static_calls_target_table_[i]->code); |
| 1066 } | 1066 } |
| 1067 } | 1067 } |
| 1068 code.set_static_calls_target_table(targets); | 1068 code.set_static_calls_target_table(targets); |
| 1069 INC_STAT(Thread::Current(), total_code_size, | 1069 INC_STAT(Thread::Current(), total_code_size, |
| 1070 targets.Length() * sizeof(uword)); | 1070 targets.Length() * sizeof(uword)); |
| 1071 } | 1071 } |
| 1072 | 1072 |
| 1073 | 1073 |
| 1074 void FlowGraphCompiler::GenerateCallWithDeopt(TokenPosition token_pos, | |
| 1075 intptr_t deopt_id, | |
| 1076 const StubEntry& stub_entry, | |
| 1077 RawPcDescriptors::Kind kind, | |
| 1078 LocationSummary* locs) { | |
| 1079 GenerateCall(token_pos, stub_entry, kind, locs); | |
| 1080 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); | |
| 1081 if (is_optimizing()) { | |
| 1082 AddDeoptIndexAtCall(deopt_id_after); | |
| 1083 } else { | |
| 1084 // Add deoptimization continuation point after the call and before the | |
| 1085 // arguments are removed. | |
| 1086 AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, token_pos); | |
| 1087 } | |
| 1088 } | |
| 1089 | |
| 1090 | 1074 |
| 1091 void FlowGraphCompiler::FinalizeCodeSourceMap(const Code& code) { | 1075 void FlowGraphCompiler::FinalizeCodeSourceMap(const Code& code) { |
| 1092 const Array& inlined_id_array = | 1076 const Array& inlined_id_array = |
| 1093 Array::Handle(zone(), code_source_map_builder_->InliningIdToFunction()); | 1077 Array::Handle(zone(), code_source_map_builder_->InliningIdToFunction()); |
| 1094 INC_STAT(Thread::Current(), total_code_size, | 1078 INC_STAT(Thread::Current(), total_code_size, |
| 1095 inlined_id_array.Length() * sizeof(uword)); | 1079 inlined_id_array.Length() * sizeof(uword)); |
| 1096 code.set_inlined_id_to_function(inlined_id_array); | 1080 code.set_inlined_id_to_function(inlined_id_array); |
| 1097 | 1081 |
| 1098 const CodeSourceMap& map = | 1082 const CodeSourceMap& map = |
| 1099 CodeSourceMap::Handle(code_source_map_builder_->Finalize()); | 1083 CodeSourceMap::Handle(code_source_map_builder_->Finalize()); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1162 // before any deoptimization point. | 1146 // before any deoptimization point. |
| 1163 ASSERT(!intrinsic_slow_path_label_.IsBound()); | 1147 ASSERT(!intrinsic_slow_path_label_.IsBound()); |
| 1164 assembler()->Bind(&intrinsic_slow_path_label_); | 1148 assembler()->Bind(&intrinsic_slow_path_label_); |
| 1165 return complete; | 1149 return complete; |
| 1166 } | 1150 } |
| 1167 | 1151 |
| 1168 | 1152 |
| 1169 // DBC is very different from other architectures in how it performs instance | 1153 // DBC is very different from other architectures in how it performs instance |
| 1170 // and static calls because it does not use stubs. | 1154 // and static calls because it does not use stubs. |
| 1171 #if !defined(TARGET_ARCH_DBC) | 1155 #if !defined(TARGET_ARCH_DBC) |
| 1156 void FlowGraphCompiler::GenerateCallWithDeopt(TokenPosition token_pos, |
| 1157 intptr_t deopt_id, |
| 1158 const StubEntry& stub_entry, |
| 1159 RawPcDescriptors::Kind kind, |
| 1160 LocationSummary* locs) { |
| 1161 GenerateCall(token_pos, stub_entry, kind, locs); |
| 1162 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); |
| 1163 if (is_optimizing()) { |
| 1164 AddDeoptIndexAtCall(deopt_id_after); |
| 1165 } else { |
| 1166 // Add deoptimization continuation point after the call and before the |
| 1167 // arguments are removed. |
| 1168 AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, token_pos); |
| 1169 } |
| 1170 } |
| 1171 |
| 1172 |
| 1172 void FlowGraphCompiler::GenerateInstanceCall(intptr_t deopt_id, | 1173 void FlowGraphCompiler::GenerateInstanceCall(intptr_t deopt_id, |
| 1173 TokenPosition token_pos, | 1174 TokenPosition token_pos, |
| 1174 intptr_t argument_count, | 1175 intptr_t argument_count, |
| 1175 LocationSummary* locs, | 1176 LocationSummary* locs, |
| 1176 const ICData& ic_data_in) { | 1177 const ICData& ic_data_in) { |
| 1177 ICData& ic_data = ICData::ZoneHandle(ic_data_in.Original()); | 1178 ICData& ic_data = ICData::ZoneHandle(ic_data_in.Original()); |
| 1178 if (FLAG_precompiled_mode) { | 1179 if (FLAG_precompiled_mode) { |
| 1179 ic_data = ic_data.AsUnaryClassChecks(); | 1180 ic_data = ic_data.AsUnaryClassChecks(); |
| 1180 EmitSwitchableInstanceCall(ic_data, argument_count, deopt_id, token_pos, | 1181 EmitSwitchableInstanceCall(ic_data, argument_count, deopt_id, token_pos, |
| 1181 locs); | 1182 locs); |
| (...skipping 750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1932 | 1933 |
| 1933 | 1934 |
| 1934 void FlowGraphCompiler::FrameStateClear() { | 1935 void FlowGraphCompiler::FrameStateClear() { |
| 1935 ASSERT(!is_optimizing()); | 1936 ASSERT(!is_optimizing()); |
| 1936 frame_state_.TruncateTo(0); | 1937 frame_state_.TruncateTo(0); |
| 1937 } | 1938 } |
| 1938 #endif // defined(DEBUG) && !defined(TARGET_ARCH_DBC) | 1939 #endif // defined(DEBUG) && !defined(TARGET_ARCH_DBC) |
| 1939 | 1940 |
| 1940 | 1941 |
| 1941 } // namespace dart | 1942 } // namespace dart |
| OLD | NEW |