Chromium Code Reviews| 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 __ movl(EAX, | |
|
Vyacheslav Egorov (Google)
2012/06/14 11:22:03
Please add a comment like:
// Load receiver into
srdjan
2012/06/14 17:47:15
Done.
| |
| 1604 Address(ESP, (instance_call()->ArgumentCount() - 1) * kWordSize)); | |
| 1605 __ testl(EAX, Immediate(kSmiTagMask)); | |
| 1606 __ j(ZERO, is_smi_label); // Smi -> deopt. | |
|
Vyacheslav Egorov (Google)
2012/06/14 11:22:03
Comment does not match the code.
(same on x64)
srdjan
2012/06/14 17:47:15
Done.
| |
| 1607 Label done; | |
| 1608 __ LoadClassId(EDI, EAX); | |
| 1609 for (intptr_t i = 0; i < class_ids().length(); i++) { | |
| 1610 Label next_test; | |
| 1611 __ cmpl(EDI, Immediate(class_ids()[i])); | |
| 1612 __ j(NOT_EQUAL, &next_test); | |
| 1613 compiler->GenerateStaticCall(instance_call()->cid(), | |
| 1614 instance_call()->token_index(), | |
| 1615 instance_call()->try_index(), | |
| 1616 *targets()[i], | |
| 1617 instance_call()->ArgumentCount(), | |
| 1618 instance_call()->argument_names()); | |
| 1619 __ jmp(&done); | |
| 1620 __ Bind(&next_test); | |
| 1621 } | |
| 1622 __ jmp(deopt); | |
| 1623 if (is_smi_label == &handle_smi) { | |
| 1624 __ Bind(&handle_smi); | |
| 1625 compiler->GenerateStaticCall(instance_call()->cid(), | |
| 1626 instance_call()->token_index(), | |
| 1627 instance_call()->try_index(), | |
| 1628 *targets()[0], | |
| 1629 instance_call()->ArgumentCount(), | |
| 1630 instance_call()->argument_names()); | |
| 1631 } | |
| 1632 __ Bind(&done); | |
| 1633 } | |
| 1634 | |
| 1635 | |
| 1588 } // namespace dart | 1636 } // namespace dart |
| 1589 | 1637 |
| 1590 #undef __ | 1638 #undef __ |
| 1591 | 1639 |
| 1592 #endif // defined TARGET_ARCH_X64 | 1640 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |