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