| 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 1256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1267 } | 1267 } |
| 1268 | 1268 |
| 1269 | 1269 |
| 1270 void FlowGraphCompiler::EmitOptimizedInstanceCall( | 1270 void FlowGraphCompiler::EmitOptimizedInstanceCall( |
| 1271 ExternalLabel* target_label, | 1271 ExternalLabel* target_label, |
| 1272 const ICData& ic_data, | 1272 const ICData& ic_data, |
| 1273 intptr_t argument_count, | 1273 intptr_t argument_count, |
| 1274 intptr_t deopt_id, | 1274 intptr_t deopt_id, |
| 1275 intptr_t token_pos, | 1275 intptr_t token_pos, |
| 1276 LocationSummary* locs) { | 1276 LocationSummary* locs) { |
| 1277 ASSERT(Array::Handle(ic_data.arguments_descriptor()).Length() > 0); |
| 1277 // Each ICData propagated from unoptimized to optimized code contains the | 1278 // Each ICData propagated from unoptimized to optimized code contains the |
| 1278 // function that corresponds to the Dart function of that IC call. Due | 1279 // function that corresponds to the Dart function of that IC call. Due |
| 1279 // to inlining in optimized code, that function may not correspond to the | 1280 // to inlining in optimized code, that function may not correspond to the |
| 1280 // top-level function (parsed_function().function()) which could be | 1281 // top-level function (parsed_function().function()) which could be |
| 1281 // reoptimized and which counter needs to be incremented. | 1282 // reoptimized and which counter needs to be incremented. |
| 1282 // Pass the function explicitly, it is used in IC stub. | 1283 // Pass the function explicitly, it is used in IC stub. |
| 1283 __ LoadObject(RDI, parsed_function().function(), PP); | 1284 __ LoadObject(RDI, parsed_function().function(), PP); |
| 1284 __ LoadObject(RBX, ic_data, PP); | 1285 __ LoadObject(RBX, ic_data, PP); |
| 1285 GenerateDartCall(deopt_id, | 1286 GenerateDartCall(deopt_id, |
| 1286 token_pos, | 1287 token_pos, |
| 1287 target_label, | 1288 target_label, |
| 1288 PcDescriptors::kIcCall, | 1289 PcDescriptors::kIcCall, |
| 1289 locs); | 1290 locs); |
| 1290 __ Drop(argument_count); | 1291 __ Drop(argument_count); |
| 1291 } | 1292 } |
| 1292 | 1293 |
| 1293 | 1294 |
| 1294 void FlowGraphCompiler::EmitInstanceCall(ExternalLabel* target_label, | 1295 void FlowGraphCompiler::EmitInstanceCall(ExternalLabel* target_label, |
| 1295 const ICData& ic_data, | 1296 const ICData& ic_data, |
| 1296 intptr_t argument_count, | 1297 intptr_t argument_count, |
| 1297 intptr_t deopt_id, | 1298 intptr_t deopt_id, |
| 1298 intptr_t token_pos, | 1299 intptr_t token_pos, |
| 1299 LocationSummary* locs) { | 1300 LocationSummary* locs) { |
| 1301 ASSERT(Array::Handle(ic_data.arguments_descriptor()).Length() > 0); |
| 1300 __ LoadObject(RBX, ic_data, PP); | 1302 __ LoadObject(RBX, ic_data, PP); |
| 1301 GenerateDartCall(deopt_id, | 1303 GenerateDartCall(deopt_id, |
| 1302 token_pos, | 1304 token_pos, |
| 1303 target_label, | 1305 target_label, |
| 1304 PcDescriptors::kIcCall, | 1306 PcDescriptors::kIcCall, |
| 1305 locs); | 1307 locs); |
| 1306 __ Drop(argument_count); | 1308 __ Drop(argument_count); |
| 1307 } | 1309 } |
| 1308 | 1310 |
| 1309 | 1311 |
| 1310 void FlowGraphCompiler::EmitMegamorphicInstanceCall( | 1312 void FlowGraphCompiler::EmitMegamorphicInstanceCall( |
| 1311 const ICData& ic_data, | 1313 const ICData& ic_data, |
| 1312 intptr_t argument_count, | 1314 intptr_t argument_count, |
| 1313 intptr_t deopt_id, | 1315 intptr_t deopt_id, |
| 1314 intptr_t token_pos, | 1316 intptr_t token_pos, |
| 1315 LocationSummary* locs) { | 1317 LocationSummary* locs) { |
| 1316 MegamorphicCacheTable* table = Isolate::Current()->megamorphic_cache_table(); | 1318 MegamorphicCacheTable* table = Isolate::Current()->megamorphic_cache_table(); |
| 1317 const String& name = String::Handle(ic_data.target_name()); | 1319 const String& name = String::Handle(ic_data.target_name()); |
| 1318 const Array& arguments_descriptor = | 1320 const Array& arguments_descriptor = |
| 1319 Array::ZoneHandle(ic_data.arguments_descriptor()); | 1321 Array::ZoneHandle(ic_data.arguments_descriptor()); |
| 1320 ASSERT(!arguments_descriptor.IsNull()); | 1322 ASSERT(!arguments_descriptor.IsNull() && (arguments_descriptor.Length() > 0)); |
| 1321 const MegamorphicCache& cache = | 1323 const MegamorphicCache& cache = |
| 1322 MegamorphicCache::ZoneHandle(table->Lookup(name, arguments_descriptor)); | 1324 MegamorphicCache::ZoneHandle(table->Lookup(name, arguments_descriptor)); |
| 1323 Label not_smi, load_cache; | 1325 Label not_smi, load_cache; |
| 1324 __ movq(RAX, Address(RSP, (argument_count - 1) * kWordSize)); | 1326 __ movq(RAX, Address(RSP, (argument_count - 1) * kWordSize)); |
| 1325 __ testq(RAX, Immediate(kSmiTagMask)); | 1327 __ testq(RAX, Immediate(kSmiTagMask)); |
| 1326 __ j(NOT_ZERO, ¬_smi, Assembler::kNearJump); | 1328 __ j(NOT_ZERO, ¬_smi, Assembler::kNearJump); |
| 1327 __ LoadImmediate(RAX, Immediate(Smi::RawValue(kSmiCid)), PP); | 1329 __ LoadImmediate(RAX, Immediate(Smi::RawValue(kSmiCid)), PP); |
| 1328 __ jmp(&load_cache); | 1330 __ jmp(&load_cache); |
| 1329 | 1331 |
| 1330 __ Bind(¬_smi); | 1332 __ Bind(¬_smi); |
| (...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1822 __ movups(reg, Address(RSP, 0)); | 1824 __ movups(reg, Address(RSP, 0)); |
| 1823 __ AddImmediate(RSP, Immediate(kFpuRegisterSize), PP); | 1825 __ AddImmediate(RSP, Immediate(kFpuRegisterSize), PP); |
| 1824 } | 1826 } |
| 1825 | 1827 |
| 1826 | 1828 |
| 1827 #undef __ | 1829 #undef __ |
| 1828 | 1830 |
| 1829 } // namespace dart | 1831 } // namespace dart |
| 1830 | 1832 |
| 1831 #endif // defined TARGET_ARCH_X64 | 1833 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |