| 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/flow_graph_builder.h" | 5 #include "vm/flow_graph_builder.h" |
| 6 | 6 |
| 7 #include "vm/ast_printer.h" | 7 #include "vm/ast_printer.h" |
| 8 #include "vm/code_descriptors.h" | 8 #include "vm/code_descriptors.h" |
| 9 #include "vm/dart_entry.h" | 9 #include "vm/dart_entry.h" |
| 10 #include "vm/flags.h" | 10 #include "vm/flags.h" |
| (...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 628 } | 628 } |
| 629 ReturnValue(result); | 629 ReturnValue(result); |
| 630 return; | 630 return; |
| 631 } | 631 } |
| 632 | 632 |
| 633 ArgumentGraphVisitor for_left_value(owner(), temp_index()); | 633 ArgumentGraphVisitor for_left_value(owner(), temp_index()); |
| 634 node->left()->Visit(&for_left_value); | 634 node->left()->Visit(&for_left_value); |
| 635 Append(for_left_value); | 635 Append(for_left_value); |
| 636 Value* type_arguments = NULL; | 636 Value* type_arguments = NULL; |
| 637 if (!type.IsInstantiated()) { | 637 if (!type.IsInstantiated()) { |
| 638 type_arguments = BuildInstantiatorTypeArguments( | 638 type_arguments = |
| 639 node->token_index(), for_left_value.temp_index()); | 639 BuildInstantiatorTypeArguments(node->token_index(), |
| 640 for_left_value.temp_index()); |
| 640 } | 641 } |
| 641 InstanceOfComp* instance_of = | 642 InstanceOfComp* instance_of = |
| 642 new InstanceOfComp(node->id(), | 643 new InstanceOfComp(node->id(), |
| 643 node->token_index(), | 644 node->token_index(), |
| 644 owner()->try_index(), | 645 owner()->try_index(), |
| 645 for_left_value.value(), | 646 for_left_value.value(), |
| 646 type_arguments, | 647 type_arguments, |
| 647 node->right()->AsTypeNode()->type(), | 648 node->right()->AsTypeNode()->type(), |
| 648 (node->kind() == Token::kISNOT)); | 649 (node->kind() == Token::kISNOT)); |
| 649 ReturnComputation(instance_of); | 650 ReturnComputation(instance_of); |
| (...skipping 1003 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1653 new BindInstr(temp_index(), | 1654 new BindInstr(temp_index(), |
| 1654 new CloneContextComp(node->id(), | 1655 new CloneContextComp(node->id(), |
| 1655 node->token_index(), | 1656 node->token_index(), |
| 1656 owner()->try_index(), | 1657 owner()->try_index(), |
| 1657 new UseVal(context))); | 1658 new UseVal(context))); |
| 1658 AddInstruction(clone); | 1659 AddInstruction(clone); |
| 1659 ReturnComputation(new StoreContextComp(new UseVal(clone))); | 1660 ReturnComputation(new StoreContextComp(new UseVal(clone))); |
| 1660 } | 1661 } |
| 1661 | 1662 |
| 1662 | 1663 |
| 1663 TempVal* EffectGraphVisitor::BuildObjectAllocation(ConstructorCallNode* node, | 1664 Definition* EffectGraphVisitor::BuildObjectAllocation( |
| 1664 int start_index) { | 1665 ConstructorCallNode* node) { |
| 1665 const Class& cls = Class::ZoneHandle(node->constructor().owner()); | 1666 const Class& cls = Class::ZoneHandle(node->constructor().owner()); |
| 1666 const bool requires_type_arguments = cls.HasTypeArguments(); | 1667 const bool requires_type_arguments = cls.HasTypeArguments(); |
| 1667 | 1668 |
| 1668 ZoneGrowableArray<Value*>* allocate_arguments = | 1669 ZoneGrowableArray<Value*>* allocate_arguments = |
| 1669 new ZoneGrowableArray<Value*>(); | 1670 new ZoneGrowableArray<Value*>(); |
| 1670 if (requires_type_arguments) { | 1671 if (requires_type_arguments) { |
| 1671 BuildConstructorTypeArguments(node, start_index, allocate_arguments); | 1672 BuildConstructorTypeArguments(node, allocate_arguments); |
| 1672 } | 1673 } |
| 1673 AllocateObjectComp* alloc_comp = | 1674 BindInstr* allocate = |
| 1674 new AllocateObjectComp(node, | 1675 new BindInstr(temp_index(), |
| 1675 owner()->try_index(), | 1676 new AllocateObjectComp(node, |
| 1676 allocate_arguments); | 1677 owner()->try_index(), |
| 1677 AddInstruction(new BindInstr(start_index, alloc_comp)); | 1678 allocate_arguments)); |
| 1678 return new TempVal(start_index); | 1679 AddInstruction(allocate); |
| 1680 AllocateTempIndex(); |
| 1681 return allocate; |
| 1679 } | 1682 } |
| 1680 | 1683 |
| 1681 | 1684 |
| 1682 void EffectGraphVisitor::BuildConstructorCall(ConstructorCallNode* node, | 1685 void EffectGraphVisitor::BuildConstructorCall(ConstructorCallNode* node, |
| 1683 int start_index, | |
| 1684 Value* alloc_value) { | 1686 Value* alloc_value) { |
| 1687 BindInstr* ctor_arg = |
| 1688 new BindInstr(temp_index(), |
| 1689 new ConstantVal( |
| 1690 Smi::ZoneHandle(Smi::New(Function::kCtorPhaseAll)))); |
| 1691 AddInstruction(ctor_arg); |
| 1692 AllocateTempIndex(); |
| 1693 |
| 1685 ZoneGrowableArray<Value*>* values = new ZoneGrowableArray<Value*>(); | 1694 ZoneGrowableArray<Value*>* values = new ZoneGrowableArray<Value*>(); |
| 1686 values->Add(alloc_value); | 1695 values->Add(alloc_value); |
| 1687 const Smi& ctor_arg = Smi::ZoneHandle(Smi::New(Function::kCtorPhaseAll)); | 1696 values->Add(new UseVal(ctor_arg)); |
| 1688 TempVal* ctor_arg_value = new TempVal(start_index); | 1697 |
| 1689 AddInstruction( | 1698 TranslateArgumentList(*node->arguments(), temp_index(), values); |
| 1690 new BindInstr(ctor_arg_value->index(), new ConstantVal(ctor_arg))); | |
| 1691 values->Add(ctor_arg_value); | |
| 1692 TranslateArgumentList(*node->arguments(), start_index + 1, values); | |
| 1693 StaticCallComp* call = | 1699 StaticCallComp* call = |
| 1694 new StaticCallComp(node->token_index(), | 1700 new StaticCallComp(node->token_index(), |
| 1695 owner()->try_index(), | 1701 owner()->try_index(), |
| 1696 node->constructor(), | 1702 node->constructor(), |
| 1697 node->arguments()->names(), | 1703 node->arguments()->names(), |
| 1698 values); | 1704 values); |
| 1705 DeallocateTempIndex(); // Consuming ctor_arg. |
| 1706 DeallocateTempIndex(); // Consuming alloc_value. |
| 1699 AddInstruction(new DoInstr(call)); | 1707 AddInstruction(new DoInstr(call)); |
| 1700 } | 1708 } |
| 1701 | 1709 |
| 1702 | 1710 |
| 1703 void EffectGraphVisitor::VisitConstructorCallNode(ConstructorCallNode* node) { | 1711 void EffectGraphVisitor::VisitConstructorCallNode(ConstructorCallNode* node) { |
| 1704 if (node->constructor().IsFactory()) { | 1712 if (node->constructor().IsFactory()) { |
| 1705 ZoneGrowableArray<Value*>* factory_arguments = | 1713 ZoneGrowableArray<Value*>* factory_arguments = |
| 1706 new ZoneGrowableArray<Value*>(); | 1714 new ZoneGrowableArray<Value*>(); |
| 1707 factory_arguments->Add(BuildFactoryTypeArguments(node, temp_index())); | 1715 factory_arguments->Add(new UseVal(BuildFactoryTypeArguments(node))); |
| 1708 ASSERT(factory_arguments->length() == 1); | 1716 ASSERT(factory_arguments->length() == 1); |
| 1709 TranslateArgumentList(*node->arguments(), | 1717 TranslateArgumentList(*node->arguments(), |
| 1710 temp_index() + 1, | 1718 temp_index(), |
| 1711 factory_arguments); | 1719 factory_arguments); |
| 1712 StaticCallComp* call = | 1720 StaticCallComp* call = |
| 1713 new StaticCallComp(node->token_index(), | 1721 new StaticCallComp(node->token_index(), |
| 1714 owner()->try_index(), | 1722 owner()->try_index(), |
| 1715 node->constructor(), | 1723 node->constructor(), |
| 1716 node->arguments()->names(), | 1724 node->arguments()->names(), |
| 1717 factory_arguments); | 1725 factory_arguments); |
| 1726 DeallocateTempIndex(); // Consuming type arguments. |
| 1718 ReturnComputation(call); | 1727 ReturnComputation(call); |
| 1719 return; | 1728 return; |
| 1720 } | 1729 } |
| 1721 // t_n contains the allocated and initialized object. | 1730 // t_n contains the allocated and initialized object. |
| 1722 // t_n <- AllocateObject(class) | 1731 // t_n <- AllocateObject(class) |
| 1723 // t_n+1 <- ctor-arg | 1732 // t_n+1 <- ctor-arg |
| 1724 // t_n+2... <- constructor arguments start here | 1733 // t_n+2... <- constructor arguments start here |
| 1725 // StaticCall(constructor, t_n+1, t_n+2, ...) | 1734 // StaticCall(constructor, t_n+1, t_n+2, ...) |
| 1726 // No need to preserve allocated value (simpler than in ValueGraphVisitor). | 1735 // No need to preserve allocated value (simpler than in ValueGraphVisitor). |
| 1727 TempVal* alloc_value = BuildObjectAllocation(node, temp_index()); | 1736 Definition* allocate = BuildObjectAllocation(node); |
| 1728 BuildConstructorCall(node, alloc_value->index() + 1, alloc_value); | 1737 BuildConstructorCall(node, new UseVal(allocate)); |
| 1729 } | 1738 } |
| 1730 | 1739 |
| 1731 | 1740 |
| 1732 Value* EffectGraphVisitor::BuildInstantiatorTypeArguments( | 1741 Value* EffectGraphVisitor::BuildInstantiatorTypeArguments( |
| 1733 intptr_t token_index, intptr_t start_index) { | 1742 intptr_t token_index, intptr_t start_index) { |
| 1734 const Class& instantiator_class = Class::Handle( | 1743 const Class& instantiator_class = Class::Handle( |
| 1735 owner()->parsed_function().function().owner()); | 1744 owner()->parsed_function().function().owner()); |
| 1736 if (instantiator_class.NumTypeParameters() == 0) { | 1745 if (instantiator_class.NumTypeParameters() == 0) { |
| 1737 // The type arguments are compile time constants. | 1746 // The type arguments are compile time constants. |
| 1738 AbstractTypeArguments& type_arguments = AbstractTypeArguments::ZoneHandle(); | 1747 AbstractTypeArguments& type_arguments = AbstractTypeArguments::ZoneHandle(); |
| 1739 // TODO(regis): Temporary type should be allocated in new gen heap. | 1748 // TODO(regis): Temporary type should be allocated in new gen heap. |
| 1740 Type& type = Type::Handle( | 1749 Type& type = Type::Handle( |
| 1741 Type::New(instantiator_class, type_arguments, token_index)); | 1750 Type::New(instantiator_class, type_arguments, token_index)); |
| 1742 type ^= ClassFinalizer::FinalizeType( | 1751 type ^= ClassFinalizer::FinalizeType( |
| 1743 instantiator_class, type, ClassFinalizer::kFinalizeWellFormed); | 1752 instantiator_class, type, ClassFinalizer::kFinalizeWellFormed); |
| 1744 type_arguments = type.arguments(); | 1753 type_arguments = type.arguments(); |
| 1745 BindInstr* args = | 1754 BindInstr* args = |
| 1746 new BindInstr(temp_index(), new ConstantVal(type_arguments)); | 1755 new BindInstr(temp_index(), new ConstantVal(type_arguments)); |
| 1747 AddInstruction(args); | 1756 AddInstruction(args); |
| 1748 return new UseVal(args); | 1757 return new UseVal(args); |
| 1749 } | 1758 } |
| 1750 ASSERT(owner()->parsed_function().instantiator() != NULL); | 1759 ASSERT(owner()->parsed_function().instantiator() != NULL); |
| 1751 ValueGraphVisitor for_instantiator(owner(), start_index); | 1760 ArgumentGraphVisitor for_instantiator(owner(), start_index); |
| 1752 owner()->parsed_function().instantiator()->Visit(&for_instantiator); | 1761 owner()->parsed_function().instantiator()->Visit(&for_instantiator); |
| 1753 Append(for_instantiator); | 1762 Append(for_instantiator); |
| 1754 Function& outer_function = | 1763 Function& outer_function = |
| 1755 Function::Handle(owner()->parsed_function().function().raw()); | 1764 Function::Handle(owner()->parsed_function().function().raw()); |
| 1756 while (outer_function.IsLocalFunction()) { | 1765 while (outer_function.IsLocalFunction()) { |
| 1757 outer_function = outer_function.parent_function(); | 1766 outer_function = outer_function.parent_function(); |
| 1758 } | 1767 } |
| 1759 if (outer_function.IsFactory()) { | 1768 if (outer_function.IsFactory()) { |
| 1760 // All OK. | 1769 // All OK. |
| 1761 return for_instantiator.value(); | 1770 return for_instantiator.value(); |
| 1762 } | 1771 } |
| 1763 | 1772 |
| 1764 // The instantiator is the receiver of the caller, which is not a factory. | 1773 // The instantiator is the receiver of the caller, which is not a factory. |
| 1765 // The receiver cannot be null; extract its AbstractTypeArguments object. | 1774 // The receiver cannot be null; extract its AbstractTypeArguments object. |
| 1766 // Note that in the factory case, the instantiator is the first parameter | 1775 // Note that in the factory case, the instantiator is the first parameter |
| 1767 // of the factory, i.e. already an AbstractTypeArguments object. | 1776 // of the factory, i.e. already an AbstractTypeArguments object. |
| 1768 intptr_t type_arguments_instance_field_offset = | 1777 intptr_t type_arguments_instance_field_offset = |
| 1769 instantiator_class.type_arguments_instance_field_offset(); | 1778 instantiator_class.type_arguments_instance_field_offset(); |
| 1770 ASSERT(type_arguments_instance_field_offset != Class::kNoTypeArguments); | 1779 ASSERT(type_arguments_instance_field_offset != Class::kNoTypeArguments); |
| 1771 | 1780 |
| 1772 NativeLoadFieldComp* load = new NativeLoadFieldComp( | 1781 BindInstr* load = |
| 1773 for_instantiator.value(), type_arguments_instance_field_offset); | 1782 new BindInstr(start_index, |
| 1774 AddInstruction(new BindInstr(start_index, load)); | 1783 new NativeLoadFieldComp( |
| 1775 return new TempVal(start_index); | 1784 for_instantiator.value(), |
| 1785 type_arguments_instance_field_offset)); |
| 1786 AddInstruction(load); |
| 1787 return new UseVal(load); |
| 1776 } | 1788 } |
| 1777 | 1789 |
| 1778 | 1790 |
| 1779 Value* EffectGraphVisitor::BuildFactoryTypeArguments( | 1791 Definition* EffectGraphVisitor::BuildFactoryTypeArguments( |
| 1780 ConstructorCallNode* node, intptr_t start_index) { | 1792 ConstructorCallNode* node) { |
| 1781 ASSERT(node->constructor().IsFactory()); | 1793 ASSERT(node->constructor().IsFactory()); |
| 1782 if (node->type_arguments().IsNull() || | 1794 if (node->type_arguments().IsNull() || |
| 1783 node->type_arguments().IsInstantiated()) { | 1795 node->type_arguments().IsInstantiated()) { |
| 1784 AddInstruction( | 1796 BindInstr* type_args = |
| 1785 new BindInstr(start_index, new ConstantVal(node->type_arguments()))); | 1797 new BindInstr(temp_index(), new ConstantVal(node->type_arguments())); |
| 1786 return new TempVal(start_index); | 1798 AddInstruction(type_args); |
| 1799 AllocateTempIndex(); |
| 1800 return type_args; |
| 1787 } | 1801 } |
| 1788 // The type arguments are uninstantiated. | 1802 // The type arguments are uninstantiated. |
| 1789 Value* instantiator_value = | 1803 Value* instantiator_value = |
| 1790 BuildInstantiatorTypeArguments(node->token_index(), start_index); | 1804 BuildInstantiatorTypeArguments(node->token_index(), temp_index()); |
| 1791 ExtractFactoryTypeArgumentsComp* extract = | 1805 BindInstr* extract = |
| 1792 new ExtractFactoryTypeArgumentsComp(node, | 1806 new BindInstr(temp_index(), |
| 1793 owner()->try_index(), | 1807 new ExtractFactoryTypeArgumentsComp(node, |
| 1794 instantiator_value); | 1808 owner()->try_index(), |
| 1795 AddInstruction(new BindInstr(start_index, extract)); | 1809 instantiator_value)); |
| 1796 return new TempVal(start_index); | 1810 AddInstruction(extract); |
| 1811 AllocateTempIndex(); |
| 1812 return extract; |
| 1797 } | 1813 } |
| 1798 | 1814 |
| 1799 | 1815 |
| 1800 void EffectGraphVisitor::BuildConstructorTypeArguments( | 1816 void EffectGraphVisitor::BuildConstructorTypeArguments( |
| 1801 ConstructorCallNode* node, | 1817 ConstructorCallNode* node, |
| 1802 intptr_t start_index, | |
| 1803 ZoneGrowableArray<Value*>* args) { | 1818 ZoneGrowableArray<Value*>* args) { |
| 1804 const Class& cls = Class::ZoneHandle(node->constructor().owner()); | 1819 const Class& cls = Class::ZoneHandle(node->constructor().owner()); |
| 1805 ASSERT(cls.HasTypeArguments() && !node->constructor().IsFactory()); | 1820 ASSERT(cls.HasTypeArguments() && !node->constructor().IsFactory()); |
| 1806 if (node->type_arguments().IsNull() || | 1821 if (node->type_arguments().IsNull() || |
| 1807 node->type_arguments().IsInstantiated()) { | 1822 node->type_arguments().IsInstantiated()) { |
| 1808 AddInstruction( | 1823 BindInstr* type_args = |
| 1809 new BindInstr(start_index, new ConstantVal(node->type_arguments()))); | 1824 new BindInstr(temp_index(), new ConstantVal(node->type_arguments())); |
| 1810 args->Add(new TempVal(start_index)); | 1825 AddInstruction(type_args); |
| 1811 // No instantiator required. | 1826 // No instantiator required. |
| 1812 const Smi& no_instantiator = | 1827 BindInstr* no_instantiator = |
| 1813 Smi::ZoneHandle(Smi::New(StubCode::kNoInstantiator)); | 1828 new BindInstr(temp_index() + 1, |
| 1814 AddInstruction(new BindInstr( | 1829 new ConstantVal( |
| 1815 start_index + 1, new ConstantVal(no_instantiator))); | 1830 Smi::ZoneHandle(Smi::New( |
| 1816 args->Add(new TempVal(start_index + 1)); | 1831 StubCode::kNoInstantiator)))); |
| 1832 AddInstruction(no_instantiator); |
| 1833 args->Add(new UseVal(type_args)); |
| 1834 args->Add(new UseVal(no_instantiator)); |
| 1817 return; | 1835 return; |
| 1818 } | 1836 } |
| 1819 // The type arguments are uninstantiated. | 1837 // The type arguments are uninstantiated. |
| 1820 // Place holder to hold uninstantiated constructor type arguments. | 1838 // Place holder to hold uninstantiated constructor type arguments. |
| 1821 AddInstruction(new BindInstr(start_index, | 1839 BindInstr* placeholder = |
| 1822 new ConstantVal(Object::ZoneHandle()))); | 1840 new BindInstr(temp_index(), |
| 1823 Value* instantiator_value = | 1841 new ConstantVal(Object::ZoneHandle())); |
| 1824 BuildInstantiatorTypeArguments(node->token_index(), start_index + 1); | 1842 AddInstruction(placeholder); |
| 1825 AddInstruction(new PickTempInstr(start_index + 2, start_index + 1)); | 1843 Value* instantiator = |
| 1826 Value* dup_instantiator_value = new TempVal(start_index + 2); | 1844 BuildInstantiatorTypeArguments(node->token_index(), temp_index() + 1); |
| 1827 ExtractConstructorTypeArgumentsComp* extract_type_arguments = | 1845 ASSERT(instantiator->IsUse()); |
| 1828 new ExtractConstructorTypeArgumentsComp(node, dup_instantiator_value); | 1846 PickTempInstr* duplicate_instantiator = |
| 1829 AddInstruction(new BindInstr(start_index + 2, extract_type_arguments)); | 1847 new PickTempInstr(temp_index() + 2, |
| 1830 AddInstruction(new TuckTempInstr(start_index, start_index + 2)); | 1848 instantiator->AsUse()->definition()->temp_index()); |
| 1831 Value* constructor_type_arguments_value = new TempVal(start_index); | 1849 AddInstruction(duplicate_instantiator); |
| 1832 args->Add(constructor_type_arguments_value); | 1850 BindInstr* extract_type_arguments = |
| 1833 Value* discard_value = new TempVal(start_index + 2); | 1851 new BindInstr(temp_index() + 2, |
| 1834 ExtractConstructorInstantiatorComp* extract_instantiator = | 1852 new ExtractConstructorTypeArgumentsComp( |
| 1835 new ExtractConstructorInstantiatorComp(node, | 1853 node, new UseVal(duplicate_instantiator))); |
| 1836 instantiator_value, | 1854 AddInstruction(extract_type_arguments); |
| 1837 discard_value); | 1855 AddInstruction(new TuckTempInstr(placeholder->temp_index(), |
| 1838 AddInstruction(new BindInstr(start_index + 1, extract_instantiator)); | 1856 extract_type_arguments->temp_index())); |
| 1839 Value* constructor_instantiator_value = new TempVal(start_index + 1); | 1857 BindInstr* extract_instantiator = |
| 1840 args->Add(constructor_instantiator_value); | 1858 new BindInstr(temp_index() + 1, |
| 1859 new ExtractConstructorInstantiatorComp( |
| 1860 node, |
| 1861 instantiator, |
| 1862 new UseVal(extract_type_arguments))); |
| 1863 AddInstruction(extract_instantiator); |
| 1864 args->Add(new UseVal(placeholder)); |
| 1865 args->Add(new UseVal(extract_instantiator)); |
| 1841 } | 1866 } |
| 1842 | 1867 |
| 1843 | 1868 |
| 1844 void ValueGraphVisitor::VisitConstructorCallNode(ConstructorCallNode* node) { | 1869 void ValueGraphVisitor::VisitConstructorCallNode(ConstructorCallNode* node) { |
| 1845 if (node->constructor().IsFactory()) { | 1870 if (node->constructor().IsFactory()) { |
| 1846 EffectGraphVisitor::VisitConstructorCallNode(node); | 1871 EffectGraphVisitor::VisitConstructorCallNode(node); |
| 1847 return; | 1872 return; |
| 1848 } | 1873 } |
| 1849 | 1874 |
| 1850 // t_n contains the allocated and initialized object. | 1875 // t_n contains the allocated and initialized object. |
| 1851 // t_n <- AllocateObject(class) | 1876 // t_n <- AllocateObject(class) |
| 1852 // t_n+1 <- Pick(t_n) | 1877 // t_n+1 <- Pick(t_n) |
| 1853 // t_n+2 <- ctor-arg | 1878 // t_n+2 <- ctor-arg |
| 1854 // t_n+3... <- constructor arguments start here | 1879 // t_n+3... <- constructor arguments start here |
| 1855 // StaticCall(constructor, t_n+1, t_n+2, ...) | 1880 // StaticCall(constructor, t_n+1, t_n+2, ...) |
| 1856 | 1881 |
| 1857 TempVal* alloc_value = BuildObjectAllocation(node, temp_index()); | 1882 Definition* allocate = BuildObjectAllocation(node); |
| 1858 intptr_t result_index = AllocateTempIndex(); | 1883 PickTempInstr* duplicate = |
| 1859 | 1884 new PickTempInstr(temp_index(), allocate->temp_index()); |
| 1860 TempVal* dup_alloc_value = new TempVal(result_index + 1); | 1885 AddInstruction(duplicate); |
| 1861 AddInstruction( | 1886 AllocateTempIndex(); |
| 1862 new PickTempInstr(dup_alloc_value->index(), alloc_value->index())); | 1887 BuildConstructorCall(node, new UseVal(duplicate)); |
| 1863 | 1888 ReturnValue(new UseVal(allocate)); |
| 1864 BuildConstructorCall(node, dup_alloc_value->index() + 1, dup_alloc_value); | |
| 1865 ReturnValue(alloc_value); | |
| 1866 } | 1889 } |
| 1867 | 1890 |
| 1868 | 1891 |
| 1869 void EffectGraphVisitor::VisitInstanceGetterNode(InstanceGetterNode* node) { | 1892 void EffectGraphVisitor::VisitInstanceGetterNode(InstanceGetterNode* node) { |
| 1870 ArgumentGraphVisitor for_receiver(owner(), temp_index()); | 1893 ArgumentGraphVisitor for_receiver(owner(), temp_index()); |
| 1871 node->receiver()->Visit(&for_receiver); | 1894 node->receiver()->Visit(&for_receiver); |
| 1872 Append(for_receiver); | 1895 Append(for_receiver); |
| 1873 ZoneGrowableArray<Value*>* arguments = new ZoneGrowableArray<Value*>(1); | 1896 ZoneGrowableArray<Value*>* arguments = new ZoneGrowableArray<Value*>(1); |
| 1874 arguments->Add(for_receiver.value()); | 1897 arguments->Add(for_receiver.value()); |
| 1875 const String& name = | 1898 const String& name = |
| (...skipping 1045 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2921 char* chars = reinterpret_cast<char*>( | 2944 char* chars = reinterpret_cast<char*>( |
| 2922 Isolate::Current()->current_zone()->Allocate(len)); | 2945 Isolate::Current()->current_zone()->Allocate(len)); |
| 2923 OS::SNPrint(chars, len, kFormat, function_name, reason); | 2946 OS::SNPrint(chars, len, kFormat, function_name, reason); |
| 2924 const Error& error = Error::Handle( | 2947 const Error& error = Error::Handle( |
| 2925 LanguageError::New(String::Handle(String::New(chars)))); | 2948 LanguageError::New(String::Handle(String::New(chars)))); |
| 2926 Isolate::Current()->long_jump_base()->Jump(1, error); | 2949 Isolate::Current()->long_jump_base()->Jump(1, error); |
| 2927 } | 2950 } |
| 2928 | 2951 |
| 2929 | 2952 |
| 2930 } // namespace dart | 2953 } // namespace dart |
| OLD | NEW |