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