| 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 1425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1436 } | 1436 } |
| 1437 | 1437 |
| 1438 | 1438 |
| 1439 static void EmitDoubleBinaryOp(FlowGraphCompiler* compiler, | 1439 static void EmitDoubleBinaryOp(FlowGraphCompiler* compiler, |
| 1440 BinaryOpComp* comp) { | 1440 BinaryOpComp* comp) { |
| 1441 Register left = comp->locs()->in(0).reg(); | 1441 Register left = comp->locs()->in(0).reg(); |
| 1442 Register right = comp->locs()->in(1).reg(); | 1442 Register right = comp->locs()->in(1).reg(); |
| 1443 Register temp = comp->locs()->temp(0).reg(); | 1443 Register temp = comp->locs()->temp(0).reg(); |
| 1444 Register result = comp->locs()->out().reg(); | 1444 Register result = comp->locs()->out().reg(); |
| 1445 | 1445 |
| 1446 const Class& double_class = | 1446 const Class& double_class = compiler->double_class(); |
| 1447 Class::ZoneHandle(Isolate::Current()->object_store()->double_class()); | |
| 1448 const Code& stub = | 1447 const Code& stub = |
| 1449 Code::Handle(StubCode::GetAllocationStubForClass(double_class)); | 1448 Code::Handle(StubCode::GetAllocationStubForClass(double_class)); |
| 1450 const ExternalLabel label(double_class.ToCString(), stub.EntryPoint()); | 1449 const ExternalLabel label(double_class.ToCString(), stub.EntryPoint()); |
| 1451 __ pushl(left); | 1450 __ pushl(left); |
| 1452 __ pushl(right); | 1451 __ pushl(right); |
| 1453 compiler->GenerateCall(comp->instance_call()->token_index(), | 1452 compiler->GenerateCall(comp->instance_call()->token_index(), |
| 1454 comp->instance_call()->try_index(), | 1453 comp->instance_call()->try_index(), |
| 1455 &label, | 1454 &label, |
| 1456 PcDescriptors::kOther); | 1455 PcDescriptors::kOther); |
| 1457 // Newly allocated object is now in the result register (RAX). | 1456 // Newly allocated object is now in the result register (RAX). |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1577 kDeoptSmiBinaryOp, | 1576 kDeoptSmiBinaryOp, |
| 1578 value); | 1577 value); |
| 1579 if (test_class.id() == kDouble) { | 1578 if (test_class.id() == kDouble) { |
| 1580 Register temp = locs()->temp(0).reg(); | 1579 Register temp = locs()->temp(0).reg(); |
| 1581 ASSERT(result != temp); | 1580 ASSERT(result != temp); |
| 1582 __ testl(value, Immediate(kSmiTagMask)); | 1581 __ testl(value, Immediate(kSmiTagMask)); |
| 1583 __ j(ZERO, deopt); // Smi. | 1582 __ j(ZERO, deopt); // Smi. |
| 1584 __ CompareClassId(value, kDouble, temp); | 1583 __ CompareClassId(value, kDouble, temp); |
| 1585 __ j(NOT_EQUAL, deopt); | 1584 __ j(NOT_EQUAL, deopt); |
| 1586 // Allocate result object. | 1585 // Allocate result object. |
| 1587 const Class& double_class = | 1586 const Class& double_class = compiler->double_class(); |
| 1588 Class::ZoneHandle(Isolate::Current()->object_store()->double_class()); | |
| 1589 const Code& stub = | 1587 const Code& stub = |
| 1590 Code::Handle(StubCode::GetAllocationStubForClass(double_class)); | 1588 Code::Handle(StubCode::GetAllocationStubForClass(double_class)); |
| 1591 const ExternalLabel label(double_class.ToCString(), stub.EntryPoint()); | 1589 const ExternalLabel label(double_class.ToCString(), stub.EntryPoint()); |
| 1592 __ pushl(value); | 1590 __ pushl(value); |
| 1593 compiler->GenerateCall(instance_call()->token_index(), | 1591 compiler->GenerateCall(instance_call()->token_index(), |
| 1594 instance_call()->try_index(), | 1592 instance_call()->try_index(), |
| 1595 &label, | 1593 &label, |
| 1596 PcDescriptors::kOther); | 1594 PcDescriptors::kOther); |
| 1597 // Result is in EAX. | 1595 // Result is in EAX. |
| 1598 __ movl(result, EAX); | 1596 __ movl(result, EAX); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1639 __ testl(value, Immediate(kSmiTagMask)); | 1637 __ testl(value, Immediate(kSmiTagMask)); |
| 1640 __ j(ZERO, deopt); // Deoptimize if Smi. | 1638 __ j(ZERO, deopt); // Deoptimize if Smi. |
| 1641 __ CompareClassId(value, kDouble, temp); | 1639 __ CompareClassId(value, kDouble, temp); |
| 1642 __ j(NOT_EQUAL, deopt); // Deoptimize if not Double. | 1640 __ j(NOT_EQUAL, deopt); // Deoptimize if not Double. |
| 1643 ASSERT(value == result); | 1641 ASSERT(value == result); |
| 1644 return; | 1642 return; |
| 1645 } | 1643 } |
| 1646 | 1644 |
| 1647 ASSERT(from() == kSmi); | 1645 ASSERT(from() == kSmi); |
| 1648 | 1646 |
| 1649 // TODO(vegorov): allocate a single ZoneHandle in FlowGraphCompiler for | 1647 const Class& double_class = compiler->double_class(); |
| 1650 // double class. | |
| 1651 const Class& double_class = | |
| 1652 Class::ZoneHandle(Isolate::Current()->object_store()->double_class()); | |
| 1653 | |
| 1654 const Code& stub = | 1648 const Code& stub = |
| 1655 Code::Handle(StubCode::GetAllocationStubForClass(double_class)); | 1649 Code::Handle(StubCode::GetAllocationStubForClass(double_class)); |
| 1656 | |
| 1657 const ExternalLabel label(double_class.ToCString(), stub.EntryPoint()); | 1650 const ExternalLabel label(double_class.ToCString(), stub.EntryPoint()); |
| 1658 | 1651 |
| 1659 // TODO(vegorov): allocate box in the driver loop to avoid pushing and poping. | 1652 // TODO(vegorov): allocate box in the driver loop to avoid pushing and poping. |
| 1660 __ pushl(value); | 1653 __ pushl(value); |
| 1661 compiler->GenerateCall(instance_call()->token_index(), | 1654 compiler->GenerateCall(instance_call()->token_index(), |
| 1662 instance_call()->try_index(), | 1655 instance_call()->try_index(), |
| 1663 &label, | 1656 &label, |
| 1664 PcDescriptors::kOther); | 1657 PcDescriptors::kOther); |
| 1665 ASSERT(result == EAX); | 1658 ASSERT(result == EAX); |
| 1666 __ popl(value); | 1659 __ popl(value); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1720 } | 1713 } |
| 1721 __ Bind(&done); | 1714 __ Bind(&done); |
| 1722 } | 1715 } |
| 1723 | 1716 |
| 1724 | 1717 |
| 1725 } // namespace dart | 1718 } // namespace dart |
| 1726 | 1719 |
| 1727 #undef __ | 1720 #undef __ |
| 1728 | 1721 |
| 1729 #endif // defined TARGET_ARCH_X64 | 1722 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |