| 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 1567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1578 __ popl(value); | 1578 __ popl(value); |
| 1579 | 1579 |
| 1580 __ testl(value, Immediate(kSmiTagMask)); | 1580 __ testl(value, Immediate(kSmiTagMask)); |
| 1581 __ j(NOT_ZERO, deopt); // Deoptimize if not Smi. | 1581 __ j(NOT_ZERO, deopt); // Deoptimize if not Smi. |
| 1582 __ SmiUntag(value); | 1582 __ SmiUntag(value); |
| 1583 __ cvtsi2sd(XMM0, value); | 1583 __ cvtsi2sd(XMM0, value); |
| 1584 __ movsd(FieldAddress(result, Double::value_offset()), XMM0); | 1584 __ movsd(FieldAddress(result, Double::value_offset()), XMM0); |
| 1585 } | 1585 } |
| 1586 | 1586 |
| 1587 | 1587 |
| 1588 LocationSummary* PolymorphicInstanceCallComp::MakeLocationSummary() const { |
| 1589 return MakeCallSummary(); |
| 1590 } |
| 1591 |
| 1592 |
| 1593 void PolymorphicInstanceCallComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 1594 ASSERT(instance_call()->VerifyComputation()); |
| 1595 ASSERT(class_ids().length() == targets().length()); |
| 1596 ASSERT(class_ids().length() > 0); |
| 1597 Label* deopt = compiler->AddDeoptStub(instance_call()->cid(), |
| 1598 instance_call()->token_index(), |
| 1599 instance_call()->try_index(), |
| 1600 kDeoptPolymorphicInstanceCallTestFail); |
| 1601 Label handle_smi; |
| 1602 Label* is_smi_label = class_ids()[0] == kSmi ? &handle_smi : deopt; |
| 1603 // Load receiver into EAX. |
| 1604 __ movl(EAX, |
| 1605 Address(ESP, (instance_call()->ArgumentCount() - 1) * kWordSize)); |
| 1606 __ testl(EAX, Immediate(kSmiTagMask)); |
| 1607 __ j(ZERO, is_smi_label); |
| 1608 Label done; |
| 1609 __ LoadClassId(EDI, EAX); |
| 1610 for (intptr_t i = 0; i < class_ids().length(); i++) { |
| 1611 Label next_test; |
| 1612 __ cmpl(EDI, Immediate(class_ids()[i])); |
| 1613 __ j(NOT_EQUAL, &next_test); |
| 1614 compiler->GenerateStaticCall(instance_call()->cid(), |
| 1615 instance_call()->token_index(), |
| 1616 instance_call()->try_index(), |
| 1617 *targets()[i], |
| 1618 instance_call()->ArgumentCount(), |
| 1619 instance_call()->argument_names()); |
| 1620 __ jmp(&done); |
| 1621 __ Bind(&next_test); |
| 1622 } |
| 1623 __ jmp(deopt); |
| 1624 if (is_smi_label == &handle_smi) { |
| 1625 __ Bind(&handle_smi); |
| 1626 compiler->GenerateStaticCall(instance_call()->cid(), |
| 1627 instance_call()->token_index(), |
| 1628 instance_call()->try_index(), |
| 1629 *targets()[0], |
| 1630 instance_call()->ArgumentCount(), |
| 1631 instance_call()->argument_names()); |
| 1632 } |
| 1633 __ Bind(&done); |
| 1634 } |
| 1635 |
| 1636 |
| 1588 } // namespace dart | 1637 } // namespace dart |
| 1589 | 1638 |
| 1590 #undef __ | 1639 #undef __ |
| 1591 | 1640 |
| 1592 #endif // defined TARGET_ARCH_X64 | 1641 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |