| 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 1203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1214 const ICData& ic_data) { | 1214 const ICData& ic_data) { |
| 1215 uword label_address = 0; | 1215 uword label_address = 0; |
| 1216 if (ic_data.NumArgsTested() == 0) { | 1216 if (ic_data.NumArgsTested() == 0) { |
| 1217 label_address = StubCode::ZeroArgsUnoptimizedStaticCallEntryPoint(); | 1217 label_address = StubCode::ZeroArgsUnoptimizedStaticCallEntryPoint(); |
| 1218 } else if (ic_data.NumArgsTested() == 2) { | 1218 } else if (ic_data.NumArgsTested() == 2) { |
| 1219 label_address = StubCode::TwoArgsUnoptimizedStaticCallEntryPoint(); | 1219 label_address = StubCode::TwoArgsUnoptimizedStaticCallEntryPoint(); |
| 1220 } else { | 1220 } else { |
| 1221 UNIMPLEMENTED(); | 1221 UNIMPLEMENTED(); |
| 1222 } | 1222 } |
| 1223 ExternalLabel target_label(label_address); | 1223 ExternalLabel target_label(label_address); |
| 1224 __ movq(R10, Immediate(0)); |
| 1224 __ LoadObject(RBX, ic_data, PP); | 1225 __ LoadObject(RBX, ic_data, PP); |
| 1225 GenerateDartCall(deopt_id, | 1226 GenerateDartCall(deopt_id, |
| 1226 token_pos, | 1227 token_pos, |
| 1227 &target_label, | 1228 &target_label, |
| 1228 PcDescriptors::kUnoptStaticCall, | 1229 PcDescriptors::kUnoptStaticCall, |
| 1229 locs); | 1230 locs); |
| 1230 __ Drop(argument_count); | 1231 __ Drop(argument_count); |
| 1232 #if defined(DEBUG) |
| 1233 __ movq(R10, Immediate(1)); // Garbage that looks like an object. |
| 1234 #endif |
| 1231 } | 1235 } |
| 1232 | 1236 |
| 1233 | 1237 |
| 1234 void FlowGraphCompiler::EmitEdgeCounter() { | 1238 void FlowGraphCompiler::EmitEdgeCounter() { |
| 1235 // We do not check for overflow when incrementing the edge counter. The | 1239 // We do not check for overflow when incrementing the edge counter. The |
| 1236 // function should normally be optimized long before the counter can | 1240 // function should normally be optimized long before the counter can |
| 1237 // overflow; and though we do not reset the counters when we optimize or | 1241 // overflow; and though we do not reset the counters when we optimize or |
| 1238 // deoptimize, there is a bound on the number of | 1242 // deoptimize, there is a bound on the number of |
| 1239 // optimization/deoptimization cycles we will attempt. | 1243 // optimization/deoptimization cycles we will attempt. |
| 1240 const Array& counter = Array::ZoneHandle(Array::New(1, Heap::kOld)); | 1244 const Array& counter = Array::ZoneHandle(Array::New(1, Heap::kOld)); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 1271 } | 1275 } |
| 1272 | 1276 |
| 1273 | 1277 |
| 1274 void FlowGraphCompiler::EmitInstanceCall(ExternalLabel* target_label, | 1278 void FlowGraphCompiler::EmitInstanceCall(ExternalLabel* target_label, |
| 1275 const ICData& ic_data, | 1279 const ICData& ic_data, |
| 1276 intptr_t argument_count, | 1280 intptr_t argument_count, |
| 1277 intptr_t deopt_id, | 1281 intptr_t deopt_id, |
| 1278 intptr_t token_pos, | 1282 intptr_t token_pos, |
| 1279 LocationSummary* locs) { | 1283 LocationSummary* locs) { |
| 1280 ASSERT(Array::Handle(ic_data.arguments_descriptor()).Length() > 0); | 1284 ASSERT(Array::Handle(ic_data.arguments_descriptor()).Length() > 0); |
| 1285 __ movq(R10, Immediate(0)); |
| 1281 __ LoadObject(RBX, ic_data, PP); | 1286 __ LoadObject(RBX, ic_data, PP); |
| 1282 GenerateDartCall(deopt_id, | 1287 GenerateDartCall(deopt_id, |
| 1283 token_pos, | 1288 token_pos, |
| 1284 target_label, | 1289 target_label, |
| 1285 PcDescriptors::kIcCall, | 1290 PcDescriptors::kIcCall, |
| 1286 locs); | 1291 locs); |
| 1287 __ Drop(argument_count); | 1292 __ Drop(argument_count); |
| 1293 #if defined(DEBUG) |
| 1294 __ movq(R10, Immediate(1)); // Garbage that looks like an object. |
| 1295 #endif |
| 1288 } | 1296 } |
| 1289 | 1297 |
| 1290 | 1298 |
| 1291 void FlowGraphCompiler::EmitMegamorphicInstanceCall( | 1299 void FlowGraphCompiler::EmitMegamorphicInstanceCall( |
| 1292 const ICData& ic_data, | 1300 const ICData& ic_data, |
| 1293 intptr_t argument_count, | 1301 intptr_t argument_count, |
| 1294 intptr_t deopt_id, | 1302 intptr_t deopt_id, |
| 1295 intptr_t token_pos, | 1303 intptr_t token_pos, |
| 1296 LocationSummary* locs) { | 1304 LocationSummary* locs) { |
| 1297 MegamorphicCacheTable* table = Isolate::Current()->megamorphic_cache_table(); | 1305 MegamorphicCacheTable* table = Isolate::Current()->megamorphic_cache_table(); |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1406 void FlowGraphCompiler::EmitEqualityRegRegCompare(Register left, | 1414 void FlowGraphCompiler::EmitEqualityRegRegCompare(Register left, |
| 1407 Register right, | 1415 Register right, |
| 1408 bool needs_number_check, | 1416 bool needs_number_check, |
| 1409 intptr_t token_pos) { | 1417 intptr_t token_pos) { |
| 1410 if (needs_number_check) { | 1418 if (needs_number_check) { |
| 1411 __ pushq(left); | 1419 __ pushq(left); |
| 1412 __ pushq(right); | 1420 __ pushq(right); |
| 1413 if (is_optimizing()) { | 1421 if (is_optimizing()) { |
| 1414 __ CallPatchable(&StubCode::OptimizedIdenticalWithNumberCheckLabel()); | 1422 __ CallPatchable(&StubCode::OptimizedIdenticalWithNumberCheckLabel()); |
| 1415 } else { | 1423 } else { |
| 1424 __ movq(R10, Immediate(0)); |
| 1425 __ movq(RBX, Immediate(0)); |
| 1416 __ CallPatchable(&StubCode::UnoptimizedIdenticalWithNumberCheckLabel()); | 1426 __ CallPatchable(&StubCode::UnoptimizedIdenticalWithNumberCheckLabel()); |
| 1417 } | 1427 } |
| 1418 if (token_pos != Scanner::kNoSourcePos) { | 1428 if (token_pos != Scanner::kNoSourcePos) { |
| 1419 AddCurrentDescriptor(PcDescriptors::kRuntimeCall, | 1429 AddCurrentDescriptor(PcDescriptors::kRuntimeCall, |
| 1420 Isolate::kNoDeoptId, | 1430 Isolate::kNoDeoptId, |
| 1421 token_pos); | 1431 token_pos); |
| 1422 } | 1432 } |
| 1433 #if defined(DEBUG) |
| 1434 // Do this *after* adding the pc descriptor! |
| 1435 if (!is_optimizing()) { |
| 1436 __ movq(R10, Immediate(1)); // Garbage that looks like an object. |
| 1437 __ movq(RBX, Immediate(1)); |
| 1438 } |
| 1439 #endif |
| 1423 // Stub returns result in flags (result of a cmpl, we need ZF computed). | 1440 // Stub returns result in flags (result of a cmpl, we need ZF computed). |
| 1424 __ popq(right); | 1441 __ popq(right); |
| 1425 __ popq(left); | 1442 __ popq(left); |
| 1426 } else { | 1443 } else { |
| 1427 __ cmpl(left, right); | 1444 __ cmpl(left, right); |
| 1428 } | 1445 } |
| 1429 } | 1446 } |
| 1430 | 1447 |
| 1431 | 1448 |
| 1432 // This function must be in sync with FlowGraphCompiler::RecordSafepoint and | 1449 // This function must be in sync with FlowGraphCompiler::RecordSafepoint and |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1702 __ movups(reg, Address(RSP, 0)); | 1719 __ movups(reg, Address(RSP, 0)); |
| 1703 __ AddImmediate(RSP, Immediate(kFpuRegisterSize), PP); | 1720 __ AddImmediate(RSP, Immediate(kFpuRegisterSize), PP); |
| 1704 } | 1721 } |
| 1705 | 1722 |
| 1706 | 1723 |
| 1707 #undef __ | 1724 #undef __ |
| 1708 | 1725 |
| 1709 } // namespace dart | 1726 } // namespace dart |
| 1710 | 1727 |
| 1711 #endif // defined TARGET_ARCH_X64 | 1728 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |