| 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 1399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1410 GenerateDartCall(deopt_id, | 1410 GenerateDartCall(deopt_id, |
| 1411 token_pos, | 1411 token_pos, |
| 1412 &stub_code->CallStaticFunctionLabel(), | 1412 &stub_code->CallStaticFunctionLabel(), |
| 1413 RawPcDescriptors::kOptStaticCall, | 1413 RawPcDescriptors::kOptStaticCall, |
| 1414 locs); | 1414 locs); |
| 1415 AddStaticCallTarget(function); | 1415 AddStaticCallTarget(function); |
| 1416 __ Drop(argument_count); | 1416 __ Drop(argument_count); |
| 1417 } | 1417 } |
| 1418 | 1418 |
| 1419 | 1419 |
| 1420 void FlowGraphCompiler::EmitEqualityRegConstCompare(Register reg, | 1420 Condition FlowGraphCompiler::EmitEqualityRegConstCompare( |
| 1421 const Object& obj, | 1421 Register reg, |
| 1422 bool needs_number_check, | 1422 const Object& obj, |
| 1423 intptr_t token_pos) { | 1423 bool needs_number_check, |
| 1424 intptr_t token_pos) { |
| 1424 ASSERT(!needs_number_check || | 1425 ASSERT(!needs_number_check || |
| 1425 (!obj.IsMint() && !obj.IsDouble() && !obj.IsBigint())); | 1426 (!obj.IsMint() && !obj.IsDouble() && !obj.IsBigint())); |
| 1426 | 1427 |
| 1427 if (obj.IsSmi() && (Smi::Cast(obj).Value() == 0)) { | 1428 if (obj.IsSmi() && (Smi::Cast(obj).Value() == 0)) { |
| 1428 ASSERT(!needs_number_check); | 1429 ASSERT(!needs_number_check); |
| 1429 __ testq(reg, reg); | 1430 __ testq(reg, reg); |
| 1430 return; | 1431 return EQUAL; |
| 1431 } | 1432 } |
| 1432 | 1433 |
| 1433 if (needs_number_check) { | 1434 if (needs_number_check) { |
| 1434 StubCode* stub_code = isolate()->stub_code(); | 1435 StubCode* stub_code = isolate()->stub_code(); |
| 1435 __ pushq(reg); | 1436 __ pushq(reg); |
| 1436 __ PushObject(obj, PP); | 1437 __ PushObject(obj, PP); |
| 1437 if (is_optimizing()) { | 1438 if (is_optimizing()) { |
| 1438 __ CallPatchable(&stub_code->OptimizedIdenticalWithNumberCheckLabel()); | 1439 __ CallPatchable(&stub_code->OptimizedIdenticalWithNumberCheckLabel()); |
| 1439 } else { | 1440 } else { |
| 1440 __ CallPatchable(&stub_code->UnoptimizedIdenticalWithNumberCheckLabel()); | 1441 __ CallPatchable(&stub_code->UnoptimizedIdenticalWithNumberCheckLabel()); |
| 1441 } | 1442 } |
| 1442 if (token_pos != Scanner::kNoSourcePos) { | 1443 if (token_pos != Scanner::kNoSourcePos) { |
| 1443 AddCurrentDescriptor(RawPcDescriptors::kRuntimeCall, | 1444 AddCurrentDescriptor(RawPcDescriptors::kRuntimeCall, |
| 1444 Isolate::kNoDeoptId, | 1445 Isolate::kNoDeoptId, |
| 1445 token_pos); | 1446 token_pos); |
| 1446 } | 1447 } |
| 1448 // Stub returns result in flags (result of a cmpq, we need ZF computed). |
| 1447 __ popq(reg); // Discard constant. | 1449 __ popq(reg); // Discard constant. |
| 1448 __ popq(reg); // Restore 'reg'. | 1450 __ popq(reg); // Restore 'reg'. |
| 1449 return; | 1451 } else { |
| 1452 __ CompareObject(reg, obj, PP); |
| 1450 } | 1453 } |
| 1451 | 1454 return EQUAL; |
| 1452 __ CompareObject(reg, obj, PP); | |
| 1453 } | 1455 } |
| 1454 | 1456 |
| 1455 | 1457 |
| 1456 void FlowGraphCompiler::EmitEqualityRegRegCompare(Register left, | 1458 Condition FlowGraphCompiler::EmitEqualityRegRegCompare(Register left, |
| 1457 Register right, | 1459 Register right, |
| 1458 bool needs_number_check, | 1460 bool needs_number_check, |
| 1459 intptr_t token_pos) { | 1461 intptr_t token_pos) { |
| 1460 if (needs_number_check) { | 1462 if (needs_number_check) { |
| 1461 StubCode* stub_code = isolate()->stub_code(); | 1463 StubCode* stub_code = isolate()->stub_code(); |
| 1462 __ pushq(left); | 1464 __ pushq(left); |
| 1463 __ pushq(right); | 1465 __ pushq(right); |
| 1464 if (is_optimizing()) { | 1466 if (is_optimizing()) { |
| 1465 __ CallPatchable(&stub_code->OptimizedIdenticalWithNumberCheckLabel()); | 1467 __ CallPatchable(&stub_code->OptimizedIdenticalWithNumberCheckLabel()); |
| 1466 } else { | 1468 } else { |
| 1467 __ CallPatchable(&stub_code->UnoptimizedIdenticalWithNumberCheckLabel()); | 1469 __ CallPatchable(&stub_code->UnoptimizedIdenticalWithNumberCheckLabel()); |
| 1468 } | 1470 } |
| 1469 if (token_pos != Scanner::kNoSourcePos) { | 1471 if (token_pos != Scanner::kNoSourcePos) { |
| 1470 AddCurrentDescriptor(RawPcDescriptors::kRuntimeCall, | 1472 AddCurrentDescriptor(RawPcDescriptors::kRuntimeCall, |
| 1471 Isolate::kNoDeoptId, | 1473 Isolate::kNoDeoptId, |
| 1472 token_pos); | 1474 token_pos); |
| 1473 } | 1475 } |
| 1474 #if defined(DEBUG) | 1476 #if defined(DEBUG) |
| 1475 // Do this *after* adding the pc descriptor! | 1477 // Do this *after* adding the pc descriptor! |
| 1476 if (!is_optimizing()) { | 1478 if (!is_optimizing()) { |
| 1477 __ movq(R10, Immediate(kInvalidObjectPointer)); | 1479 __ movq(R10, Immediate(kInvalidObjectPointer)); |
| 1478 __ movq(RBX, Immediate(kInvalidObjectPointer)); | 1480 __ movq(RBX, Immediate(kInvalidObjectPointer)); |
| 1479 } | 1481 } |
| 1480 #endif | 1482 #endif |
| 1481 // Stub returns result in flags (result of a cmpl, we need ZF computed). | 1483 // Stub returns result in flags (result of a cmpq, we need ZF computed). |
| 1482 __ popq(right); | 1484 __ popq(right); |
| 1483 __ popq(left); | 1485 __ popq(left); |
| 1484 } else { | 1486 } else { |
| 1485 __ cmpl(left, right); | 1487 __ cmpl(left, right); |
| 1486 } | 1488 } |
| 1489 return EQUAL; |
| 1487 } | 1490 } |
| 1488 | 1491 |
| 1489 | 1492 |
| 1490 // This function must be in sync with FlowGraphCompiler::RecordSafepoint and | 1493 // This function must be in sync with FlowGraphCompiler::RecordSafepoint and |
| 1491 // FlowGraphCompiler::SlowPathEnvironmentFor. | 1494 // FlowGraphCompiler::SlowPathEnvironmentFor. |
| 1492 void FlowGraphCompiler::SaveLiveRegisters(LocationSummary* locs) { | 1495 void FlowGraphCompiler::SaveLiveRegisters(LocationSummary* locs) { |
| 1493 #if defined(DEBUG) | 1496 #if defined(DEBUG) |
| 1494 locs->CheckWritableInputs(); | 1497 locs->CheckWritableInputs(); |
| 1495 ClobberDeadTempRegisters(locs); | 1498 ClobberDeadTempRegisters(locs); |
| 1496 #endif | 1499 #endif |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1806 __ movups(reg, Address(RSP, 0)); | 1809 __ movups(reg, Address(RSP, 0)); |
| 1807 __ AddImmediate(RSP, Immediate(kFpuRegisterSize), PP); | 1810 __ AddImmediate(RSP, Immediate(kFpuRegisterSize), PP); |
| 1808 } | 1811 } |
| 1809 | 1812 |
| 1810 | 1813 |
| 1811 #undef __ | 1814 #undef __ |
| 1812 | 1815 |
| 1813 } // namespace dart | 1816 } // namespace dart |
| 1814 | 1817 |
| 1815 #endif // defined TARGET_ARCH_X64 | 1818 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |