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 1351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1362 // Allocation site tracking. ================================================= | 1362 // Allocation site tracking. ================================================= |
1363 // =========================================================================== | 1363 // =========================================================================== |
1364 | 1364 |
1365 // Updates the AllocationSite of a given {object}. If the global prenuring | 1365 // Updates the AllocationSite of a given {object}. If the global prenuring |
1366 // storage is passed as {pretenuring_feedback} the memento found count on | 1366 // storage is passed as {pretenuring_feedback} the memento found count on |
1367 // the corresponding allocation site is immediately updated and an entry | 1367 // the corresponding allocation site is immediately updated and an entry |
1368 // in the hash map is created. Otherwise the entry (including a the count | 1368 // in the hash map is created. Otherwise the entry (including a the count |
1369 // value) is cached on the local pretenuring feedback. | 1369 // value) is cached on the local pretenuring feedback. |
1370 template <UpdateAllocationSiteMode mode> | 1370 template <UpdateAllocationSiteMode mode> |
1371 inline void UpdateAllocationSite(HeapObject* object, | 1371 inline void UpdateAllocationSite(HeapObject* object, |
1372 HashMap* pretenuring_feedback); | 1372 base::HashMap* pretenuring_feedback); |
1373 | 1373 |
1374 // Removes an entry from the global pretenuring storage. | 1374 // Removes an entry from the global pretenuring storage. |
1375 inline void RemoveAllocationSitePretenuringFeedback(AllocationSite* site); | 1375 inline void RemoveAllocationSitePretenuringFeedback(AllocationSite* site); |
1376 | 1376 |
1377 // Merges local pretenuring feedback into the global one. Note that this | 1377 // Merges local pretenuring feedback into the global one. Note that this |
1378 // method needs to be called after evacuation, as allocation sites may be | 1378 // method needs to be called after evacuation, as allocation sites may be |
1379 // evacuated and this method resolves forward pointers accordingly. | 1379 // evacuated and this method resolves forward pointers accordingly. |
1380 void MergeAllocationSitePretenuringFeedback( | 1380 void MergeAllocationSitePretenuringFeedback( |
1381 const HashMap& local_pretenuring_feedback); | 1381 const base::HashMap& local_pretenuring_feedback); |
1382 | 1382 |
1383 // ============================================================================= | 1383 // ============================================================================= |
1384 | 1384 |
1385 #ifdef VERIFY_HEAP | 1385 #ifdef VERIFY_HEAP |
1386 // Verify the heap is in its normal state before or after a GC. | 1386 // Verify the heap is in its normal state before or after a GC. |
1387 void Verify(); | 1387 void Verify(); |
1388 #endif | 1388 #endif |
1389 | 1389 |
1390 #ifdef DEBUG | 1390 #ifdef DEBUG |
1391 void set_allocation_timeout(int timeout) { allocation_timeout_ = timeout; } | 1391 void set_allocation_timeout(int timeout) { allocation_timeout_ = timeout; } |
(...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2192 // If the --deopt_every_n_garbage_collections flag is set to a positive value, | 2192 // If the --deopt_every_n_garbage_collections flag is set to a positive value, |
2193 // this variable holds the number of garbage collections since the last | 2193 // this variable holds the number of garbage collections since the last |
2194 // deoptimization triggered by garbage collection. | 2194 // deoptimization triggered by garbage collection. |
2195 int gcs_since_last_deopt_; | 2195 int gcs_since_last_deopt_; |
2196 | 2196 |
2197 // The feedback storage is used to store allocation sites (keys) and how often | 2197 // The feedback storage is used to store allocation sites (keys) and how often |
2198 // they have been visited (values) by finding a memento behind an object. The | 2198 // they have been visited (values) by finding a memento behind an object. The |
2199 // storage is only alive temporary during a GC. The invariant is that all | 2199 // storage is only alive temporary during a GC. The invariant is that all |
2200 // pointers in this map are already fixed, i.e., they do not point to | 2200 // pointers in this map are already fixed, i.e., they do not point to |
2201 // forwarding pointers. | 2201 // forwarding pointers. |
2202 HashMap* global_pretenuring_feedback_; | 2202 base::HashMap* global_pretenuring_feedback_; |
2203 | 2203 |
2204 char trace_ring_buffer_[kTraceRingBufferSize]; | 2204 char trace_ring_buffer_[kTraceRingBufferSize]; |
2205 // If it's not full then the data is from 0 to ring_buffer_end_. If it's | 2205 // If it's not full then the data is from 0 to ring_buffer_end_. If it's |
2206 // full then the data is from ring_buffer_end_ to the end of the buffer and | 2206 // full then the data is from ring_buffer_end_ to the end of the buffer and |
2207 // from 0 to ring_buffer_end_. | 2207 // from 0 to ring_buffer_end_. |
2208 bool ring_buffer_full_; | 2208 bool ring_buffer_full_; |
2209 size_t ring_buffer_end_; | 2209 size_t ring_buffer_end_; |
2210 | 2210 |
2211 // Shared state read by the scavenge collector and set by ScavengeObject. | 2211 // Shared state read by the scavenge collector and set by ScavengeObject. |
2212 PromotionQueue promotion_queue_; | 2212 PromotionQueue promotion_queue_; |
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2659 friend class LargeObjectSpace; | 2659 friend class LargeObjectSpace; |
2660 friend class NewSpace; | 2660 friend class NewSpace; |
2661 friend class PagedSpace; | 2661 friend class PagedSpace; |
2662 DISALLOW_COPY_AND_ASSIGN(AllocationObserver); | 2662 DISALLOW_COPY_AND_ASSIGN(AllocationObserver); |
2663 }; | 2663 }; |
2664 | 2664 |
2665 } // namespace internal | 2665 } // namespace internal |
2666 } // namespace v8 | 2666 } // namespace v8 |
2667 | 2667 |
2668 #endif // V8_HEAP_HEAP_H_ | 2668 #endif // V8_HEAP_HEAP_H_ |
OLD | NEW |