Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: src/hydrogen.h

Issue 61463005: Supported folding of constant size allocation followed by dynamic size allocation. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebasing on r18647 Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/code-stubs-hydrogen.cc ('k') | src/hydrogen.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 1648 matching lines...) Expand 10 before | Expand all | Expand 10 after
1659 JSArrayBuilder(HGraphBuilder* builder, 1659 JSArrayBuilder(HGraphBuilder* builder,
1660 ElementsKind kind, 1660 ElementsKind kind,
1661 HValue* constructor_function = NULL); 1661 HValue* constructor_function = NULL);
1662 1662
1663 enum FillMode { 1663 enum FillMode {
1664 DONT_FILL_WITH_HOLE, 1664 DONT_FILL_WITH_HOLE,
1665 FILL_WITH_HOLE 1665 FILL_WITH_HOLE
1666 }; 1666 };
1667 1667
1668 ElementsKind kind() { return kind_; } 1668 ElementsKind kind() { return kind_; }
1669 HAllocate* elements_location() { return elements_location_; }
1669 1670
1670 HValue* AllocateEmptyArray(); 1671 HAllocate* AllocateEmptyArray();
1671 HValue* AllocateArray(HValue* capacity, HValue* length_field, 1672 HAllocate* AllocateArray(HValue* capacity,
1672 FillMode fill_mode = FILL_WITH_HOLE); 1673 HValue* length_field,
1674 FillMode fill_mode = FILL_WITH_HOLE);
1675 // Use these allocators when capacity could be unknown at compile time
1676 // but its limit is known. For constant |capacity| the value of
1677 // |capacity_upper_bound| is ignored and the actual |capacity|
1678 // value is used as an upper bound.
1679 HAllocate* AllocateArray(HValue* capacity,
1680 int capacity_upper_bound,
1681 HValue* length_field,
1682 FillMode fill_mode = FILL_WITH_HOLE);
1683 HAllocate* AllocateArray(HValue* capacity,
1684 HConstant* capacity_upper_bound,
1685 HValue* length_field,
1686 FillMode fill_mode = FILL_WITH_HOLE);
1673 HValue* GetElementsLocation() { return elements_location_; } 1687 HValue* GetElementsLocation() { return elements_location_; }
1674 HValue* EmitMapCode(); 1688 HValue* EmitMapCode();
1675 1689
1676 private: 1690 private:
1677 Zone* zone() const { return builder_->zone(); } 1691 Zone* zone() const { return builder_->zone(); }
1678 int elements_size() const { 1692 int elements_size() const {
1679 return IsFastDoubleElementsKind(kind_) ? kDoubleSize : kPointerSize; 1693 return IsFastDoubleElementsKind(kind_) ? kDoubleSize : kPointerSize;
1680 } 1694 }
1681 HGraphBuilder* builder() { return builder_; } 1695 HGraphBuilder* builder() { return builder_; }
1682 HGraph* graph() { return builder_->graph(); } 1696 HGraph* graph() { return builder_->graph(); }
1683 int initial_capacity() { 1697 int initial_capacity() {
1684 STATIC_ASSERT(JSArray::kPreallocatedArrayElements > 0); 1698 STATIC_ASSERT(JSArray::kPreallocatedArrayElements > 0);
1685 return JSArray::kPreallocatedArrayElements; 1699 return JSArray::kPreallocatedArrayElements;
1686 } 1700 }
1687 1701
1688 HValue* EmitInternalMapCode(); 1702 HValue* EmitInternalMapCode();
1689 HValue* EstablishEmptyArrayAllocationSize();
1690 HValue* EstablishAllocationSize(HValue* length_node);
1691 HValue* AllocateArray(HValue* size_in_bytes, HValue* capacity,
1692 HValue* length_field,
1693 FillMode fill_mode = FILL_WITH_HOLE);
1694 1703
1695 HGraphBuilder* builder_; 1704 HGraphBuilder* builder_;
1696 ElementsKind kind_; 1705 ElementsKind kind_;
1697 AllocationSiteMode mode_; 1706 AllocationSiteMode mode_;
1698 HValue* allocation_site_payload_; 1707 HValue* allocation_site_payload_;
1699 HValue* constructor_function_; 1708 HValue* constructor_function_;
1700 HInnerAllocatedObject* elements_location_; 1709 HAllocate* elements_location_;
1701 }; 1710 };
1702 1711
1703 HValue* BuildAllocateArrayFromLength(JSArrayBuilder* array_builder, 1712 HValue* BuildAllocateArrayFromLength(JSArrayBuilder* array_builder,
1704 HValue* length_argument); 1713 HValue* length_argument);
1714 HValue* BuildCalculateElementsSize(ElementsKind kind,
1715 HValue* capacity);
1716 HConstant* EstablishHeaderAllocationSize(AllocationSiteMode mode);
1717 HConstant* EstablishElementsAllocationSize(ElementsKind kind, int capacity);
1705 1718
1706 HValue* BuildAllocateElements(ElementsKind kind, 1719 HAllocate* BuildAllocateElements(ElementsKind kind,
1707 HValue* capacity); 1720 HValue* size_in_bytes,
1721 PretenureFlag pretenure);
1708 1722
1709 void BuildInitializeElementsHeader(HValue* elements, 1723 void BuildInitializeElementsHeader(HValue* elements,
1710 ElementsKind kind, 1724 ElementsKind kind,
1711 HValue* capacity); 1725 HValue* capacity);
1712 1726
1713 HValue* BuildAllocateElementsAndInitializeElementsHeader(ElementsKind kind, 1727 HValue* BuildAllocateElementsAndInitializeElementsHeader(ElementsKind kind,
1714 HValue* capacity); 1728 HValue* capacity);
1715 1729
1716 // array must have been allocated with enough room for 1730 // |array| must have been allocated with enough room for
1717 // 1) the JSArray, 2) a AllocationMemento if mode requires it, 1731 // 1) the JSArray and 2) an AllocationMemento if mode requires it.
1718 // 3) a FixedArray or FixedDoubleArray. 1732 // Initially the array elements storage is initialized with empty array.
1719 // A pointer to the Fixed(Double)Array is returned. 1733 void BuildJSArrayHeader(HValue* array,
1720 HInnerAllocatedObject* BuildJSArrayHeader(HValue* array, 1734 HValue* array_map,
1721 HValue* array_map, 1735 AllocationSiteMode mode,
1722 AllocationSiteMode mode, 1736 ElementsKind elements_kind,
1723 ElementsKind elements_kind, 1737 HValue* allocation_site_payload,
1724 HValue* allocation_site_payload, 1738 HValue* length_field);
1725 HValue* length_field);
1726 1739
1727 HValue* BuildGrowElementsCapacity(HValue* object, 1740 HValue* BuildGrowElementsCapacity(HValue* object,
1728 HValue* elements, 1741 HValue* elements,
1729 ElementsKind kind, 1742 ElementsKind kind,
1730 ElementsKind new_kind, 1743 ElementsKind new_kind,
1731 HValue* length, 1744 HValue* length,
1732 HValue* new_capacity); 1745 HValue* new_capacity);
1733 1746
1734 void BuildFillElementsWithHole(HValue* elements, 1747 void BuildFillElementsWithHole(HValue* elements,
1735 ElementsKind elements_kind, 1748 ElementsKind elements_kind,
(...skipping 960 matching lines...) Expand 10 before | Expand all | Expand 10 after
2696 } 2709 }
2697 2710
2698 private: 2711 private:
2699 HGraphBuilder* builder_; 2712 HGraphBuilder* builder_;
2700 }; 2713 };
2701 2714
2702 2715
2703 } } // namespace v8::internal 2716 } } // namespace v8::internal
2704 2717
2705 #endif // V8_HYDROGEN_H_ 2718 #endif // V8_HYDROGEN_H_
OLDNEW
« no previous file with comments | « src/code-stubs-hydrogen.cc ('k') | src/hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698