| 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 "src/allocation.h" | 10 #include "src/allocation.h" |
| (...skipping 1774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1785 | 1785 |
| 1786 // Allocate and partially initializes a String. There are two String | 1786 // Allocate and partially initializes a String. There are two String |
| 1787 // encodings: ASCII and two byte. These functions allocate a string of the | 1787 // encodings: ASCII and two byte. These functions allocate a string of the |
| 1788 // given length and set its map and length fields. The characters of the | 1788 // given length and set its map and length fields. The characters of the |
| 1789 // string are uninitialized. | 1789 // string are uninitialized. |
| 1790 MUST_USE_RESULT AllocationResult AllocateRawOneByteString( | 1790 MUST_USE_RESULT AllocationResult AllocateRawOneByteString( |
| 1791 int length, PretenureFlag pretenure); | 1791 int length, PretenureFlag pretenure); |
| 1792 MUST_USE_RESULT AllocationResult AllocateRawTwoByteString( | 1792 MUST_USE_RESULT AllocationResult AllocateRawTwoByteString( |
| 1793 int length, PretenureFlag pretenure); | 1793 int length, PretenureFlag pretenure); |
| 1794 | 1794 |
| 1795 // Allocates and fully initializes a String. There are two String | |
| 1796 // encodings: ASCII and two byte. One should choose between the three string | |
| 1797 // allocation functions based on the encoding of the string buffer used to | |
| 1798 // initialized the string. | |
| 1799 // - ...FromAscii initializes the string from a buffer that is ASCII | |
| 1800 // encoded (it does not check that the buffer is ASCII encoded) and the | |
| 1801 // result will be ASCII encoded. | |
| 1802 // - ...FromUTF8 initializes the string from a buffer that is UTF-8 | |
| 1803 // encoded. If the characters are all single-byte characters, the | |
| 1804 // result will be ASCII encoded, otherwise it will converted to two | |
| 1805 // byte. | |
| 1806 // - ...FromTwoByte initializes the string from a buffer that is two-byte | |
| 1807 // encoded. If the characters are all single-byte characters, the | |
| 1808 // result will be converted to ASCII, otherwise it will be left as | |
| 1809 // two-byte. | |
| 1810 MUST_USE_RESULT AllocationResult AllocateStringFromUtf8Slow( | |
| 1811 Vector<const char> str, | |
| 1812 int non_ascii_start, | |
| 1813 PretenureFlag pretenure = NOT_TENURED); | |
| 1814 MUST_USE_RESULT AllocationResult AllocateStringFromTwoByte( | |
| 1815 Vector<const uc16> str, | |
| 1816 PretenureFlag pretenure = NOT_TENURED); | |
| 1817 | |
| 1818 bool CreateInitialMaps(); | 1795 bool CreateInitialMaps(); |
| 1819 void CreateInitialObjects(); | 1796 void CreateInitialObjects(); |
| 1820 | 1797 |
| 1821 // Allocates an internalized string in old space based on the character | 1798 // Allocates an internalized string in old space based on the character |
| 1822 // stream. | 1799 // stream. |
| 1823 MUST_USE_RESULT inline AllocationResult AllocateInternalizedStringFromUtf8( | 1800 MUST_USE_RESULT inline AllocationResult AllocateInternalizedStringFromUtf8( |
| 1824 Vector<const char> str, | 1801 Vector<const char> str, |
| 1825 int chars, | 1802 int chars, |
| 1826 uint32_t hash_field); | 1803 uint32_t hash_field); |
| 1827 | 1804 |
| (...skipping 956 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2784 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. | 2761 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. |
| 2785 | 2762 |
| 2786 private: | 2763 private: |
| 2787 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2764 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
| 2788 }; | 2765 }; |
| 2789 #endif // DEBUG | 2766 #endif // DEBUG |
| 2790 | 2767 |
| 2791 } } // namespace v8::internal | 2768 } } // namespace v8::internal |
| 2792 | 2769 |
| 2793 #endif // V8_HEAP_H_ | 2770 #endif // V8_HEAP_H_ |
| OLD | NEW |