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 1243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1254 | 1254 |
1255 Address* store_buffer_top_address() { | 1255 Address* store_buffer_top_address() { |
1256 return reinterpret_cast<Address*>(&roots_[kStoreBufferTopRootIndex]); | 1256 return reinterpret_cast<Address*>(&roots_[kStoreBufferTopRootIndex]); |
1257 } | 1257 } |
1258 | 1258 |
1259 // Get address of native contexts list for serialization support. | 1259 // Get address of native contexts list for serialization support. |
1260 Object** native_contexts_list_address() { | 1260 Object** native_contexts_list_address() { |
1261 return &native_contexts_list_; | 1261 return &native_contexts_list_; |
1262 } | 1262 } |
1263 | 1263 |
| 1264 #ifdef VERIFY_HEAP |
| 1265 // Verify the heap is in its normal state before or after a GC. |
| 1266 void Verify(); |
| 1267 #endif |
| 1268 |
1264 #ifdef DEBUG | 1269 #ifdef DEBUG |
1265 void Print(); | 1270 void Print(); |
1266 void PrintHandles(); | 1271 void PrintHandles(); |
1267 | 1272 |
1268 // Verify the heap is in its normal state before or after a GC. | |
1269 void Verify(); | |
1270 | |
1271 void OldPointerSpaceCheckStoreBuffer(); | 1273 void OldPointerSpaceCheckStoreBuffer(); |
1272 void MapSpaceCheckStoreBuffer(); | 1274 void MapSpaceCheckStoreBuffer(); |
1273 void LargeObjectSpaceCheckStoreBuffer(); | 1275 void LargeObjectSpaceCheckStoreBuffer(); |
1274 | 1276 |
1275 // Report heap statistics. | 1277 // Report heap statistics. |
1276 void ReportHeapStatistics(const char* title); | 1278 void ReportHeapStatistics(const char* title); |
1277 void ReportCodeStatistics(const char* title); | 1279 void ReportCodeStatistics(const char* title); |
| 1280 #endif |
| 1281 |
| 1282 // Zapping is needed for verify heap, and always done in debug builds. |
| 1283 static inline bool ShouldZapGarbage() { |
| 1284 #ifdef DEBUG |
| 1285 return true; |
| 1286 #else |
| 1287 #ifdef VERIFY_HEAP |
| 1288 return FLAG_verify_heap; |
| 1289 #else |
| 1290 return false; |
| 1291 #endif |
| 1292 #endif |
| 1293 } |
1278 | 1294 |
1279 // Fill in bogus values in from space | 1295 // Fill in bogus values in from space |
1280 void ZapFromSpace(); | 1296 void ZapFromSpace(); |
1281 #endif | |
1282 | 1297 |
1283 // Print short heap statistics. | 1298 // Print short heap statistics. |
1284 void PrintShortHeapStatistics(); | 1299 void PrintShortHeapStatistics(); |
1285 | 1300 |
1286 // Makes a new symbol object | 1301 // Makes a new symbol object |
1287 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation | 1302 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation |
1288 // failed. | 1303 // failed. |
1289 // Please note this function does not perform a garbage collection. | 1304 // Please note this function does not perform a garbage collection. |
1290 MUST_USE_RESULT MaybeObject* CreateSymbol( | 1305 MUST_USE_RESULT MaybeObject* CreateSymbol( |
1291 const char* str, int length, int hash); | 1306 const char* str, int length, int hash); |
(...skipping 902 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2194 public: | 2209 public: |
2195 inline AlwaysAllocateScope(); | 2210 inline AlwaysAllocateScope(); |
2196 inline ~AlwaysAllocateScope(); | 2211 inline ~AlwaysAllocateScope(); |
2197 | 2212 |
2198 private: | 2213 private: |
2199 // Implicitly disable artificial allocation failures. | 2214 // Implicitly disable artificial allocation failures. |
2200 DisallowAllocationFailure disallow_allocation_failure_; | 2215 DisallowAllocationFailure disallow_allocation_failure_; |
2201 }; | 2216 }; |
2202 | 2217 |
2203 | 2218 |
2204 #ifdef DEBUG | |
2205 // Visitor class to verify interior pointers in spaces that do not contain | 2219 // Visitor class to verify interior pointers in spaces that do not contain |
2206 // or care about intergenerational references. All heap object pointers have to | 2220 // or care about intergenerational references. All heap object pointers have to |
2207 // point into the heap to a location that has a map pointer at its first word. | 2221 // point into the heap to a location that has a map pointer at its first word. |
2208 // Caveat: Heap::Contains is an approximation because it can return true for | 2222 // Caveat: Heap::Contains is an approximation because it can return true for |
2209 // objects in a heap space but above the allocation pointer. | 2223 // objects in a heap space but above the allocation pointer. |
2210 class VerifyPointersVisitor: public ObjectVisitor { | 2224 class VerifyPointersVisitor: public ObjectVisitor { |
2211 public: | 2225 public: |
2212 inline void VisitPointers(Object** start, Object** end); | 2226 inline void VisitPointers(Object** start, Object** end); |
2213 }; | 2227 }; |
2214 #endif | |
2215 | 2228 |
2216 | 2229 |
2217 // Space iterator for iterating over all spaces of the heap. | 2230 // Space iterator for iterating over all spaces of the heap. |
2218 // Returns each space in turn, and null when it is done. | 2231 // Returns each space in turn, and null when it is done. |
2219 class AllSpaces BASE_EMBEDDED { | 2232 class AllSpaces BASE_EMBEDDED { |
2220 public: | 2233 public: |
2221 Space* next(); | 2234 Space* next(); |
2222 AllSpaces() { counter_ = FIRST_SPACE; } | 2235 AllSpaces() { counter_ = FIRST_SPACE; } |
2223 private: | 2236 private: |
2224 int counter_; | 2237 int counter_; |
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2794 AssertNoAllocation no_alloc; // i.e. no gc allowed. | 2807 AssertNoAllocation no_alloc; // i.e. no gc allowed. |
2795 | 2808 |
2796 private: | 2809 private: |
2797 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2810 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
2798 }; | 2811 }; |
2799 #endif // DEBUG || LIVE_OBJECT_LIST | 2812 #endif // DEBUG || LIVE_OBJECT_LIST |
2800 | 2813 |
2801 } } // namespace v8::internal | 2814 } } // namespace v8::internal |
2802 | 2815 |
2803 #endif // V8_HEAP_H_ | 2816 #endif // V8_HEAP_H_ |
OLD | NEW |