Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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_ARM. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM. |
| 6 #if defined(TARGET_ARCH_ARM) | 6 #if defined(TARGET_ARCH_ARM) |
| 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 1592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1603 | 1603 |
| 1604 | 1604 |
| 1605 void ExtractConstructorTypeArgumentsInstr::EmitNativeCode( | 1605 void ExtractConstructorTypeArgumentsInstr::EmitNativeCode( |
| 1606 FlowGraphCompiler* compiler) { | 1606 FlowGraphCompiler* compiler) { |
| 1607 Register instantiator_reg = locs()->in(0).reg(); | 1607 Register instantiator_reg = locs()->in(0).reg(); |
| 1608 Register result_reg = locs()->out().reg(); | 1608 Register result_reg = locs()->out().reg(); |
| 1609 ASSERT(instantiator_reg == result_reg); | 1609 ASSERT(instantiator_reg == result_reg); |
| 1610 | 1610 |
| 1611 // instantiator_reg is the instantiator type argument vector, i.e. an | 1611 // instantiator_reg is the instantiator type argument vector, i.e. an |
| 1612 // AbstractTypeArguments object (or null). | 1612 // AbstractTypeArguments object (or null). |
| 1613 if (!type_arguments().IsUninstantiatedIdentity() && | 1613 ASSERT(!type_arguments().IsUninstantiatedIdentity() && |
| 1614 !type_arguments().CanShareInstantiatorTypeArguments( | 1614 !type_arguments().CanShareInstantiatorTypeArguments( |
| 1615 instantiator_class())) { | 1615 instantiator_class())); |
| 1616 // If the instantiator is null and if the type argument vector | 1616 // If the instantiator is null and if the type argument vector |
| 1617 // instantiated from null becomes a vector of dynamic, then use null as | 1617 // instantiated from null becomes a vector of dynamic, then use null as |
| 1618 // the type arguments. | 1618 // the type arguments. |
| 1619 Label type_arguments_instantiated; | 1619 Label type_arguments_instantiated; |
| 1620 const intptr_t len = type_arguments().Length(); | 1620 const intptr_t len = type_arguments().Length(); |
| 1621 if (type_arguments().IsRawInstantiatedRaw(len)) { | 1621 if (type_arguments().IsRawInstantiatedRaw(len)) { |
| 1622 __ CompareImmediate(instantiator_reg, | 1622 __ CompareImmediate(instantiator_reg, |
| 1623 reinterpret_cast<intptr_t>(Object::null())); | 1623 reinterpret_cast<intptr_t>(Object::null())); |
| 1624 __ b(&type_arguments_instantiated, EQ); | 1624 __ b(&type_arguments_instantiated, EQ); |
| 1625 } | |
| 1626 // Instantiate non-null type arguments. | |
| 1627 // In the non-factory case, we rely on the allocation stub to | |
| 1628 // instantiate the type arguments. | |
| 1629 __ LoadObject(result_reg, type_arguments()); | |
| 1630 // result_reg: uninstantiated type arguments. | |
| 1631 __ Bind(&type_arguments_instantiated); | |
| 1632 } | 1625 } |
| 1633 ASSERT(instantiator_reg == result_reg); | 1626 // Instantiate non-null type arguments. |
| 1627 // In the non-factory case, we rely on the allocation stub to | |
| 1628 // instantiate the type arguments. | |
| 1629 __ LoadObject(result_reg, type_arguments()); | |
| 1630 // result_reg: uninstantiated type arguments. | |
| 1631 __ Bind(&type_arguments_instantiated); | |
| 1632 | |
| 1634 // result_reg: uninstantiated or instantiated type arguments. | 1633 // result_reg: uninstantiated or instantiated type arguments. |
| 1635 } | 1634 } |
| 1636 | 1635 |
| 1637 | 1636 |
| 1638 LocationSummary* | 1637 LocationSummary* |
| 1639 ExtractConstructorInstantiatorInstr::MakeLocationSummary() const { | 1638 ExtractConstructorInstantiatorInstr::MakeLocationSummary() const { |
| 1640 const intptr_t kNumInputs = 1; | 1639 const intptr_t kNumInputs = 1; |
| 1641 const intptr_t kNumTemps = 0; | 1640 const intptr_t kNumTemps = 0; |
| 1642 LocationSummary* locs = | 1641 LocationSummary* locs = |
| 1643 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); | 1642 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 1644 locs->set_in(0, Location::RequiresRegister()); | 1643 locs->set_in(0, Location::RequiresRegister()); |
| 1645 locs->set_out(Location::SameAsFirstInput()); | 1644 locs->set_out(Location::SameAsFirstInput()); |
| 1646 return locs; | 1645 return locs; |
| 1647 } | 1646 } |
| 1648 | 1647 |
| 1649 | 1648 |
| 1650 void ExtractConstructorInstantiatorInstr::EmitNativeCode( | 1649 void ExtractConstructorInstantiatorInstr::EmitNativeCode( |
| 1651 FlowGraphCompiler* compiler) { | 1650 FlowGraphCompiler* compiler) { |
| 1652 Register instantiator_reg = locs()->in(0).reg(); | 1651 Register instantiator_reg = locs()->in(0).reg(); |
| 1653 ASSERT(locs()->out().reg() == instantiator_reg); | 1652 ASSERT(locs()->out().reg() == instantiator_reg); |
| 1654 | 1653 |
| 1655 // instantiator_reg is the instantiator AbstractTypeArguments object | 1654 // instantiator_reg is the instantiator AbstractTypeArguments object |
| 1656 // (or null). | 1655 // (or null). |
| 1657 if (type_arguments().IsUninstantiatedIdentity() || | 1656 ASSERT(!type_arguments().IsUninstantiatedIdentity() && |
| 1658 type_arguments().CanShareInstantiatorTypeArguments( | 1657 !type_arguments().CanShareInstantiatorTypeArguments( |
| 1659 instantiator_class())) { | 1658 instantiator_class())); |
| 1660 // The instantiator was used in VisitExtractConstructorTypeArguments as the | 1659 |
| 1660 // If the instantiator is null and if the type argument vector | |
| 1661 // instantiated from null becomes a vector of dynamic, then use null as | |
| 1662 // the type arguments and do not pass the instantiator. | |
| 1663 const intptr_t len = type_arguments().Length(); | |
| 1664 if (type_arguments().IsRawInstantiatedRaw(len)) { | |
| 1665 Label instantiator_not_null; | |
| 1666 __ CompareImmediate(instantiator_reg, | |
| 1667 reinterpret_cast<intptr_t>(Object::null())); | |
| 1668 __ b(&instantiator_not_null, NE); | |
| 1669 // Null was used in VisitExtractConstructorTypeArguments as the | |
| 1661 // instantiated type arguments, no proper instantiator needed. | 1670 // instantiated type arguments, no proper instantiator needed. |
| 1662 __ LoadImmediate(instantiator_reg, | 1671 __ LoadImmediate(instantiator_reg, |
|
Kevin Millikin (Google)
2013/05/21 11:06:05
Yeah, this is kind of broken.
| |
| 1663 Smi::RawValue(StubCode::kNoInstantiator)); | 1672 Smi::RawValue(StubCode::kNoInstantiator)); |
| 1664 } else { | 1673 __ Bind(&instantiator_not_null); |
| 1665 // If the instantiator is null and if the type argument vector | |
| 1666 // instantiated from null becomes a vector of dynamic, then use null as | |
| 1667 // the type arguments and do not pass the instantiator. | |
| 1668 const intptr_t len = type_arguments().Length(); | |
| 1669 if (type_arguments().IsRawInstantiatedRaw(len)) { | |
| 1670 Label instantiator_not_null; | |
| 1671 __ CompareImmediate(instantiator_reg, | |
| 1672 reinterpret_cast<intptr_t>(Object::null())); | |
| 1673 __ b(&instantiator_not_null, NE); | |
| 1674 // Null was used in VisitExtractConstructorTypeArguments as the | |
| 1675 // instantiated type arguments, no proper instantiator needed. | |
| 1676 __ LoadImmediate(instantiator_reg, | |
| 1677 Smi::RawValue(StubCode::kNoInstantiator)); | |
| 1678 __ Bind(&instantiator_not_null); | |
| 1679 } | |
| 1680 } | 1674 } |
| 1681 // instantiator_reg: instantiator or kNoInstantiator. | 1675 // instantiator_reg: instantiator or kNoInstantiator. |
| 1682 } | 1676 } |
| 1683 | 1677 |
| 1684 | 1678 |
| 1685 LocationSummary* AllocateContextInstr::MakeLocationSummary() const { | 1679 LocationSummary* AllocateContextInstr::MakeLocationSummary() const { |
| 1686 const intptr_t kNumInputs = 0; | 1680 const intptr_t kNumInputs = 0; |
| 1687 const intptr_t kNumTemps = 1; | 1681 const intptr_t kNumTemps = 1; |
| 1688 LocationSummary* locs = | 1682 LocationSummary* locs = |
| 1689 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); | 1683 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); |
| (...skipping 1182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2872 compiler->GenerateCall(token_pos(), | 2866 compiler->GenerateCall(token_pos(), |
| 2873 &label, | 2867 &label, |
| 2874 PcDescriptors::kOther, | 2868 PcDescriptors::kOther, |
| 2875 locs()); | 2869 locs()); |
| 2876 __ Drop(2); // Discard type arguments and receiver. | 2870 __ Drop(2); // Discard type arguments and receiver. |
| 2877 } | 2871 } |
| 2878 | 2872 |
| 2879 } // namespace dart | 2873 } // namespace dart |
| 2880 | 2874 |
| 2881 #endif // defined TARGET_ARCH_ARM | 2875 #endif // defined TARGET_ARCH_ARM |
| OLD | NEW |