| 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_X64. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64. |
| 6 #if defined(TARGET_ARCH_X64) | 6 #if defined(TARGET_ARCH_X64) |
| 7 | 7 |
| 8 #include "vm/flow_graph_compiler.h" | 8 #include "vm/flow_graph_compiler.h" |
| 9 | 9 |
| 10 #include "vm/ast_printer.h" | 10 #include "vm/ast_printer.h" |
| (...skipping 1130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1141 __ Jmp(&stub_code->DeoptimizeLazyLabel(), PP); | 1141 __ Jmp(&stub_code->DeoptimizeLazyLabel(), PP); |
| 1142 } | 1142 } |
| 1143 } | 1143 } |
| 1144 | 1144 |
| 1145 | 1145 |
| 1146 void FlowGraphCompiler::GenerateCall(intptr_t token_pos, | 1146 void FlowGraphCompiler::GenerateCall(intptr_t token_pos, |
| 1147 const ExternalLabel* label, | 1147 const ExternalLabel* label, |
| 1148 RawPcDescriptors::Kind kind, | 1148 RawPcDescriptors::Kind kind, |
| 1149 LocationSummary* locs) { | 1149 LocationSummary* locs) { |
| 1150 __ Call(label, PP); | 1150 __ Call(label, PP); |
| 1151 AddCurrentDescriptor(kind, Isolate::kNoDeoptId, token_pos); | 1151 RecordCallInfo(token_pos, kind, Isolate::kNoDeoptId, locs, 0); |
| 1152 RecordSafepoint(locs); | |
| 1153 } | 1152 } |
| 1154 | 1153 |
| 1155 | 1154 |
| 1156 void FlowGraphCompiler::GenerateDartCall(intptr_t deopt_id, | 1155 void FlowGraphCompiler::GenerateDartCall(intptr_t deopt_id, |
| 1157 intptr_t token_pos, | 1156 intptr_t token_pos, |
| 1158 const ExternalLabel* label, | 1157 const ExternalLabel* label, |
| 1159 RawPcDescriptors::Kind kind, | 1158 RawPcDescriptors::Kind kind, |
| 1160 LocationSummary* locs) { | 1159 LocationSummary* locs) { |
| 1161 __ CallPatchable(label); | 1160 __ CallPatchable(label); |
| 1162 AddCurrentDescriptor(kind, deopt_id, token_pos); | 1161 RecordCallInfo(token_pos, kind, deopt_id, locs, locs->input_count()); |
| 1163 RecordSafepoint(locs); | |
| 1164 // Marks either the continuation point in unoptimized code or the | |
| 1165 // deoptimization point in optimized code, after call. | |
| 1166 const intptr_t deopt_id_after = Isolate::ToDeoptAfter(deopt_id); | |
| 1167 if (is_optimizing()) { | |
| 1168 AddDeoptIndexAtCall(deopt_id_after, token_pos); | |
| 1169 } else { | |
| 1170 // Add deoptimization continuation point after the call and before the | |
| 1171 // arguments are removed. | |
| 1172 AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, token_pos); | |
| 1173 } | |
| 1174 } | 1162 } |
| 1175 | 1163 |
| 1176 | 1164 |
| 1177 void FlowGraphCompiler::GenerateRuntimeCall(intptr_t token_pos, | 1165 void FlowGraphCompiler::GenerateRuntimeCall(intptr_t token_pos, |
| 1178 intptr_t deopt_id, | 1166 intptr_t deopt_id, |
| 1179 const RuntimeEntry& entry, | 1167 const RuntimeEntry& entry, |
| 1180 intptr_t argument_count, | 1168 intptr_t argument_count, |
| 1181 LocationSummary* locs) { | 1169 LocationSummary* locs) { |
| 1182 __ CallRuntime(entry, argument_count); | 1170 __ CallRuntime(entry, argument_count); |
| 1183 AddCurrentDescriptor(RawPcDescriptors::kOther, deopt_id, token_pos); | 1171 RecordCallInfo(token_pos, RawPcDescriptors::kOther, deopt_id, locs, 0); |
| 1184 RecordSafepoint(locs); | |
| 1185 if (deopt_id != Isolate::kNoDeoptId) { | |
| 1186 // Marks either the continuation point in unoptimized code or the | |
| 1187 // deoptimization point in optimized code, after call. | |
| 1188 const intptr_t deopt_id_after = Isolate::ToDeoptAfter(deopt_id); | |
| 1189 if (is_optimizing()) { | |
| 1190 AddDeoptIndexAtCall(deopt_id_after, token_pos); | |
| 1191 } else { | |
| 1192 // Add deoptimization continuation point after the call and before the | |
| 1193 // arguments are removed. | |
| 1194 AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, token_pos); | |
| 1195 } | |
| 1196 } | |
| 1197 } | 1172 } |
| 1198 | 1173 |
| 1199 | 1174 |
| 1200 void FlowGraphCompiler::EmitUnoptimizedStaticCall( | 1175 void FlowGraphCompiler::EmitUnoptimizedStaticCall( |
| 1201 intptr_t argument_count, | 1176 intptr_t argument_count, |
| 1202 intptr_t deopt_id, | 1177 intptr_t deopt_id, |
| 1203 intptr_t token_pos, | 1178 intptr_t token_pos, |
| 1204 LocationSummary* locs, | 1179 LocationSummary* locs, |
| 1205 const ICData& ic_data) { | 1180 const ICData& ic_data) { |
| 1206 StubCode* stub_code = isolate()->stub_code(); | 1181 StubCode* stub_code = isolate()->stub_code(); |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1327 // proper target for the given name and arguments descriptor. If the | 1302 // proper target for the given name and arguments descriptor. If the |
| 1328 // illegal class id was found, the target is a cache miss handler that can | 1303 // illegal class id was found, the target is a cache miss handler that can |
| 1329 // be invoked as a normal Dart function. | 1304 // be invoked as a normal Dart function. |
| 1330 __ movq(RAX, FieldAddress(RDI, RCX, TIMES_8, base + kWordSize)); | 1305 __ movq(RAX, FieldAddress(RDI, RCX, TIMES_8, base + kWordSize)); |
| 1331 __ movq(RCX, FieldAddress(RAX, Function::instructions_offset())); | 1306 __ movq(RCX, FieldAddress(RAX, Function::instructions_offset())); |
| 1332 __ LoadObject(RBX, ic_data, PP); | 1307 __ LoadObject(RBX, ic_data, PP); |
| 1333 __ LoadObject(R10, arguments_descriptor, PP); | 1308 __ LoadObject(R10, arguments_descriptor, PP); |
| 1334 __ AddImmediate( | 1309 __ AddImmediate( |
| 1335 RCX, Immediate(Instructions::HeaderSize() - kHeapObjectTag), PP); | 1310 RCX, Immediate(Instructions::HeaderSize() - kHeapObjectTag), PP); |
| 1336 __ call(RCX); | 1311 __ call(RCX); |
| 1337 AddCurrentDescriptor(RawPcDescriptors::kOther, | 1312 RecordCallInfo( |
| 1338 Isolate::kNoDeoptId, token_pos); | 1313 token_pos, RawPcDescriptors::kOther, deopt_id, locs, locs->input_count()); |
| 1339 RecordSafepoint(locs); | |
| 1340 AddDeoptIndexAtCall(Isolate::ToDeoptAfter(deopt_id), token_pos); | |
| 1341 __ Drop(argument_count); | 1314 __ Drop(argument_count); |
| 1342 } | 1315 } |
| 1343 | 1316 |
| 1344 | 1317 |
| 1345 void FlowGraphCompiler::EmitOptimizedStaticCall( | 1318 void FlowGraphCompiler::EmitOptimizedStaticCall( |
| 1346 const Function& function, | 1319 const Function& function, |
| 1347 const Array& arguments_descriptor, | 1320 const Array& arguments_descriptor, |
| 1348 intptr_t argument_count, | 1321 intptr_t argument_count, |
| 1349 intptr_t deopt_id, | 1322 intptr_t deopt_id, |
| 1350 intptr_t token_pos, | 1323 intptr_t token_pos, |
| (...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1724 __ movups(reg, Address(RSP, 0)); | 1697 __ movups(reg, Address(RSP, 0)); |
| 1725 __ AddImmediate(RSP, Immediate(kFpuRegisterSize), PP); | 1698 __ AddImmediate(RSP, Immediate(kFpuRegisterSize), PP); |
| 1726 } | 1699 } |
| 1727 | 1700 |
| 1728 | 1701 |
| 1729 #undef __ | 1702 #undef __ |
| 1730 | 1703 |
| 1731 } // namespace dart | 1704 } // namespace dart |
| 1732 | 1705 |
| 1733 #endif // defined TARGET_ARCH_X64 | 1706 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |