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_HEAP_H_ | 5 #ifndef V8_HEAP_HEAP_H_ |
6 #define V8_HEAP_HEAP_H_ | 6 #define V8_HEAP_HEAP_H_ |
7 | 7 |
8 #include <cmath> | 8 #include <cmath> |
9 #include <map> | 9 #include <map> |
10 | 10 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 ExternalInternalizedStringWithOneByteDataMap) \ | 98 ExternalInternalizedStringWithOneByteDataMap) \ |
99 V(Map, external_one_byte_internalized_string_map, \ | 99 V(Map, external_one_byte_internalized_string_map, \ |
100 ExternalOneByteInternalizedStringMap) \ | 100 ExternalOneByteInternalizedStringMap) \ |
101 V(Map, short_external_internalized_string_map, \ | 101 V(Map, short_external_internalized_string_map, \ |
102 ShortExternalInternalizedStringMap) \ | 102 ShortExternalInternalizedStringMap) \ |
103 V(Map, short_external_internalized_string_with_one_byte_data_map, \ | 103 V(Map, short_external_internalized_string_with_one_byte_data_map, \ |
104 ShortExternalInternalizedStringWithOneByteDataMap) \ | 104 ShortExternalInternalizedStringWithOneByteDataMap) \ |
105 V(Map, short_external_one_byte_internalized_string_map, \ | 105 V(Map, short_external_one_byte_internalized_string_map, \ |
106 ShortExternalOneByteInternalizedStringMap) \ | 106 ShortExternalOneByteInternalizedStringMap) \ |
107 V(Map, short_external_one_byte_string_map, ShortExternalOneByteStringMap) \ | 107 V(Map, short_external_one_byte_string_map, ShortExternalOneByteStringMap) \ |
| 108 V(Map, external_int8_array_map, ExternalInt8ArrayMap) \ |
| 109 V(Map, external_uint8_array_map, ExternalUint8ArrayMap) \ |
| 110 V(Map, external_int16_array_map, ExternalInt16ArrayMap) \ |
| 111 V(Map, external_uint16_array_map, ExternalUint16ArrayMap) \ |
| 112 V(Map, external_int32_array_map, ExternalInt32ArrayMap) \ |
| 113 V(Map, external_uint32_array_map, ExternalUint32ArrayMap) \ |
| 114 V(Map, external_float32_array_map, ExternalFloat32ArrayMap) \ |
| 115 V(Map, external_float64_array_map, ExternalFloat64ArrayMap) \ |
| 116 V(Map, external_uint8_clamped_array_map, ExternalUint8ClampedArrayMap) \ |
| 117 V(ExternalArray, empty_external_int8_array, EmptyExternalInt8Array) \ |
| 118 V(ExternalArray, empty_external_uint8_array, EmptyExternalUint8Array) \ |
| 119 V(ExternalArray, empty_external_int16_array, EmptyExternalInt16Array) \ |
| 120 V(ExternalArray, empty_external_uint16_array, EmptyExternalUint16Array) \ |
| 121 V(ExternalArray, empty_external_int32_array, EmptyExternalInt32Array) \ |
| 122 V(ExternalArray, empty_external_uint32_array, EmptyExternalUint32Array) \ |
| 123 V(ExternalArray, empty_external_float32_array, EmptyExternalFloat32Array) \ |
| 124 V(ExternalArray, empty_external_float64_array, EmptyExternalFloat64Array) \ |
| 125 V(ExternalArray, empty_external_uint8_clamped_array, \ |
| 126 EmptyExternalUint8ClampedArray) \ |
108 V(Map, fixed_uint8_array_map, FixedUint8ArrayMap) \ | 127 V(Map, fixed_uint8_array_map, FixedUint8ArrayMap) \ |
109 V(Map, fixed_int8_array_map, FixedInt8ArrayMap) \ | 128 V(Map, fixed_int8_array_map, FixedInt8ArrayMap) \ |
110 V(Map, fixed_uint16_array_map, FixedUint16ArrayMap) \ | 129 V(Map, fixed_uint16_array_map, FixedUint16ArrayMap) \ |
111 V(Map, fixed_int16_array_map, FixedInt16ArrayMap) \ | 130 V(Map, fixed_int16_array_map, FixedInt16ArrayMap) \ |
112 V(Map, fixed_uint32_array_map, FixedUint32ArrayMap) \ | 131 V(Map, fixed_uint32_array_map, FixedUint32ArrayMap) \ |
113 V(Map, fixed_int32_array_map, FixedInt32ArrayMap) \ | 132 V(Map, fixed_int32_array_map, FixedInt32ArrayMap) \ |
114 V(Map, fixed_float32_array_map, FixedFloat32ArrayMap) \ | 133 V(Map, fixed_float32_array_map, FixedFloat32ArrayMap) \ |
115 V(Map, fixed_float64_array_map, FixedFloat64ArrayMap) \ | 134 V(Map, fixed_float64_array_map, FixedFloat64ArrayMap) \ |
116 V(Map, fixed_uint8_clamped_array_map, FixedUint8ClampedArrayMap) \ | 135 V(Map, fixed_uint8_clamped_array_map, FixedUint8ClampedArrayMap) \ |
117 V(FixedTypedArrayBase, empty_fixed_uint8_array, EmptyFixedUint8Array) \ | 136 V(FixedTypedArrayBase, empty_fixed_uint8_array, EmptyFixedUint8Array) \ |
(...skipping 1125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1243 | 1262 |
1244 // Generated code can embed direct references to non-writable roots if | 1263 // Generated code can embed direct references to non-writable roots if |
1245 // they are in new space. | 1264 // they are in new space. |
1246 static bool RootCanBeWrittenAfterInitialization(RootListIndex root_index); | 1265 static bool RootCanBeWrittenAfterInitialization(RootListIndex root_index); |
1247 // Generated code can treat direct references to this root as constant. | 1266 // Generated code can treat direct references to this root as constant. |
1248 bool RootCanBeTreatedAsConstant(RootListIndex root_index); | 1267 bool RootCanBeTreatedAsConstant(RootListIndex root_index); |
1249 | 1268 |
1250 Map* MapForFixedTypedArray(ExternalArrayType array_type); | 1269 Map* MapForFixedTypedArray(ExternalArrayType array_type); |
1251 RootListIndex RootIndexForFixedTypedArray(ExternalArrayType array_type); | 1270 RootListIndex RootIndexForFixedTypedArray(ExternalArrayType array_type); |
1252 | 1271 |
| 1272 Map* MapForExternalArrayType(ExternalArrayType array_type); |
| 1273 RootListIndex RootIndexForExternalArrayType(ExternalArrayType array_type); |
| 1274 |
| 1275 RootListIndex RootIndexForEmptyExternalArray(ElementsKind kind); |
1253 RootListIndex RootIndexForEmptyFixedTypedArray(ElementsKind kind); | 1276 RootListIndex RootIndexForEmptyFixedTypedArray(ElementsKind kind); |
| 1277 ExternalArray* EmptyExternalArrayForMap(Map* map); |
1254 FixedTypedArrayBase* EmptyFixedTypedArrayForMap(Map* map); | 1278 FixedTypedArrayBase* EmptyFixedTypedArrayForMap(Map* map); |
1255 | 1279 |
1256 void RecordStats(HeapStats* stats, bool take_snapshot = false); | 1280 void RecordStats(HeapStats* stats, bool take_snapshot = false); |
1257 | 1281 |
1258 // Copy block of memory from src to dst. Size of block should be aligned | 1282 // Copy block of memory from src to dst. Size of block should be aligned |
1259 // by pointer size. | 1283 // by pointer size. |
1260 static inline void CopyBlock(Address dst, Address src, int byte_size); | 1284 static inline void CopyBlock(Address dst, Address src, int byte_size); |
1261 | 1285 |
1262 // Optimized version of memmove for blocks with pointer size aligned sizes and | 1286 // Optimized version of memmove for blocks with pointer size aligned sizes and |
1263 // pointer size aligned addresses. | 1287 // pointer size aligned addresses. |
(...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2015 | 2039 |
2016 // Computes a single character string where the character has code. | 2040 // Computes a single character string where the character has code. |
2017 // A cache is used for one-byte (Latin1) codes. | 2041 // A cache is used for one-byte (Latin1) codes. |
2018 MUST_USE_RESULT AllocationResult | 2042 MUST_USE_RESULT AllocationResult |
2019 LookupSingleCharacterStringFromCode(uint16_t code); | 2043 LookupSingleCharacterStringFromCode(uint16_t code); |
2020 | 2044 |
2021 // Allocate a symbol in old space. | 2045 // Allocate a symbol in old space. |
2022 MUST_USE_RESULT AllocationResult AllocateSymbol(); | 2046 MUST_USE_RESULT AllocationResult AllocateSymbol(); |
2023 | 2047 |
2024 // Allocates an external array of the specified length and type. | 2048 // Allocates an external array of the specified length and type. |
2025 MUST_USE_RESULT AllocationResult AllocateFixedTypedArrayWithExternalPointer( | 2049 MUST_USE_RESULT AllocationResult |
2026 int length, ExternalArrayType array_type, void* external_pointer, | 2050 AllocateExternalArray(int length, ExternalArrayType array_type, |
2027 PretenureFlag pretenure); | 2051 void* external_pointer, PretenureFlag pretenure); |
2028 | 2052 |
2029 // Allocates a fixed typed array of the specified length and type. | 2053 // Allocates a fixed typed array of the specified length and type. |
2030 MUST_USE_RESULT AllocationResult | 2054 MUST_USE_RESULT AllocationResult |
2031 AllocateFixedTypedArray(int length, ExternalArrayType array_type, | 2055 AllocateFixedTypedArray(int length, ExternalArrayType array_type, |
2032 bool initialize, PretenureFlag pretenure); | 2056 bool initialize, PretenureFlag pretenure); |
2033 | 2057 |
2034 // Make a copy of src and return it. | 2058 // Make a copy of src and return it. |
2035 MUST_USE_RESULT AllocationResult CopyAndTenureFixedCOWArray(FixedArray* src); | 2059 MUST_USE_RESULT AllocationResult CopyAndTenureFixedCOWArray(FixedArray* src); |
2036 | 2060 |
2037 // Make a copy of src, set the map, and return the copy. | 2061 // Make a copy of src, set the map, and return the copy. |
2038 MUST_USE_RESULT AllocationResult | 2062 MUST_USE_RESULT AllocationResult |
2039 CopyFixedDoubleArrayWithMap(FixedDoubleArray* src, Map* map); | 2063 CopyFixedDoubleArrayWithMap(FixedDoubleArray* src, Map* map); |
2040 | 2064 |
2041 // Allocates a fixed double array with uninitialized values. Returns | 2065 // Allocates a fixed double array with uninitialized values. Returns |
2042 MUST_USE_RESULT AllocationResult AllocateUninitializedFixedDoubleArray( | 2066 MUST_USE_RESULT AllocationResult AllocateUninitializedFixedDoubleArray( |
2043 int length, PretenureFlag pretenure = NOT_TENURED); | 2067 int length, PretenureFlag pretenure = NOT_TENURED); |
2044 | 2068 |
2045 // These five Create*EntryStub functions are here and forced to not be inlined | 2069 // These five Create*EntryStub functions are here and forced to not be inlined |
2046 // because of a gcc-4.4 bug that assigns wrong vtable entries. | 2070 // because of a gcc-4.4 bug that assigns wrong vtable entries. |
2047 NO_INLINE(void CreateJSEntryStub()); | 2071 NO_INLINE(void CreateJSEntryStub()); |
2048 NO_INLINE(void CreateJSConstructEntryStub()); | 2072 NO_INLINE(void CreateJSConstructEntryStub()); |
2049 | 2073 |
2050 void CreateFixedStubs(); | 2074 void CreateFixedStubs(); |
2051 | 2075 |
2052 // Allocate empty fixed array. | 2076 // Allocate empty fixed array. |
2053 MUST_USE_RESULT AllocationResult AllocateEmptyFixedArray(); | 2077 MUST_USE_RESULT AllocationResult AllocateEmptyFixedArray(); |
2054 | 2078 |
| 2079 // Allocate empty external array of given type. |
| 2080 MUST_USE_RESULT AllocationResult |
| 2081 AllocateEmptyExternalArray(ExternalArrayType array_type); |
| 2082 |
2055 // Allocate empty fixed typed array of given type. | 2083 // Allocate empty fixed typed array of given type. |
2056 MUST_USE_RESULT AllocationResult | 2084 MUST_USE_RESULT AllocationResult |
2057 AllocateEmptyFixedTypedArray(ExternalArrayType array_type); | 2085 AllocateEmptyFixedTypedArray(ExternalArrayType array_type); |
2058 | 2086 |
2059 // Allocate a tenured simple cell. | 2087 // Allocate a tenured simple cell. |
2060 MUST_USE_RESULT AllocationResult AllocateCell(Object* value); | 2088 MUST_USE_RESULT AllocationResult AllocateCell(Object* value); |
2061 | 2089 |
2062 // Allocate a tenured JS global property cell initialized with the hole. | 2090 // Allocate a tenured JS global property cell initialized with the hole. |
2063 MUST_USE_RESULT AllocationResult AllocatePropertyCell(); | 2091 MUST_USE_RESULT AllocationResult AllocatePropertyCell(); |
2064 | 2092 |
(...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2861 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. | 2889 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. |
2862 | 2890 |
2863 private: | 2891 private: |
2864 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2892 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
2865 }; | 2893 }; |
2866 #endif // DEBUG | 2894 #endif // DEBUG |
2867 } | 2895 } |
2868 } // namespace v8::internal | 2896 } // namespace v8::internal |
2869 | 2897 |
2870 #endif // V8_HEAP_HEAP_H_ | 2898 #endif // V8_HEAP_HEAP_H_ |
OLD | NEW |