| 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_IA32. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. |
| 6 #if defined(TARGET_ARCH_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
| 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 1569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1580 return summary; | 1580 return summary; |
| 1581 } | 1581 } |
| 1582 | 1582 |
| 1583 | 1583 |
| 1584 void UnarySmiOpComp::EmitNativeCode(FlowGraphCompiler* compiler) { | 1584 void UnarySmiOpComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 1585 const ICData& ic_data = *instance_call()->ic_data(); | 1585 const ICData& ic_data = *instance_call()->ic_data(); |
| 1586 ASSERT(!ic_data.IsNull()); | 1586 ASSERT(!ic_data.IsNull()); |
| 1587 ASSERT(ic_data.num_args_tested() == 1); | 1587 ASSERT(ic_data.num_args_tested() == 1); |
| 1588 // TODO(srdjan): Implement for more checks. | 1588 // TODO(srdjan): Implement for more checks. |
| 1589 ASSERT(ic_data.NumberOfChecks() == 1); | 1589 ASSERT(ic_data.NumberOfChecks() == 1); |
| 1590 Class& test_class = Class::Handle(); | 1590 intptr_t test_class_id; |
| 1591 Function& target = Function::Handle(); | 1591 Function& target = Function::Handle(); |
| 1592 ic_data.GetOneClassCheckAt(0, &test_class, &target); | 1592 ic_data.GetOneClassCheckAt(0, &test_class_id, &target); |
| 1593 | 1593 |
| 1594 Register value = locs()->in(0).reg(); | 1594 Register value = locs()->in(0).reg(); |
| 1595 Register result = locs()->out().reg(); | 1595 Register result = locs()->out().reg(); |
| 1596 ASSERT(value == result); | 1596 ASSERT(value == result); |
| 1597 Label* deopt = compiler->AddDeoptStub(instance_call()->cid(), | 1597 Label* deopt = compiler->AddDeoptStub(instance_call()->cid(), |
| 1598 instance_call()->token_index(), | 1598 instance_call()->token_index(), |
| 1599 instance_call()->try_index(), | 1599 instance_call()->try_index(), |
| 1600 kDeoptSmiBinaryOp, | 1600 kDeoptSmiBinaryOp, |
| 1601 value); | 1601 value); |
| 1602 if (test_class.id() == kSmi) { | 1602 if (test_class_id == kSmi) { |
| 1603 __ testl(value, Immediate(kSmiTagMask)); | 1603 __ testl(value, Immediate(kSmiTagMask)); |
| 1604 __ j(NOT_ZERO, deopt); | 1604 __ j(NOT_ZERO, deopt); |
| 1605 switch (op_kind()) { | 1605 switch (op_kind()) { |
| 1606 case Token::kNEGATE: | 1606 case Token::kNEGATE: |
| 1607 __ negl(value); | 1607 __ negl(value); |
| 1608 __ j(OVERFLOW, deopt); | 1608 __ j(OVERFLOW, deopt); |
| 1609 break; | 1609 break; |
| 1610 case Token::kBIT_NOT: | 1610 case Token::kBIT_NOT: |
| 1611 __ notl(value); | 1611 __ notl(value); |
| 1612 __ andl(value, Immediate(~kSmiTagMask)); // Remove inverted smi-tag. | 1612 __ andl(value, Immediate(~kSmiTagMask)); // Remove inverted smi-tag. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1633 } | 1633 } |
| 1634 | 1634 |
| 1635 | 1635 |
| 1636 void NumberNegateComp::EmitNativeCode(FlowGraphCompiler* compiler) { | 1636 void NumberNegateComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 1637 const ICData& ic_data = *instance_call()->ic_data(); | 1637 const ICData& ic_data = *instance_call()->ic_data(); |
| 1638 ASSERT(!ic_data.IsNull()); | 1638 ASSERT(!ic_data.IsNull()); |
| 1639 ASSERT(ic_data.num_args_tested() == 1); | 1639 ASSERT(ic_data.num_args_tested() == 1); |
| 1640 | 1640 |
| 1641 // TODO(srdjan): Implement for more checks. | 1641 // TODO(srdjan): Implement for more checks. |
| 1642 ASSERT(ic_data.NumberOfChecks() == 1); | 1642 ASSERT(ic_data.NumberOfChecks() == 1); |
| 1643 Class& test_class = Class::Handle(); | 1643 intptr_t test_class_id; |
| 1644 Function& target = Function::Handle(); | 1644 Function& target = Function::Handle(); |
| 1645 ic_data.GetOneClassCheckAt(0, &test_class, &target); | 1645 ic_data.GetOneClassCheckAt(0, &test_class_id, &target); |
| 1646 | 1646 |
| 1647 Register value = locs()->in(0).reg(); | 1647 Register value = locs()->in(0).reg(); |
| 1648 Register result = locs()->out().reg(); | 1648 Register result = locs()->out().reg(); |
| 1649 ASSERT(value == result); | 1649 ASSERT(value == result); |
| 1650 Label* deopt = compiler->AddDeoptStub(instance_call()->cid(), | 1650 Label* deopt = compiler->AddDeoptStub(instance_call()->cid(), |
| 1651 instance_call()->token_index(), | 1651 instance_call()->token_index(), |
| 1652 instance_call()->try_index(), | 1652 instance_call()->try_index(), |
| 1653 kDeoptSmiBinaryOp, | 1653 kDeoptSmiBinaryOp, |
| 1654 value); | 1654 value); |
| 1655 if (test_class.id() == kDouble) { | 1655 if (test_class_id == kDouble) { |
| 1656 Register temp = locs()->temp(0).reg(); | 1656 Register temp = locs()->temp(0).reg(); |
| 1657 ASSERT(result != temp); | 1657 ASSERT(result != temp); |
| 1658 __ testl(value, Immediate(kSmiTagMask)); | 1658 __ testl(value, Immediate(kSmiTagMask)); |
| 1659 __ j(ZERO, deopt); // Smi. | 1659 __ j(ZERO, deopt); // Smi. |
| 1660 __ CompareClassId(value, kDouble, temp); | 1660 __ CompareClassId(value, kDouble, temp); |
| 1661 __ j(NOT_EQUAL, deopt); | 1661 __ j(NOT_EQUAL, deopt); |
| 1662 // Allocate result object. | 1662 // Allocate result object. |
| 1663 const Class& double_class = compiler->double_class(); | 1663 const Class& double_class = compiler->double_class(); |
| 1664 const Code& stub = | 1664 const Code& stub = |
| 1665 Code::Handle(StubCode::GetAllocationStubForClass(double_class)); | 1665 Code::Handle(StubCode::GetAllocationStubForClass(double_class)); |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1790 } | 1790 } |
| 1791 __ Bind(&done); | 1791 __ Bind(&done); |
| 1792 } | 1792 } |
| 1793 | 1793 |
| 1794 | 1794 |
| 1795 } // namespace dart | 1795 } // namespace dart |
| 1796 | 1796 |
| 1797 #undef __ | 1797 #undef __ |
| 1798 | 1798 |
| 1799 #endif // defined TARGET_ARCH_X64 | 1799 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |