| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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/intermediate_language.h" | 8 #include "vm/intermediate_language.h" |
| 9 | 9 |
| 10 #include "lib/error.h" | 10 #include "lib/error.h" |
| (...skipping 1586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1597 return summary; | 1597 return summary; |
| 1598 } | 1598 } |
| 1599 | 1599 |
| 1600 | 1600 |
| 1601 void UnarySmiOpComp::EmitNativeCode(FlowGraphCompiler* compiler) { | 1601 void UnarySmiOpComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 1602 const ICData& ic_data = *instance_call()->ic_data(); | 1602 const ICData& ic_data = *instance_call()->ic_data(); |
| 1603 ASSERT(!ic_data.IsNull()); | 1603 ASSERT(!ic_data.IsNull()); |
| 1604 ASSERT(ic_data.num_args_tested() == 1); | 1604 ASSERT(ic_data.num_args_tested() == 1); |
| 1605 // TODO(srdjan): Implement for more checks. | 1605 // TODO(srdjan): Implement for more checks. |
| 1606 ASSERT(ic_data.NumberOfChecks() == 1); | 1606 ASSERT(ic_data.NumberOfChecks() == 1); |
| 1607 Class& test_class = Class::Handle(); | 1607 intptr_t test_class_id; |
| 1608 Function& target = Function::Handle(); | 1608 Function& target = Function::Handle(); |
| 1609 ic_data.GetOneClassCheckAt(0, &test_class, &target); | 1609 ic_data.GetOneClassCheckAt(0, &test_class_id, &target); |
| 1610 | 1610 |
| 1611 Register value = locs()->in(0).reg(); | 1611 Register value = locs()->in(0).reg(); |
| 1612 Register result = locs()->out().reg(); | 1612 Register result = locs()->out().reg(); |
| 1613 ASSERT(value == result); | 1613 ASSERT(value == result); |
| 1614 Label* deopt = compiler->AddDeoptStub(instance_call()->cid(), | 1614 Label* deopt = compiler->AddDeoptStub(instance_call()->cid(), |
| 1615 instance_call()->token_index(), | 1615 instance_call()->token_index(), |
| 1616 instance_call()->try_index(), | 1616 instance_call()->try_index(), |
| 1617 kDeoptSmiBinaryOp, | 1617 kDeoptSmiBinaryOp, |
| 1618 value); | 1618 value); |
| 1619 if (test_class.id() == kSmi) { | 1619 if (test_class_id == kSmi) { |
| 1620 __ testq(value, Immediate(kSmiTagMask)); | 1620 __ testq(value, Immediate(kSmiTagMask)); |
| 1621 __ j(NOT_ZERO, deopt); | 1621 __ j(NOT_ZERO, deopt); |
| 1622 switch (op_kind()) { | 1622 switch (op_kind()) { |
| 1623 case Token::kNEGATE: | 1623 case Token::kNEGATE: |
| 1624 __ negq(value); | 1624 __ negq(value); |
| 1625 __ j(OVERFLOW, deopt); | 1625 __ j(OVERFLOW, deopt); |
| 1626 break; | 1626 break; |
| 1627 case Token::kBIT_NOT: | 1627 case Token::kBIT_NOT: |
| 1628 __ notq(value); | 1628 __ notq(value); |
| 1629 __ andq(value, Immediate(~kSmiTagMask)); // Remove inverted smi-tag. | 1629 __ andq(value, Immediate(~kSmiTagMask)); // Remove inverted smi-tag. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1650 } | 1650 } |
| 1651 | 1651 |
| 1652 | 1652 |
| 1653 void NumberNegateComp::EmitNativeCode(FlowGraphCompiler* compiler) { | 1653 void NumberNegateComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 1654 const ICData& ic_data = *instance_call()->ic_data(); | 1654 const ICData& ic_data = *instance_call()->ic_data(); |
| 1655 ASSERT(!ic_data.IsNull()); | 1655 ASSERT(!ic_data.IsNull()); |
| 1656 ASSERT(ic_data.num_args_tested() == 1); | 1656 ASSERT(ic_data.num_args_tested() == 1); |
| 1657 | 1657 |
| 1658 // TODO(srdjan): Implement for more checks. | 1658 // TODO(srdjan): Implement for more checks. |
| 1659 ASSERT(ic_data.NumberOfChecks() == 1); | 1659 ASSERT(ic_data.NumberOfChecks() == 1); |
| 1660 Class& test_class = Class::Handle(); | 1660 intptr_t test_class_id; |
| 1661 Function& target = Function::Handle(); | 1661 Function& target = Function::Handle(); |
| 1662 ic_data.GetOneClassCheckAt(0, &test_class, &target); | 1662 ic_data.GetOneClassCheckAt(0, &test_class_id, &target); |
| 1663 | 1663 |
| 1664 Register value = locs()->in(0).reg(); | 1664 Register value = locs()->in(0).reg(); |
| 1665 Register result = locs()->out().reg(); | 1665 Register result = locs()->out().reg(); |
| 1666 ASSERT(value == result); | 1666 ASSERT(value == result); |
| 1667 Label* deopt = compiler->AddDeoptStub(instance_call()->cid(), | 1667 Label* deopt = compiler->AddDeoptStub(instance_call()->cid(), |
| 1668 instance_call()->token_index(), | 1668 instance_call()->token_index(), |
| 1669 instance_call()->try_index(), | 1669 instance_call()->try_index(), |
| 1670 kDeoptSmiBinaryOp, | 1670 kDeoptSmiBinaryOp, |
| 1671 value); | 1671 value); |
| 1672 if (test_class.id() == kDouble) { | 1672 if (test_class_id == kDouble) { |
| 1673 Register temp = locs()->temp(0).reg(); | 1673 Register temp = locs()->temp(0).reg(); |
| 1674 __ testq(value, Immediate(kSmiTagMask)); | 1674 __ testq(value, Immediate(kSmiTagMask)); |
| 1675 __ j(ZERO, deopt); // Smi. | 1675 __ j(ZERO, deopt); // Smi. |
| 1676 __ CompareClassId(value, kDouble); | 1676 __ CompareClassId(value, kDouble); |
| 1677 __ j(NOT_EQUAL, deopt); | 1677 __ j(NOT_EQUAL, deopt); |
| 1678 // Allocate result object. | 1678 // Allocate result object. |
| 1679 const Class& double_class = compiler->double_class(); | 1679 const Class& double_class = compiler->double_class(); |
| 1680 const Code& stub = | 1680 const Code& stub = |
| 1681 Code::Handle(StubCode::GetAllocationStubForClass(double_class)); | 1681 Code::Handle(StubCode::GetAllocationStubForClass(double_class)); |
| 1682 const ExternalLabel label(double_class.ToCString(), stub.EntryPoint()); | 1682 const ExternalLabel label(double_class.ToCString(), stub.EntryPoint()); |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1803 instance_call()->argument_names()); | 1803 instance_call()->argument_names()); |
| 1804 } | 1804 } |
| 1805 __ Bind(&done); | 1805 __ Bind(&done); |
| 1806 } | 1806 } |
| 1807 | 1807 |
| 1808 } // namespace dart | 1808 } // namespace dart |
| 1809 | 1809 |
| 1810 #undef __ | 1810 #undef __ |
| 1811 | 1811 |
| 1812 #endif // defined TARGET_ARCH_X64 | 1812 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |