Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 1611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1622 JSArrayBuilder(HGraphBuilder* builder, | 1622 JSArrayBuilder(HGraphBuilder* builder, |
| 1623 ElementsKind kind, | 1623 ElementsKind kind, |
| 1624 HValue* constructor_function = NULL); | 1624 HValue* constructor_function = NULL); |
| 1625 | 1625 |
| 1626 enum FillMode { | 1626 enum FillMode { |
| 1627 DONT_FILL_WITH_HOLE, | 1627 DONT_FILL_WITH_HOLE, |
| 1628 FILL_WITH_HOLE | 1628 FILL_WITH_HOLE |
| 1629 }; | 1629 }; |
| 1630 | 1630 |
| 1631 ElementsKind kind() { return kind_; } | 1631 ElementsKind kind() { return kind_; } |
| 1632 HAllocate* elements_location() { return elements_location_; } | |
| 1632 | 1633 |
| 1633 HValue* AllocateEmptyArray(); | 1634 HAllocate* AllocateEmptyArray(); |
| 1634 HValue* AllocateArray(HValue* capacity, HValue* length_field, | 1635 HAllocate* AllocateArray(HValue* capacity, |
| 1635 FillMode fill_mode = FILL_WITH_HOLE); | 1636 HValue* length_field, |
| 1637 FillMode fill_mode = FILL_WITH_HOLE); | |
| 1638 // Use these allocators when capacity could be unknown at compile time | |
| 1639 // but its limit is known. For constant |capacity| the value of | |
| 1640 // |capacity_upper_bound| is ignored and the actual |capacity| | |
| 1641 // value is used as an upper bound. | |
| 1642 HAllocate* AllocateArray(HValue* capacity, | |
| 1643 int capacity_upper_bound, | |
| 1644 HValue* length_field, | |
| 1645 FillMode fill_mode = FILL_WITH_HOLE); | |
| 1646 HAllocate* AllocateArray(HValue* capacity, | |
| 1647 HConstant* capacity_upper_bound, | |
| 1648 HValue* length_field, | |
| 1649 FillMode fill_mode = FILL_WITH_HOLE); | |
| 1636 HValue* GetElementsLocation() { return elements_location_; } | 1650 HValue* GetElementsLocation() { return elements_location_; } |
| 1637 HValue* EmitMapCode(); | 1651 HValue* EmitMapCode(); |
| 1638 | 1652 |
| 1639 private: | 1653 private: |
| 1640 Zone* zone() const { return builder_->zone(); } | 1654 Zone* zone() const { return builder_->zone(); } |
| 1641 int elements_size() const { | 1655 int elements_size() const { |
| 1642 return IsFastDoubleElementsKind(kind_) ? kDoubleSize : kPointerSize; | 1656 return IsFastDoubleElementsKind(kind_) ? kDoubleSize : kPointerSize; |
| 1643 } | 1657 } |
| 1644 HGraphBuilder* builder() { return builder_; } | 1658 HGraphBuilder* builder() { return builder_; } |
| 1645 HGraph* graph() { return builder_->graph(); } | 1659 HGraph* graph() { return builder_->graph(); } |
| 1646 int initial_capacity() { | 1660 int initial_capacity() { |
| 1647 STATIC_ASSERT(JSArray::kPreallocatedArrayElements > 0); | 1661 STATIC_ASSERT(JSArray::kPreallocatedArrayElements > 0); |
| 1648 return JSArray::kPreallocatedArrayElements; | 1662 return JSArray::kPreallocatedArrayElements; |
| 1649 } | 1663 } |
| 1650 | 1664 |
| 1651 HValue* EmitInternalMapCode(); | 1665 HValue* EmitInternalMapCode(); |
| 1652 HValue* EstablishEmptyArrayAllocationSize(); | |
| 1653 HValue* EstablishAllocationSize(HValue* length_node); | |
| 1654 HValue* AllocateArray(HValue* size_in_bytes, HValue* capacity, | |
| 1655 HValue* length_field, | |
| 1656 FillMode fill_mode = FILL_WITH_HOLE); | |
| 1657 | 1666 |
| 1658 HGraphBuilder* builder_; | 1667 HGraphBuilder* builder_; |
| 1659 ElementsKind kind_; | 1668 ElementsKind kind_; |
| 1660 AllocationSiteMode mode_; | 1669 AllocationSiteMode mode_; |
| 1661 HValue* allocation_site_payload_; | 1670 HValue* allocation_site_payload_; |
| 1662 HValue* constructor_function_; | 1671 HValue* constructor_function_; |
| 1663 HInnerAllocatedObject* elements_location_; | 1672 HAllocate* elements_location_; |
| 1664 }; | 1673 }; |
| 1665 | 1674 |
| 1666 HValue* BuildAllocateArrayFromLength(JSArrayBuilder* array_builder, | 1675 HValue* BuildAllocateArrayFromLength(JSArrayBuilder* array_builder, |
| 1667 HValue* length_argument); | 1676 HValue* length_argument); |
| 1677 HValue* BuildCalculateElementsSize(ElementsKind kind, | |
| 1678 HValue* capacity); | |
| 1679 HConstant* EstablishHeaderAllocationSize(AllocationSiteMode mode); | |
| 1680 HConstant* EstablishElementsAllocationSize(ElementsKind kind, int capacity); | |
| 1668 | 1681 |
| 1669 HValue* BuildAllocateElements(ElementsKind kind, | 1682 HAllocate* BuildAllocateElements(ElementsKind kind, |
| 1670 HValue* capacity); | 1683 HValue* size_in_bytes, |
| 1684 PretenureFlag pretenure); | |
| 1671 | 1685 |
| 1672 void BuildInitializeElementsHeader(HValue* elements, | 1686 void BuildInitializeElementsHeader(HValue* elements, |
| 1673 ElementsKind kind, | 1687 ElementsKind kind, |
| 1674 HValue* capacity); | 1688 HValue* capacity); |
| 1675 | 1689 |
| 1676 HValue* BuildAllocateElementsAndInitializeElementsHeader(ElementsKind kind, | 1690 HValue* BuildAllocateElementsAndInitializeElementsHeader(ElementsKind kind, |
| 1677 HValue* capacity); | 1691 HValue* capacity); |
| 1678 | 1692 |
| 1679 // array must have been allocated with enough room for | 1693 // Array must have been allocated with enough room for |
|
Hannes Payer (out of office)
2014/01/16 12:58:39
Can you keep array lower case since it refers to t
| |
| 1680 // 1) the JSArray, 2) a AllocationMemento if mode requires it, | 1694 // 1) the JSArray and 2) an AllocationMemento if mode requires it. |
| 1681 // 3) a FixedArray or FixedDoubleArray. | 1695 // Initially the array elements storage is initialized with empty array. |
| 1682 // A pointer to the Fixed(Double)Array is returned. | 1696 void BuildJSArrayHeader(HValue* array, |
| 1683 HInnerAllocatedObject* BuildJSArrayHeader(HValue* array, | 1697 HValue* array_map, |
| 1684 HValue* array_map, | 1698 AllocationSiteMode mode, |
| 1685 AllocationSiteMode mode, | 1699 ElementsKind elements_kind, |
| 1686 ElementsKind elements_kind, | 1700 HValue* allocation_site_payload, |
| 1687 HValue* allocation_site_payload, | 1701 HValue* length_field); |
| 1688 HValue* length_field); | |
| 1689 | 1702 |
| 1690 HValue* BuildGrowElementsCapacity(HValue* object, | 1703 HValue* BuildGrowElementsCapacity(HValue* object, |
| 1691 HValue* elements, | 1704 HValue* elements, |
| 1692 ElementsKind kind, | 1705 ElementsKind kind, |
| 1693 ElementsKind new_kind, | 1706 ElementsKind new_kind, |
| 1694 HValue* length, | 1707 HValue* length, |
| 1695 HValue* new_capacity); | 1708 HValue* new_capacity); |
| 1696 | 1709 |
| 1697 void BuildFillElementsWithHole(HValue* elements, | 1710 void BuildFillElementsWithHole(HValue* elements, |
| 1698 ElementsKind elements_kind, | 1711 ElementsKind elements_kind, |
| (...skipping 941 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2640 } | 2653 } |
| 2641 | 2654 |
| 2642 private: | 2655 private: |
| 2643 HGraphBuilder* builder_; | 2656 HGraphBuilder* builder_; |
| 2644 }; | 2657 }; |
| 2645 | 2658 |
| 2646 | 2659 |
| 2647 } } // namespace v8::internal | 2660 } } // namespace v8::internal |
| 2648 | 2661 |
| 2649 #endif // V8_HYDROGEN_H_ | 2662 #endif // V8_HYDROGEN_H_ |
| OLD | NEW |