OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_HYDROGEN_H_ | 5 #ifndef V8_HYDROGEN_H_ |
6 #define V8_HYDROGEN_H_ | 6 #define V8_HYDROGEN_H_ |
7 | 7 |
8 #include "v8.h" | 8 #include "v8.h" |
9 | 9 |
10 #include "accessors.h" | 10 #include "accessors.h" |
(...skipping 1378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1389 ElementsKind elements_kind, | 1389 ElementsKind elements_kind, |
1390 PropertyAccessType access_type, | 1390 PropertyAccessType access_type, |
1391 LoadKeyedHoleMode load_mode = NEVER_RETURN_HOLE); | 1391 LoadKeyedHoleMode load_mode = NEVER_RETURN_HOLE); |
1392 | 1392 |
1393 HInstruction* AddLoadStringInstanceType(HValue* string); | 1393 HInstruction* AddLoadStringInstanceType(HValue* string); |
1394 HInstruction* AddLoadStringLength(HValue* string); | 1394 HInstruction* AddLoadStringLength(HValue* string); |
1395 HStoreNamedField* AddStoreMapConstant(HValue* object, Handle<Map> map) { | 1395 HStoreNamedField* AddStoreMapConstant(HValue* object, Handle<Map> map) { |
1396 return Add<HStoreNamedField>(object, HObjectAccess::ForMap(), | 1396 return Add<HStoreNamedField>(object, HObjectAccess::ForMap(), |
1397 Add<HConstant>(map)); | 1397 Add<HConstant>(map)); |
1398 } | 1398 } |
| 1399 HLoadNamedField* AddLoadMap(HValue* object, |
| 1400 HValue* dependency = NULL); |
1399 HLoadNamedField* AddLoadElements(HValue* object, | 1401 HLoadNamedField* AddLoadElements(HValue* object, |
1400 HValue* dependency = NULL); | 1402 HValue* dependency = NULL); |
1401 | 1403 |
1402 bool MatchRotateRight(HValue* left, | 1404 bool MatchRotateRight(HValue* left, |
1403 HValue* right, | 1405 HValue* right, |
1404 HValue** operand, | 1406 HValue** operand, |
1405 HValue** shift_amount); | 1407 HValue** shift_amount); |
1406 | 1408 |
1407 HValue* BuildBinaryOperation(Token::Value op, | 1409 HValue* BuildBinaryOperation(Token::Value op, |
1408 HValue* left, | 1410 HValue* left, |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1681 JSArrayBuilder(HGraphBuilder* builder, | 1683 JSArrayBuilder(HGraphBuilder* builder, |
1682 ElementsKind kind, | 1684 ElementsKind kind, |
1683 HValue* constructor_function = NULL); | 1685 HValue* constructor_function = NULL); |
1684 | 1686 |
1685 enum FillMode { | 1687 enum FillMode { |
1686 DONT_FILL_WITH_HOLE, | 1688 DONT_FILL_WITH_HOLE, |
1687 FILL_WITH_HOLE | 1689 FILL_WITH_HOLE |
1688 }; | 1690 }; |
1689 | 1691 |
1690 ElementsKind kind() { return kind_; } | 1692 ElementsKind kind() { return kind_; } |
| 1693 HAllocate* elements_location() { return elements_location_; } |
1691 | 1694 |
1692 HValue* AllocateEmptyArray(); | 1695 HAllocate* AllocateEmptyArray(); |
1693 HValue* AllocateArray(HValue* capacity, HValue* length_field, | 1696 HAllocate* AllocateArray(HValue* capacity, |
1694 FillMode fill_mode = FILL_WITH_HOLE); | 1697 HValue* length_field, |
| 1698 FillMode fill_mode = FILL_WITH_HOLE); |
| 1699 // Use these allocators when capacity could be unknown at compile time |
| 1700 // but its limit is known. For constant |capacity| the value of |
| 1701 // |capacity_upper_bound| is ignored and the actual |capacity| |
| 1702 // value is used as an upper bound. |
| 1703 HAllocate* AllocateArray(HValue* capacity, |
| 1704 int capacity_upper_bound, |
| 1705 HValue* length_field, |
| 1706 FillMode fill_mode = FILL_WITH_HOLE); |
| 1707 HAllocate* AllocateArray(HValue* capacity, |
| 1708 HConstant* capacity_upper_bound, |
| 1709 HValue* length_field, |
| 1710 FillMode fill_mode = FILL_WITH_HOLE); |
1695 HValue* GetElementsLocation() { return elements_location_; } | 1711 HValue* GetElementsLocation() { return elements_location_; } |
1696 HValue* EmitMapCode(); | 1712 HValue* EmitMapCode(); |
1697 | 1713 |
1698 private: | 1714 private: |
1699 Zone* zone() const { return builder_->zone(); } | 1715 Zone* zone() const { return builder_->zone(); } |
1700 int elements_size() const { | 1716 int elements_size() const { |
1701 return IsFastDoubleElementsKind(kind_) ? kDoubleSize : kPointerSize; | 1717 return IsFastDoubleElementsKind(kind_) ? kDoubleSize : kPointerSize; |
1702 } | 1718 } |
1703 HGraphBuilder* builder() { return builder_; } | 1719 HGraphBuilder* builder() { return builder_; } |
1704 HGraph* graph() { return builder_->graph(); } | 1720 HGraph* graph() { return builder_->graph(); } |
1705 int initial_capacity() { | 1721 int initial_capacity() { |
1706 STATIC_ASSERT(JSArray::kPreallocatedArrayElements > 0); | 1722 STATIC_ASSERT(JSArray::kPreallocatedArrayElements > 0); |
1707 return JSArray::kPreallocatedArrayElements; | 1723 return JSArray::kPreallocatedArrayElements; |
1708 } | 1724 } |
1709 | 1725 |
1710 HValue* EmitInternalMapCode(); | 1726 HValue* EmitInternalMapCode(); |
1711 HValue* EstablishEmptyArrayAllocationSize(); | |
1712 HValue* EstablishAllocationSize(HValue* length_node); | |
1713 HValue* AllocateArray(HValue* size_in_bytes, HValue* capacity, | |
1714 HValue* length_field, | |
1715 FillMode fill_mode = FILL_WITH_HOLE); | |
1716 | 1727 |
1717 HGraphBuilder* builder_; | 1728 HGraphBuilder* builder_; |
1718 ElementsKind kind_; | 1729 ElementsKind kind_; |
1719 AllocationSiteMode mode_; | 1730 AllocationSiteMode mode_; |
1720 HValue* allocation_site_payload_; | 1731 HValue* allocation_site_payload_; |
1721 HValue* constructor_function_; | 1732 HValue* constructor_function_; |
1722 HInnerAllocatedObject* elements_location_; | 1733 HAllocate* elements_location_; |
1723 }; | 1734 }; |
1724 | 1735 |
1725 HValue* BuildAllocateArrayFromLength(JSArrayBuilder* array_builder, | 1736 HValue* BuildAllocateArrayFromLength(JSArrayBuilder* array_builder, |
1726 HValue* length_argument); | 1737 HValue* length_argument); |
| 1738 HValue* BuildCalculateElementsSize(ElementsKind kind, |
| 1739 HValue* capacity); |
| 1740 HAllocate* AllocateJSArrayObject(AllocationSiteMode mode); |
| 1741 HConstant* EstablishElementsAllocationSize(ElementsKind kind, int capacity); |
1727 | 1742 |
1728 HValue* BuildAllocateElements(ElementsKind kind, | 1743 HAllocate* BuildAllocateElements(ElementsKind kind, HValue* size_in_bytes); |
1729 HValue* capacity); | |
1730 | 1744 |
1731 void BuildInitializeElementsHeader(HValue* elements, | 1745 void BuildInitializeElementsHeader(HValue* elements, |
1732 ElementsKind kind, | 1746 ElementsKind kind, |
1733 HValue* capacity); | 1747 HValue* capacity); |
1734 | 1748 |
1735 HValue* BuildAllocateElementsAndInitializeElementsHeader(ElementsKind kind, | 1749 HValue* BuildAllocateElementsAndInitializeElementsHeader(ElementsKind kind, |
1736 HValue* capacity); | 1750 HValue* capacity); |
1737 | 1751 |
1738 // array must have been allocated with enough room for | 1752 // |array| must have been allocated with enough room for |
1739 // 1) the JSArray, 2) a AllocationMemento if mode requires it, | 1753 // 1) the JSArray and 2) an AllocationMemento if mode requires it. |
1740 // 3) a FixedArray or FixedDoubleArray. | 1754 // If the |elements| value provided is NULL then the array elements storage |
1741 // A pointer to the Fixed(Double)Array is returned. | 1755 // is initialized with empty array. |
1742 HInnerAllocatedObject* BuildJSArrayHeader(HValue* array, | 1756 void BuildJSArrayHeader(HValue* array, |
1743 HValue* array_map, | 1757 HValue* array_map, |
1744 AllocationSiteMode mode, | 1758 HValue* elements, |
1745 ElementsKind elements_kind, | 1759 AllocationSiteMode mode, |
1746 HValue* allocation_site_payload, | 1760 ElementsKind elements_kind, |
1747 HValue* length_field); | 1761 HValue* allocation_site_payload, |
| 1762 HValue* length_field); |
1748 | 1763 |
1749 HValue* BuildGrowElementsCapacity(HValue* object, | 1764 HValue* BuildGrowElementsCapacity(HValue* object, |
1750 HValue* elements, | 1765 HValue* elements, |
1751 ElementsKind kind, | 1766 ElementsKind kind, |
1752 ElementsKind new_kind, | 1767 ElementsKind new_kind, |
1753 HValue* length, | 1768 HValue* length, |
1754 HValue* new_capacity); | 1769 HValue* new_capacity); |
1755 | 1770 |
| 1771 void BuildFillElementsWithValue(HValue* elements, |
| 1772 ElementsKind elements_kind, |
| 1773 HValue* from, |
| 1774 HValue* to, |
| 1775 HValue* value); |
| 1776 |
1756 void BuildFillElementsWithHole(HValue* elements, | 1777 void BuildFillElementsWithHole(HValue* elements, |
1757 ElementsKind elements_kind, | 1778 ElementsKind elements_kind, |
1758 HValue* from, | 1779 HValue* from, |
1759 HValue* to); | 1780 HValue* to); |
1760 | 1781 |
1761 void BuildCopyElements(HValue* array, | 1782 void BuildCopyElements(HValue* from_elements, |
1762 HValue* from_elements, | |
1763 ElementsKind from_elements_kind, | 1783 ElementsKind from_elements_kind, |
1764 HValue* to_elements, | 1784 HValue* to_elements, |
1765 ElementsKind to_elements_kind, | 1785 ElementsKind to_elements_kind, |
1766 HValue* length, | 1786 HValue* length, |
1767 HValue* capacity); | 1787 HValue* capacity); |
1768 | 1788 |
1769 HValue* BuildCloneShallowArrayCommon(HValue* boilerplate, | |
1770 HValue* allocation_site, | |
1771 HValue* extra_size, | |
1772 HValue** return_elements, | |
1773 AllocationSiteMode mode); | |
1774 | |
1775 HValue* BuildCloneShallowArrayCow(HValue* boilerplate, | 1789 HValue* BuildCloneShallowArrayCow(HValue* boilerplate, |
1776 HValue* allocation_site, | 1790 HValue* allocation_site, |
1777 AllocationSiteMode mode, | 1791 AllocationSiteMode mode, |
1778 ElementsKind kind); | 1792 ElementsKind kind); |
1779 | 1793 |
1780 HValue* BuildCloneShallowArrayEmpty(HValue* boilerplate, | 1794 HValue* BuildCloneShallowArrayEmpty(HValue* boilerplate, |
1781 HValue* allocation_site, | 1795 HValue* allocation_site, |
1782 AllocationSiteMode mode); | 1796 AllocationSiteMode mode); |
1783 | 1797 |
1784 HValue* BuildCloneShallowArrayNonEmpty(HValue* boilerplate, | 1798 HValue* BuildCloneShallowArrayNonEmpty(HValue* boilerplate, |
(...skipping 1025 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2810 } | 2824 } |
2811 | 2825 |
2812 private: | 2826 private: |
2813 HGraphBuilder* builder_; | 2827 HGraphBuilder* builder_; |
2814 }; | 2828 }; |
2815 | 2829 |
2816 | 2830 |
2817 } } // namespace v8::internal | 2831 } } // namespace v8::internal |
2818 | 2832 |
2819 #endif // V8_HYDROGEN_H_ | 2833 #endif // V8_HYDROGEN_H_ |
OLD | NEW |