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 1304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1315 } | 1315 } |
1316 | 1316 |
1317 // Get address of native contexts list for serialization support. | 1317 // Get address of native contexts list for serialization support. |
1318 Object** native_contexts_list_address() { | 1318 Object** native_contexts_list_address() { |
1319 return &native_contexts_list_; | 1319 return &native_contexts_list_; |
1320 } | 1320 } |
1321 | 1321 |
1322 #ifdef VERIFY_HEAP | 1322 #ifdef VERIFY_HEAP |
1323 // Verify the heap is in its normal state before or after a GC. | 1323 // Verify the heap is in its normal state before or after a GC. |
1324 void Verify(); | 1324 void Verify(); |
| 1325 |
| 1326 |
| 1327 bool weak_embedded_maps_verification_enabled() { |
| 1328 return no_weak_embedded_maps_verification_scope_depth_ == 0; |
| 1329 } |
1325 #endif | 1330 #endif |
1326 | 1331 |
1327 #ifdef DEBUG | 1332 #ifdef DEBUG |
1328 void Print(); | 1333 void Print(); |
1329 void PrintHandles(); | 1334 void PrintHandles(); |
1330 | 1335 |
1331 void OldPointerSpaceCheckStoreBuffer(); | 1336 void OldPointerSpaceCheckStoreBuffer(); |
1332 void MapSpaceCheckStoreBuffer(); | 1337 void MapSpaceCheckStoreBuffer(); |
1333 void LargeObjectSpaceCheckStoreBuffer(); | 1338 void LargeObjectSpaceCheckStoreBuffer(); |
1334 | 1339 |
(...skipping 848 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2183 | 2188 |
2184 int number_idle_notifications_; | 2189 int number_idle_notifications_; |
2185 unsigned int last_idle_notification_gc_count_; | 2190 unsigned int last_idle_notification_gc_count_; |
2186 bool last_idle_notification_gc_count_init_; | 2191 bool last_idle_notification_gc_count_init_; |
2187 | 2192 |
2188 int mark_sweeps_since_idle_round_started_; | 2193 int mark_sweeps_since_idle_round_started_; |
2189 int ms_count_at_last_idle_notification_; | 2194 int ms_count_at_last_idle_notification_; |
2190 unsigned int gc_count_at_last_idle_gc_; | 2195 unsigned int gc_count_at_last_idle_gc_; |
2191 int scavenges_since_last_idle_round_; | 2196 int scavenges_since_last_idle_round_; |
2192 | 2197 |
| 2198 #ifdef VERIFY_HEAP |
| 2199 int no_weak_embedded_maps_verification_scope_depth_; |
| 2200 #endif |
| 2201 |
2193 static const int kMaxMarkSweepsInIdleRound = 7; | 2202 static const int kMaxMarkSweepsInIdleRound = 7; |
2194 static const int kIdleScavengeThreshold = 5; | 2203 static const int kIdleScavengeThreshold = 5; |
2195 | 2204 |
2196 // Shared state read by the scavenge collector and set by ScavengeObject. | 2205 // Shared state read by the scavenge collector and set by ScavengeObject. |
2197 PromotionQueue promotion_queue_; | 2206 PromotionQueue promotion_queue_; |
2198 | 2207 |
2199 // Flag is set when the heap has been configured. The heap can be repeatedly | 2208 // Flag is set when the heap has been configured. The heap can be repeatedly |
2200 // configured through the API until it is set up. | 2209 // configured through the API until it is set up. |
2201 bool configured_; | 2210 bool configured_; |
2202 | 2211 |
2203 ExternalStringTable external_string_table_; | 2212 ExternalStringTable external_string_table_; |
2204 | 2213 |
2205 ErrorObjectList error_object_list_; | 2214 ErrorObjectList error_object_list_; |
2206 | 2215 |
2207 VisitorDispatchTable<ScavengingCallback> scavenging_visitors_table_; | 2216 VisitorDispatchTable<ScavengingCallback> scavenging_visitors_table_; |
2208 | 2217 |
2209 MemoryChunk* chunks_queued_for_free_; | 2218 MemoryChunk* chunks_queued_for_free_; |
2210 | 2219 |
2211 Mutex* relocation_mutex_; | 2220 Mutex* relocation_mutex_; |
2212 | 2221 |
2213 friend class Factory; | 2222 friend class Factory; |
2214 friend class GCTracer; | 2223 friend class GCTracer; |
2215 friend class DisallowAllocationFailure; | 2224 friend class DisallowAllocationFailure; |
2216 friend class AlwaysAllocateScope; | 2225 friend class AlwaysAllocateScope; |
2217 friend class Page; | 2226 friend class Page; |
2218 friend class Isolate; | 2227 friend class Isolate; |
2219 friend class MarkCompactCollector; | 2228 friend class MarkCompactCollector; |
2220 friend class MarkCompactMarkingVisitor; | 2229 friend class MarkCompactMarkingVisitor; |
2221 friend class MapCompact; | 2230 friend class MapCompact; |
| 2231 #ifdef VERIFY_HEAP |
| 2232 friend class NoWeakEmbeddedMapsVerificationScope; |
| 2233 #endif |
2222 | 2234 |
2223 DISALLOW_COPY_AND_ASSIGN(Heap); | 2235 DISALLOW_COPY_AND_ASSIGN(Heap); |
2224 }; | 2236 }; |
2225 | 2237 |
2226 | 2238 |
2227 class HeapStats { | 2239 class HeapStats { |
2228 public: | 2240 public: |
2229 static const int kStartMarker = 0xDECADE00; | 2241 static const int kStartMarker = 0xDECADE00; |
2230 static const int kEndMarker = 0xDECADE01; | 2242 static const int kEndMarker = 0xDECADE01; |
2231 | 2243 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2272 class AlwaysAllocateScope { | 2284 class AlwaysAllocateScope { |
2273 public: | 2285 public: |
2274 inline AlwaysAllocateScope(); | 2286 inline AlwaysAllocateScope(); |
2275 inline ~AlwaysAllocateScope(); | 2287 inline ~AlwaysAllocateScope(); |
2276 | 2288 |
2277 private: | 2289 private: |
2278 // Implicitly disable artificial allocation failures. | 2290 // Implicitly disable artificial allocation failures. |
2279 DisallowAllocationFailure disallow_allocation_failure_; | 2291 DisallowAllocationFailure disallow_allocation_failure_; |
2280 }; | 2292 }; |
2281 | 2293 |
| 2294 #ifdef VERIFY_HEAP |
| 2295 class NoWeakEmbeddedMapsVerificationScope { |
| 2296 public: |
| 2297 inline NoWeakEmbeddedMapsVerificationScope(); |
| 2298 inline ~NoWeakEmbeddedMapsVerificationScope(); |
| 2299 }; |
| 2300 #endif |
| 2301 |
2282 | 2302 |
2283 // Visitor class to verify interior pointers in spaces that do not contain | 2303 // Visitor class to verify interior pointers in spaces that do not contain |
2284 // or care about intergenerational references. All heap object pointers have to | 2304 // or care about intergenerational references. All heap object pointers have to |
2285 // point into the heap to a location that has a map pointer at its first word. | 2305 // point into the heap to a location that has a map pointer at its first word. |
2286 // Caveat: Heap::Contains is an approximation because it can return true for | 2306 // Caveat: Heap::Contains is an approximation because it can return true for |
2287 // objects in a heap space but above the allocation pointer. | 2307 // objects in a heap space but above the allocation pointer. |
2288 class VerifyPointersVisitor: public ObjectVisitor { | 2308 class VerifyPointersVisitor: public ObjectVisitor { |
2289 public: | 2309 public: |
2290 inline void VisitPointers(Object** start, Object** end); | 2310 inline void VisitPointers(Object** start, Object** end); |
2291 }; | 2311 }; |
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2892 AssertNoAllocation no_alloc; // i.e. no gc allowed. | 2912 AssertNoAllocation no_alloc; // i.e. no gc allowed. |
2893 | 2913 |
2894 private: | 2914 private: |
2895 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2915 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
2896 }; | 2916 }; |
2897 #endif // DEBUG | 2917 #endif // DEBUG |
2898 | 2918 |
2899 } } // namespace v8::internal | 2919 } } // namespace v8::internal |
2900 | 2920 |
2901 #endif // V8_HEAP_H_ | 2921 #endif // V8_HEAP_H_ |
OLD | NEW |