| 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_HEAP_H_ | 5 #ifndef V8_HEAP_H_ |
| 6 #define V8_HEAP_H_ | 6 #define V8_HEAP_H_ |
| 7 | 7 |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 | 9 |
| 10 #include "allocation.h" | 10 #include "allocation.h" |
| (...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 677 | 677 |
| 678 Address* OldDataSpaceAllocationTopAddress() { | 678 Address* OldDataSpaceAllocationTopAddress() { |
| 679 return old_data_space_->allocation_top_address(); | 679 return old_data_space_->allocation_top_address(); |
| 680 } | 680 } |
| 681 Address* OldDataSpaceAllocationLimitAddress() { | 681 Address* OldDataSpaceAllocationLimitAddress() { |
| 682 return old_data_space_->allocation_limit_address(); | 682 return old_data_space_->allocation_limit_address(); |
| 683 } | 683 } |
| 684 | 684 |
| 685 // Returns a deep copy of the JavaScript object. | 685 // Returns a deep copy of the JavaScript object. |
| 686 // Properties and elements are copied too. | 686 // Properties and elements are copied too. |
| 687 // Returns failure if allocation failed. | |
| 688 // Optionally takes an AllocationSite to be appended in an AllocationMemento. | 687 // Optionally takes an AllocationSite to be appended in an AllocationMemento. |
| 689 MUST_USE_RESULT MaybeObject* CopyJSObject(JSObject* source, | 688 MUST_USE_RESULT AllocationResult CopyJSObject(JSObject* source, |
| 690 AllocationSite* site = NULL); | 689 AllocationSite* site = NULL); |
| 691 | 690 |
| 692 // Clear the Instanceof cache (used when a prototype changes). | 691 // Clear the Instanceof cache (used when a prototype changes). |
| 693 inline void ClearInstanceofCache(); | 692 inline void ClearInstanceofCache(); |
| 694 | 693 |
| 695 // Iterates the whole code space to clear all ICs of the given kind. | 694 // Iterates the whole code space to clear all ICs of the given kind. |
| 696 void ClearAllICsByKind(Code::Kind kind); | 695 void ClearAllICsByKind(Code::Kind kind); |
| 697 | 696 |
| 698 // For use during bootup. | 697 // For use during bootup. |
| 699 void RepairFreeListsAfterBoot(); | 698 void RepairFreeListsAfterBoot(); |
| 700 | 699 |
| 701 template<typename T> | 700 template<typename T> |
| 702 static inline bool IsOneByte(T t, int chars); | 701 static inline bool IsOneByte(T t, int chars); |
| 703 | 702 |
| 704 // Move len elements within a given array from src_index index to dst_index | 703 // Move len elements within a given array from src_index index to dst_index |
| 705 // index. | 704 // index. |
| 706 void MoveElements(FixedArray* array, int dst_index, int src_index, int len); | 705 void MoveElements(FixedArray* array, int dst_index, int src_index, int len); |
| 707 | 706 |
| 708 // Sloppy mode arguments object size. | 707 // Sloppy mode arguments object size. |
| 709 static const int kSloppyArgumentsObjectSize = | 708 static const int kSloppyArgumentsObjectSize = |
| 710 JSObject::kHeaderSize + 2 * kPointerSize; | 709 JSObject::kHeaderSize + 2 * kPointerSize; |
| 711 // Strict mode arguments has no callee so it is smaller. | 710 // Strict mode arguments has no callee so it is smaller. |
| 712 static const int kStrictArgumentsObjectSize = | 711 static const int kStrictArgumentsObjectSize = |
| 713 JSObject::kHeaderSize + 1 * kPointerSize; | 712 JSObject::kHeaderSize + 1 * kPointerSize; |
| 714 // Indicies for direct access into argument objects. | 713 // Indicies for direct access into argument objects. |
| 715 static const int kArgumentsLengthIndex = 0; | 714 static const int kArgumentsLengthIndex = 0; |
| 716 // callee is only valid in sloppy mode. | 715 // callee is only valid in sloppy mode. |
| 717 static const int kArgumentsCalleeIndex = 1; | 716 static const int kArgumentsCalleeIndex = 1; |
| 718 | 717 |
| 719 // Converts an int into either a Smi or a HeapNumber object. | |
| 720 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation | |
| 721 // failed. | |
| 722 // Please note this does not perform a garbage collection. | |
| 723 MUST_USE_RESULT inline MaybeObject* NumberFromUint32( | |
| 724 uint32_t value, PretenureFlag pretenure = NOT_TENURED); | |
| 725 | |
| 726 // Finalizes an external string by deleting the associated external | 718 // Finalizes an external string by deleting the associated external |
| 727 // data and clearing the resource pointer. | 719 // data and clearing the resource pointer. |
| 728 inline void FinalizeExternalString(String* string); | 720 inline void FinalizeExternalString(String* string); |
| 729 | 721 |
| 730 // Initialize a filler object to keep the ability to iterate over the heap | 722 // Initialize a filler object to keep the ability to iterate over the heap |
| 731 // when shortening objects. | 723 // when shortening objects. |
| 732 void CreateFillerObjectAt(Address addr, int size); | 724 void CreateFillerObjectAt(Address addr, int size); |
| 733 | 725 |
| 734 bool CanMoveObjectStart(HeapObject* object); | 726 bool CanMoveObjectStart(HeapObject* object); |
| 735 | 727 |
| (...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1433 | 1425 |
| 1434 void EnsureWeakObjectToCodeTable(); | 1426 void EnsureWeakObjectToCodeTable(); |
| 1435 | 1427 |
| 1436 static void FatalProcessOutOfMemory(const char* location, | 1428 static void FatalProcessOutOfMemory(const char* location, |
| 1437 bool take_snapshot = false); | 1429 bool take_snapshot = false); |
| 1438 | 1430 |
| 1439 protected: | 1431 protected: |
| 1440 // Methods made available to tests. | 1432 // Methods made available to tests. |
| 1441 | 1433 |
| 1442 // Allocates a JS Map in the heap. | 1434 // Allocates a JS Map in the heap. |
| 1443 MUST_USE_RESULT MaybeObject* AllocateMap( | 1435 MUST_USE_RESULT AllocationResult AllocateMap( |
| 1444 InstanceType instance_type, | 1436 InstanceType instance_type, |
| 1445 int instance_size, | 1437 int instance_size, |
| 1446 ElementsKind elements_kind = TERMINAL_FAST_ELEMENTS_KIND); | 1438 ElementsKind elements_kind = TERMINAL_FAST_ELEMENTS_KIND); |
| 1447 | 1439 |
| 1448 // Allocates and initializes a new JavaScript object based on a | 1440 // Allocates and initializes a new JavaScript object based on a |
| 1449 // constructor. | 1441 // constructor. |
| 1450 // If allocation_site is non-null, then a memento is emitted after the object | 1442 // If allocation_site is non-null, then a memento is emitted after the object |
| 1451 // that points to the site. | 1443 // that points to the site. |
| 1452 MUST_USE_RESULT MaybeObject* AllocateJSObject( | 1444 MUST_USE_RESULT AllocationResult AllocateJSObject( |
| 1453 JSFunction* constructor, | 1445 JSFunction* constructor, |
| 1454 PretenureFlag pretenure = NOT_TENURED, | 1446 PretenureFlag pretenure = NOT_TENURED, |
| 1455 AllocationSite* allocation_site = NULL); | 1447 AllocationSite* allocation_site = NULL); |
| 1456 | 1448 |
| 1457 // Allocates and initializes a new JavaScript object based on a map. | 1449 // Allocates and initializes a new JavaScript object based on a map. |
| 1458 // Passing an allocation site means that a memento will be created that | 1450 // Passing an allocation site means that a memento will be created that |
| 1459 // points to the site. | 1451 // points to the site. |
| 1460 MUST_USE_RESULT MaybeObject* AllocateJSObjectFromMap( | 1452 MUST_USE_RESULT AllocationResult AllocateJSObjectFromMap( |
| 1461 Map* map, | 1453 Map* map, |
| 1462 PretenureFlag pretenure = NOT_TENURED, | 1454 PretenureFlag pretenure = NOT_TENURED, |
| 1463 bool alloc_props = true, | 1455 bool alloc_props = true, |
| 1464 AllocationSite* allocation_site = NULL); | 1456 AllocationSite* allocation_site = NULL); |
| 1465 | 1457 |
| 1466 // Allocated a HeapNumber from value. | 1458 // Allocated a HeapNumber from value. |
| 1467 MUST_USE_RESULT MaybeObject* AllocateHeapNumber( | 1459 MUST_USE_RESULT AllocationResult AllocateHeapNumber( |
| 1468 double value, PretenureFlag pretenure = NOT_TENURED); | 1460 double value, PretenureFlag pretenure = NOT_TENURED); |
| 1469 | 1461 |
| 1470 // Allocate a byte array of the specified length | 1462 // Allocate a byte array of the specified length |
| 1471 MUST_USE_RESULT MaybeObject* AllocateByteArray( | 1463 MUST_USE_RESULT AllocationResult AllocateByteArray( |
| 1472 int length, | 1464 int length, |
| 1473 PretenureFlag pretenure = NOT_TENURED); | 1465 PretenureFlag pretenure = NOT_TENURED); |
| 1474 | 1466 |
| 1475 // Allocates an arguments object - optionally with an elements array. | 1467 // Allocates an arguments object - optionally with an elements array. |
| 1476 MUST_USE_RESULT MaybeObject* AllocateArgumentsObject( | 1468 MUST_USE_RESULT AllocationResult AllocateArgumentsObject( |
| 1477 Object* callee, int length); | 1469 Object* callee, int length); |
| 1478 | 1470 |
| 1479 // Copy the code and scope info part of the code object, but insert | 1471 // Copy the code and scope info part of the code object, but insert |
| 1480 // the provided data as the relocation information. | 1472 // the provided data as the relocation information. |
| 1481 MUST_USE_RESULT MaybeObject* CopyCode(Code* code, Vector<byte> reloc_info); | 1473 MUST_USE_RESULT AllocationResult CopyCode(Code* code, |
| 1474 Vector<byte> reloc_info); |
| 1482 | 1475 |
| 1483 MUST_USE_RESULT MaybeObject* CopyCode(Code* code); | 1476 MUST_USE_RESULT AllocationResult CopyCode(Code* code); |
| 1484 | 1477 |
| 1485 // Allocates a fixed array initialized with undefined values | 1478 // Allocates a fixed array initialized with undefined values |
| 1486 MUST_USE_RESULT MaybeObject* AllocateFixedArray( | 1479 MUST_USE_RESULT AllocationResult AllocateFixedArray( |
| 1487 int length, | 1480 int length, |
| 1488 PretenureFlag pretenure = NOT_TENURED); | 1481 PretenureFlag pretenure = NOT_TENURED); |
| 1489 | 1482 |
| 1490 private: | 1483 private: |
| 1491 Heap(); | 1484 Heap(); |
| 1492 | 1485 |
| 1493 // This can be calculated directly from a pointer to the heap; however, it is | 1486 // This can be calculated directly from a pointer to the heap; however, it is |
| 1494 // more expedient to get at the isolate directly from within Heap methods. | 1487 // more expedient to get at the isolate directly from within Heap methods. |
| 1495 Isolate* isolate_; | 1488 Isolate* isolate_; |
| 1496 | 1489 |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1732 ASSERT(preferred_old_space == OLD_POINTER_SPACE || | 1725 ASSERT(preferred_old_space == OLD_POINTER_SPACE || |
| 1733 preferred_old_space == OLD_DATA_SPACE); | 1726 preferred_old_space == OLD_DATA_SPACE); |
| 1734 if (object_size > Page::kMaxRegularHeapObjectSize) return LO_SPACE; | 1727 if (object_size > Page::kMaxRegularHeapObjectSize) return LO_SPACE; |
| 1735 return (pretenure == TENURED) ? preferred_old_space : NEW_SPACE; | 1728 return (pretenure == TENURED) ? preferred_old_space : NEW_SPACE; |
| 1736 } | 1729 } |
| 1737 | 1730 |
| 1738 // Allocate an uninitialized object. The memory is non-executable if the | 1731 // Allocate an uninitialized object. The memory is non-executable if the |
| 1739 // hardware and OS allow. This is the single choke-point for allocations | 1732 // hardware and OS allow. This is the single choke-point for allocations |
| 1740 // performed by the runtime and should not be bypassed (to extend this to | 1733 // performed by the runtime and should not be bypassed (to extend this to |
| 1741 // inlined allocations, use the Heap::DisableInlineAllocation() support). | 1734 // inlined allocations, use the Heap::DisableInlineAllocation() support). |
| 1742 MUST_USE_RESULT inline MaybeObject* AllocateRaw(int size_in_bytes, | 1735 MUST_USE_RESULT inline AllocationResult AllocateRaw( |
| 1743 AllocationSpace space, | 1736 int size_in_bytes, |
| 1744 AllocationSpace retry_space); | 1737 AllocationSpace space, |
| 1738 AllocationSpace retry_space); |
| 1745 | 1739 |
| 1746 // Allocates a heap object based on the map. | 1740 // Allocates a heap object based on the map. |
| 1747 MUST_USE_RESULT MaybeObject* Allocate(Map* map, AllocationSpace space, | 1741 MUST_USE_RESULT AllocationResult Allocate( |
| 1748 AllocationSite* allocation_site = NULL); | 1742 Map* map, |
| 1743 AllocationSpace space, |
| 1744 AllocationSite* allocation_site = NULL); |
| 1749 | 1745 |
| 1750 // Allocates a partial map for bootstrapping. | 1746 // Allocates a partial map for bootstrapping. |
| 1751 MUST_USE_RESULT MaybeObject* AllocatePartialMap(InstanceType instance_type, | 1747 MUST_USE_RESULT AllocationResult AllocatePartialMap( |
| 1752 int instance_size); | 1748 InstanceType instance_type, |
| 1749 int instance_size); |
| 1753 | 1750 |
| 1754 // Initializes a JSObject based on its map. | 1751 // Initializes a JSObject based on its map. |
| 1755 void InitializeJSObjectFromMap(JSObject* obj, | 1752 void InitializeJSObjectFromMap(JSObject* obj, |
| 1756 FixedArray* properties, | 1753 FixedArray* properties, |
| 1757 Map* map); | 1754 Map* map); |
| 1758 void InitializeAllocationMemento(AllocationMemento* memento, | 1755 void InitializeAllocationMemento(AllocationMemento* memento, |
| 1759 AllocationSite* allocation_site); | 1756 AllocationSite* allocation_site); |
| 1760 | 1757 |
| 1761 // Allocate a block of memory in the given space (filled with a filler). | 1758 // Allocate a block of memory in the given space (filled with a filler). |
| 1762 // Used as a fall-back for generated code when the space is full. | 1759 // Used as a fall-back for generated code when the space is full. |
| 1763 MUST_USE_RESULT MaybeObject* AllocateFillerObject(int size, | 1760 MUST_USE_RESULT AllocationResult AllocateFillerObject(int size, |
| 1764 bool double_align, | 1761 bool double_align, |
| 1765 AllocationSpace space); | 1762 AllocationSpace space); |
| 1766 | 1763 |
| 1767 // Allocate an uninitialized fixed array. | 1764 // Allocate an uninitialized fixed array. |
| 1768 MUST_USE_RESULT MaybeObject* AllocateRawFixedArray( | 1765 MUST_USE_RESULT AllocationResult AllocateRawFixedArray( |
| 1769 int length, PretenureFlag pretenure); | 1766 int length, PretenureFlag pretenure); |
| 1770 | 1767 |
| 1771 // Allocate an uninitialized fixed double array. | 1768 // Allocate an uninitialized fixed double array. |
| 1772 MUST_USE_RESULT MaybeObject* AllocateRawFixedDoubleArray( | 1769 MUST_USE_RESULT AllocationResult AllocateRawFixedDoubleArray( |
| 1773 int length, PretenureFlag pretenure); | 1770 int length, PretenureFlag pretenure); |
| 1774 | 1771 |
| 1775 // Allocate an initialized fixed array with the given filler value. | 1772 // Allocate an initialized fixed array with the given filler value. |
| 1776 MUST_USE_RESULT MaybeObject* AllocateFixedArrayWithFiller( | 1773 MUST_USE_RESULT AllocationResult AllocateFixedArrayWithFiller( |
| 1777 int length, PretenureFlag pretenure, Object* filler); | 1774 int length, PretenureFlag pretenure, Object* filler); |
| 1778 | 1775 |
| 1779 // Allocate and partially initializes a String. There are two String | 1776 // Allocate and partially initializes a String. There are two String |
| 1780 // encodings: ASCII and two byte. These functions allocate a string of the | 1777 // encodings: ASCII and two byte. These functions allocate a string of the |
| 1781 // given length and set its map and length fields. The characters of the | 1778 // given length and set its map and length fields. The characters of the |
| 1782 // string are uninitialized. | 1779 // string are uninitialized. |
| 1783 MUST_USE_RESULT MaybeObject* AllocateRawOneByteString( | 1780 MUST_USE_RESULT AllocationResult AllocateRawOneByteString( |
| 1784 int length, PretenureFlag pretenure); | 1781 int length, PretenureFlag pretenure); |
| 1785 MUST_USE_RESULT MaybeObject* AllocateRawTwoByteString( | 1782 MUST_USE_RESULT AllocationResult AllocateRawTwoByteString( |
| 1786 int length, PretenureFlag pretenure); | 1783 int length, PretenureFlag pretenure); |
| 1787 | 1784 |
| 1788 // Allocates and fully initializes a String. There are two String | 1785 // Allocates and fully initializes a String. There are two String |
| 1789 // encodings: ASCII and two byte. One should choose between the three string | 1786 // encodings: ASCII and two byte. One should choose between the three string |
| 1790 // allocation functions based on the encoding of the string buffer used to | 1787 // allocation functions based on the encoding of the string buffer used to |
| 1791 // initialized the string. | 1788 // initialized the string. |
| 1792 // - ...FromAscii initializes the string from a buffer that is ASCII | 1789 // - ...FromAscii initializes the string from a buffer that is ASCII |
| 1793 // encoded (it does not check that the buffer is ASCII encoded) and the | 1790 // encoded (it does not check that the buffer is ASCII encoded) and the |
| 1794 // result will be ASCII encoded. | 1791 // result will be ASCII encoded. |
| 1795 // - ...FromUTF8 initializes the string from a buffer that is UTF-8 | 1792 // - ...FromUTF8 initializes the string from a buffer that is UTF-8 |
| 1796 // encoded. If the characters are all single-byte characters, the | 1793 // encoded. If the characters are all single-byte characters, the |
| 1797 // result will be ASCII encoded, otherwise it will converted to two | 1794 // result will be ASCII encoded, otherwise it will converted to two |
| 1798 // byte. | 1795 // byte. |
| 1799 // - ...FromTwoByte initializes the string from a buffer that is two-byte | 1796 // - ...FromTwoByte initializes the string from a buffer that is two-byte |
| 1800 // encoded. If the characters are all single-byte characters, the | 1797 // encoded. If the characters are all single-byte characters, the |
| 1801 // result will be converted to ASCII, otherwise it will be left as | 1798 // result will be converted to ASCII, otherwise it will be left as |
| 1802 // two-byte. | 1799 // two-byte. |
| 1803 MUST_USE_RESULT MaybeObject* AllocateStringFromUtf8Slow( | 1800 MUST_USE_RESULT AllocationResult AllocateStringFromUtf8Slow( |
| 1804 Vector<const char> str, | 1801 Vector<const char> str, |
| 1805 int non_ascii_start, | 1802 int non_ascii_start, |
| 1806 PretenureFlag pretenure = NOT_TENURED); | 1803 PretenureFlag pretenure = NOT_TENURED); |
| 1807 MUST_USE_RESULT MaybeObject* AllocateStringFromTwoByte( | 1804 MUST_USE_RESULT AllocationResult AllocateStringFromTwoByte( |
| 1808 Vector<const uc16> str, | 1805 Vector<const uc16> str, |
| 1809 PretenureFlag pretenure = NOT_TENURED); | 1806 PretenureFlag pretenure = NOT_TENURED); |
| 1810 | 1807 |
| 1811 bool CreateInitialMaps(); | 1808 bool CreateInitialMaps(); |
| 1812 void CreateInitialObjects(); | 1809 void CreateInitialObjects(); |
| 1813 | 1810 |
| 1814 // Allocates an internalized string in old space based on the character | 1811 // Allocates an internalized string in old space based on the character |
| 1815 // stream. | 1812 // stream. |
| 1816 MUST_USE_RESULT inline MaybeObject* AllocateInternalizedStringFromUtf8( | 1813 MUST_USE_RESULT inline AllocationResult AllocateInternalizedStringFromUtf8( |
| 1817 Vector<const char> str, | 1814 Vector<const char> str, |
| 1818 int chars, | 1815 int chars, |
| 1819 uint32_t hash_field); | 1816 uint32_t hash_field); |
| 1820 | 1817 |
| 1821 MUST_USE_RESULT inline MaybeObject* AllocateOneByteInternalizedString( | 1818 MUST_USE_RESULT inline AllocationResult AllocateOneByteInternalizedString( |
| 1822 Vector<const uint8_t> str, | 1819 Vector<const uint8_t> str, |
| 1823 uint32_t hash_field); | 1820 uint32_t hash_field); |
| 1824 | 1821 |
| 1825 MUST_USE_RESULT inline MaybeObject* AllocateTwoByteInternalizedString( | 1822 MUST_USE_RESULT inline AllocationResult AllocateTwoByteInternalizedString( |
| 1826 Vector<const uc16> str, | 1823 Vector<const uc16> str, |
| 1827 uint32_t hash_field); | 1824 uint32_t hash_field); |
| 1828 | 1825 |
| 1829 template<bool is_one_byte, typename T> | 1826 template<bool is_one_byte, typename T> |
| 1830 MUST_USE_RESULT MaybeObject* AllocateInternalizedStringImpl( | 1827 MUST_USE_RESULT AllocationResult AllocateInternalizedStringImpl( |
| 1831 T t, int chars, uint32_t hash_field); | 1828 T t, int chars, uint32_t hash_field); |
| 1832 | 1829 |
| 1833 template<typename T> | 1830 template<typename T> |
| 1834 MUST_USE_RESULT inline MaybeObject* AllocateInternalizedStringImpl( | 1831 MUST_USE_RESULT inline AllocationResult AllocateInternalizedStringImpl( |
| 1835 T t, int chars, uint32_t hash_field); | 1832 T t, int chars, uint32_t hash_field); |
| 1836 | 1833 |
| 1837 // Allocates an uninitialized fixed array. It must be filled by the caller. | 1834 // Allocates an uninitialized fixed array. It must be filled by the caller. |
| 1838 MUST_USE_RESULT MaybeObject* AllocateUninitializedFixedArray(int length); | 1835 MUST_USE_RESULT AllocationResult AllocateUninitializedFixedArray(int length); |
| 1839 | 1836 |
| 1840 // Make a copy of src and return it. Returns | 1837 // Make a copy of src and return it. Returns |
| 1841 // Failure::RetryAfterGC(requested_bytes, space) if the allocation failed. | 1838 // Failure::RetryAfterGC(requested_bytes, space) if the allocation failed. |
| 1842 MUST_USE_RESULT inline MaybeObject* CopyFixedArray(FixedArray* src); | 1839 MUST_USE_RESULT inline AllocationResult CopyFixedArray(FixedArray* src); |
| 1843 | 1840 |
| 1844 // Make a copy of src, set the map, and return the copy. Returns | 1841 // Make a copy of src, set the map, and return the copy. Returns |
| 1845 // Failure::RetryAfterGC(requested_bytes, space) if the allocation failed. | 1842 // Failure::RetryAfterGC(requested_bytes, space) if the allocation failed. |
| 1846 MUST_USE_RESULT MaybeObject* CopyFixedArrayWithMap(FixedArray* src, Map* map); | 1843 MUST_USE_RESULT AllocationResult CopyFixedArrayWithMap(FixedArray* src, |
| 1844 Map* map); |
| 1847 | 1845 |
| 1848 // Make a copy of src and return it. Returns | 1846 // Make a copy of src and return it. Returns |
| 1849 // Failure::RetryAfterGC(requested_bytes, space) if the allocation failed. | 1847 // Failure::RetryAfterGC(requested_bytes, space) if the allocation failed. |
| 1850 MUST_USE_RESULT inline MaybeObject* CopyFixedDoubleArray( | 1848 MUST_USE_RESULT inline AllocationResult CopyFixedDoubleArray( |
| 1851 FixedDoubleArray* src); | 1849 FixedDoubleArray* src); |
| 1852 | 1850 |
| 1853 // Make a copy of src and return it. Returns | 1851 // Make a copy of src and return it. Returns |
| 1854 // Failure::RetryAfterGC(requested_bytes, space) if the allocation failed. | 1852 // Failure::RetryAfterGC(requested_bytes, space) if the allocation failed. |
| 1855 MUST_USE_RESULT inline MaybeObject* CopyConstantPoolArray( | 1853 MUST_USE_RESULT inline AllocationResult CopyConstantPoolArray( |
| 1856 ConstantPoolArray* src); | 1854 ConstantPoolArray* src); |
| 1857 | 1855 |
| 1858 | 1856 |
| 1859 // Computes a single character string where the character has code. | 1857 // Computes a single character string where the character has code. |
| 1860 // A cache is used for ASCII codes. | 1858 // A cache is used for ASCII codes. |
| 1861 MUST_USE_RESULT MaybeObject* LookupSingleCharacterStringFromCode( | 1859 MUST_USE_RESULT AllocationResult LookupSingleCharacterStringFromCode( |
| 1862 uint16_t code); | 1860 uint16_t code); |
| 1863 | 1861 |
| 1864 // Allocate a symbol in old space. | 1862 // Allocate a symbol in old space. |
| 1865 MUST_USE_RESULT MaybeObject* AllocateSymbol(); | 1863 MUST_USE_RESULT AllocationResult AllocateSymbol(); |
| 1866 | 1864 |
| 1867 // Make a copy of src, set the map, and return the copy. | 1865 // Make a copy of src, set the map, and return the copy. |
| 1868 MUST_USE_RESULT MaybeObject* CopyConstantPoolArrayWithMap( | 1866 MUST_USE_RESULT AllocationResult CopyConstantPoolArrayWithMap( |
| 1869 ConstantPoolArray* src, Map* map); | 1867 ConstantPoolArray* src, Map* map); |
| 1870 | 1868 |
| 1871 MUST_USE_RESULT MaybeObject* AllocateConstantPoolArray( | 1869 MUST_USE_RESULT AllocationResult AllocateConstantPoolArray( |
| 1872 int number_of_int64_entries, | 1870 int number_of_int64_entries, |
| 1873 int number_of_code_ptr_entries, | 1871 int number_of_code_ptr_entries, |
| 1874 int number_of_heap_ptr_entries, | 1872 int number_of_heap_ptr_entries, |
| 1875 int number_of_int32_entries); | 1873 int number_of_int32_entries); |
| 1876 | 1874 |
| 1877 // Allocates an external array of the specified length and type. | 1875 // Allocates an external array of the specified length and type. |
| 1878 MUST_USE_RESULT MaybeObject* AllocateExternalArray( | 1876 MUST_USE_RESULT AllocationResult AllocateExternalArray( |
| 1879 int length, | 1877 int length, |
| 1880 ExternalArrayType array_type, | 1878 ExternalArrayType array_type, |
| 1881 void* external_pointer, | 1879 void* external_pointer, |
| 1882 PretenureFlag pretenure); | 1880 PretenureFlag pretenure); |
| 1883 | 1881 |
| 1884 // Allocates a fixed typed array of the specified length and type. | 1882 // Allocates a fixed typed array of the specified length and type. |
| 1885 MUST_USE_RESULT MaybeObject* AllocateFixedTypedArray( | 1883 MUST_USE_RESULT AllocationResult AllocateFixedTypedArray( |
| 1886 int length, | 1884 int length, |
| 1887 ExternalArrayType array_type, | 1885 ExternalArrayType array_type, |
| 1888 PretenureFlag pretenure); | 1886 PretenureFlag pretenure); |
| 1889 | 1887 |
| 1890 // Make a copy of src and return it. | 1888 // Make a copy of src and return it. |
| 1891 MUST_USE_RESULT MaybeObject* CopyAndTenureFixedCOWArray(FixedArray* src); | 1889 MUST_USE_RESULT AllocationResult CopyAndTenureFixedCOWArray(FixedArray* src); |
| 1892 | 1890 |
| 1893 // Make a copy of src, set the map, and return the copy. | 1891 // Make a copy of src, set the map, and return the copy. |
| 1894 MUST_USE_RESULT MaybeObject* CopyFixedDoubleArrayWithMap( | 1892 MUST_USE_RESULT AllocationResult CopyFixedDoubleArrayWithMap( |
| 1895 FixedDoubleArray* src, Map* map); | 1893 FixedDoubleArray* src, Map* map); |
| 1896 | 1894 |
| 1897 // Allocates a fixed double array with uninitialized values. Returns | 1895 // Allocates a fixed double array with uninitialized values. Returns |
| 1898 MUST_USE_RESULT MaybeObject* AllocateUninitializedFixedDoubleArray( | 1896 MUST_USE_RESULT AllocationResult AllocateUninitializedFixedDoubleArray( |
| 1899 int length, | 1897 int length, |
| 1900 PretenureFlag pretenure = NOT_TENURED); | 1898 PretenureFlag pretenure = NOT_TENURED); |
| 1901 | 1899 |
| 1902 // These five Create*EntryStub functions are here and forced to not be inlined | 1900 // These five Create*EntryStub functions are here and forced to not be inlined |
| 1903 // because of a gcc-4.4 bug that assigns wrong vtable entries. | 1901 // because of a gcc-4.4 bug that assigns wrong vtable entries. |
| 1904 NO_INLINE(void CreateJSEntryStub()); | 1902 NO_INLINE(void CreateJSEntryStub()); |
| 1905 NO_INLINE(void CreateJSConstructEntryStub()); | 1903 NO_INLINE(void CreateJSConstructEntryStub()); |
| 1906 | 1904 |
| 1907 void CreateFixedStubs(); | 1905 void CreateFixedStubs(); |
| 1908 | 1906 |
| 1909 // Allocate empty fixed array. | 1907 // Allocate empty fixed array. |
| 1910 MUST_USE_RESULT MaybeObject* AllocateEmptyFixedArray(); | 1908 MUST_USE_RESULT AllocationResult AllocateEmptyFixedArray(); |
| 1911 | 1909 |
| 1912 // Allocate empty external array of given type. | 1910 // Allocate empty external array of given type. |
| 1913 MUST_USE_RESULT MaybeObject* AllocateEmptyExternalArray( | 1911 MUST_USE_RESULT AllocationResult AllocateEmptyExternalArray( |
| 1914 ExternalArrayType array_type); | 1912 ExternalArrayType array_type); |
| 1915 | 1913 |
| 1916 // Allocate empty fixed typed array of given type. | 1914 // Allocate empty fixed typed array of given type. |
| 1917 MUST_USE_RESULT MaybeObject* AllocateEmptyFixedTypedArray( | 1915 MUST_USE_RESULT AllocationResult AllocateEmptyFixedTypedArray( |
| 1918 ExternalArrayType array_type); | 1916 ExternalArrayType array_type); |
| 1919 | 1917 |
| 1920 // Allocate empty constant pool array. | 1918 // Allocate empty constant pool array. |
| 1921 MUST_USE_RESULT MaybeObject* AllocateEmptyConstantPoolArray(); | 1919 MUST_USE_RESULT AllocationResult AllocateEmptyConstantPoolArray(); |
| 1922 | 1920 |
| 1923 // Allocate a tenured simple cell. | 1921 // Allocate a tenured simple cell. |
| 1924 MUST_USE_RESULT MaybeObject* AllocateCell(Object* value); | 1922 MUST_USE_RESULT AllocationResult AllocateCell(Object* value); |
| 1925 | 1923 |
| 1926 // Allocate a tenured JS global property cell initialized with the hole. | 1924 // Allocate a tenured JS global property cell initialized with the hole. |
| 1927 MUST_USE_RESULT MaybeObject* AllocatePropertyCell(); | 1925 MUST_USE_RESULT AllocationResult AllocatePropertyCell(); |
| 1928 | 1926 |
| 1929 // Allocates a new utility object in the old generation. | 1927 // Allocates a new utility object in the old generation. |
| 1930 MUST_USE_RESULT MaybeObject* AllocateStruct(InstanceType type); | 1928 MUST_USE_RESULT AllocationResult AllocateStruct(InstanceType type); |
| 1931 | 1929 |
| 1932 // Allocates a new foreign object. | 1930 // Allocates a new foreign object. |
| 1933 MUST_USE_RESULT MaybeObject* AllocateForeign( | 1931 MUST_USE_RESULT AllocationResult AllocateForeign( |
| 1934 Address address, PretenureFlag pretenure = NOT_TENURED); | 1932 Address address, PretenureFlag pretenure = NOT_TENURED); |
| 1935 | 1933 |
| 1936 MUST_USE_RESULT MaybeObject* AllocateCode(int object_size, bool immovable); | 1934 MUST_USE_RESULT AllocationResult AllocateCode(int object_size, |
| 1935 bool immovable); |
| 1937 | 1936 |
| 1938 MUST_USE_RESULT MaybeObject* InternalizeStringWithKey(HashTableKey* key); | 1937 MUST_USE_RESULT AllocationResult InternalizeStringWithKey(HashTableKey* key); |
| 1939 | 1938 |
| 1940 MUST_USE_RESULT MaybeObject* InternalizeString(String* str); | 1939 MUST_USE_RESULT AllocationResult InternalizeString(String* str); |
| 1941 | 1940 |
| 1942 // Performs a minor collection in new generation. | 1941 // Performs a minor collection in new generation. |
| 1943 void Scavenge(); | 1942 void Scavenge(); |
| 1944 | 1943 |
| 1945 // Commits from space if it is uncommitted. | 1944 // Commits from space if it is uncommitted. |
| 1946 void EnsureFromSpaceIsCommitted(); | 1945 void EnsureFromSpaceIsCommitted(); |
| 1947 | 1946 |
| 1948 // Uncommit unused semi space. | 1947 // Uncommit unused semi space. |
| 1949 bool UncommitFromSpace() { return new_space_.UncommitFromSpace(); } | 1948 bool UncommitFromSpace() { return new_space_.UncommitFromSpace(); } |
| 1950 | 1949 |
| (...skipping 859 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2810 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. | 2809 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. |
| 2811 | 2810 |
| 2812 private: | 2811 private: |
| 2813 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2812 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
| 2814 }; | 2813 }; |
| 2815 #endif // DEBUG | 2814 #endif // DEBUG |
| 2816 | 2815 |
| 2817 } } // namespace v8::internal | 2816 } } // namespace v8::internal |
| 2818 | 2817 |
| 2819 #endif // V8_HEAP_H_ | 2818 #endif // V8_HEAP_H_ |
| OLD | NEW |