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